diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Customizer.dpr b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Customizer.dpr new file mode 100644 index 0000000..0202e78 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Customizer.dpr @@ -0,0 +1,15 @@ +program Customizer; + +uses + Forms, + Unit1 in 'Unit1.pas' {Form1}, + Unit2 in 'Unit2.pas' {Form2}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.CreateForm(TForm2, Form2); + Application.Run; +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit1.dfm b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit1.dfm new file mode 100644 index 0000000..a77ac8c --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit1.dfm @@ -0,0 +1,1592 @@ +object Form1: TForm1 + Left = 281 + Top = 159 + Caption = 'Form1' + ClientHeight = 487 + ClientWidth = 748 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [] + OldCreateOrder = False + ShowHint = True + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object SpTBXSplitter1: TSpTBXSplitter + Left = 142 + Top = 75 + Height = 347 + Cursor = crSizeWE + end + object SpTBXSplitter2: TSpTBXSplitter + Left = 614 + Top = 75 + Height = 347 + Cursor = crSizeWE + Align = alRight + end + object SpTBXTabControl1: TSpTBXTabControl + Left = 147 + Top = 75 + Width = 467 + Height = 347 + Align = alClient + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Courier New' + Font.Style = [] + ParentFont = False + ActiveTabIndex = 0 + HiddenItems = <> + object SpTBXTabItem1: TSpTBXTabItem + Caption = 'FAQ.txt' + Checked = True + end + object SpTBXTabItem2: TSpTBXTabItem + Caption = 'Advanced Techniques.txt' + end + object SpTBXTabItem3: TSpTBXTabItem + Caption = 'Translations.txt' + end + object SpTBXTabSheet3: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 467 + Height = 324 + Caption = 'Translations.txt' + ImageIndex = -1 + TabItem = 'SpTBXTabItem3' + object Memo4: TMemo + Left = 2 + Top = 0 + Width = 461 + Height = 320 + Align = alClient + BorderStyle = bsNone + ScrollBars = ssVertical + TabOrder = 0 + end + end + object SpTBXTabSheet2: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 467 + Height = 324 + Caption = 'Advanced Techniques.txt' + ImageIndex = -1 + TabItem = 'SpTBXTabItem2' + object Memo3: TMemo + Left = 2 + Top = 0 + Width = 461 + Height = 320 + Align = alClient + BorderStyle = bsNone + ScrollBars = ssVertical + TabOrder = 0 + end + end + object SpTBXTabSheet1: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 467 + Height = 324 + Caption = 'FAQ.txt' + ImageIndex = -1 + TabItem = 'SpTBXTabItem1' + object Memo2: TMemo + Left = 2 + Top = 0 + Width = 461 + Height = 320 + Align = alClient + BorderStyle = bsNone + ScrollBars = ssVertical + TabOrder = 0 + end + end + end + object SpTBXDock1: TSpTBXDock + Left = 0 + Top = 0 + Width = 748 + Height = 75 + PopupMenu = SpTBXPopupMenu1 + object tbStandard: TSpTBXToolbar + Left = 0 + Top = 23 + DockPos = 0 + DockRow = 1 + Images = ImageList1 + ShrinkMode = tbsmNone + TabOrder = 1 + Caption = 'Standard' + object tNew: TSpTBXItem + Caption = 'New' + ImageIndex = 14 + ShortCut = 16462 + OnClick = ActionsExecute + end + object tOpen: TSpTBXItem + Caption = 'Open' + ImageIndex = 15 + ShortCut = 16463 + OnClick = ActionsExecute + end + object tSave: TSpTBXItem + Caption = 'Save' + ImageIndex = 16 + ShortCut = 16467 + OnClick = ActionsExecute + end + object SpTBXSeparatorItem7: TSpTBXSeparatorItem + end + object tCut: TSpTBXItem + Caption = 'Cut' + ImageIndex = 10 + ShortCut = 16472 + OnClick = ActionsExecute + end + object tCopy: TSpTBXItem + Caption = 'Copy' + ImageIndex = 9 + ShortCut = 16451 + OnClick = ActionsExecute + end + object tPaste: TSpTBXItem + Caption = 'Paste' + DisplayMode = nbdmImageAndText + ImageIndex = 11 + ShortCut = 16470 + OnClick = ActionsExecute + end + object SpTBXSeparatorItem9: TSpTBXSeparatorItem + end + object tFind: TSpTBXItem + Caption = 'Find' + DisplayMode = nbdmImageAndText + ImageIndex = 12 + ShortCut = 16454 + OnClick = ActionsExecute + end + object SpTBXSeparatorItem12: TSpTBXSeparatorItem + end + object tSkins: TSpTBXSubmenuItem + Caption = 'Skins' + Options = [tboDropdownArrow] + object SpTBXSkinGroupItem1: TSpTBXSkinGroupItem + end + end + object SpTBXSeparatorItem13: TSpTBXSeparatorItem + end + object TBControlItem1: TTBControlItem + Control = tLanguages + end + object tLanguages: TSpTBXComboBox + Left = 282 + Top = 0 + Width = 145 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 0 + OnClick = tLanguagesItemClick + end + end + object tbFormat: TSpTBXToolbar + Left = 0 + Top = 49 + DockPos = 0 + DockRow = 2 + Images = ImageList1 + ShrinkMode = tbsmNone + TabOrder = 3 + Caption = 'Format' + object TBControlItem2: TTBControlItem + Control = tFont + end + object TBControlItem3: TTBControlItem + Control = tFontSize + end + object SpTBXSeparatorItem8: TSpTBXSeparatorItem + end + object tBold: TSpTBXItem + Caption = 'Bold' + DisplayMode = nbdmImageAndText + ImageIndex = 4 + ShortCut = 16450 + OnClick = ActionsExecute + end + object tItalic: TSpTBXItem + Caption = 'Italic' + ImageIndex = 5 + ShortCut = 16457 + OnClick = ActionsExecute + end + object tUnderline: TSpTBXItem + Caption = 'Underline' + ImageIndex = 6 + ShortCut = 16469 + OnClick = ActionsExecute + end + object tFont: TSpTBXComboBox + Left = 0 + Top = 0 + Width = 120 + Height = 21 + ItemHeight = 13 + TabOrder = 0 + Text = 'Verdana' + Items.Strings = ( + 'Arial' + 'Times New Roman' + 'Courier New') + end + object tFontSize: TSpTBXComboBox + Left = 120 + Top = 0 + Width = 70 + Height = 21 + ItemHeight = 13 + TabOrder = 1 + Text = '12' + Items.Strings = ( + '8' + '9' + '10' + '14' + '16' + '20') + end + end + object tbMenuBar: TSpTBXToolbar + Left = 0 + Top = 0 + CloseButton = False + DockPos = 0 + FullSize = True + Images = ImageList1 + MenuBar = True + ProcessShortCuts = True + ShrinkMode = tbsmWrap + TabOrder = 0 + Caption = 'Menu' + Customizable = False + object mFile: TSpTBXSubmenuItem + Caption = '&File' + object mNew: TSpTBXItem + Caption = 'New' + ImageIndex = 14 + ShortCut = 16462 + OnClick = ActionsExecute + end + object mOpen: TSpTBXItem + Caption = 'Open...' + ImageIndex = 15 + ShortCut = 16463 + OnClick = ActionsExecute + end + object mSave: TSpTBXItem + Caption = 'Save' + ImageIndex = 16 + ShortCut = 16467 + OnClick = ActionsExecute + end + object mPrint: TSpTBXItem + Caption = 'Print' + ImageIndex = 17 + OnClick = ActionsExecute + end + object SpTBXSeparatorItem1: TSpTBXSeparatorItem + end + object mExit: TSpTBXItem + Caption = 'Exit' + OnClick = ActionsExecute + end + end + object mEdit: TSpTBXSubmenuItem + Caption = '&Edit' + object mCut: TSpTBXItem + Caption = 'Cut' + ImageIndex = 10 + ShortCut = 16472 + OnClick = ActionsExecute + end + object mCopy: TSpTBXItem + Caption = 'Copy' + ImageIndex = 9 + ShortCut = 16451 + OnClick = ActionsExecute + end + object mPaste: TSpTBXItem + Caption = 'Paste' + ImageIndex = 11 + ShortCut = 16470 + OnClick = ActionsExecute + end + object SpTBXSeparatorItem2: TSpTBXSeparatorItem + end + object mSelectAll: TSpTBXItem + Caption = 'Select All' + ShortCut = 16449 + OnClick = ActionsExecute + end + object SpTBXSeparatorItem3: TSpTBXSeparatorItem + end + object mFind: TSpTBXItem + Caption = 'Find' + ImageIndex = 12 + ShortCut = 16454 + OnClick = ActionsExecute + end + end + object SpTBXSubmenuItem1: TSpTBXSubmenuItem + Caption = '&Format' + object mBold: TSpTBXItem + Caption = 'Bold' + ImageIndex = 4 + ShortCut = 16450 + OnClick = ActionsExecute + end + object mItalic: TSpTBXItem + Caption = 'Italic' + ImageIndex = 5 + ShortCut = 16457 + OnClick = ActionsExecute + end + object mUnderline: TSpTBXItem + Caption = 'Underline' + ImageIndex = 6 + ShortCut = 16469 + OnClick = ActionsExecute + end + object SpTBXSeparatorItem5: TSpTBXSeparatorItem + end + object mLeftJustify: TSpTBXItem + Caption = 'Left Justify' + ImageIndex = 0 + OnClick = ActionsExecute + end + object mCentered: TSpTBXItem + Caption = 'Centered' + ImageIndex = 1 + OnClick = ActionsExecute + end + object mRightJustify: TSpTBXItem + Caption = 'Right Justify' + ImageIndex = 2 + OnClick = ActionsExecute + end + object SpTBXSeparatorItem6: TSpTBXSeparatorItem + end + object mBullets: TSpTBXItem + Caption = 'Bullets' + ImageIndex = 7 + OnClick = ActionsExecute + end + object mNumberedBullets: TSpTBXItem + Caption = 'Numbered Bullets' + ImageIndex = 8 + OnClick = ActionsExecute + end + end + object mView: TSpTBXSubmenuItem + Caption = '&View' + object mSidebar: TSpTBXSubmenuItem + Caption = '&Sidebar' + object mCommandsLog: TSpTBXItem + Caption = '&Commands Log' + Control = dpLog + end + object mOptions: TSpTBXItem + Caption = '&Options' + Control = dpOptions + end + object mmHelp: TSpTBXItem + Caption = '&Help' + Control = dpHelp + end + end + object mToolbars: TSpTBXSubmenuItem + Caption = '&Toolbars' + object mStandardToolbar: TSpTBXItem + Caption = '&Standard Toolbar' + Control = tbStandard + end + object tLayoutsToolbar: TSpTBXItem + Caption = '&Layouts Toolbar' + Control = tbLayouts + end + object mFormattingToolbar: TSpTBXItem + Caption = '&Formatting Toolbar' + Control = tbFormat + end + object mNavigationToolbar: TSpTBXItem + Caption = '&Navigation Toolbar' + Control = tbNavigation + end + end + end + object mHelp: TSpTBXSubmenuItem + Caption = '&Help' + object mmmHelp: TSpTBXItem + Caption = '&Help' + end + object mAbout: TSpTBXItem + Caption = '&About' + Enabled = False + end + end + end + object tbLayouts: TSpTBXToolbar + Left = 437 + Top = 23 + DockPos = 433 + DockRow = 1 + Images = ImageList1 + ShrinkMode = tbsmNone + TabOrder = 2 + Caption = 'Layouts' + Customizable = False + object SpTBXLabelItem1: TSpTBXLabelItem + Caption = 'Layouts' + end + object TBControlItem4: TTBControlItem + Control = tLayouts + end + object tLayoutSave: TSpTBXItem + Caption = 'Save' + OnClick = tLayoutSaveClick + end + object tLayouts: TSpTBXComboBox + Left = 48 + Top = 0 + Width = 100 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 0 + OnClick = tLayoutsItemClick + end + end + end + object SpTBXMultiDock1: TSpTBXMultiDock + Left = 0 + Top = 75 + Width = 142 + Height = 347 + object dpLog: TSpTBXDockablePanel + Left = 0 + Top = 156 + Width = 142 + Height = 191 + Caption = 'Commands Log' + DockPos = 156 + TabOrder = 0 + object Memo1: TMemo + Left = 0 + Top = 19 + Width = 138 + Height = 168 + Align = alClient + BorderStyle = bsNone + ReadOnly = True + ScrollBars = ssVertical + TabOrder = 1 + end + end + object dpOptions: TSpTBXDockablePanel + Left = 0 + Top = 0 + Width = 142 + Height = 156 + Caption = 'Customizer Options' + DockPos = 0 + TabOrder = 1 + end + end + object SpTBXMultiDock2: TSpTBXMultiDock + Left = 619 + Top = 75 + Width = 129 + Height = 347 + Position = dpxRight + object dpHelp: TSpTBXDockablePanel + Left = 0 + Top = 0 + Width = 129 + Height = 347 + Caption = 'Help' + DockPos = 16 + TabOrder = 0 + DesignSize = ( + 125 + 343) + object SpTBXLabel1: TSpTBXLabel + Left = 9 + Top = 32 + Width = 96 + Height = 49 + Caption = 'Right click the toolbars to customize them' + Anchors = [akLeft, akTop, akRight] + AutoSize = False + Wrapping = twWrap + end + end + end + object SpTBXDock2: TSpTBXDock + Left = 0 + Top = 422 + Width = 748 + Height = 39 + PopupMenu = SpTBXPopupMenu1 + Position = dpBottom + object tbNavigation: TSpTBXToolbar + Left = 0 + Top = 0 + Images = ImageList1 + Options = [tboImageAboveCaption, tboSameWidth] + TabOrder = 0 + Caption = 'Navigation' + DisplayMode = tbdmImageAboveCaption + object tBack: TSpTBXItem + Caption = 'Back' + ImageIndex = 20 + OnClick = ActionsExecute + end + object tForward: TSpTBXItem + Caption = 'Forward' + ImageIndex = 21 + OnClick = ActionsExecute + end + object tRefresh: TSpTBXItem + Caption = 'Refresh' + ImageIndex = 23 + OnClick = ActionsExecute + end + object tStop: TSpTBXItem + Caption = 'Stop' + ImageIndex = 22 + OnClick = ActionsExecute + end + object tSearch: TSpTBXItem + Caption = 'Search' + ImageIndex = 24 + OnClick = ActionsExecute + end + end + end + object SpTBXStatusBar1: TSpTBXStatusBar + Left = 0 + Top = 461 + Width = 748 + Height = 26 + end + object ImageList1: TImageList + Left = 192 + Top = 352 + Bitmap = { + 494C01011A001D00040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000007000000001002000000000000070 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000CE00009CFF000000CE00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000084840000FF00000084840000FF00000084840000000000000000 + CE0063CEFF006300FF000000CE00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000009C31000063 + 31000063310000840000848400000000000000000000000000000000000063CE + FF006300FF000000CE000000000000000000006363009CFFFF0000CEFF0000CE + FF0000CEFF0000CEFF00009CCE0000CEFF00009CCE0000CEFF00009CCE00009C + CE00639C9C00009CCE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000009C310063CE310063CE + 3100009C3100009C31004A4A4A0084848400CE9C3100CE9C31009C6331000000 + 00000000CE00000000000000000000000000006363009CFFFF0000CEFF0000CE + FF0000CEFF0000CEFF0000CEFF00FF00000000CEFF00009CCE0000CEFF00009C + CE00009CCE00639C9C0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000009C310063FF310063FF + 310063CE31004A4A4A0084848400FFCE9C00FFCE3100FFCE3100CE9C31009C63 + 310000000000000000000000000000000000006363009CFFFF009CFFFF0000CE + FF0000CEFF00FF00000000CEFF00FF00000000CEFF00FF000000009CCE0000CE + FF00009CCE00009CCE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000009C31009CFFCE0063FF310063CE + 3100008400004A4A4A00FFCE9C00FFFFCE00FFFF9C00FFFF9C00FFCE3100CE9C + 3100000000009C0031000000000000000000006363009CFFFF0000CEFF009CFF + FF0000CEFF0000CEFF00FF000000FF000000FF00000000CEFF0000CEFF00009C + CE0000CEFF00009CCE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000009C31009CFFCE0063FF3100009C + 3100FF9C00004A4A4A00FFCE9C00FFFFFF00FFFFCE00FFFF9C00FFCE3100CE9C + 310000000000FF0000000000000000000000006363009CFFFF00FFFFFF0000CE + FF00FF000000FF000000FF00000000FFFF00FF000000FF000000FF00000000CE + FF00009CCE00009CCE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000009C3100009C3100009C3100FFCE + 3100FFCE31004A4A4A0084848400FFFFFF00FFFFFF00FFFFCE00FFCE9C008484 + 840000000000FF6331000000000000000000006363009CFFFF0000CEFF00FFFF + FF0000CEFF0000CEFF00FF000000FF000000FF00000000CEFF0000CEFF00009C + CE0000CEFF00009CCE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FF633100FFFFCE00FFFF3100FFCE + 3100FFCE3100FF9C00004A4A4A0084848400FFCE9C00FFCE9C00848484000000 + 0000FF633100FF6331000000000000000000006363009CFFFF00FFFFFF0000CE + FF00FFFFFF00FF00000000CEFF00FF00000000CEFF00FF00000000CEFF0000CE + FF00009CCE00009CCE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FF633100FFFFCE00FF9C00000084 + 000000840000FFCE3100FF9C00004A4A4A004A4A4A004A4A4A004A4A4A00FF9C + 0000FF6331009C0031000000000000000000006363009CFFFF0000CEFF00FFFF + FF0000CEFF00FFFFFF0000CEFF00FF00000000CEFF0000CEFF0000CEFF0000CE + FF0000CEFF00009CCE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF6331000084000063CE + 3100009C3100FF633100FF9C0000FF9C0000FF9C0000FF633100FF9C0000FF63 + 3100FF000000000000000000000000000000006363009CFFFF009CFFFF009CFF + FF009CFFFF009CFFFF009CFFFF009CFFFF009CFFFF009CFFFF009CFFFF009CFF + FF009CFFFF009CFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000006331009CFFCE0063FF + 310063CE310000840000FF633100FF9C0000FF9C0000FF9C0000FF633100FF9C + 0000FF6331000000000000000000000000000063630000636300006363000063 + 6300006363000063630000636300006363000063630000636300006363000063 + 6300006363000063630000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000006331009CFF + CE0063FF310063CE3100009C31000084000000840000FF6331009C9C0000FF63 + 31000000000000000000000000000000000000000000006363009CFFFF009CFF + FF009CFFFF009CFFFF009CFFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000063 + 31000063310063FF310063FF310063CE3100009C310000840000FF633100FF63 + 3100000000000000000000000000000000000000000000000000006363000063 + 6300006363000063630000636300000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000633100006331000063310000633100FF633100000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000009C0000009C0000009C0000009C0000009C0000009C000000 + 000000000000000000000000000000000000000000000000000084848400CECE + CE00CECECE00CECECE00CECECE00CECECE00CECECE00CECECE00CECECE00CECE + CE00CECECE00CECECE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000009C000000 + CE000000CE000000CE000000CE000000CE000000CE000000CE0000009C000000 + 9C0000009C00000000000000000000000000000000000000000084848400FFFF + FF00FFFFFF009CFFFF00FFFFFF009CFFFF00009C31009CFFFF00FFFFFF009CFF + FF00FFFFFF00CECECE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000009C000000CE000063 + FF003100FF003100FF003100FF003100FF003100FF000000CE000000CE000000 + CE0000009C0000009C000000000000000000000000000000000084848400FFFF + FF009CFFFF00FFFFFF009CFFFF00009C3100009C3100FFFFFF009CFFFF00FFFF + FF009CFFFF00CECECE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000009C000063FF003100 + FF003100FF003100FF003100FF003100FF003100FF003100FF003100FF000000 + CE000000CE0000009C000000000000000000000000000000000084848400FFFF + FF00FFFFFF009CFFFF00009C3100009C3100009C3100009C3100009C31009CFF + FF00FFFFFF00CECECE0000000000000000000000000000000000000000000000 + 000000000000FF9C310000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000FF6331000000 + 00000000000000000000000000000000000000009C006363FF000063FF003100 + FF003100FF003100FF003100FF003100FF003100FF003100FF003100FF003100 + FF000000CE0000009C0000009C0000000000000000000000000084848400FFFF + FF009CFFFF00FFFFFF009CFFFF00009C3100009C3100FFFFFF00639C00006363 + 00009CFFFF00CECECE0000000000000000000000000000000000000000000000 + 0000FF9C3100FF9C310000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000FF9C3100FF63 + 31000000000000000000000000000000000000009C006363FF00319CFF003100 + FF003100FF00FFFFFF00FFFFFF003100FF003100FF00FFFFFF00FFFFFF003100 + FF000000CE000000CE0000009C0000000000000000000000000084848400FFFF + FF00FFFFFF009CFFFF00FFFFFF009CFFFF00009C31009CFFFF00FFFFFF006363 + 0000FFFFFF00CECECE000000000000000000000000000000000000000000FF9C + 3100FFCE3100FF9C3100FF9C3100FF9C3100FF9C3100FF9C3100FF9C3100FF9C + 3100FF9C31000000000000000000000000000000000000000000FF633100FF9C + 3100FF9C3100FF9C3100FF9C3100FF9C3100FF9C3100FF9C3100FF9C3100FFCE + 3100FF63310000000000000000000000000000009C006363FF00319CFF003100 + FF003100FF003100FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF003100FF003100 + FF003100FF000000CE0000009C0000000000000000000000000084848400FFFF + FF009CFFFF00636300009CFFFF00FFFFFF009CFFFF00FFFFFF009CFFFF006363 + 00009CFFFF00CECECE0000000000000000000000000000000000FF633100FFFF + 9C00FFFF9C00FFFF9C00FFFF9C00FFFF9C00FFFF9C00FFFF9C00FFFF9C00FFFF + 9C00FF9C31000000000000000000000000000000000000000000FF633100FFFF + CE00FFFFCE00FFFFCE00FFFFCE00FFFFCE00FFFFCE00FFFFCE00FFFFCE00FFFF + 9C00FFCE310000000000000000000000000000009C006363FF00319CFF003100 + FF003100FF003100FF003100FF00FFFFFF00FFFFFF003100FF003100FF003100 + FF003100FF000000CE0000009C0000000000000000000000000084848400FFFF + FF00FFFFFF0063630000FFFFFF009CFFFF00009C31009CFFFF00FFFFFF009CFF + FF00FFFFFF00CECECE000000000000000000000000000000000000000000FF63 + 3100FFFF9C00FFFF9C0000000000FF633100FF633100FF633100FF633100FF63 + 3100FF6331000000000000000000000000000000000000000000FF633100FF63 + 3100FF633100FF633100FF633100FF633100FF633100FF633100FFFFCE00FFCE + 31000000000000000000000000000000000000009C006363FF00319CFF000063 + FF003100FF003100FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF003100FF003100 + FF003100FF000000CE0000009C0000000000000000000000000084848400FFFF + FF009CFFFF0063630000639C0000FFFFFF00009C3100009C31009CFFFF00FFFF + FF009CFFFF00CECECE0000000000000000000000000000000000000000000000 + 0000FF633100FFFF9C0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF633100FFCE31000000 + 00000000000000000000000000000000000000009C006363CE00319CFF000063 + FF003100FF00FFFFFF00FFFFFF003100FF003100FF00FFFFFF00FFFFFF003100 + FF003100FF000000CE0000009C0000000000000000000000000084848400FFFF + FF00FFFFFF009CFFFF00009C3100009C3100009C3100009C3100009C31009CFF + FF00FFFFFF00CECECE0000000000000000000000000000000000000000000000 + 000000000000FF63310000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF633100000000000000 + 0000000000000000000000000000000000000000000000009C006363FF00319C + FF000063FF003100FF003100FF003100FF003100FF003100FF003100FF003100 + FF003100FF000000CE000000000000000000000000000000000084848400FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00009C3100009C31009CFFFF00FFFF + FF00CECECE00CECECE0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF633100000000000000 + 0000000000000000000000000000000000000000000000009C006363CE00319C + FF00319CFF000063FF000063FF003100FF003100FF003100FF003100FF003100 + FF003100FF0000009C000000000000000000000000000000000084848400FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00009C31009CFFFF00FFFFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000009C006363 + CE006363FF00319CFF00319CFF000063FF000063FF003100FF003100FF003100 + FF000000CE00000000000000000000000000000000000000000084848400FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF009CFFFF00FFFFFF009CFFFF008484 + 8400FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 9C0000009C006363CE006363FF006363FF006363FF006363FF000000CE000000 + 000000000000000000000000000000000000000000000000000084848400FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF008484 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000009C0000009C0000009C0000009C0000009C0000009C000000 + 0000000000000000000000000000000000000000000000000000848484008484 + 8400848484008484840084848400848484008484840084848400848484008484 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008484840084848400848484008484 + 8400848484008484840084848400848484008484840084848400848484008484 + 8400848484008484840084848400848484000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000840000008400000084000000840000008400000084000000840000008400 + 0000840000008400000084000000000000008484840000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000848484000000000000000000008484000084 + 8400000000000000000000000000000000000000000000000000C6C6C600C6C6 + C600000000000084840000000000000000000000000000000000C6C6C600C6C6 + C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C6000000 + 0000C6C6C6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008484840000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000848484000000000000000000008484000084 + 8400000000000000000000000000000000000000000000000000C6C6C600C6C6 + C600000000000084840000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000C6C6C60000000000000000000000000000000000000000008400 + 0000840000008400000084000000840000000000000000000000000000008400 + 0000840000008400000084000000000000008484840084848400848484008484 + 8400848484008484840084848400848484008484840084848400848484008484 + 8400848484008484840084848400848484000000000000000000008484000084 + 8400000000000000000000000000000000000000000000000000C6C6C600C6C6 + C6000000000000848400000000000000000000000000C6C6C600C6C6C600C6C6 + C600C6C6C600C6C6C600C6C6C60000FFFF0000FFFF0000FFFF00C6C6C600C6C6 + C600000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000084000000000000000000000000000000000000000000 + 0000840000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000008484000084 + 8400000000000000000000000000000000000000000000000000000000000000 + 00000000000000848400000000000000000000000000C6C6C600C6C6C600C6C6 + C600C6C6C600C6C6C600C6C6C600848484008484840084848400C6C6C600C6C6 + C60000000000C6C6C60000000000000000000000000000000000000000000000 + 0000000000000000000084000000840000000000000000000000000000000000 + 0000840000008400000000000000000000008400000084000000840000008400 + 0000000000000000000000000000840000008400000084000000840000008400 + 0000840000000000000000000000000000000000000000000000008484000084 + 8400008484000084840000848400008484000084840000848400008484000084 + 8400008484000084840000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000C6C6C600C6C6C60000000000FF000000FF000000FF000000FF00 + 0000FF0000000000000000000000840000008400000084000000840000008400 + 0000840000008400000000000000000000000000000084848400840000000000 + 0000000000000000000000000000000000008484840084000000840000008484 + 8400000000000000000000000000000000000000000000000000008484000084 + 8400000000000000000000000000000000000000000000000000000000000000 + 00000084840000848400000000000000000000000000C6C6C600C6C6C600C6C6 + C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C6000000 + 0000C6C6C60000000000C6C6C600000000000000000000000000FF000000FF00 + 0000000000000000000000000000000000008400000084000000000000000000 + 0000840000008400000000000000000000000000000000000000840000008400 + 0000000000000000000000000000000000008484840084000000840000000000 + 0000000000000000000000000000000000000000000000000000008484000000 + 0000C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6 + C600000000000084840000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000C6C6 + C60000000000C6C6C6000000000000000000000000000000000000000000FF00 + 0000FF0000000000000000000000000000000000000084000000840000000000 + 0000840000008400000000000000000000000000000000000000848484008400 + 0000000000000000000000000000000000008400000084000000848484000000 + 0000000000000000000000000000000000000000000000000000008484000000 + 0000C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6 + C60000000000008484000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000 + 0000C6C6C60000000000C6C6C600000000000000000000000000000000000000 + 0000FF000000FF000000FF000000FF000000FF000000FF000000840000008400 + 0000840000008400000000000000000000000000000000000000000000008400 + 0000840000008400000084000000840000008400000084000000000000000000 + 0000000000000000000000000000000000000000000000000000008484000000 + 0000C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6 + C600000000000084840000000000000000000000000000000000000000000000 + 0000FFFFFF000000000000000000000000000000000000000000FFFFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FF000000FF0000000000000000000000FF000000FF0000008400 + 0000840000008400000000000000000000000000000000000000000000008484 + 8400840000000000000000000000840000008400000084848400000000000000 + 0000000000000000000000000000000000000000000000000000008484000000 + 0000C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6 + C600000000000084840000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FF000000FF00000000000000FF000000FF0000000000 + 0000840000008400000000000000000000000000000000000000000000000000 + 0000840000008400000000000000840000008400000000000000000000000000 + 0000000000000000000000000000000000000000000000000000008484000000 + 0000C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6 + C600000000000000000000000000000000000000000000000000000000000000 + 000000000000FFFFFF000000000000000000000000000000000000000000FFFF + FF00000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000FF000000FF000000FF000000FF0000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000848484008400000084000000840000008484840000000000000000000000 + 0000000000000000000000000000000000000000000000000000008484000000 + 0000C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6 + C60000000000C6C6C60000000000000000000000000000000000000000000000 + 000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FF000000FF000000FF0000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF0000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008484840084000000848484000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00000000000000000000000000000000000000000084000000840000008400 + 0000840000000000000000000000000000008400000084000000840000008400 + 000084000000840000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000000000008484000084 + 8400008484000084840000848400008484000084840000848400008484000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00000000000000000000000000000000000000000000000000848484008400 + 0000000000000000000000000000000000000000000084848400840000008400 + 000084848400000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000FFFF00000000000084 + 8400008484000084840000848400008484000084840000848400008484000084 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000840000000000000000000000000000000000000084848400840000008400 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000000000000000000000000000000000000000FFFFFF0000FFFF000000 + 0000008484000084840000848400008484000084840000848400008484000084 + 8400008484000000000000000000000000000000000000000000FFFFFF000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 0000000000000000000000000000000000000000000000000000000000008484 + 8400840000000000000000000000000000000000000084000000840000008484 + 840000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000FFFF00FFFFFF0000FF + FF00000000000084840000848400008484000084840000848400008484000084 + 8400008484000084840000000000000000000000000000000000FFFFFF000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000008400000084000000840000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000000000000000000000000000000000000000FFFFFF0000FFFF00FFFF + FF0000FFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000FFFFFF000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000848484008400000000000000000000008400000084000000848484000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000FFFF00FFFFFF0000FF + FF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000084000000000000008400000084000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000000000000000000000000000000000000000FFFFFF0000FFFF00FFFF + FF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF00000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF000000000000000000000000000000000000000000FFFFFF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008484840084000000840000008400000084848400000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000FFFF00FFFFFF0000FF + FF00000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000840000008400000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084848400840000008484840000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000000FFFFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF000000000000000000000000000000000000000000FFFFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000840000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000840000008400000084000000840000008400 + 0000840000008400000084000000840000000000000000000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000840000008400000084000000840000008400 + 0000840000008400000084000000000000000000000000000000000000008400 + 0000000000000000000084000000000000000000000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00840000000000000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0084000000000000000000000000000000000000008400 + 0000000000000000000084000000000000008400000000000000000000008400 + 0000000000000000000000000000000000000000000084848400008484008484 + 8400008484008484840084000000FFFFFF008400000084000000840000008400 + 00008400000084000000FFFFFF00840000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000FFFFFF000000000000000000000000000000 + 000000000000FFFFFF0084000000000000000000000000000000000000008400 + 0000000000000000000084000000000000008400000000000000000000008400 + 0000000000000000000000000000000000000000000000848400848484000084 + 8400848484000084840084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0084000000000000000000000000000000000000000000 + 0000840000008400000084000000000000008400000000000000000000008400 + 0000000000000000000000000000000000000000000084848400008484008484 + 8400008484008484840084000000FFFFFF00840000008400000084000000FFFF + FF00840000008400000084000000840000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0084000000FFFFFF000000000000000000000000000000 + 000000000000FFFFFF0084000000000000000000000000000000000000000000 + 0000000000000000000084000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000848400848484000084 + 8400848484000084840084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF0084000000FFFFFF0084000000000000000000000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 0000000000000000000084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0084000000000000000000000000000000000000000000 + 0000000000000000000084000000000000008400000000000000000000000000 + 0000000000000000000000000000000000000000000084848400008484008484 + 8400008484008484840084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00840000008400000000000000000000000000000000000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0084000000FFFFFF000000000000000000FFFFFF008400 + 0000840000008400000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000848400848484000084 + 8400848484000084840084000000840000008400000084000000840000008400 + 0000840000000000000000000000000000008400000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 0000000000000000000084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF008400 + 0000FFFFFF008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084848400008484008484 + 8400008484008484840000848400848484000084840084848400008484008484 + 8400008484000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0084000000FFFFFF00FFFFFF00FFFFFF00FFFFFF008400 + 0000840000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000848400848484000000 + 0000000000000000000000000000000000000000000000000000000000008484 + 8400848484000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 0000FFFFFF000000000084000000840000008400000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084848400848484000000 + 0000C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600C6C6C600000000008484 + 8400008484000000000000000000000000000000000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF0000000000FFFFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000848400848484000084 + 84000000000000FFFF00000000000000000000FFFF0000000000848484000084 + 8400848484000000000000000000000000008400000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000FFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000848484000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008484840000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084848400000000008484840000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008484840000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084848400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000848484000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000848484000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000040000000700000000100010000000000800300000000000000000000 + 000000000000000000000000FFFFFF00FFF9FFFF00000000F830FFFF00000000 + E000000100000000C00100010000000080030001000000008003000100000000 + 0001000100000000000100010000000000010001000000000001000100000000 + 000100010000000080030001000000008003000100000000C00780FF00000000 + E00FC1FF00000000F83FFFFF00000000FFFFFFFFF81FC001FFFFFFFFE007C001 + FFFFFFFFC003C001FDFFFFBF8001C001F9FFFF9F8001C001F1FFFF8F0000C001 + E003C0070000C001C003C0030000C001C003C0030000C001E003C0070000C001 + F1FFFF8F0000C001F9FFFF9F8001C001FDFFFFBF8001C001FFFFFFFFC003C003 + FFFFFFFFE007C007FFFFFFFFF81FC00FFFFFFFFFFFFF0000C001C007E0017FFE + 80018003FFFF7FFE80010001E0E1000080010001F9F3FFFF80010001FCF30E07 + 8001000006039F0F80010000CF33CF1F80018000E793CF1F8001C000F003E03F + 8001E001F983E63F8001E007FC93F27F8001F007FE1FF07F8001F003FF1FF8FF + 8001F803FF9FF8FFFFFFFFFFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 07C1FFFFC007001F07C18703C007000F07C1CF87C00700070101E78FC0070003 + 0001E78FC00700010201F01FC00700000201F31FC007001F8003F93FC007001F + C107F83FC007001FC107FC7FC0078FF1E38FFC7FC00FFFF9E38FFEFFC01FFF75 + E38FFFFFC03FFF8FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFFF3FFFC00 + DFFFFC01ED9F8000B803FC01ED6F00001FFFFC01ED6F0000FFFF0001F16F0000 + 1FFF0001FD1F0001BFFF0001FC7F0003D8030001FEFF00033FFF0003FC7F0003 + FFFF0007FD7F00031FFF000FF93F0003BFFF00FFFBBF0003380301FFFBBF8007 + BFFF03FFFBBFF87FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF1FFFFFFFFFFFE00F1803E01FE07FFFFF1FFFF18FF8FFF83FFFFF + F18FF8FFF11FFFFFF18FFC7FF39F1FFFF01FFC7FF39F1803F18FFE3FF39F1FFF + F18FFE3FF39FFFFFF18FFF1FF39FFFFFE01FFE0FF39F1FFFFFFFFFFFE10F1803 + FFFFFFFFFFFF1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFF003FC00FF0030003FFFFFFFFFFFFFFFF0003000300030003 + FFFFFFFFFFFFFFFF003FC00FF0030003FFFFFFFFFFFFFFFF0003000300030003 + FFFFFFFFFFFFFFFF003FC00FF0030003FFFFFFFFFFFFFFFF0003000300030003 + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 + 000000000000} + end + object SpTBXPopupMenu1: TSpTBXPopupMenu + Left = 224 + Top = 352 + object pGroupItem1: TTBGroupItem + LinkSubitems = mToolbars + end + object SpTBXSeparatorItem10: TSpTBXSeparatorItem + end + object pCustomize: TSpTBXItem + Caption = 'Customize...' + OnClick = aCustomizeExecute + end + object pEmbeddedCustomize: TSpTBXItem + Caption = 'Embedded Customize...' + OnClick = aEmbeddedCustomizeExecute + end + end + object SpTBXCustomizer1: TSpTBXCustomizer + Images = ImageList1 + Left = 192 + Top = 384 + object cPrint: TSpTBXItem + Caption = 'Print' + ImageIndex = 17 + OnClick = ActionsExecute + end + object cLeftJustify: TSpTBXItem + Caption = 'Left Justify' + ImageIndex = 0 + OnClick = ActionsExecute + end + object cCentered: TSpTBXItem + Caption = 'Centered' + ImageIndex = 1 + OnClick = ActionsExecute + end + object cRightJustify: TSpTBXItem + Caption = 'Right Justify' + ImageIndex = 2 + OnClick = ActionsExecute + end + object cBullets: TSpTBXItem + Caption = 'Bullets' + ImageIndex = 7 + OnClick = ActionsExecute + end + object cNumBullets: TSpTBXItem + Caption = 'Numbered Bullets' + ImageIndex = 8 + OnClick = ActionsExecute + end + object cFavs: TSpTBXItem + Caption = 'Favs' + ImageIndex = 25 + OnClick = ActionsExecute + end + object cSelectAll: TSpTBXItem + Caption = 'Select All' + ShortCut = 16449 + OnClick = ActionsExecute + end + object cExit: TSpTBXItem + Caption = 'Exit' + OnClick = ActionsExecute + end + end +end diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit1.pas b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit1.pas new file mode 100644 index 0000000..a56db25 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit1.pas @@ -0,0 +1,350 @@ +unit Unit1; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, Menus, ImgList, ActnList, ComCtrls, + {$IFNDEF UNICODE} + TntActnList, TntDialogs, TntStdCtrls, TntSystem, TntForms, + {$ENDIF} + { TB2K } + TB2Dock, TB2Toolbar, TB2Item, TB2ExtItems, + SpTBXSkins, SpTBXItem, SpTBXControls, SpTBXDkPanels, SpTBXTabs, SpTBXEditors, + SpTBXCustomizer, + { gettext } + gnugettext; + +type + TForm1 = class(TForm) + ImageList1: TImageList; + SpTBXDock1: TSpTBXDock; + SpTBXMultiDock1: TSpTBXMultiDock; + SpTBXMultiDock2: TSpTBXMultiDock; + SpTBXDock2: TSpTBXDock; + dpLog: TSpTBXDockablePanel; + dpHelp: TSpTBXDockablePanel; + tbStandard: TSpTBXToolbar; + tbFormat: TSpTBXToolbar; + tbMenuBar: TSpTBXToolbar; + tbNavigation: TSpTBXToolbar; + mFile: TSpTBXSubmenuItem; + mEdit: TSpTBXSubmenuItem; + mView: TSpTBXSubmenuItem; + mHelp: TSpTBXSubmenuItem; + mNew: TSpTBXItem; + mOpen: TSpTBXItem; + mSave: TSpTBXItem; + SpTBXSeparatorItem1: TSpTBXSeparatorItem; + mExit: TSpTBXItem; + mCut: TSpTBXItem; + mCopy: TSpTBXItem; + mPaste: TSpTBXItem; + SpTBXSeparatorItem2: TSpTBXSeparatorItem; + mSelectAll: TSpTBXItem; + SpTBXSeparatorItem3: TSpTBXSeparatorItem; + mFind: TSpTBXItem; + mLeftJustify: TSpTBXItem; + mUnderline: TSpTBXItem; + mItalic: TSpTBXItem; + mBold: TSpTBXItem; + SpTBXSeparatorItem5: TSpTBXSeparatorItem; + mRightJustify: TSpTBXItem; + mCentered: TSpTBXItem; + SpTBXSeparatorItem6: TSpTBXSeparatorItem; + mBullets: TSpTBXItem; + mNumberedBullets: TSpTBXItem; + mSidebar: TSpTBXSubmenuItem; + mOptions: TSpTBXItem; + mmHelp: TSpTBXItem; + mToolbars: TSpTBXSubmenuItem; + SpTBXPopupMenu1: TSpTBXPopupMenu; + mStandardToolbar: TSpTBXItem; + mFormattingToolbar: TSpTBXItem; + mNavigationToolbar: TSpTBXItem; + mCommandsLog: TSpTBXItem; + dpOptions: TSpTBXDockablePanel; + mmmHelp: TSpTBXItem; + mAbout: TSpTBXItem; + tNew: TSpTBXItem; + tOpen: TSpTBXItem; + tSave: TSpTBXItem; + tCut: TSpTBXItem; + tCopy: TSpTBXItem; + tPaste: TSpTBXItem; + tBold: TSpTBXItem; + SpTBXSeparatorItem8: TSpTBXSeparatorItem; + tItalic: TSpTBXItem; + tUnderline: TSpTBXItem; + mPrint: TSpTBXItem; + SpTBXSeparatorItem7: TSpTBXSeparatorItem; + SpTBXSeparatorItem9: TSpTBXSeparatorItem; + tFind: TSpTBXItem; + tStop: TSpTBXItem; + tRefresh: TSpTBXItem; + tForward: TSpTBXItem; + tBack: TSpTBXItem; + tSearch: TSpTBXItem; + pGroupItem1: TTBGroupItem; + SpTBXSeparatorItem10: TSpTBXSeparatorItem; + pCustomize: TSpTBXItem; + tbLayouts: TSpTBXToolbar; + tLayoutSave: TSpTBXItem; + SpTBXLabelItem1: TSpTBXLabelItem; + tLayoutsToolbar: TSpTBXItem; + SpTBXCustomizer1: TSpTBXCustomizer; + cPrint: TSpTBXItem; + cLeftJustify: TSpTBXItem; + cCentered: TSpTBXItem; + cNumBullets: TSpTBXItem; + cBullets: TSpTBXItem; + cRightJustify: TSpTBXItem; + cFavs: TSpTBXItem; + cExit: TSpTBXItem; + cSelectAll: TSpTBXItem; + Memo1: TMemo; + SpTBXSubmenuItem1: TSpTBXSubmenuItem; + SpTBXTabControl1: TSpTBXTabControl; + SpTBXTabItem1: TSpTBXTabItem; + SpTBXTabSheet1: TSpTBXTabSheet; + SpTBXTabItem2: TSpTBXTabItem; + SpTBXTabSheet2: TSpTBXTabSheet; + Memo2: TMemo; + Memo3: TMemo; + SpTBXSeparatorItem12: TSpTBXSeparatorItem; + tSkins: TSpTBXSubmenuItem; + SpTBXSkinGroupItem1: TSpTBXSkinGroupItem; + pEmbeddedCustomize: TSpTBXItem; + SpTBXLabel1: TSpTBXLabel; + SpTBXSeparatorItem13: TSpTBXSeparatorItem; + SpTBXTabItem3: TSpTBXTabItem; + SpTBXTabSheet3: TSpTBXTabSheet; + Memo4: TMemo; + SpTBXSplitter1: TSpTBXSplitter; + SpTBXSplitter2: TSpTBXSplitter; + tLanguages: TSpTBXComboBox; + TBControlItem1: TTBControlItem; + tFont: TSpTBXComboBox; + TBControlItem2: TTBControlItem; + tFontSize: TSpTBXComboBox; + TBControlItem3: TTBControlItem; + tLayouts: TSpTBXComboBox; + TBControlItem4: TTBControlItem; + SpTBXStatusBar1: TSpTBXStatusBar; + procedure ActionsExecute(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure tLayoutSaveClick(Sender: TObject); + procedure tLayoutsItemClick(Sender: TObject); + procedure aCustomizeExecute(Sender: TObject); + procedure aEmbeddedCustomizeExecute(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure tLanguagesItemClick(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + FAppPath: string; + FIniPath: string; + procedure FillLayoutList(CurrentLayout: string = ''); + end; + +var + Form1: TForm1; + +implementation + +uses + Unit2; + +{$R *.dfm} + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Form } + +procedure TForm1.FormShow(Sender: TObject); +begin + FAppPath := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)); + FIniPath := FAppPath + 'Options.ini'; + + // Load the text files + Memo2.Lines.LoadFromFile(FAppPath + 'faq.txt'); + Memo3.Lines.LoadFromFile(FAppPath + 'advanced.txt'); + Memo4.Lines.LoadFromFile(FAppPath + 'translations.txt'); + + // Load the items positions and the last layout from the ini file + SpTBXCustomizer1.Load(FIniPath); + + // Load the layout list + FillLayoutList('LastLayout'); + + SpTBXCustomizer1.MenuBar := tbMenuBar; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + // Save the items positions and the current layout to the Ini file + SpTBXCustomizer1.Save(FIniPath); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Layouts UI } + +procedure TForm1.FillLayoutList(CurrentLayout: string); +var + I: integer; +begin + // Fill the tLayouts combobox + tLayouts.Items.Clear; + for I := 0 to SpTBXCustomizer1.Layouts.Count - 1 do + tLayouts.Items.Add(SpTBXCustomizer1.Layouts[I]); + I := tLayouts.Items.IndexOf(CurrentLayout); + if I > -1 then + tLayouts.ItemIndex := I; +end; + +procedure TForm1.tLayoutsItemClick(Sender: TObject); +begin + if tLayouts.ItemIndex > -1 then + SpTBXCustomizer1.LoadLayout(FIniPath, tLayouts.Items[tLayouts.ItemIndex]); +end; + +procedure TForm1.tLayoutSaveClick(Sender: TObject); +var + S: string; +begin + {$IFNDEF UNICODE} + S := TntDialogs.WideInputBox(_('Save Layout'), _('Save current layout as:'), ''); + {$ELSE} + S := InputBox(_('Save Layout'), _('Save current layout as:'), ''); + {$ENDIF} + if S <> '' then begin + SpTBXCustomizer1.SaveLayout(FIniPath, S); + FillLayoutList(S); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Actions } + +procedure TForm1.ActionsExecute(Sender: TObject); +begin + if Sender is TSpTBXItem then + Memo1.Lines.Add(TSpTBXItem(Sender).Caption + ' ' + _('Executed')); +end; + +procedure TForm1.aCustomizeExecute(Sender: TObject); +begin + SpTBXCustomizer1.Show; +end; + +procedure TForm1.aEmbeddedCustomizeExecute(Sender: TObject); +begin + if not Form2.Visible then begin + SpTBXCustomizer1.ShowEmbedded(Form2.ClientPanel); + Form2.Show; + Form2.tCustomize.Click; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Languages } + +function MyWideCustomLoadResString(ResStringRec: PResStringRec; var Value: WideString): Boolean; +begin + Result := True; + Value := GnuGetText.LoadResStringW(ResStringRec); +end; + +procedure SpDxGetTextInitialize(LanguageCode: string; AComponents: array of TComponent; ShellFont, UnicodeResourceStrings: Boolean); +// LanguageCode can be an ISO language code: 'en', 'es', 'ko' +// And also can be the ISO code plus a description: '[en] English', '[es] Spanish', '[ko] Korean' +var + I, L: Integer; +begin + // Get the ISO language code + L := Length(LanguageCode); + if (L > 2) and (LanguageCode[1] = '[') then begin + I := Pos(']', LanguageCode); + if (I > 0) then + LanguageCode := Copy(LanguageCode, 2, I - 2); + end; + + {$IFNDEF UNICODE} + // Override Delphi's automatic ResourceString conversion to Ansi + if UnicodeResourceStrings then begin + TntSystem.InstallTntSystemUpdates; + // Override TNT's LoadResString function + // This is necessary because dxGetText uses a different + // way to access the translated ResourceStrings. + TntSystem.WideCustomLoadResString := MyWideCustomLoadResString; + end; + {$ENDIF} + + if ShellFont then begin + if (Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion >= 5) then + DefFontData.Name := 'MS Shell Dlg 2' + else + DefFontData.Name := 'MS Shell Dlg'; + end; + + gnugettext.TP_GlobalIgnoreClassProperty(TAction,'Category'); + gnugettext.TP_GlobalIgnoreClassProperty(TControl,'HelpKeyword'); + gnugettext.TP_GlobalIgnoreClassProperty(TControl,'ImeName'); + gnugettext.TP_GlobalIgnoreClass(Graphics.TFont); + gnugettext.TP_GlobalIgnoreClass(TSpTBXTabSheet); + + gnugettext.UseLanguage(LanguageCode); + for I := Low(AComponents) to High(AComponents) do + gnugettext.TranslateComponent(AComponents[I]); +end; + +procedure SpDxGetTextChangeLanguage(LanguageCode: string; AComponents: array of TComponent); +// LanguageCode can be an ISO language code: 'en', 'es', 'ko' +// And also can be the ISO code plus a description: '[en] English', '[es] Spanish', '[ko] Korean' +var + I, L: Integer; + C: TComponent; +begin + // Get the ISO language code + L := Length(LanguageCode); + if (L > 2) and (LanguageCode[1] = '[') then begin + I := Pos(']', LanguageCode); + if (I > 0) then + LanguageCode := Copy(LanguageCode, 2, I - 2); + end; + + if LanguageCode <> gnugettext.GetCurrentLanguage then begin + gnugettext.UseLanguage(LanguageCode); + for I := Low(AComponents) to High(AComponents) do begin + C := AComponents[I]; + SpBeginUpdateAllToolbars(C); + try + gnugettext.ReTranslateComponent(C); + finally + SpEndUpdateAllToolbars(C); + end; + end; + end; +end; + +procedure TForm1.tLanguagesItemClick(Sender: TObject); +var + I: integer; +begin + I := tLanguages.ItemIndex; + if I > -1 then begin + tLanguages.Text := tLanguages.Items[I]; + // Change language and retranslate + SpDxGetTextChangeLanguage(tLanguages.Text, [Self, Form2]); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + SpDxGetTextInitialize('en', [Self], True, True); + tLanguages.Items.LoadFromFile('langcodes.txt'); + tLanguages.ItemIndex := 1; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit2.dfm b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit2.dfm new file mode 100644 index 0000000..667975b --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit2.dfm @@ -0,0 +1,1229 @@ +object Form2: TForm2 + Left = 279 + Top = 214 + BorderIcons = [biSystemMenu] + Caption = 'Options' + ClientHeight = 425 + ClientWidth = 456 + Color = clBtnFace + Constraints.MinHeight = 454 + Constraints.MinWidth = 464 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnClose = FormClose + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object SpTBXDock1: TSpTBXDock + Left = 0 + Top = 0 + Width = 86 + Height = 425 + BoundLines = [blTop, blBottom, blLeft, blRight] + Position = dpLeft + object SpTBXToolbar1: TSpTBXToolbar + Left = 0 + Top = 0 + DockMode = dmCannotFloatOrChangeDocks + DragHandleStyle = dhNone + Images = ImageList1 + Options = [tboImageAboveCaption, tboSameWidth] + ShrinkMode = tbsmNone + Stretch = True + TabOrder = 0 + Caption = 'SpTBXToolbar1' + Customizable = False + DisplayMode = tbdmImageAboveCaption + object tProperties: TSpTBXItem + Caption = 'Properties' + GroupIndex = 1 + ImageIndex = 0 + OnClick = SideBarClick + CustomWidth = 80 + CustomHeight = 75 + end + object tPageSetup: TSpTBXItem + Caption = 'Page Setup' + GroupIndex = 1 + ImageIndex = 1 + OnClick = SideBarClick + CustomWidth = 80 + CustomHeight = 75 + end + object tHistory: TSpTBXItem + Caption = 'History' + GroupIndex = 1 + ImageIndex = 2 + OnClick = SideBarClick + CustomWidth = 80 + CustomHeight = 75 + end + object tFavorites: TSpTBXItem + Caption = 'Favorites' + GroupIndex = 1 + ImageIndex = 3 + OnClick = SideBarClick + CustomWidth = 80 + CustomHeight = 75 + end + object tCustomize: TSpTBXItem + Caption = 'Customizer' + GroupIndex = 1 + ImageIndex = 4 + OnClick = SideBarClick + CustomWidth = 80 + CustomHeight = 75 + end + end + end + object LeftPanel: TPanel + Left = 86 + Top = 0 + Width = 370 + Height = 425 + Align = alClient + BevelOuter = bvNone + TabOrder = 1 + object ClientPanel: TPanel + Left = 0 + Top = 28 + Width = 370 + Height = 360 + Align = alClient + BevelOuter = bvNone + TabOrder = 0 + end + object ButtonsPanel: TPanel + Left = 0 + Top = 388 + Width = 370 + Height = 37 + Align = alBottom + BevelOuter = bvNone + TabOrder = 1 + DesignSize = ( + 370 + 37) + object SpTBXButton1: TSpTBXButton + Left = 124 + Top = 7 + Width = 75 + Height = 25 + Caption = 'OK' + Anchors = [akRight, akBottom] + TabOrder = 0 + OnClick = ButtonClick + end + object SpTBXButton2: TSpTBXButton + Left = 207 + Top = 7 + Width = 75 + Height = 25 + Caption = 'Cancel' + Anchors = [akRight, akBottom] + TabOrder = 1 + OnClick = ButtonClick + end + object SpTBXButton3: TSpTBXButton + Left = 287 + Top = 7 + Width = 75 + Height = 25 + Caption = 'Apply' + Anchors = [akRight, akBottom] + TabOrder = 2 + OnClick = ButtonClick + end + end + object TitlePanel: TSpTBXLabel + Left = 0 + Top = 0 + Width = 370 + Height = 28 + Caption = 'Customizer' + Color = clGray + Align = alTop + AutoSize = False + Font.Charset = ANSI_CHARSET + Font.Color = clSilver + Font.Height = -19 + Font.Name = 'Tahoma' + Font.Style = [fsBold] + ParentFont = False + end + end + object ImageList1: TImageList + Height = 32 + Width = 32 + Left = 112 + Top = 392 + Bitmap = { + 494C010105000900040020002000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000800000004000000001002000000000000080 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000B55A0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A + 0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A + 0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A00000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000B55A0000F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500F7AD + A500F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500F7AD + A500F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500B55A00000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000CE630000FFC6C600FFC6C600FFC6C600FFC6C60084848400FFC6 + C600FFC6C600FFC6C600FFC6C600FFC6C60084848400FFC6C600FFC6C600FFC6 + C600FFC6C600FFC6C60084848400FFC6C600FFC6C600FFC6C600CE6300000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000E7730000FFDEDE0084848400FFDEDE00FFDEDE0084848400FFDE + DE00FFDEDE0084848400FFDEDE00FFDEDE0084848400FFDEDE00FFDEDE008484 + 8400FFDEDE00FFDEDE0084848400FFDEDE00FFDEDE0084848400E77300000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000E7730000E7730000E7730000E7730000E7730000E7730000E773 + 0000E7730000E7730000E7730000E7730000E7730000E7730000E7730000E773 + 0000E7730000E7730000E7730000E7730000E7730000E7730000E77300000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000B55A0000B55A0000B55A0000B55A + 0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A0000B55A + 0000B55A0000B55A000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00F7ADA500F7ADA500F7AD + A500F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500F7ADA500F7AD + A500B55A00000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600FFC6C600FFC6 + C600FFC6C6002D2D2D0058534E009C9C9C00FFC6C600FFC6C600F7ADA500B55A + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600B55A0000B55A + 0000B55A000058534E00373C3E005160610052636B00F7ADA500B55A00000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600CE6300000000 + 0000B55A0000D6D6D60054777B00428CDE0018556F008A5B5200000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600CE630000B55A + 0000FFC6C600FFC6C60054777B0029799A008D787F00D47719008A5B52000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600B55A0000FFC6 + C600FFC6C600FFC6C600848484007C707800F9C08600F8B26600D47719008A5B + 5200000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600FFC6C600FFC6 + C600FFC6C600F7ADA500B55A000085787C00FBCA9500F9C08600F8B26600D477 + 19008A5B52000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600FFC6C600FFC6 + C600F7ADA500B55A00000000000000000000AD7B7300FBD3A900F9C08600F8B2 + 6600D47719008A5B520000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600FFC6C600F7AD + A500B55A000000000000000000000000000000000000AD7B7300FBD3A900F9C0 + 8600F8B26600D47719008A5B5200000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00FFC6C600F7ADA500B55A + 0000000000000000000000000000000000000000000000000000AD7B7300FBD3 + A900F9C08600F8B26600D47719008A5B52000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00F7ADA500B55A00000000 + 000000000000000000000000000000000000000000000000000000000000AD7B + 7300FBCA9500B9858500299CEF004ABDFF000A62A00000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000FFDEDE00B55A0000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000AD7B7300299CEF004ABDFF00299CEF00021EAA0000009A00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A0000B55A000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000004ABDFF00299CEF000936C9001029D6000316AC000018C6000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B55A00000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000018C6006D8AFD00106BFF000018C600000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000018C6000018C60000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000AD7B7B00B5848400B5848400B5848400B584 + 8400B5848400B5848400B5848400B5848400B5848400B5848400B5848400B584 + 8400B5848400B5848400B5848400B5848400B5848400B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000948C8C00948C8C00948C8C00948C8C00948C8C00948C8C000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000087BAD00087BAD000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000087BAD00087BAD00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000AD7B7B00EFDEC600F7E7C600F7DEBD00F7DE + B500F7D6B500F7D6AD00F7D6A500EFCE9C00EFCE9C00EFCE9400EFCE9400EFCE + 9400EFCE9400EFCE9400EFCE9400EFCE9400EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000E7C6AD00A57B6300A57B6300A57B6300A57B6300A57B6300A57B6300A57B + 6300A57B6300A57B6300A57B6300A57B6300A57B6300A57B6300000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000009C9C + 9C009C9C9C009C9C9C00A5A5A500ADADAD00A5A5A500A5A5A5009C9C9C00948C + 8C00948C8C000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000218CB50063C6E70031A5CE00087B + AD00000000000000000000000000000000000000000000000000000000000000 + 0000107BAD0021ADD60029BDE700107BAD000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000AD7B7B00EFDEC600F7E7CE00F7DEC600F7DE + BD00F7D6B500F7D6AD00F7D6AD00EFCEA500EFCE9C00EFCE9C00EFCE9400EFCE + 9400EFCE9400EFCE9400EFCE9400EFCE9400EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFDED600F7CEBD00F7CEBD00F7CEBD00F7CEBD00F7CEBD00F7CEBD00F7CE + BD00F7CEBD00F7CEBD00F7CEBD00F7CEBD00F7CEBD00DEAD8C00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000009C9C9C00948C8C00B5AD + AD00CECECE00D6D6D600C6C6C600BDBDBD00BDBDBD00C6BDBD00CEC6C600CEC6 + C600B5ADAD00948C8C00948C8C00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000001884B50084DEF70073EFFF0042B5 + D600087BAD000000000000000000000000000000000000000000000000001084 + B50039C6E700FFFFFF0031C6EF00087BAD000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000AD7B7B00F7DECE00F7E7CE00F7DEC600F7DE + C600F7DEBD00F7D6B500F7D6AD00F7D6AD00EFCEA500EFCE9C00EFCE9C00EFCE + 9400EFCE9400EFCE9400EFCE9400EFCE9400EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFDED600F7CEBD008C6B5200F7CEBD00F7CEBD008C6B5200F7CEBD00F7CE + BD008C6B5200F7CEBD00F7CEBD008C6B5200F7CEBD00DEAD8C00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000009C9C9C00A5A5A500D6D6D600E7E7 + E700B5B5B5008C8484008C847B009C9484009C948400948C7B00847B73009C94 + 9400D6C6C600D6C6C600AD9C9C00948C8C000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000087BAD0052B5D6006BE7FF0073E7 + FF0042BDDE00087BAD00000000000000000000000000000000001884B5004ACE + EF00FFFFFF0042E7FF00189CC600087BAD000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000AD7B7B00F7E7CE00F7E7D600F7E7CE00F7DE + C600F7DEBD00F7DEBD00F7D6B500F7D6AD00F7D6AD00EFCEA500EFCE9C00EFCE + 9C00EFCE9400EFCE9400EFCE9400EFCE9400EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000E7C6AD00E7C6AD00E7C6AD00E7C6AD00E7C6AD00E7C6AD00E7C6AD00E7C6 + AD00E7C6AD00E7C6AD00E7C6AD00E7C6AD00E7C6AD00E7C6AD00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000009C9C9C00ADADAD00EFEFEF00D6D6D6008C8C + 8400A59C8C00D6D6BD00FFF7E700CECEF700849CF700FFF7E700E7E7CE00ADAD + 94007B736B00B5A5A500E7CECE00B5A5A500948C8C0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000087BAD0073DEF7005AE7 + FF007BEFFF0052C6E700087BAD000000000000000000218CB5006BDEF700FFFF + FF0042E7FF0031C6EF00107BAD00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000AD7B7B00F7E7D600F7EFDE00F7E7D600F7E7 + CE00F7DEC600F7DEC600F7DEBD00F7D6B500F7D6AD00F7D6AD00EFCEA500EFCE + 9C00EFCE9C00EFCE9400EFCE9400EFCE9400EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000E7C6AD00A57B6300A57B6300A57B + 6300000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000009C9C9C00A5A5A500EFEFEF00D6D6D6008C8C8400CEC6 + B500FFFFEF00FFF7E700FFE7C600D6BDBD00AD9CBD00FFE7CE00FFF7EF00FFFF + FF00E7E7CE00847B6B00AD949400EFCECE00AD9C9C00948C8C00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000087BAD0063C6E70052E7 + FF0063E7FF007BEFFF0063CEE7001084B500188CBD0073DEF700FFFFFF005AE7 + FF004AE7FF0021ADD600087BAD00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000AD847B00F7E7DE00F7EFDE00F7E7D600F7E7 + CE00F7E7CE00F7DEC600F7DEC600F7DEBD00F7D6B500F7D6AD00F7D6AD00EFCE + A500EFCE9C00EFCE9C00EFCE9400EFCE9400EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000B5848400B5848400B5848400B5848400B5848400B5848400B584 + 8400B5848400B5848400B5848400B5848400B5848400B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000009C9C9C00D6DED60042944A00427B4200D6D6BD00FFFF + EF00FFE7C600F7D6A500F7C69400F7C68400F7C68400EFBD8400F7D6AD00FFF7 + DE00FFFFFF00F7F7E700847B6B00BDA5A500E7C6C600948C8C00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000399CC60063E7 + FF004ADEFF0063E7FF0084EFFF0073DEF7007BE7F700FFFFFF007BEFFF006BE7 + FF0052DEFF00108CB50000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000AD847B00F7EFE700F7EFE700292921005A52 + 42005A5242005A5242005A5242005A524200F7DEBD00F7D6B500F7D6AD00F7D6 + AD00EFCEA500EFCE9C00EFCE9C00EFCE9400EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD008C6B5200DEAD + 8C0000000000C6A59C00FFEFD600F7E7C600F7DEBD00F7DEB500F7D6AD00F7D6 + A500EFCE9C00EFCE9400EFCE9400EFCE9400F7D69C00B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000009C9C9C00B5B5B5006BA56B0031AD4A00219C39009CC69400FFF7 + CE00FFEFC600FFE7BD00F7DEB500F7D6AD00F7C69400F7C68C00F7CE9C00F7DE + B500FFF7CE00FFFFFF00E7DECE00736B6300E7C6C600BDADAD00948C8C000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000107BAD0063CE + E70042DEFF004ADEFF0063E7FF0084EFFF0094EFFF009CEFFF008CEFFF007BEF + FF004AC6E700087BAD0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B58C7B00F7EFE700FFF7EF0018181800DECE + CE008494EF000842FF00394AAD00524A4200F7DEBD00F7DEBD00F7D6B500F7D6 + AD00F7D6AD00EFCEA500EFCE9C00EFCE9C00EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000C6A59C00FFEFD600F7E7CE00F7DEC600F7DEBD00F7D6B500F7D6 + A500EFCE9C00EFCE9C00EFCE9400EFCE9400EFCE9C00B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000009C9C9C0084B58400219C39005AE78C0052DE8400218C2900B5D6 + 9C00FFFFD600FFFFD600FFFFD600FFF7CE00FFE7B500F7D6A500F7C69400F7CE + 9C00F7CE9C00FFE7C600FFFFFF00A59C8C00A58C8C00E7C6C600948C8C000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000087B + AD004ADEFF0039DEFF0052DEFF0063E7FF007BEFFF0094EFFF009CEFFF0084EF + FF00087BAD000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000B58C8400F7EFEF00FFF7EF00292929007384 + D6004263F700A5ADE7001039E7004A424A00F7DEC600F7DEBD00F7DEBD00F7D6 + B500F7D6AD00F7D6AD00EFCEA500EFCE9C00EFCE9400B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000C6ADA500FFEFE700F7E7D600F7E7CE00F7DEC600F7DEBD00F7D6 + B500F7D6AD00EFCE9C00EFCE9C00EFCE9400EFCE9C00B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00009C9C9C0052845200108C210042D66B0052DE7B005AE78C0052DE7B00298C + 3100DEEFBD00FFFFD600FFFFD600FFFFDE00FFFFD600FFEFC600F7D6A500F7C6 + 9400EFBD8400F7C68C00FFF7E700DEDEC6007B736300EFC6C600A59C9C00A59C + 9C00000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000087BAD001084B50021B5 + DE0021D6FF0029D6FF0042DEFF0052DEFF006BE7FF0084EFFF0094EFFF0094EF + FF0042ADCE00087BAD0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000BD8C8400F7F7F700FFFFF700181818009494 + B500C6C6CE00DECECE004A63CE00214AD600F7DECE00F7DEC600F7DEC600F7DE + BD00F7D6B500F7D6AD00F7D6AD00EFCEA500EFCE9C00B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD008C6B5200DEAD + 8C0000000000C6ADA500FFF7E700F7E7D600F7E7CE00F7E7C600F7DEC600F7DE + B500F7D6B500F7D6AD00EFCE9C00EFCE9C00EFCE9400B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00009C9C9C00108C180029BD420039CE5A0042CE63004AD67B005AE78C004AD6 + 7B0031943900DEEFBD00FFFFD600E7E7C600CEC6B500FFFFD600FFF7CE00FFDE + A500F7C68C00EFB57B00FFE7C600FFFFE7007B736300E7BDBD00B5A5A500A59C + 9C00000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000073AD002994C60052CEEF0042DE + FF0021D6FF0018CEFF0029D6FF0042DEFF0052DEFF006BE7FF0084EFFF009CEF + FF009CEFFF0063C6E700188CB500000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000BD948400F7F7F700FFFFFF00424242004242 + 4200424242004242390042424A001842D600738CEF0084848400F7DEC600F7DE + BD00F7DEBD00F7D6B500F7D6AD00F7D6AD00EFCEA500B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000CEB5AD00FFFFF700FFEFE700F7E7D600F7E7D600F7E7CE00F7DE + C600F7DEBD00F7D6B500F7D6AD00EFCE9C00EFCE9C00B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000730800109C180018A5290029BD420031C6520042CE630029A5420029A5 + 4200188C2900398C3900E7EFC6008C847B0063636B0073736B009C9C8C00948C + 7B009C846B00EFB57B00D6BDB500ADBDF700847B7300E7BDBD00BDADAD00A59C + 9C00000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000087BAD001884B50063BDDE008CE7FF0073E7FF0052DE + FF0039DEFF0021D6FF0018D6FF0029D6FF0042DEFF005AE7FF006BE7FF0084EF + FF009CEFFF009CF7FF007BE7F70031A5CE00087BAD0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000C6948400F7F7F700FFFFFF00F7F7F700F7EF + EF00F7EFE700F7EFE700F7E7DE00DED6D600426BF7004A6BEF009CA5DE00F7DE + C600F7DEBD00F7DEBD00F7D6B500F7D6AD00EFCEA500B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000D6B5AD00FFFFFF00FFF7EF00FFEFE700F7E7D600F7E7CE00F7E7 + C600F7DEC600F7DEBD00F7D6AD00F7D6A500F7D6A500B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000007308004A8C52002184290018AD310029BD420031C65200298C2900B5D6 + B500BDD6AD00B5D69C00DEEFBD008C8C8400737373002121290052524A005252 + 4A00635A4A00EFBD8400BDADB500738CEF00847B7300E7BDBD00BDADAD00A59C + 9C00000000000000000000000000000000000000000000000000000000000000 + 000000000000087BAD0042A5C600ADE7F700CEFFFF00ADF7FF008CE7FF006BE7 + FF0052DEFF0039DEFF0021D6FF0018D6FF0029D6FF0042DEFF005AE7FF0073E7 + FF008CE7FF009CEFFF0094EFFF0084EFFF0052C6E700087BAD00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000C69C8400F7F7F700FFFFFF00FFFFFF00FFFF + FF00FFF7F700FFF7EF00F7EFE700F7EFE700F7E7DE0094A5EF00637BEF00F7E7 + CE00F7DEC600F7DEBD00F7DEBD00F7D6B500F7D6AD00B58C7B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD008C6B5200DEAD + 8C0000000000D6BDB500FFFFFF00FFF7F700FFF7EF00FFEFDE00F7E7D600F7E7 + CE00F7E7C600F7DEC600F7DEBD00F7D6B500F7D6AD00B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00009C9C9C00ADADAD0073AD7300109C180021B5390021B5390042944200FFFF + FF00FFFFFF00FFFFE700FFFFD600E7E7C600ADAD9400424242006B6B6300FFF7 + CE00FFDEAD00EFBD8400F7DEB500FFF7DE00847B6B00E7C6C600B5A5A500A59C + 9C00000000000000000000000000000000000000000000000000000000000000 + 0000107BAD008CCEE700DEFFFF00DEFFFF00D6FFFF00CEFFFF00B5F7FF009CEF + FF0084EFFF0063E7FF0039DEFF0018D6FF0018D6FF0031DEFF004ADEFF0063E7 + FF0073E7FF0094EFFF009CEFFF008CEFFF0084EFFF0063E7FF00087BAD000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000C69C8400F7F7F700FFFFFF00848484008484 + 840084848400848484008484840084848400F7EFE700F7EFDE00F7E7D600F7E7 + CE00F7E7CE00F7DEC600F7DEBD00F7DEBD00DEC6A5009C847B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000D6BDB500FFFFFF00FFFFFF00FFF7F700FFF7EF00FFEFE700F7E7 + D600F7E7CE00F7DEC600F7DEBD00F7DEB500F7DEB500B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00009C9C9C009C9C9C00B5D6B500088C100010AD210018AD3100298C3100F7FF + F700FFFFFF00FFFFFF00FFFFE700FFFFDE00FFFFDE00D6D6BD00424242006B6B + 6300F7DEB500F7CE9C00FFEFD600D6D6BD008C7B7B00EFC6C600A59C9C00A59C + 9C00000000000000000000000000000000000000000000000000000000000000 + 000000000000087BAD00087BAD00087BAD00087BAD00087BAD00087BAD00087B + AD00087BAD0073BDDE0073E7FF0029D6FF0018D6FF0018D6FF0021ADD600087B + AD00087BAD00087BAD00087BAD00087BAD00087BAD00087BAD00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000CE9C8C00FFF7F700FFFFFF00080808008C8C + 8C00ADB5B500848CAD005A637B0042424200F7EFE700F7EFE700F7EFDE00F7E7 + D600F7E7CE00F7E7CE00EFD6BD00CEBDAD00B5AD94009C847B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000DEBDB500FFFFFF00FFFFFF00FFFFFF00FFF7F700FFEFE700FFEF + DE00F7E7D600F7E7CE00F7DEC600F7DEC600F7D6B500B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000094949400D6D6D600298C2900109C180010AD2100108C1800ADCE + AD00FFFFFF00FFFFFF00FFFFFF00FFFFF700FFFFDE00FFFFDE00E7E7C6004A4A + 4200524A4200E7CEAD00FFFFE700A5A58C00B59C9C00E7C6C600A59C9C000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000087BAD008CE7FF004ADEFF0031DEFF0018CEFF000884B5000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000CEA58C00FFF7F700FFFFFF0018181800EFEF + EF00CED6F700295AFF00526BBD005A5A5A00F7F7EF00F7EFE700F7EFE700F7EF + DE00F7EFDE00E7DECE00CEBDAD00BDB5A500B5AD9C009C847B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD008C6B5200DEAD + 8C0000000000DEC6B500FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFF7F700FFEF + E700FFEFDE00FFEFDE00FFEFD600E7DEC600C6BDAD00B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000094949400B5ADAD0084B58400088C100010AD2100109C1800298C + 3100E7EFDE00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFEF00FFFFEF00E7E7 + C60052525200BDBDB500E7E7C6008C848400EFC6C600B5A5A500A59C9C000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000087BAD009CE7FF0063E7FF004ADEFF0029CEF700087BAD000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000D6A58C00FFF7F700FFFFFF00292929007B94 + DE003163FF00849CFF001039E7004A4A5200FFF7F700FFF7EF00FFF7E700EFDE + D600B5847300AD847300AD7B7300AD7B7300AD7B7300AD847300000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000E7C6B500FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFF7 + EF00FFF7EF00F7E7D600C6A59400B5948C00B58C8400B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000094949400CECECE0042944A000894180010AD2100109C + 1800218C29007BB57B00CEE7CE00F7FFF700FFFFFF00FFFFFF00FFFFFF00FFFF + EF00FFF7DE00E7EFC60094948C00CEB5B500DEC6C600948C8C00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000087BAD009CDEF70084EFFF0063E7FF0039C6E700087BAD000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000DEAD8C00FFF7F700FFFFFF00181818009CA5 + C600CED6EF00FFFFFF004A6BE700314AC600FFFFF700FFF7F700FFF7EF00E7CE + C600B5847300E7B58400E7AD6B00EFA55200EFA53900B5848400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000E7C6B500FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFF700E7CECE00BD8C7300EFB57300EFA54A00C6846B00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000949494009C9C9C00D6DED600398C4200088C1000109C + 180008A51800089418000884100018842100218431004A9C4A00FFFFFF00FFFF + EF00E7E7C600A59C9400C6ADAD00E7C6C600A59C9C0094949400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000087BAD009CD6E7009CEFFF007BEFFF0039B5DE00087BAD000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000DEAD8C00FFF7F700FFFFFF00292929004242 + 42004242420042424200313952001039E7009CB5FF00FFFFFF00FFFFF700E7CE + C600B5847300EFC68C00F7BD6B00FFB55200B584840000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD008C6B5200DEAD + 8C0000000000EFCEBD00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00E7D6CE00C6947B00FFC67300CE94730000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000094949400A5A5A500D6DED6007BAD8400398C + 390018842100108C1800188C2900298C31004294520094BD8C00E7EFDE00C6C6 + B500A59C9C00CEBDBD00E7C6C600AD9C9C009494940000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000087BAD00087BAD00C6F7FF0094EFFF00087BAD00087BAD000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000DEAD8C00FFF7F700FFFFFF00EFEFEF00EFEF + EF00EFEFEF00EFEFEF00EFEFEF00CED6EF003163FF006B8CFF00C6CEFF00E7D6 + CE00B5847300EFC68C00F7BD6B00B58484000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFDED600F7CEBD00F7CEBD00DEAD + 8C0000000000E7C6B500FFF7F700FFF7EF00FFF7EF00FFF7EF00FFF7EF00FFF7 + EF00FFF7EF00E7CECE00C6947B00CE9C84000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000949494009C9C9C00CECECE00E7E7 + E700CECECE00BDBDB500BDB5AD00CEBDAD00CEBDAD00BDB5AD00B5ADAD00C6B5 + B500DEC6C600D6BDBD00A59C9C00949494000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000087BAD00DEFFFF00ADF7FF00087BAD00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000DEAD8C00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00EFEFFF006B8CFF00426BFF00E7D6 + D600B5847300EFC68C00B5848400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000E7C6AD00E7C6AD00E7C6AD00DEAD + 8C0000000000E7C6B500EFCEB500EFCEB500EFCEB500EFCEB500E7C6B500E7C6 + B500EFCEB500D6BDB500BD847B00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000009494940094949400A5A5 + A500C6C6C600D6D6D600CECECE00C6C6C600C6C6C600C6C6C600CEC6C600C6BD + BD00A5A5A5009494940094949400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000087BAD00F7FFFF00C6F7FF00087BAD00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000DEAD8C00E7CEBD00EFD6BD00EFD6BD00EFCE + C600E7CEBD00E7CEBD00E7CEBD00E7CEBD00DEC6BD00DEC6BD00DEC6BD00CEAD + A500B5847300B584840000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000009494 + 940094949400949494009C9C9C00A5A5A500A5A5A500A59C9C00949494009494 + 9400949494000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000087BAD009CCEE70073BDDE00087BAD00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000DEA58400D6A58400D6A58400D6A58400D6A5 + 8400D69C7B00CE9C7B00CE947B00C6947B00C6947B00C68C7B00BD8C7300B584 + 7300B58484000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000948C8C00948C8C00948C8C00948C8C00948C8C00948C8C000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000087BAD00087BAD0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000080000000400000000100010000000000000400000000000000000000 + 000000000000000000000000FFFFFF00FFFFFFFF000000000000000000000000 + FFFFFFFF000000000000000000000000FFFFFFFF000000000000000000000000 + FFFFFFFF000000000000000000000000FFFFFFFF000000000000000000000000 + F800001F000000000000000000000000F800001F000000000000000000000000 + F800001F000000000000000000000000F800001F000000000000000000000000 + F800001F000000000000000000000000FFFFFFFF000000000000000000000000 + FE0003FF000000000000000000000000FE0007FF000000000000000000000000 + FE000FFF000000000000000000000000FE001FFF000000000000000000000000 + FE103FFF000000000000000000000000FE001FFF000000000000000000000000 + FE000FFF000000000000000000000000FE0007FF000000000000000000000000 + FE0303FF000000000000000000000000FE0781FF000000000000000000000000 + FE0FC0FF000000000000000000000000FE1FE07F000000000000000000000000 + FE3FF03F000000000000000000000000FE7FF81F000000000000000000000000 + FEFFFC3F000000000000000000000000FFFFFE7F000000000000000000000000 + FFFFFFFF000000000000000000000000FFFFFFFF000000000000000000000000 + FFFFFFFF000000000000000000000000FFFFFFFF000000000000000000000000 + FFFFFFFF000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE00003FFFFFFFFFFFF81FFFFF9FF9FF + FE00003FFFF0003FFFE007FFFF0FF0FFFE00003FFFF0003FFF8001FFFF07E0FF + FE00003FFFF0003FFF0000FFFF03C0FFFE00003FFFF0003FFE00007FFF8181FF + FE00003FFF0FFFFFFC00003FFF8001FFFE00003FFF08003FFC00003FFFC003FF + FE00003FFF08003FF800001FFFC003FFFE00003FFF08003FF800001FFFE007FF + FE00003FFF08003FF000000FFF8003FFFE00003FFF08003FF000000FFF0001FF + FE00003FFF08003FF000000FFC00007FFE00003FFF08003FF000000FF800003F + FE00003FFF08003FF000000FF000001FFE00003FFF08003FF000000FF800003F + FE00003FFF08003FF800001FFFF81FFFFE00003FFF08003FF800001FFFF81FFF + FE00003FFF08003FFC00003FFFF81FFFFE00003FFF08003FFC00003FFFF81FFF + FE00007FFF08007FFE00007FFFF81FFFFE0000FFFF0800FFFF0000FFFFFC3FFF + FE0001FFFF0801FFFF8001FFFFFC3FFFFE0003FFFFFFFFFFFFE007FFFFFC3FFF + FE0007FFFFFFFFFFFFF81FFFFFFE7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 + 000000000000} + end +end diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit2.pas b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit2.pas new file mode 100644 index 0000000..cabfa6a --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/Unit2.pas @@ -0,0 +1,78 @@ +unit Unit2; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ImgList, ExtCtrls, + { gettext } + gnugettext, + { TB2K } + TB2Item, TB2Dock, TB2Toolbar, SpTBXItem, SpTBXControls, SpTBXDkPanels; + +type + TForm2 = class(TForm) + SpTBXDock1: TSpTBXDock; + SpTBXToolbar1: TSpTBXToolbar; + SpTBXButton1: TSpTBXButton; + SpTBXButton2: TSpTBXButton; + SpTBXButton3: TSpTBXButton; + ImageList1: TImageList; + tProperties: TSpTBXItem; + tPageSetup: TSpTBXItem; + tHistory: TSpTBXItem; + tFavorites: TSpTBXItem; + tCustomize: TSpTBXItem; + ClientPanel: TPanel; + LeftPanel: TPanel; + ButtonsPanel: TPanel; + TitlePanel: TSpTBXLabel; + procedure SideBarClick(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure ButtonClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +uses + Unit1; + +{$R *.dfm} + +procedure TForm2.ButtonClick(Sender: TObject); +begin + Close; +end; + +procedure TForm2.SideBarClick(Sender: TObject); +var + Item: TSpTBXItem; +begin + if Sender is TSpTBXItem then begin + Item := Sender as TSpTBXItem; + Item.Checked := True; + TitlePanel.Caption := Item.Caption; + ClientPanel.Visible := Item = tCustomize; + end; +end; + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin + // We need to close the customizer form manually here + Form1.SpTBXCustomizer1.Close; +end; + +procedure TForm2.FormCreate(Sender: TObject); +begin + gnugettext.TranslateComponent(Self); +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/advanced.txt b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/advanced.txt new file mode 100644 index 0000000..bed4456 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/advanced.txt @@ -0,0 +1,55 @@ + +Advanced Techniques: + +1) How can I embed the customizer? + +You can embed the customizer to another control, but the form of this control cannot be modal or the drag & drop will not work. +You also need to close the customizer explicitly by calling the Close method. + +SpTBXCustomizer1.ShowEmbedded(Panel1); + +2) How can I store more options related to the items customizations? + +To load and store your custom data use the OnLoad and OnSave events: + +procedure TForm1.SpTBXCustomizer1Save(Sender: TObject; + LayoutName: String; ExtraOptions: TStringList); +begin + // Save the Form's font size + ExtraOptions.Values['FontSize'] := IntToStr(Font.Size); +end; + +procedure TForm1.SpTBXCustomizer1Load(Sender: +TObject; LayoutName: String; ExtraOptions: TStringList); +var + S: string; +begin + // Restore the Form's font size + S := ExtraOptions.Values['FontSize']; + if S <> '' then + Font.Size := StrToInt(S); +end; + +3) How can I store more options related to a specific layout? + +The layout is just the position and visibility of the toolbars and dockable panels, but you can store more options related to a layout. +To load and store your custom data use the OnLayoutLoad and OnLayoutSave events: + +procedure TForm1.SpTBXCustomizer1LayoutSave(Sender: +TObject; + LayoutName: String; ExtraOptions: TStringList); +begin + // Save the Form's WindowState + ExtraOptions.Values['MyOption'] := IntToStr(Ord(WindowState)); +end; + +procedure TForm1.SpTBXCustomizer1LayoutLoad(Sender: +TObject; LayoutName: String; ExtraOptions: TStringList); +var + S: string; +begin + // Restore the Form's WindowState + S := ExtraOptions.Values['MyOption']; + if S <> '' then + WindowState := TWindowState(StrToInt(S)); +end; \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/faq.txt b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/faq.txt new file mode 100644 index 0000000..d6adc52 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/faq.txt @@ -0,0 +1,33 @@ + +TSpTBXCustomizer FAQ: + +1) What is it? + +TSpTBXCustomizer is a SpTBXLib toolbar customization component. +It allows you to save the toolbars and dockable panels layout and customize the toolbars items. + +2) How do I start using it? + +Double click the TSpTBXCustomizer or use the Items property to add your custom commands. +Use the ImageList property to hook the images to the commands, and the Menubar property to fill the shortcuts list. +To show the customizer at runtime use the Show method. + +3) How do I load and save the items customizations? + +You can load and save to the Registry or to an Ini file, call the Load method from the Form.OnShow event, and the Save method from the Form.OnDestroy event: + +SpTBXCustomizer1.Load('C:\Options.ini'); + +SpTBXCustomizer1.Save('C:\Options.ini'); + +SpTBXCustomizer1.Load(HKEY_CURRENT_USER, +'Software\Silverpointdev\CustomizerDemo'); + +SpTBXCustomizer1.Save(HKEY_CURRENT_USER, +'Software\Silverpointdev\CustomizerDemo'); + +4) How do I load a specific layout? + +Once the toolbar layouts are loaded you can access the available layouts through the Layouts property. +To load a specific layout use the LoadLayout method. +To save the current layout use the SaveLayout method. \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/gnugettext.pas b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/gnugettext.pas new file mode 100644 index 0000000..2a86dbc --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/gnugettext.pas @@ -0,0 +1,3067 @@ +{*------------------------------------------------------------------------------ + GNU gettext translation system for Delphi, Kylix, C++ Builder and others. + All parts of the translation system are kept in this unit. + + @author Lars B. Dybdahl and others + @version $LastChangedRevision$ + @see http://dybdahl.dk/dxgettext/ +-------------------------------------------------------------------------------} +unit gnugettext; +(**************************************************************) +(* *) +(* (C) Copyright by Lars B. Dybdahl and others *) +(* E-mail: Lars@dybdahl.dk, phone +45 70201241 *) +(* *) +(* Contributors: Peter Thornqvist, Troy Wolbrink, *) +(* Frank Andreas de Groot, Igor Siticov, *) +(* Jacques Garcia Vazquez, Igor Gitman *) +(* *) +(* See http://dybdahl.dk/dxgettext/ for more information *) +(* *) +(**************************************************************) + +// Information about this file: +// $LastChangedDate$ +// $LastChangedRevision$ +// $HeadURL$ + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// The names of any contributor may not be used to endorse or promote +// products derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +interface + +// If the conditional define DXGETTEXTDEBUG is defined, debugging log is activated. +// Use DefaultInstance.DebugLogToFile() to write the log to a file. +{ $define DXGETTEXTDEBUG} + +{$ifdef VER100} + // Delphi 3 + {$DEFINE DELPHI5OROLDER} + {$DEFINE DELPHI6OROLDER} + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER110} + // C++ Builder 3 + {$DEFINE DELPHI5OROLDER} + {$DEFINE DELPHI6OROLDER} + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER120} + // Delphi 4 + {$DEFINE DELPHI5OROLDER} + {$DEFINE DELPHI6OROLDER} + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER125} + // C++ Builder 4 + {$DEFINE DELPHI5OROLDER} + {$DEFINE DELPHI6OROLDER} + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER130} + // Delphi 5 + {$DEFINE DELPHI5OROLDER} + {$DEFINE DELPHI6OROLDER} + {$DEFINE DELPHI2007OROLDER} + {$ifdef WIN32} + {$DEFINE MSWINDOWS} + {$endif} +{$endif} +{$ifdef VER135} + // C++ Builder 5 + {$DEFINE DELPHI5OROLDER} + {$DEFINE DELPHI6OROLDER} + {$DEFINE DELPHI2007OROLDER} + {$ifdef WIN32} + {$DEFINE MSWINDOWS} + {$endif} +{$endif} +{$ifdef VER140} + // Delphi 6 + {$DEFINE DELPHI2007OROLDER} +{$ifdef MSWINDOWS} + {$DEFINE DELPHI6OROLDER} +{$endif} +{$endif} +{$ifdef VER150} + // Delphi 7 + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER160} + // Delphi 8 + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER170} + // Delphi 2005 + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER180} + // Delphi 2006 + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER190} + // Delphi 2007 + {$DEFINE DELPHI2007OROLDER} +{$endif} +{$ifdef VER200} + // Delphi 2009 with Unicode +{$endif} + +uses +{$ifdef DELPHI5OROLDER} + gnugettextD5, +{$endif} +{$ifdef MSWINDOWS} + Windows, +{$else} + Libc, +{$ifdef FPC} + CWString, +{$endif} +{$endif} + Classes, StrUtils, SysUtils, TypInfo; + +(*****************************************************************************) +(* *) +(* MAIN API *) +(* *) +(*****************************************************************************) + +type + {$IFNDEF UNICODE} + UnicodeString=WideString; + RawUtf8String=AnsiString; + {$ELSE} + RawUtf8String=RawByteString; + {$ENDIF} + DomainString=string; + LanguageString=string; + ComponentNameString=string; + FilenameString=string; + MsgIdString=UnicodeString; + TranslatedUnicodeString=UnicodeString; + +// Main GNU gettext functions. See documentation for instructions on how to use them. +function _(const szMsgId: MsgIdString): TranslatedUnicodeString; +function gettext(const szMsgId: MsgIdString): TranslatedUnicodeString; +function dgettext(const szDomain: DomainString; const szMsgId: MsgIdString): TranslatedUnicodeString; +function dngettext(const szDomain: DomainString; const singular,plural: MsgIdString; Number:longint): TranslatedUnicodeString; +function ngettext(const singular,plural: MsgIdString; Number:longint): TranslatedUnicodeString; +procedure textdomain(const szDomain: DomainString); +function getcurrenttextdomain: DomainString; +procedure bindtextdomain(const szDomain: DomainString; const szDirectory: FilenameString); + +// Set language to use +procedure UseLanguage(LanguageCode: LanguageString); +function GetCurrentLanguage:LanguageString; + +// Translates a component (form, frame etc.) to the currently selected language. +// Put TranslateComponent(self) in the OnCreate event of all your forms. +// See the manual for documentation on these functions +type + TTranslator=procedure (obj:TObject) of object; + +procedure TP_Ignore(AnObject:TObject; const name:ComponentNameString); +procedure TP_IgnoreClass (IgnClass:TClass); +procedure TP_IgnoreClassProperty (IgnClass:TClass;const propertyname:ComponentNameString); +procedure TP_GlobalIgnoreClass (IgnClass:TClass); +procedure TP_GlobalIgnoreClassProperty (IgnClass:TClass;const propertyname:ComponentNameString); +procedure TP_GlobalHandleClass (HClass:TClass;Handler:TTranslator); +procedure TranslateComponent(AnObject: TComponent; const TextDomain:DomainString=''); +procedure RetranslateComponent(AnObject: TComponent; const TextDomain:DomainString=''); + +// Add more domains that resourcestrings can be extracted from. If a translation +// is not found in the default domain, this domain will be searched, too. +// This is useful for adding mo files for certain runtime libraries and 3rd +// party component libraries +procedure AddDomainForResourceString (const domain:DomainString); +procedure RemoveDomainForResourceString (const domain:DomainString); + +// Unicode-enabled way to get resourcestrings, automatically translated +// Use like this: ws:=LoadResStringW(@NameOfResourceString); +function LoadResString(ResStringRec: PResStringRec): widestring; +function LoadResStringW(ResStringRec: PResStringRec): UnicodeString; + +// This returns an empty string if not translated or translator name is not specified. +function GetTranslatorNameAndEmail:TranslatedUnicodeString; + + +(*****************************************************************************) +(* *) +(* ADVANCED FUNCTIONALITY *) +(* *) +(*****************************************************************************) + +const + DefaultTextDomain = 'default'; + +var + ExecutableFilename:FilenameString; // This is set to paramstr(0) or the name of the DLL you are creating. + +const + PreferExternal=false; // Set to true, to prefer external *.mo over embedded translation + +const + // Subversion source code version control version information + VCSVersion='$LastChangedRevision$'; + +type + EGnuGettext=class(Exception); + EGGProgrammingError=class(EGnuGettext); + EGGComponentError=class(EGnuGettext); + EGGIOError=class(EGnuGettext); + EGGAnsi2WideConvError=class(EGnuGettext); + +// This function will turn resourcestring hooks on or off, eventually with BPL file support. +// Please do not activate BPL file support when the package is in design mode. +const AutoCreateHooks=true; +procedure HookIntoResourceStrings (enabled:boolean=true; SupportPackages:boolean=false); + + + + +(*****************************************************************************) +(* *) +(* CLASS based implementation. *) +(* Use TGnuGettextInstance to have more than one language *) +(* in your application at the same time *) +(* *) +(*****************************************************************************) + +{$ifdef MSWINDOWS} +{$ifndef DELPHI6OROLDER} +{$WARN UNSAFE_TYPE OFF} +{$WARN UNSAFE_CODE OFF} +{$WARN UNSAFE_CAST OFF} +{$endif} +{$endif} + +type + TOnDebugLine = Procedure (Sender: TObject; const Line: String; var Discard: Boolean) of Object; // Set Discard to false if output should still go to ordinary debug log + TGetPluralForm=function (Number:Longint):Integer; + TDebugLogger=procedure (line: ansistring) of object; + +{*------------------------------------------------------------------------------ + Handles .mo files, in separate files or inside the exe file. + Don't use this class. It's for internal use. +-------------------------------------------------------------------------------} + TMoFile= + class /// Threadsafe. Only constructor and destructor are writing to memory + private + doswap: boolean; + public + Users:Integer; /// Reference count. If it reaches zero, this object should be destroyed. + constructor Create (filename:FilenameString;Offset,Size:int64); + destructor Destroy; override; + function gettext(const msgid: RawUtf8String;var found:boolean): RawUtf8String; // uses mo file and utf-8 + property isSwappedArchitecture:boolean read doswap; + private + N, O, T: Cardinal; /// Values defined at http://www.linuxselfhelp.com/gnu/gettext/html_chapter/gettext_6.html + startindex,startstep:integer; + {$ifdef mswindows} + mo: THandle; + momapping: THandle; + {$endif} + momemoryHandle:PAnsiChar; + momemory: PAnsiChar; + function autoswap32(i: cardinal): cardinal; + function CardinalInMem(baseptr: PAnsiChar; Offset: Cardinal): Cardinal; + end; + +{*------------------------------------------------------------------------------ + Handles all issues regarding a specific domain. + Don't use this class. It's for internal use. +-------------------------------------------------------------------------------} + TDomain= + class + private + Enabled:boolean; + vDirectory: FilenameString; + procedure setDirectory(const dir: FilenameString); + public + DebugLogger:TDebugLogger; + Domain: DomainString; + property Directory: FilenameString read vDirectory write setDirectory; + constructor Create; + destructor Destroy; override; + // Set parameters + procedure SetLanguageCode (const langcode:LanguageString); + procedure SetFilename (const filename:FilenameString); // Bind this domain to a specific file + // Get information + procedure GetListOfLanguages(list:TStrings); + function GetTranslationProperty(Propertyname: ComponentNameString): TranslatedUnicodeString; + function gettext(const msgid: RawUtf8String): RawUtf8String; // uses mo file and utf-8 + private + mofile:TMoFile; + SpecificFilename:FilenameString; + curlang: LanguageString; + OpenHasFailedBefore: boolean; + procedure OpenMoFile; + procedure CloseMoFile; + end; + +{*------------------------------------------------------------------------------ + Helper class for invoking events. +-------------------------------------------------------------------------------} + TExecutable= + class + procedure Execute; virtual; abstract; + end; + +{*------------------------------------------------------------------------------ + The main translation engine. +-------------------------------------------------------------------------------} + TGnuGettextInstance= + class + private + fOnDebugLine:TOnDebugLine; + CreatorThread:Cardinal; /// Only this thread can use LoadResString + public + Enabled:Boolean; /// Set this to false to disable translations + DesignTimeCodePage:Integer; /// See MultiByteToWideChar() in Win32 API for documentation + constructor Create; + destructor Destroy; override; + procedure UseLanguage(LanguageCode: LanguageString); + procedure GetListOfLanguages (const domain:DomainString; list:TStrings); // Puts list of language codes, for which there are translations in the specified domain, into list + {$ifdef DELPHI5OROLDER} + function gettext(const szMsgId: MsgIdString): TranslatedUnicodeString; virtual; + function ngettext(const singular,plural:MsgIdString;Number:longint):TranslatedUnicodeString; virtual; + {$endif} + {$ifndef DELPHI5OROLDER} + {$ifndef UNICODE} + function gettext(const szMsgId: ansistring): TranslatedUnicodeString; overload; virtual; + function ngettext(const singular,plural:ansistring;Number:longint):TranslatedUnicodeString; overload; virtual; + {$endif} + function gettext(const szMsgId: MsgIdString): TranslatedUnicodeString; overload; virtual; + function ngettext(const singular,plural:MsgIdString;Number:longint):TranslatedUnicodeString; overload; virtual; + {$endif} + function GetCurrentLanguage:LanguageString; + function GetTranslationProperty (const Propertyname:ComponentNameString):TranslatedUnicodeString; + function GetTranslatorNameAndEmail:TranslatedUnicodeString; + + // Form translation tools, these are not threadsafe. All TP_ procs must be called just before TranslateProperites() + procedure TP_Ignore(AnObject:TObject; const name:ComponentNameString); + procedure TP_IgnoreClass (IgnClass:TClass); + procedure TP_IgnoreClassProperty (IgnClass:TClass;propertyname:ComponentNameString); + procedure TP_GlobalIgnoreClass (IgnClass:TClass); + procedure TP_GlobalIgnoreClassProperty (IgnClass:TClass;propertyname:ComponentNameString); + procedure TP_GlobalHandleClass (HClass:TClass;Handler:TTranslator); + procedure TranslateProperties(AnObject: TObject; textdomain:DomainString=''); + procedure TranslateComponent(AnObject: TComponent; const TextDomain:DomainString=''); + procedure RetranslateComponent(AnObject: TComponent; const TextDomain:DomainString=''); + + // Multi-domain functions + {$ifdef DELPHI5OROLDER} + function dgettext(const szDomain: DomainString; const szMsgId: MsgIdString): TranslatedUnicodeString; virtual; + function dngettext(const szDomain: DomainString; const singular,plural:MsgIdString;Number:longint):TranslatedUnicodeString; virtual; + {$endif} + {$ifndef DELPHI5OROLDER} + {$ifndef UNICODE} + function dgettext(const szDomain: DomainString; const szMsgId: ansistring): TranslatedUnicodeString; overload; virtual; + function dngettext(const szDomain: DomainString; const singular,plural:ansistring;Number:longint):TranslatedUnicodeString; overload; virtual; + {$endif} + function dgettext(const szDomain: DomainString; const szMsgId: MsgIdString): TranslatedUnicodeString; overload; virtual; + function dngettext(const szDomain: DomainString; const singular,plural:MsgIdString;Number:longint):TranslatedUnicodeString; overload; virtual; + {$endif} + procedure textdomain(const szDomain: DomainString); + function getcurrenttextdomain: DomainString; + procedure bindtextdomain(const szDomain: DomainString; const szDirectory: FilenameString); + procedure bindtextdomainToFile (const szDomain: DomainString; const filename: FilenameString); // Also works with files embedded in exe file + + // Windows API functions + function LoadResString(ResStringRec: PResStringRec): UnicodeString; + + // Output all log info to this file. This may only be called once. + procedure DebugLogToFile (const filename:FilenameString; append:boolean=false); + procedure DebugLogPause (PauseEnabled:boolean); + property OnDebugLine: TOnDebugLine read fOnDebugLine write fOnDebugLine; // If set, all debug output goes here + {$ifndef UNICODE} + // Conversion according to design-time character set + function ansi2wideDTCP (const s:AnsiString):MsgIdString; // Convert using Design Time Code Page + {$endif} + protected + procedure TranslateStrings (sl:TStrings;const TextDomain:DomainString); + + // Override these three, if you want to inherited from this class + // to create a new class that handles other domain and language dependent + // issues + procedure WhenNewLanguage (const LanguageID:LanguageString); virtual; // Override to know when language changes + procedure WhenNewDomain (const TextDomain:DomainString); virtual; // Override to know when text domain changes. Directory is purely informational + procedure WhenNewDomainDirectory (const TextDomain:DomainString;const Directory:FilenameString); virtual; // Override to know when any text domain's directory changes. It won't be called if a domain is fixed to a specific file. + private + curlang: LanguageString; + curGetPluralForm:TGetPluralForm; + curmsgdomain: DomainString; + savefileCS: TMultiReadExclusiveWriteSynchronizer; + savefile: TextFile; + savememory: TStringList; + DefaultDomainDirectory:FilenameString; + domainlist: TStringList; /// List of domain names. Objects are TDomain. + TP_IgnoreList:TStringList; /// Temporary list, reset each time TranslateProperties is called + TP_ClassHandling:TList; /// Items are TClassMode. If a is derived from b, a comes first + TP_GlobalClassHandling:TList; /// Items are TClassMode. If a is derived from b, a comes first + TP_Retranslator:TExecutable; /// Cast this to TTP_Retranslator + {$ifdef DXGETTEXTDEBUG} + DebugLogCS:TMultiReadExclusiveWriteSynchronizer; + DebugLog:TStream; + DebugLogOutputPaused:Boolean; + {$endif} + function TP_CreateRetranslator:TExecutable; // Must be freed by caller! + procedure FreeTP_ClassHandlingItems; + {$ifdef DXGETTEXTDEBUG} + procedure DebugWriteln(line: ansistring); + {$endif} + procedure TranslateProperty(AnObject: TObject; PropInfo: PPropInfo; + TodoList: TStrings; const TextDomain:DomainString); + function Getdomain(const domain:DomainString; const DefaultDomainDirectory:FilenameString; const CurLang: LanguageString): TDomain; // Translates a single property of an object + end; + +const + LOCALE_SISO639LANGNAME = $59; // Used by Lazarus software development tool + LOCALE_SISO3166CTRYNAME = $5A; // Used by Lazarus software development tool + +var + DefaultInstance:TGnuGettextInstance; /// Default instance of the main API for singlethreaded applications. + +implementation + +{$ifndef MSWINDOWS} +{$ifndef LINUX} + 'This version of gnugettext.pas is only meant to be compiled with Kylix 3,' + 'Delphi 6, Delphi 7 and later versions. If you use other versions, please' + 'get the gnugettext.pas version from the Delphi 5 directory.' +{$endif} +{$endif} + +(**************************************************************************) +// Some comments on the implementation: +// This unit should be independent of other units where possible. +// It should have a small footprint in any way. +(**************************************************************************) +// TMultiReadExclusiveWriteSynchronizer is used instead of TCriticalSection +// because it makes this unit independent of the SyncObjs unit +(**************************************************************************) + +{$B-,R+,I+,Q+} +{$ifdef DELPHI5OROLDER} +uses + FileCtrl; +{$endif} + +type + TTP_RetranslatorItem= + class + obj:TObject; + Propname:ComponentNameString; + OldValue:TranslatedUnicodeString; + end; + TTP_Retranslator= + class (TExecutable) + TextDomain:DomainString; + Instance:TGnuGettextInstance; + constructor Create; + destructor Destroy; override; + procedure Remember (obj:TObject; PropName:ComponentNameString; OldValue:TranslatedUnicodeString); + procedure Execute; override; + private + list:TList; + end; + TEmbeddedFileInfo= + class + offset,size:int64; + end; + TFileLocator= + class // This class finds files even when embedded inside executable + constructor Create; + destructor Destroy; override; + procedure Analyze; // List files embedded inside executable + function FileExists (filename:FilenameString):boolean; + function GetMoFile (filename:FilenameString;DebugLogger:TDebugLogger):TMoFile; + procedure ReleaseMoFile (mofile:TMoFile); + private + basedirectory:FilenameString; + filelist:TStringList; //Objects are TEmbeddedFileInfo. Filenames are relative to .exe file + MoFilesCS:TMultiReadExclusiveWriteSynchronizer; + MoFiles:TStringList; // Objects are filenames+offset, objects are TMoFile + function ReadInt64 (str:TStream):int64; + end; + TGnuGettextComponentMarker= + class (TComponent) + public + LastLanguage:LanguageString; + Retranslator:TExecutable; + destructor Destroy; override; + end; + TClassMode= + class + HClass:TClass; + SpecialHandler:TTranslator; + PropertiesToIgnore:TStringList; // This is ignored if Handler is set + constructor Create; + destructor Destroy; override; + end; + TRStrinfo = record + strlength, stroffset: cardinal; + end; + TStrInfoArr = array[0..10000000] of TRStrinfo; + PStrInfoArr = ^TStrInfoArr; + TCharArray5=array[0..4] of ansichar; + THook= // Replaces a runtime library procedure with a custom procedure + class + public + constructor Create (OldProcedure, NewProcedure: pointer; FollowJump:boolean=false); + destructor Destroy; override; // Restores unhooked state + procedure Reset (FollowJump:boolean=false); // Disables and picks up patch points again + procedure Disable; + procedure Enable; + private + oldproc,newproc:Pointer; + Patch:TCharArray5; + Original:TCharArray5; + PatchPosition:PAnsiChar; + procedure Shutdown; // Same as destroy, except that object is not destroyed + end; + +var + // System information + Win32PlatformIsUnicode:boolean=False; + + // Information about files embedded inside .exe file + FileLocator:TFileLocator; + + // Hooks into runtime library functions + ResourceStringDomainListCS:TMultiReadExclusiveWriteSynchronizer; + ResourceStringDomainList:TStringList; + HookLoadResString:THook; + HookLoadStr:THook; + HookFmtLoadStr:THook; + +function GGGetEnvironmentVariable(const Name:widestring):widestring; +var + Len: integer; + W : WideString; +begin + Result := ''; + SetLength(W,1); + Len := Windows.GetEnvironmentVariableW(PWideChar(Name), PWideChar(W), 1); + if Len > 0 then begin + SetLength(Result, Len - 1); + Windows.GetEnvironmentVariableW(PWideChar(Name), PWideChar(Result), Len); + end; +end; + +function StripCRRawMsgId (s:RawUtf8String):RawUtf8String; +var + i:integer; +begin + i:=1; + while i<=length(s) do begin + if s[i]=#13 then delete (s,i,1) else inc (i); + end; + Result:=s; +end; + +function EnsureLineBreakInTranslatedString (s:RawUtf8String):RawUtf8String; +{$ifdef MSWINDOWS} +var + i:integer; +{$endif} +begin + {$ifdef MSWINDOWS} + Assert (sLinebreak=ansistring(#13#10)); + i:=1; + while i<=length(s) do begin + if (s[i]=#10) and (MidStr(s,i-1,1)<>#13) then begin + insert (#13,s,i); + inc (i,2); + end else + inc (i); + end; + {$endif} + Result:=s; +end; + +function IsWriteProp(Info: PPropInfo): Boolean; +begin + Result := Assigned(Info) and (Info^.SetProc <> nil); +end; + +function ResourceStringGettext(MsgId: MsgIdString): TranslatedUnicodeString; +var + i:integer; +begin + if (MsgID='') or (ResourceStringDomainListCS=nil) then begin + // This only happens during very complicated program startups that fail, + // or when Msgid='' + Result:=MsgId; + exit; + end; + ResourceStringDomainListCS.BeginRead; + try + for i:=0 to ResourceStringDomainList.Count-1 do begin + Result:=dgettext(ResourceStringDomainList.Strings[i], MsgId); + if Result<>MsgId then + break; + end; + finally + ResourceStringDomainListCS.EndRead; + end; +end; + +function gettext(const szMsgId: MsgIdString): TranslatedUnicodeString; +begin + Result:=DefaultInstance.gettext(szMsgId); +end; + +{*------------------------------------------------------------------------------ + This is the main translation procedure used in programs. It takes a parameter, + looks it up in the translation dictionary, and returns the translation. + If no translation is found, the parameter is returned. + + @param szMsgId The text, that should be displayed if no translation is found. +-------------------------------------------------------------------------------} +function _(const szMsgId: MsgIdString): TranslatedUnicodeString; +begin + Result:=DefaultInstance.gettext(szMsgId); +end; + +{*------------------------------------------------------------------------------ + Translates a text, using a specified translation domain. + If no translation is found, the parameter is returned. + + @param szDomain Which translation domain that should be searched for a translation. + @param szMsgId The text, that should be displayed if no translation is found. +-------------------------------------------------------------------------------} +function dgettext(const szDomain: DomainString; const szMsgId: MsgIdString): TranslatedUnicodeString; +begin + Result:=DefaultInstance.dgettext(szDomain, szMsgId); +end; + +function dngettext(const szDomain: DomainString; const singular,plural: MsgIdString; Number:longint): TranslatedUnicodeString; +begin + Result:=DefaultInstance.dngettext(szDomain,singular,plural,Number); +end; + +function ngettext(const singular,plural: MsgIdString; Number:longint): TranslatedUnicodeString; +begin + Result:=DefaultInstance.ngettext(singular,plural,Number); +end; + +procedure textdomain(const szDomain: Domainstring); +begin + DefaultInstance.textdomain(szDomain); +end; + +procedure SetGettextEnabled (enabled:boolean); +begin + DefaultInstance.Enabled:=enabled; +end; + +function getcurrenttextdomain: DomainString; +begin + Result:=DefaultInstance.getcurrenttextdomain; +end; + +procedure bindtextdomain(const szDomain: DomainString; const szDirectory: FilenameString); +begin + DefaultInstance.bindtextdomain(szDomain, szDirectory); +end; + +procedure TP_Ignore(AnObject:TObject; const name:FilenameString); +begin + DefaultInstance.TP_Ignore(AnObject, name); +end; + +procedure TP_GlobalIgnoreClass (IgnClass:TClass); +begin + DefaultInstance.TP_GlobalIgnoreClass(IgnClass); +end; + +procedure TP_IgnoreClass (IgnClass:TClass); +begin + DefaultInstance.TP_IgnoreClass(IgnClass); +end; + +procedure TP_IgnoreClassProperty (IgnClass:TClass;const propertyname:ComponentNameString); +begin + DefaultInstance.TP_IgnoreClassProperty(IgnClass,propertyname); +end; + +procedure TP_GlobalIgnoreClassProperty (IgnClass:TClass;const propertyname:ComponentNameString); +begin + DefaultInstance.TP_GlobalIgnoreClassProperty(IgnClass,propertyname); +end; + +procedure TP_GlobalHandleClass (HClass:TClass;Handler:TTranslator); +begin + DefaultInstance.TP_GlobalHandleClass (HClass, Handler); +end; + +procedure TranslateComponent(AnObject: TComponent; const TextDomain:DomainString=''); +begin + DefaultInstance.TranslateComponent(AnObject, TextDomain); +end; + +procedure RetranslateComponent(AnObject: TComponent; const TextDomain:DomainString=''); +begin + DefaultInstance.RetranslateComponent(AnObject, TextDomain); +end; + +{$ifdef MSWINDOWS} + +// These constants are only used in Windows 95 +// Thanks to Frank Andreas de Groot for this table +const + IDAfrikaans = $0436; IDAlbanian = $041C; + IDArabicAlgeria = $1401; IDArabicBahrain = $3C01; + IDArabicEgypt = $0C01; IDArabicIraq = $0801; + IDArabicJordan = $2C01; IDArabicKuwait = $3401; + IDArabicLebanon = $3001; IDArabicLibya = $1001; + IDArabicMorocco = $1801; IDArabicOman = $2001; + IDArabicQatar = $4001; IDArabic = $0401; + IDArabicSyria = $2801; IDArabicTunisia = $1C01; + IDArabicUAE = $3801; IDArabicYemen = $2401; + IDArmenian = $042B; IDAssamese = $044D; + IDAzeriCyrillic = $082C; IDAzeriLatin = $042C; + IDBasque = $042D; IDByelorussian = $0423; + IDBengali = $0445; IDBulgarian = $0402; + IDBurmese = $0455; IDCatalan = $0403; + IDChineseHongKong = $0C04; IDChineseMacao = $1404; + IDSimplifiedChinese = $0804; IDChineseSingapore = $1004; + IDTraditionalChinese = $0404; IDCroatian = $041A; + IDCzech = $0405; IDDanish = $0406; + IDBelgianDutch = $0813; IDDutch = $0413; + IDEnglishAUS = $0C09; IDEnglishBelize = $2809; + IDEnglishCanadian = $1009; IDEnglishCaribbean = $2409; + IDEnglishIreland = $1809; IDEnglishJamaica = $2009; + IDEnglishNewZealand = $1409; IDEnglishPhilippines = $3409; + IDEnglishSouthAfrica = $1C09; IDEnglishTrinidad = $2C09; + IDEnglishUK = $0809; IDEnglishUS = $0409; + IDEnglishZimbabwe = $3009; IDEstonian = $0425; + IDFaeroese = $0438; IDFarsi = $0429; + IDFinnish = $040B; IDBelgianFrench = $080C; + IDFrenchCameroon = $2C0C; IDFrenchCanadian = $0C0C; + IDFrenchCotedIvoire = $300C; IDFrench = $040C; + IDFrenchLuxembourg = $140C; IDFrenchMali = $340C; + IDFrenchMonaco = $180C; IDFrenchReunion = $200C; + IDFrenchSenegal = $280C; IDSwissFrench = $100C; + IDFrenchWestIndies = $1C0C; IDFrenchZaire = $240C; + IDFrisianNetherlands = $0462; IDGaelicIreland = $083C; + IDGaelicScotland = $043C; IDGalician = $0456; + IDGeorgian = $0437; IDGermanAustria = $0C07; + IDGerman = $0407; IDGermanLiechtenstein = $1407; + IDGermanLuxembourg = $1007; IDSwissGerman = $0807; + IDGreek = $0408; IDGujarati = $0447; + IDHebrew = $040D; IDHindi = $0439; + IDHungarian = $040E; IDIcelandic = $040F; + IDIndonesian = $0421; IDItalian = $0410; + IDSwissItalian = $0810; IDJapanese = $0411; + IDKannada = $044B; IDKashmiri = $0460; + IDKazakh = $043F; IDKhmer = $0453; + IDKirghiz = $0440; IDKonkani = $0457; + IDKorean = $0412; IDLao = $0454; + IDLatvian = $0426; IDLithuanian = $0427; + IDMacedonian = $042F; IDMalaysian = $043E; + IDMalayBruneiDarussalam = $083E; IDMalayalam = $044C; + IDMaltese = $043A; IDManipuri = $0458; + IDMarathi = $044E; IDMongolian = $0450; + IDNepali = $0461; IDNorwegianBokmol = $0414; + IDNorwegianNynorsk = $0814; IDOriya = $0448; + IDPolish = $0415; IDBrazilianPortuguese = $0416; + IDPortuguese = $0816; IDPunjabi = $0446; + IDRhaetoRomanic = $0417; IDRomanianMoldova = $0818; + IDRomanian = $0418; IDRussianMoldova = $0819; + IDRussian = $0419; IDSamiLappish = $043B; + IDSanskrit = $044F; IDSerbianCyrillic = $0C1A; + IDSerbianLatin = $081A; IDSesotho = $0430; + IDSindhi = $0459; IDSlovak = $041B; + IDSlovenian = $0424; IDSorbian = $042E; + IDSpanishArgentina = $2C0A; IDSpanishBolivia = $400A; + IDSpanishChile = $340A; IDSpanishColombia = $240A; + IDSpanishCostaRica = $140A; IDSpanishDominicanRepublic = $1C0A; + IDSpanishEcuador = $300A; IDSpanishElSalvador = $440A; + IDSpanishGuatemala = $100A; IDSpanishHonduras = $480A; + IDMexicanSpanish = $080A; IDSpanishNicaragua = $4C0A; + IDSpanishPanama = $180A; IDSpanishParaguay = $3C0A; + IDSpanishPeru = $280A; IDSpanishPuertoRico = $500A; + IDSpanishModernSort = $0C0A; IDSpanish = $040A; + IDSpanishUruguay = $380A; IDSpanishVenezuela = $200A; + IDSutu = $0430; IDSwahili = $0441; + IDSwedishFinland = $081D; IDSwedish = $041D; + IDTajik = $0428; IDTamil = $0449; + IDTatar = $0444; IDTelugu = $044A; + IDThai = $041E; IDTibetan = $0451; + IDTsonga = $0431; IDTswana = $0432; + IDTurkish = $041F; IDTurkmen = $0442; + IDUkrainian = $0422; IDUrdu = $0420; + IDUzbekCyrillic = $0843; IDUzbekLatin = $0443; + IDVenda = $0433; IDVietnamese = $042A; + IDWelsh = $0452; IDXhosa = $0434; + IDZulu = $0435; + +function GetWindowsLanguage: WideString; +var + langid: Cardinal; + langcode: WideString; + CountryName: array[0..4] of widechar; + LanguageName: array[0..4] of widechar; + works: boolean; +begin + // The return value of GetLocaleInfo is compared with 3 = 2 characters and a zero + works := 3 = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, LanguageName, SizeOf(LanguageName)); + works := works and (3 = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, CountryName, SizeOf(CountryName))); + if works then begin + // Windows 98, Me, NT4, 2000, XP and newer + LangCode := PWideChar(@(LanguageName[0])); + if lowercase(LangCode)='no' then LangCode:='nb'; + LangCode:=LangCode + '_' + PWideChar(@CountryName[0]); + end else begin + // This part should only happen on Windows 95. + langid := GetThreadLocale; + case langid of + IDBelgianDutch: langcode := 'nl_BE'; + IDBelgianFrench: langcode := 'fr_BE'; + IDBrazilianPortuguese: langcode := 'pt_BR'; + IDDanish: langcode := 'da_DK'; + IDDutch: langcode := 'nl_NL'; + IDEnglishUK: langcode := 'en_GB'; + IDEnglishUS: langcode := 'en_US'; + IDFinnish: langcode := 'fi_FI'; + IDFrench: langcode := 'fr_FR'; + IDFrenchCanadian: langcode := 'fr_CA'; + IDGerman: langcode := 'de_DE'; + IDGermanLuxembourg: langcode := 'de_LU'; + IDGreek: langcode := 'el_GR'; + IDIcelandic: langcode := 'is_IS'; + IDItalian: langcode := 'it_IT'; + IDKorean: langcode := 'ko_KO'; + IDNorwegianBokmol: langcode := 'nb_NO'; + IDNorwegianNynorsk: langcode := 'nn_NO'; + IDPolish: langcode := 'pl_PL'; + IDPortuguese: langcode := 'pt_PT'; + IDRussian: langcode := 'ru_RU'; + IDSpanish, IDSpanishModernSort: langcode := 'es_ES'; + IDSwedish: langcode := 'sv_SE'; + IDSwedishFinland: langcode := 'sv_FI'; + else + langcode := 'C'; + end; + end; + Result := langcode; +end; +{$endif} + +{$ifndef UNICODE} +function LoadResStringA(ResStringRec: PResStringRec): ansistring; +begin + Result:=DefaultInstance.LoadResString(ResStringRec); +end; +{$endif} + +function GetTranslatorNameAndEmail:TranslatedUnicodeString; +begin + Result:=DefaultInstance.GetTranslatorNameAndEmail; +end; + +procedure UseLanguage(LanguageCode: LanguageString); +begin + DefaultInstance.UseLanguage(LanguageCode); +end; + +type + PStrData = ^TStrData; + TStrData = record + Ident: Integer; + Str: String; + end; + +function SysUtilsEnumStringModules(Instance: Longint; Data: Pointer): Boolean; +{$IFDEF MSWINDOWS} +var + Buffer: array [0..1023] of Char; // WideChar in Delphi 2008, AnsiChar before that +begin + with PStrData(Data)^ do begin + SetString(Str, Buffer, + LoadString(Instance, Ident, @Buffer[0], sizeof(Buffer))); + Result := Str = ''; + end; +end; +{$ENDIF} +{$IFDEF LINUX} +var + rs:TResStringRec; + Module:HModule; +begin + Module:=Instance; + rs.Module:=@Module; + with PStrData(Data)^ do begin + rs.Identifier:=Ident; + Str:=System.LoadResString(@rs); + Result:=Str=''; + end; +end; +{$ENDIF} + +function SysUtilsFindStringResource(Ident: Integer): string; +var + StrData: TStrData; +begin + StrData.Ident := Ident; + StrData.Str := ''; + EnumResourceModules(SysUtilsEnumStringModules, @StrData); + Result := StrData.Str; +end; + +function SysUtilsLoadStr(Ident: Integer): string; +begin + {$ifdef DXGETTEXTDEBUG} + DefaultInstance.DebugWriteln ('Sysutils.LoadRes('+IntToStr(ident)+') called'); + {$endif} + Result := ResourceStringGettext(SysUtilsFindStringResource(Ident)); +end; + +function SysUtilsFmtLoadStr(Ident: Integer; const Args: array of const): string; +begin + {$ifdef DXGETTEXTDEBUG} + DefaultInstance.DebugWriteln ('Sysutils.FmtLoadRes('+IntToStr(ident)+',Args) called'); + {$endif} + FmtStr(Result, ResourceStringGettext(SysUtilsFindStringResource(Ident)),Args); +end; + +function LoadResString(ResStringRec: PResStringRec): widestring; +begin + Result:=DefaultInstance.LoadResString(ResStringRec); +end; + +function LoadResStringW(ResStringRec: PResStringRec): UnicodeString; +begin + Result:=DefaultInstance.LoadResString(ResStringRec); +end; + + + +function GetCurrentLanguage:LanguageString; +begin + Result:=DefaultInstance.GetCurrentLanguage; +end; + +{ TDomain } + +procedure TDomain.CloseMoFile; +begin + if mofile<>nil then begin + FileLocator.ReleaseMoFile(mofile); + mofile:=nil; + end; + OpenHasFailedBefore:=False; +end; + +destructor TDomain.Destroy; +begin + CloseMoFile; + inherited; +end; + +{$ifdef mswindows} +function GetLastWinError:widestring; +var + errcode:Cardinal; +begin + SetLength (Result,2000); + errcode:=GetLastError(); + Windows.FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM,nil,errcode,0,PWideChar(Result),2000,nil); + Result:=PWideChar(Result); +end; +{$endif} + +procedure TDomain.OpenMoFile; +var + filename: FilenameString; +begin + // Check if it is already open + if mofile<>nil then + exit; + + // Check if it has been attempted to open the file before + if OpenHasFailedBefore then + exit; + + if SpecificFilename<>'' then begin + filename:=SpecificFilename; + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('Domain '+domain+' is bound to specific file '+filename); + {$endif} + end else begin + filename := Directory + curlang + PathDelim + 'LC_MESSAGES' + PathDelim + domain + '.mo'; + if (not FileLocator.FileExists(filename)) and (not fileexists(filename)) then begin + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('Domain '+domain+': File does not exist, neither embedded or in file system: '+filename); + {$endif} + filename := Directory + MidStr(curlang, 1, 2) + PathDelim + 'LC_MESSAGES' + PathDelim + domain + '.mo'; + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('Domain '+domain+' will attempt to use this file: '+filename); + {$endif} + end else begin + {$ifdef DXGETTEXTDEBUG} + if FileLocator.FileExists(filename) then + DebugLogger ('Domain '+domain+' will attempt to use this embedded file: '+filename) + else + DebugLogger ('Domain '+domain+' will attempt to use this file that was found on the file system: '+filename); + {$endif} + end; + end; + if (not FileLocator.FileExists(filename)) and (not fileexists(filename)) then begin + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('Domain '+domain+' failed to locate the file: '+filename); + {$endif} + OpenHasFailedBefore:=True; + exit; + end; + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('Domain '+domain+' now accesses the file.'); + {$endif} + mofile:=FileLocator.GetMoFile(filename, DebugLogger); + + {$ifdef DXGETTEXTDEBUG} + if mofile.isSwappedArchitecture then + DebugLogger ('.mo file is swapped (comes from another CPU architecture)'); + {$endif} + + // Check, that the contents of the file is utf-8 + if pos('CHARSET=UTF-8',uppercase(GetTranslationProperty('Content-Type')))=0 then begin + CloseMoFile; + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('The translation for the language code '+curlang+' (in '+filename+') does not have charset=utf-8 in its Content-Type. Translations are turned off.'); + {$endif} + {$ifdef MSWINDOWS} + MessageBoxW(0,PWideChar(widestring('The translation for the language code '+curlang+' (in '+filename+') does not have charset=utf-8 in its Content-Type. Translations are turned off.')),'Localization problem',MB_OK); + {$else} + writeln (stderr,'The translation for the language code '+curlang+' (in '+filename+') does not have charset=utf-8 in its Content-Type. Translations are turned off.'); + {$endif} + Enabled:=False; + end; +end; + +{$IFDEF UNICODE} +function utf8decode (s:RawByteString):UnicodeString; inline; +begin + Result:=UTF8ToWideString(s); +end; +{$endif} + +function TDomain.GetTranslationProperty( + Propertyname: ComponentNameString): TranslatedUnicodeString; +var + sl:TStringList; + i:integer; + s:string; +begin + Propertyname:=uppercase(Propertyname)+': '; + sl:=TStringList.Create; + try + sl.Text:=utf8decode(gettext('')); + for i:=0 to sl.Count-1 do begin + s:=sl.Strings[i]; + if uppercase(MidStr(s,1,length(Propertyname)))=Propertyname then begin + Result:=trim(MidStr(s,length(PropertyName)+1,maxint)); + + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('GetTranslationProperty('+PropertyName+') returns '''+Result+'''.'); + {$endif} + exit; + end; + end; + finally + FreeAndNil (sl); + end; + Result:=''; + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('GetTranslationProperty('+PropertyName+') did not find any value. An empty string is returned.'); + {$endif} +end; + +procedure TDomain.setDirectory(const dir: FilenameString); +begin + vDirectory := IncludeTrailingPathDelimiter(dir); + SpecificFilename:=''; + CloseMoFile; +end; + +procedure AddDomainForResourceString (const domain:DomainString); +begin + {$ifdef DXGETTEXTDEBUG} + DefaultInstance.DebugWriteln ('Extra domain for resourcestring: '+domain); + {$endif} + ResourceStringDomainListCS.BeginWrite; + try + if ResourceStringDomainList.IndexOf(domain)=-1 then + ResourceStringDomainList.Add (domain); + finally + ResourceStringDomainListCS.EndWrite; + end; +end; + +procedure RemoveDomainForResourceString (const domain:DomainString); +var + i:integer; +begin + {$ifdef DXGETTEXTDEBUG} + DefaultInstance.DebugWriteln ('Remove domain for resourcestring: '+domain); + {$endif} + ResourceStringDomainListCS.BeginWrite; + try + i:=ResourceStringDomainList.IndexOf(domain); + if i<>-1 then + ResourceStringDomainList.Delete (i); + finally + ResourceStringDomainListCS.EndWrite; + end; +end; + +procedure TDomain.SetLanguageCode(const langcode: LanguageString); +begin + CloseMoFile; + curlang:=langcode; +end; + +function GetPluralForm2EN(Number: Integer): Integer; +begin + Number:=abs(Number); + if Number=1 then Result:=0 else Result:=1; +end; + +function GetPluralForm1(Number: Integer): Integer; +begin + Result:=0; +end; + +function GetPluralForm2FR(Number: Integer): Integer; +begin + Number:=abs(Number); + if (Number=1) or (Number=0) then Result:=0 else Result:=1; +end; + +function GetPluralForm3LV(Number: Integer): Integer; +begin + Number:=abs(Number); + if (Number mod 10=1) and (Number mod 100<>11) then + Result:=0 + else + if Number<>0 then Result:=1 + else Result:=2; +end; + +function GetPluralForm3GA(Number: Integer): Integer; +begin + Number:=abs(Number); + if Number=1 then Result:=0 + else if Number=2 then Result:=1 + else Result:=2; +end; + +function GetPluralForm3LT(Number: Integer): Integer; +var + n1,n2:byte; +begin + Number:=abs(Number); + n1:=Number mod 10; + n2:=Number mod 100; + if (n1=1) and (n2<>11) then + Result:=0 + else + if (n1>=2) and ((n2<10) or (n2>=20)) then Result:=1 + else Result:=2; +end; + +function GetPluralForm3PL(Number: Integer): Integer; +var + n1,n2:byte; +begin + Number:=abs(Number); + n1:=Number mod 10; + n2:=Number mod 100; + + if Number=1 then Result:=0 + else if (n1>=2) and (n1<=4) and ((n2<10) or (n2>=20)) then Result:=1 + else Result:=2; +end; + +function GetPluralForm3RU(Number: Integer): Integer; +var + n1,n2:byte; +begin + Number:=abs(Number); + n1:=Number mod 10; + n2:=Number mod 100; + if (n1=1) and (n2<>11) then + Result:=0 + else + if (n1>=2) and (n1<=4) and ((n2<10) or (n2>=20)) then Result:=1 + else Result:=2; +end; + +function GetPluralForm3SK(Number: Integer): Integer; +begin + Number:=abs(Number); + if number=1 then Result:=0 + else if (number<5) and (number<>0) then Result:=1 + else Result:=2; +end; + +function GetPluralForm4SL(Number: Integer): Integer; +var + n2:byte; +begin + Number:=abs(Number); + n2:=Number mod 100; + if n2=1 then Result:=0 + else + if n2=2 then Result:=1 + else + if (n2=3) or (n2=4) then Result:=2 + else + Result:=3; +end; + +procedure TDomain.GetListOfLanguages(list: TStrings); +var + sr:TSearchRec; + more:boolean; + filename, path:FilenameString; + langcode:LanguageString; + i, j:integer; +begin + list.Clear; + + // Iterate through filesystem + more:=FindFirst (Directory+'*',faAnyFile,sr)=0; + try + while more do begin + if (sr.Attr and faDirectory<>0) and (sr.name<>'.') and (sr.name<>'..') then begin + filename := Directory + sr.Name + PathDelim + 'LC_MESSAGES' + PathDelim + domain + '.mo'; + if fileexists(filename) then begin + langcode:=lowercase(sr.name); + if list.IndexOf(langcode)=-1 then + list.Add(langcode); + end; + end; + more:=FindNext (sr)=0; + end; + finally + FindClose (sr); + end; + + // Iterate through embedded files + for i:=0 to FileLocator.filelist.Count-1 do begin + filename:=FileLocator.basedirectory+FileLocator.filelist.Strings[i]; + path:=Directory; + {$ifdef MSWINDOWS} + path:=uppercase(path); + filename:=uppercase(filename); + {$endif} + j:=length(path); + if MidStr(filename,1,j)=path then begin + path:=PathDelim + 'LC_MESSAGES' + PathDelim + domain + '.mo'; + {$ifdef MSWINDOWS} + path:=uppercase(path); + {$endif} + if MidStr(filename,length(filename)-length(path)+1,length(path))=path then begin + langcode:=lowercase(MidStr(filename,j+1,length(filename)-length(path)-j)); + langcode:=LeftStr(langcode,3)+uppercase(MidStr(langcode,4,maxint)); + if list.IndexOf(langcode)=-1 then + list.Add(langcode); + end; + end; + end; +end; + +procedure TDomain.SetFilename(const filename: FilenameString); +begin + CloseMoFile; + vDirectory := ''; + SpecificFilename:=filename; +end; + +function TDomain.gettext(const msgid: RawUtf8String): RawUtf8String; +var + found:boolean; +begin + if not Enabled then begin + Result:=msgid; + exit; + end; + if (mofile=nil) and (not OpenHasFailedBefore) then + OpenMoFile; + if mofile=nil then begin + {$ifdef DXGETTEXTDEBUG} + DebugLogger('.mo file is not open. Not translating "'+msgid+'"'); + {$endif} + Result := msgid; + end else begin + Result:=mofile.gettext(msgid,found); + {$ifdef DXGETTEXTDEBUG} + if found then + DebugLogger ('Found in .mo ('+Domain+'): "'+utf8encode(msgid)+'"->"'+utf8encode(Result)+'"') + else + DebugLogger ('Translation not found in .mo file ('+Domain+') : "'+utf8encode(msgid)+'"'); + {$endif} + end; +end; + +constructor TDomain.Create; +begin + inherited Create; + Enabled:=True; +end; + +{ TGnuGettextInstance } + +procedure TGnuGettextInstance.bindtextdomain(const szDomain:DomainString; + const szDirectory: FilenameString); +var + dir:FilenameString; +begin + dir:=IncludeTrailingPathDelimiter(szDirectory); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Text domain "'+szDomain+'" is now located at "'+dir+'"'); + {$endif} + getdomain(szDomain,DefaultDomainDirectory,CurLang).Directory := dir; + WhenNewDomainDirectory (szDomain, szDirectory); +end; + +constructor TGnuGettextInstance.Create; +begin + CreatorThread:=GetCurrentThreadId; + {$ifdef MSWindows} + DesignTimeCodePage:=CP_ACP; + {$endif} + {$ifdef DXGETTEXTDEBUG} + DebugLogCS:=TMultiReadExclusiveWriteSynchronizer.Create; + DebugLog:=TMemoryStream.Create; + DebugWriteln('Debug log started '+DateTimeToStr(Now)); + DebugWriteln('GNU gettext module version: '+VCSVersion); + DebugWriteln(''); + {$endif} + curGetPluralForm:=GetPluralForm2EN; + Enabled:=True; + curmsgdomain:=DefaultTextDomain; + savefileCS := TMultiReadExclusiveWriteSynchronizer.Create; + domainlist := TStringList.Create; + TP_IgnoreList:=TStringList.Create; + TP_IgnoreList.Sorted:=True; + TP_GlobalClassHandling:=TList.Create; + TP_ClassHandling:=TList.Create; + + // Set some settings + DefaultDomainDirectory := IncludeTrailingPathDelimiter(extractfilepath(ExecutableFilename))+'locale'; + + UseLanguage(''); + + bindtextdomain(DefaultTextDomain, DefaultDomainDirectory); + textdomain(DefaultTextDomain); + + // Add default properties to ignore + TP_GlobalIgnoreClassProperty(TComponent,'Name'); + TP_GlobalIgnoreClassProperty(TCollection,'PropName'); +end; + +destructor TGnuGettextInstance.Destroy; +begin + if savememory <> nil then begin + savefileCS.BeginWrite; + try + CloseFile(savefile); + finally + savefileCS.EndWrite; + end; + FreeAndNil(savememory); + end; + FreeAndNil (savefileCS); + FreeAndNil (TP_IgnoreList); + while TP_GlobalClassHandling.Count<>0 do begin + TObject(TP_GlobalClassHandling.Items[0]).Free; + TP_GlobalClassHandling.Delete(0); + end; + FreeAndNil (TP_GlobalClassHandling); + FreeTP_ClassHandlingItems; + FreeAndNil (TP_ClassHandling); + while domainlist.Count <> 0 do begin + domainlist.Objects[0].Free; + domainlist.Delete(0); + end; + FreeAndNil(domainlist); + {$ifdef DXGETTEXTDEBUG} + FreeAndNil (DebugLog); + FreeAndNil (DebugLogCS); + {$endif} + inherited; +end; + +{$ifndef DELPHI5OROLDER} +{$ifndef UNICODE} +function TGnuGettextInstance.dgettext(const szDomain: DomainString; const szMsgId: ansistring): TranslatedUnicodeString; +begin + Result:=dgettext(szDomain, ansi2wideDTCP(szMsgId)); +end; +{$endif} +{$endif} + +function TGnuGettextInstance.dgettext(const szDomain: DomainString; + const szMsgId: MsgIdString): TranslatedUnicodeString; +begin + if not Enabled then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Translation has been disabled. Text is not being translated: '+szMsgid); + {$endif} + Result:=szMsgId; + end else begin + Result:=UTF8Decode(EnsureLineBreakInTranslatedString(getdomain(szDomain,DefaultDomainDirectory,CurLang).gettext(StripCRRawMsgId(utf8encode(szMsgId))))); + + {$ifdef DXGETTEXTDEBUG} + if (szMsgId<>'') and (Result='') then + DebugWriteln (Format('Error: Translation of %s was an empty string. This may never occur.',[szMsgId])); + {$endif} + end; +end; + +function TGnuGettextInstance.GetCurrentLanguage: LanguageString; +begin + Result:=curlang; +end; + +function TGnuGettextInstance.getcurrenttextdomain: DomainString; +begin + Result := curmsgdomain; +end; + +{$ifndef DELPHI5OROLDER} +{$ifndef UNICODE} +function TGnuGettextInstance.gettext( + const szMsgId: ansistring): TranslatedUnicodeString; +begin + Result := dgettext(curmsgdomain, szMsgId); +end; +{$endif} +{$endif} + +function TGnuGettextInstance.gettext( + const szMsgId: MsgIdString): TranslatedUnicodeString; +begin + Result := dgettext(curmsgdomain, szMsgId); +end; + +procedure TGnuGettextInstance.textdomain(const szDomain: DomainString); +begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Changed text domain to "'+szDomain+'"'); + {$endif} + curmsgdomain := szDomain; + WhenNewDomain (szDomain); +end; + +function TGnuGettextInstance.TP_CreateRetranslator : TExecutable; +var + ttpr:TTP_Retranslator; +begin + ttpr:=TTP_Retranslator.Create; + ttpr.Instance:=self; + TP_Retranslator:=ttpr; + Result:=ttpr; + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('A retranslator was created.'); + {$endif} +end; + +procedure TGnuGettextInstance.TP_GlobalHandleClass(HClass: TClass; + Handler: TTranslator); +var + cm:TClassMode; + i:integer; +begin + for i:=0 to TP_GlobalClassHandling.Count-1 do begin + cm:=TObject(TP_GlobalClassHandling.Items[i]) as TClassMode; + if cm.HClass=HClass then + raise EGGProgrammingError.Create ('You cannot set a handler for a class that has already been assigned otherwise.'); + if HClass.InheritsFrom(cm.HClass) then begin + // This is the place to insert this class + cm:=TClassMode.Create; + cm.HClass:=HClass; + cm.SpecialHandler:=Handler; + TP_GlobalClassHandling.Insert(i,cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('A handler was set for class '+HClass.ClassName+'.'); + {$endif} + exit; + end; + end; + cm:=TClassMode.Create; + cm.HClass:=HClass; + cm.SpecialHandler:=Handler; + TP_GlobalClassHandling.Add(cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('A handler was set for class '+HClass.ClassName+'.'); + {$endif} +end; + +procedure TGnuGettextInstance.TP_GlobalIgnoreClass(IgnClass: TClass); +var + cm:TClassMode; + i:integer; +begin + for i:=0 to TP_GlobalClassHandling.Count-1 do begin + cm:=TObject(TP_GlobalClassHandling.Items[i]) as TClassMode; + if cm.HClass=IgnClass then + raise EGGProgrammingError.Create ('You cannot add a class to the ignore list that is already on that list: '+IgnClass.ClassName+'. You should keep all TP_Global functions in one place in your source code.'); + if IgnClass.InheritsFrom(cm.HClass) then begin + // This is the place to insert this class + cm:=TClassMode.Create; + cm.HClass:=IgnClass; + TP_GlobalClassHandling.Insert(i,cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Globally, class '+IgnClass.ClassName+' is being ignored.'); + {$endif} + exit; + end; + end; + cm:=TClassMode.Create; + cm.HClass:=IgnClass; + TP_GlobalClassHandling.Add(cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Globally, class '+IgnClass.ClassName+' is being ignored.'); + {$endif} +end; + +procedure TGnuGettextInstance.TP_GlobalIgnoreClassProperty( + IgnClass: TClass; propertyname: ComponentNameString); +var + cm:TClassMode; + i,idx:integer; +begin + propertyname:=uppercase(propertyname); + for i:=0 to TP_GlobalClassHandling.Count-1 do begin + cm:=TObject(TP_GlobalClassHandling.Items[i]) as TClassMode; + if cm.HClass=IgnClass then begin + if Assigned(cm.SpecialHandler) then + raise EGGProgrammingError.Create ('You cannot ignore a class property for a class that has a handler set.'); + if not cm.PropertiesToIgnore.Find(propertyname,idx) then + cm.PropertiesToIgnore.Add(propertyname); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Globally, the '+propertyname+' property of class '+IgnClass.ClassName+' is being ignored.'); + {$endif} + exit; + end; + if IgnClass.InheritsFrom(cm.HClass) then begin + // This is the place to insert this class + cm:=TClassMode.Create; + cm.HClass:=IgnClass; + cm.PropertiesToIgnore.Add(propertyname); + TP_GlobalClassHandling.Insert(i,cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Globally, the '+propertyname+' property of class '+IgnClass.ClassName+' is being ignored.'); + {$endif} + exit; + end; + end; + cm:=TClassMode.Create; + cm.HClass:=IgnClass; + cm.PropertiesToIgnore.Add(propertyname); + TP_GlobalClassHandling.Add(cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Globally, the '+propertyname+' property of class '+IgnClass.ClassName+' is being ignored.'); + {$endif} +end; + +procedure TGnuGettextInstance.TP_Ignore(AnObject: TObject; + const name: ComponentNameString); +begin + TP_IgnoreList.Add(uppercase(name)); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('On object with class name '+AnObject.ClassName+', ignore is set on '+name); + {$endif} +end; + +procedure TGnuGettextInstance.TranslateComponent(AnObject: TComponent; + const TextDomain: DomainString); +var + comp:TGnuGettextComponentMarker; +begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('======================================================================'); + DebugWriteln ('TranslateComponent() was called for a component with name '+AnObject.Name+'.'); + {$endif} + comp:=AnObject.FindComponent('GNUgettextMarker') as TGnuGettextComponentMarker; + if comp=nil then begin + comp:=TGnuGettextComponentMarker.Create (nil); + comp.Name:='GNUgettextMarker'; + comp.Retranslator:=TP_CreateRetranslator; + TranslateProperties (AnObject, TextDomain); + AnObject.InsertComponent(comp); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('This is the first time, that this component has been translated. A retranslator component has been created for this component.'); + {$endif} + end else begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('This is not the first time, that this component has been translated.'); + {$endif} + if comp.LastLanguage<>curlang then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('ERROR: TranslateComponent() was called twice with different languages. This indicates an attempt to switch language at runtime, but by using TranslateComponent every time. This API has changed - please use RetranslateComponent() instead.'); + {$endif} + {$ifdef mswindows} + MessageBox (0,'This application tried to switch the language, but in an incorrect way. The programmer needs to replace a call to TranslateComponent with a call to RetranslateComponent(). The programmer should see the changelog of gnugettext.pas for more information.','Error',MB_OK); + {$else} + writeln (stderr,'This application tried to switch the language, but in an incorrect way. The programmer needs to replace a call to TranslateComponent with a call to RetranslateComponent(). The programmer should see the changelog of gnugettext.pas for more information.'); + {$endif} + end else begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('ERROR: TranslateComponent has been called twice, but with the same language chosen. This is a mistake, but in order to prevent that the application breaks, no exception is raised.'); + {$endif} + end; + end; + comp.LastLanguage:=curlang; + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('======================================================================'); + {$endif} +end; + +procedure TGnuGettextInstance.TranslateProperty (AnObject:TObject; PropInfo:PPropInfo; TodoList:TStrings; const TextDomain:DomainString); +var + {$ifdef DELPHI5OROLDER} + ws: string; + old: string; + {$endif} + {$ifndef DELPHI5OROLDER} + ppi:PPropInfo; + ws: TranslatedUnicodeString; + old: TranslatedUnicodeString; + {$endif} + compmarker:TComponent; + obj:TObject; + Propname:ComponentNameString; +begin + PropName:=string(PropInfo^.Name); + try + // Translate certain types of properties + case PropInfo^.PropType^.Kind of + {$IFDEF UNICODE} + // All dfm files returning tkUString + tkString, tkLString, tkWString, tkUString: + {$ELSE} + tkString, tkLString, tkWString: + {$ENDIF} + begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Translating '+AnObject.ClassName+'.'+PropName); + {$endif} + {$ifdef DELPHI5OROLDER} + old := GetStrProp(AnObject, PropName); + {$else} + case PropInfo^.PropType^.Kind of + tkString, tkLString : + old := GetStrProp(AnObject, PropName); + tkWString : + old := GetWideStrProp(AnObject, PropName); + {$IFDEF UNICODE} + tkUString : + old := GetUnicodeStrProp(AnObject, PropName); + {$ENDIF} + else + raise Exception.Create ('Internal error: Illegal property type. This problem needs to be solved by a programmer, try to find a workaround.'); + end; + {$endif} + {$ifdef DXGETTEXTDEBUG} + if old='' then + DebugWriteln ('(Empty, not translated)') + else + DebugWriteln ('Old value: "'+old+'"'); + {$endif} + if (old <> '') and (IsWriteProp(PropInfo)) then begin + if TP_Retranslator<>nil then + (TP_Retranslator as TTP_Retranslator).Remember(AnObject, PropName, old); + ws := dgettext(textdomain,old); + if ws <> old then begin + {$ifdef DELPHI5OROLDER} + SetStrProp(AnObject, PropName, ws); + {$endif} + {$ifndef DELPHI5OROLDER} + ppi:=GetPropInfo(AnObject, Propname); + if ppi<>nil then begin + SetWideStrProp(AnObject, ppi, ws); + end else begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('ERROR: Property disappeared: '+Propname+' for object of type '+AnObject.ClassName); + {$endif} + end; + {$endif} + end; + end; + end { case item }; + tkClass: + begin + obj:=GetObjectProp(AnObject, PropName); + if obj<>nil then begin + if obj is TComponent then begin + compmarker := TComponent(obj).FindComponent('GNUgettextMarker'); + if Assigned(compmarker) then + exit; + end; + TodoList.AddObject ('',obj); + end; + end { case item }; + end { case }; + except + on E:Exception do + raise EGGComponentError.Create ('Property cannot be translated.'+sLineBreak+ + 'Add TP_GlobalIgnoreClassProperty('+AnObject.ClassName+','''+PropName+''') to your source code or use'+sLineBreak+ + 'TP_Ignore (self,''.'+PropName+''') to prevent this message.'+sLineBreak+ + 'Reason: '+e.Message); + end; +end; + +procedure TGnuGettextInstance.TranslateProperties(AnObject: TObject; textdomain:DomainString=''); +var + TodoList:TStringList; // List of Name/TObject's that is to be processed + DoneList:TStringList; // List of hex codes representing pointers to objects that have been done + i, j, Count: integer; + PropList: PPropList; + UPropName: ComponentNameString; + PropInfo: PPropInfo; + compmarker, + comp:TComponent; + cm, + currentcm:TClassMode; // currentcm is nil or contains special information about how to handle the current object + ObjectPropertyIgnoreList:TStringList; + objid:string; + Name:ComponentNameString; + {$ifdef DELPHI5OROLDER} + Data:PTypeData; + {$endif} +begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('----------------------------------------------------------------------'); + DebugWriteln ('TranslateProperties() was called for an object of class '+AnObject.ClassName+' with domain "'+textdomain+'".'); + {$endif} + if textdomain='' then + textdomain:=curmsgdomain; + if TP_Retranslator<>nil then + (TP_Retranslator as TTP_Retranslator).TextDomain:=textdomain; + {$ifdef FPC} + DoneList:=TCSStringList.Create; + TodoList:=TCSStringList.Create; + ObjectPropertyIgnoreList:=TCSStringList.Create; + {$else} + DoneList:=TStringList.Create; + TodoList:=TStringList.Create; + ObjectPropertyIgnoreList:=TStringList.Create; + {$endif} + try + TodoList.AddObject('', AnObject); + DoneList.Sorted:=True; + ObjectPropertyIgnoreList.Sorted:=True; + {$ifndef DELPHI5OROLDER} + ObjectPropertyIgnoreList.Duplicates:=dupIgnore; + ObjectPropertyIgnoreList.CaseSensitive:=False; + DoneList.Duplicates:=dupError; + DoneList.CaseSensitive:=True; + {$endif} + + while TodoList.Count<>0 do begin + AnObject:=TodoList.Objects[0]; + Name:=TodoList.Strings[0]; + TodoList.Delete(0); + if (AnObject<>nil) and (AnObject is TPersistent) then begin + // Make sure each object is only translated once + Assert (sizeof(integer)=sizeof(TObject)); + objid:=IntToHex(integer(AnObject),8); + if DoneList.Find(objid,i) then begin + continue; + end else begin + DoneList.Add(objid); + end; + + ObjectPropertyIgnoreList.Clear; + + // Find out if there is special handling of this object + currentcm:=nil; + // First check the local handling instructions + for j:=0 to TP_ClassHandling.Count-1 do begin + cm:=TObject(TP_ClassHandling.Items[j]) as TClassMode; + if AnObject.InheritsFrom(cm.HClass) then begin + if cm.PropertiesToIgnore.Count<>0 then begin + ObjectPropertyIgnoreList.AddStrings(cm.PropertiesToIgnore); + end else begin + // Ignore the entire class + currentcm:=cm; + break; + end; + end; + end; + // Then check the global handling instructions + if currentcm=nil then + for j:=0 to TP_GlobalClassHandling.Count-1 do begin + cm:=TObject(TP_GlobalClassHandling.Items[j]) as TClassMode; + if AnObject.InheritsFrom(cm.HClass) then begin + if cm.PropertiesToIgnore.Count<>0 then begin + ObjectPropertyIgnoreList.AddStrings(cm.PropertiesToIgnore); + end else begin + // Ignore the entire class + currentcm:=cm; + break; + end; + end; + end; + if currentcm<>nil then begin + ObjectPropertyIgnoreList.Clear; + // Ignore or use special handler + if Assigned(currentcm.SpecialHandler) then begin + currentcm.SpecialHandler (AnObject); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Special handler activated for '+AnObject.ClassName); + {$endif} + end else begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Ignoring object '+AnObject.ClassName); + {$endif} + end; + continue; + end; + + {$ifdef DELPHI5OROLDER} + if AnObject.ClassInfo=nil then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('ClassInfo=nil encountered for class '+AnObject.ClassName+'. Translation of that component has stopped. You should ignore this object.'); + {$endif} + continue; + end; + Data := GetTypeData(AnObject.Classinfo); + Count := Data^.PropCount; + GetMem(PropList, Count * Sizeof(PPropInfo)); + {$endif} + {$ifndef DELPHI5OROLDER} + Count := GetPropList(AnObject, PropList); + {$endif} + try + {$ifdef DELPHI5OROLDER} + GetPropInfos(AnObject.ClassInfo, PropList); + {$endif} + for j := 0 to Count - 1 do begin + PropInfo := PropList[j]; + {$IFDEF UNICODE} + if not (PropInfo^.PropType^.Kind in [tkString, tkLString, tkWString, tkClass, tkUString]) then + {$ELSE} + if not (PropInfo^.PropType^.Kind in [tkString, tkLString, tkWString, tkClass]) then + {$ENDIF} + continue; + UPropName:=uppercase(string(PropInfo^.Name)); + // Ignore properties that are meant to be ignored + if ((currentcm=nil) or (not currentcm.PropertiesToIgnore.Find(UPropName,i))) and + (not TP_IgnoreList.Find(Name+'.'+UPropName,i)) and + (not ObjectPropertyIgnoreList.Find(UPropName,i)) then begin + TranslateProperty (AnObject,PropInfo,TodoList,TextDomain); + end; // if + end; // for + finally + {$ifdef DELPHI5OROLDER} + FreeMem(PropList, Data^.PropCount * Sizeof(PPropInfo)); + {$endif} + {$ifndef DELPHI5OROLDER} + if Count<>0 then + FreeMem (PropList); + {$endif} + end; + if AnObject is TStrings then begin + if ((AnObject as TStrings).Text<>'') and (TP_Retranslator<>nil) then + (TP_Retranslator as TTP_Retranslator).Remember(AnObject, 'Text', (AnObject as TStrings).Text); + TranslateStrings (AnObject as TStrings,TextDomain); + end; + // Check for TCollection + if AnObject is TCollection then begin + for i := 0 to (AnObject as TCollection).Count - 1 do begin + // Only add the object if it's not totally ignored already + if not Assigned(currentcm) or not AnObject.InheritsFrom(currentcm.HClass) then + TodoList.AddObject('',(AnObject as TCollection).Items[i]); + end; + end; + if AnObject is TComponent then begin + for i := 0 to TComponent(AnObject).ComponentCount - 1 do begin + comp:=TComponent(AnObject).Components[i]; + if (not TP_IgnoreList.Find(uppercase(comp.Name),j)) then begin + // Only add the object if it's not totally ignored or translated already + if not Assigned(currentcm) or not AnObject.InheritsFrom(currentcm.HClass) then begin + compmarker := comp.FindComponent('GNUgettextMarker'); + if not Assigned(compmarker) then + TodoList.AddObject(uppercase(comp.Name),comp); + end; + end; + end; + end; + end { if AnObject<>nil }; + end { while todolist.count<>0 }; + finally + FreeAndNil (todolist); + FreeAndNil (ObjectPropertyIgnoreList); + FreeAndNil (DoneList); + end; + FreeTP_ClassHandlingItems; + TP_IgnoreList.Clear; + TP_Retranslator:=nil; + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('----------------------------------------------------------------------'); + {$endif} +end; + +procedure TGnuGettextInstance.UseLanguage(LanguageCode: LanguageString); +var + i,p:integer; + dom:TDomain; + l2:string; +begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln('UseLanguage('''+LanguageCode+'''); called'); + {$endif} + + if LanguageCode='' then begin + LanguageCode:=GGGetEnvironmentVariable('LANG'); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('LANG env variable is '''+LanguageCode+'''.'); + {$endif} + {$ifdef MSWINDOWS} + if LanguageCode='' then begin + LanguageCode:=GetWindowsLanguage; + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Found Windows language code to be '''+LanguageCode+'''.'); + {$endif} + end; + {$endif} + p:=pos('.',LanguageCode); + if p<>0 then + LanguageCode:=LeftStr(LanguageCode,p-1); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Language code that will be set is '''+LanguageCode+'''.'); + {$endif} + end; + + curlang := LanguageCode; + for i:=0 to domainlist.Count-1 do begin + dom:=domainlist.Objects[i] as TDomain; + dom.SetLanguageCode (curlang); + end; + + l2:=lowercase(LeftStr(curlang,2)); + if (l2='en') or (l2='de') then curGetPluralForm:=GetPluralForm2EN else + if (l2='hu') or (l2='ko') or (l2='zh') or (l2='ja') or (l2='tr') then curGetPluralForm:=GetPluralForm1 else + if (l2='fr') or (l2='fa') or (lowercase(curlang)='pt_br') then curGetPluralForm:=GetPluralForm2FR else + if (l2='lv') then curGetPluralForm:=GetPluralForm3LV else + if (l2='ga') then curGetPluralForm:=GetPluralForm3GA else + if (l2='lt') then curGetPluralForm:=GetPluralForm3LT else + if (l2='ru') or (l2='uk') or (l2='hr') then curGetPluralForm:=GetPluralForm3RU else + if (l2='cs') or (l2='sk') then curGetPluralForm:=GetPluralForm3SK else + if (l2='pl') then curGetPluralForm:=GetPluralForm3PL else + if (l2='sl') then curGetPluralForm:=GetPluralForm4SL else begin + curGetPluralForm:=GetPluralForm2EN; + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Plural form for the language was not found. English plurality system assumed.'); + {$endif} + end; + + WhenNewLanguage (curlang); + + {$ifdef DXGETTEXTDEBUG} + DebugWriteln(''); + {$endif} +end; + +procedure TGnuGettextInstance.TranslateStrings(sl: TStrings;const TextDomain:DomainString); +var + line: string; + i: integer; + s:TStringList; +begin + if sl.Count > 0 then begin + sl.BeginUpdate; + try + s:=TStringList.Create; + try + s.Assign (sl); + for i:=0 to s.Count-1 do begin + line:=s.Strings[i]; + if line<>'' then + s.Strings[i]:=dgettext(TextDomain,line); + end; + sl.Assign(s); + finally + FreeAndNil (s); + end; + finally + sl.EndUpdate; + end; + end; +end; + +function TGnuGettextInstance.GetTranslatorNameAndEmail: TranslatedUnicodeString; +begin + Result:=GetTranslationProperty('LAST-TRANSLATOR'); +end; + +function TGnuGettextInstance.GetTranslationProperty( + const Propertyname: ComponentNameString): TranslatedUnicodeString; +begin + Result:=getdomain(curmsgdomain,DefaultDomainDirectory,CurLang).GetTranslationProperty (Propertyname); +end; + +function TGnuGettextInstance.dngettext(const szDomain: DomainString; const singular, plural: MsgIdString; + Number: Integer): TranslatedUnicodeString; +var + org:MsgIdString; + trans:TranslatedUnicodeString; + idx:integer; + p:integer; +begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('dngettext translation (domain '+szDomain+', number is '+IntTostr(Number)+') of '+singular+'/'+plural); + {$endif} + org:=singular+#0+plural; + trans:=dgettext(szDomain,org); + if org=trans then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Translation was equal to english version. English plural forms assumed.'); + {$endif} + idx:=GetPluralForm2EN(Number) + end else + idx:=curGetPluralForm(Number); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Index '+IntToStr(idx)+' will be used'); + {$endif} + while true do begin + p:=pos(#0,trans); + if p=0 then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Last translation used: '+utf8encode(trans)); + {$endif} + Result:=trans; + exit; + end; + if idx=0 then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Translation found: '+utf8encode(trans)); + {$endif} + Result:=LeftStr(trans,p-1); + exit; + end; + delete (trans,1,p); + dec (idx); + end; +end; + +{$ifndef DELPHI5OROLDER} +{$ifndef UNICODE} +function TGnuGettextInstance.ngettext(const singular, plural: ansistring; + Number: Integer): TranslatedUnicodeString; +begin + Result := dngettext(curmsgdomain, singular, plural, Number); +end; +{$endif} +{$endif} + +function TGnuGettextInstance.ngettext(const singular, plural: MsgIdString; + Number: Integer): TranslatedUnicodeString; +begin + Result := dngettext(curmsgdomain, singular, plural, Number); +end; + +procedure TGnuGettextInstance.WhenNewDomain(const TextDomain: DomainString); +begin + // This is meant to be empty. +end; + +procedure TGnuGettextInstance.WhenNewLanguage(const LanguageID: LanguageString); +begin + // This is meant to be empty. +end; + +procedure TGnuGettextInstance.WhenNewDomainDirectory(const TextDomain:DomainString; const Directory: FilenameString); +begin + // This is meant to be empty. +end; + +procedure TGnuGettextInstance.GetListOfLanguages(const domain: DomainString; + list: TStrings); +begin + getdomain(Domain,DefaultDomainDirectory,CurLang).GetListOfLanguages(list); +end; + +procedure TGnuGettextInstance.bindtextdomainToFile(const szDomain:DomainString; const filename: FilenameString); +begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Text domain "'+szDomain+'" is now bound to file named "'+filename+'"'); + {$endif} + getdomain(szDomain,DefaultDomainDirectory,CurLang).SetFilename (filename); +end; + +procedure TGnuGettextInstance.DebugLogPause(PauseEnabled: boolean); +begin + {$ifdef DXGETTEXTDEBUG} + DebugLogOutputPaused:=PauseEnabled; + {$endif} +end; + +procedure TGnuGettextInstance.DebugLogToFile(const filename: FilenameString; append:boolean=false); +{$ifdef DXGETTEXTDEBUG} +var + fs:TFileStream; + marker:ansistring; +{$endif} +begin + {$ifdef DXGETTEXTDEBUG} + // Create the file if needed + if (not fileexists(filename)) or (not append) then + fileclose (filecreate (filename)); + + // Open file + fs:=TFileStream.Create (filename,fmOpenWrite or fmShareDenyWrite); + if append then + fs.Seek(0,soFromEnd); + + // Write header if appending + if fs.Position<>0 then begin + marker:=sLineBreak+'==========================================================================='+sLineBreak; + fs.WriteBuffer(marker[1],length(marker)); + end; + + // Copy the memorystream contents to the file + DebugLog.Seek(0,soFromBeginning); + fs.CopyFrom(DebugLog,0); + + // Make DebugLog point to the filestream + FreeAndNil (DebugLog); + DebugLog:=fs; + {$endif} +end; + +{$ifdef DXGETTEXTDEBUG} +procedure TGnuGettextInstance.DebugWriteln(line: ansistring); +Var + Discard: Boolean; +begin + Assert (DebugLogCS<>nil); + Assert (DebugLog<>nil); + + DebugLogCS.BeginWrite; + try + if DebugLogOutputPaused then + exit; + + if Assigned (fOnDebugLine) then begin + Discard := True; + fOnDebugLine (Self, Line, Discard); + If Discard then Exit; + end; + + line:=line+sLineBreak; + + // Ensure that memory usage doesn't get too big. + if (DebugLog is TMemoryStream) and (DebugLog.Position>1000000) then begin + line:=sLineBreak+sLineBreak+sLineBreak+sLineBreak+sLineBreak+ + 'Debug log halted because memory usage grew too much.'+sLineBreak+ + 'Specify a filename to store the debug log in or disable debug loggin in gnugettext.pas.'+ + sLineBreak+sLineBreak+sLineBreak+sLineBreak+sLineBreak; + DebugLogOutputPaused:=True; + end; + DebugLog.WriteBuffer(line[1],length(line)); + finally + DebugLogCS.EndWrite; + end; +end; +{$endif} + +function TGnuGettextInstance.Getdomain(const domain:DomainString; const DefaultDomainDirectory:FilenameString; const CurLang: LanguageString): TDomain; +// Retrieves the TDomain object for the specified domain. +// Creates one, if none there, yet. +var + idx: integer; +begin + idx := domainlist.IndexOf(Domain); + if idx = -1 then begin + Result := TDomain.Create; + {$ifdef DXGETTEXTDEBUG} + Result.DebugLogger:=DebugWriteln; + {$endif} + Result.Domain := Domain; + Result.Directory := DefaultDomainDirectory; + Result.SetLanguageCode(curlang); + domainlist.AddObject(Domain, Result); + end else begin + Result := domainlist.Objects[idx] as TDomain; + end; +end; + +function TGnuGettextInstance.LoadResString( + ResStringRec: PResStringRec): UnicodeString; +{$ifdef MSWINDOWS} +var + Len: Integer; + {$IFDEF UNICODE} + Buffer: array [0..1023] of widechar; + {$else} + Buffer: array [0..1023] of ansichar; + {$endif} +{$endif} +{$ifdef LINUX } +const + ResStringTableLen = 16; +type + ResStringTable = array [0..ResStringTableLen-1] of LongWord; +var + Handle: TResourceHandle; + Tab: ^ResStringTable; + ResMod: HMODULE; +{$endif } +begin + if ResStringRec=nil then + exit; + if ResStringRec.Identifier>=64*1024 then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('LoadResString was given an invalid ResStringRec.Identifier'); + {$endif} + Result:='ERROR'; + exit; + end else begin + {$ifdef LINUX} + // This works with Unicode if the Linux has utf-8 character set + // Result:=System.LoadResString(ResStringRec); + ResMod:=FindResourceHInstance(ResStringRec^.Module^); + Handle:=FindResource(ResMod, + PAnsiChar(ResStringRec^.Identifier div ResStringTableLen), PAnsiChar(6)); // RT_STRING + Tab:=Pointer(LoadResource(ResMod, Handle)); + if Tab=nil then + Result:='' + else + Result:=PWideChar(PAnsiChar(Tab)+Tab[ResStringRec^.Identifier mod ResStringTableLen]); + {$endif} + {$ifdef MSWINDOWS} + if not Win32PlatformIsUnicode then begin + SetString(Result, Buffer, + LoadString(FindResourceHInstance(ResStringRec.Module^), + ResStringRec.Identifier, Buffer, SizeOf(Buffer))) + end else begin + Result := ''; + Len := 0; + While Length(Result)<=Len+1 do begin + if Length(Result) = 0 then + SetLength(Result, 1024) + else + SetLength(Result, Length(Result) * 2); + Len := LoadStringW(FindResourceHInstance(ResStringRec.Module^), + ResStringRec.Identifier, PWideChar(Result), Length(Result)); + end; + SetLength(Result, Len); + end; + {$endif} + end; + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Loaded resourcestring: '+utf8encode(Result)); + {$endif} + if CreatorThread<>GetCurrentThreadId then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('LoadResString was called from an invalid thread. Resourcestring was not translated.'); + {$endif} + end else + Result:=ResourceStringGettext(Result); +end; + +procedure TGnuGettextInstance.RetranslateComponent(AnObject: TComponent; + const TextDomain: DomainString); +var + comp:TGnuGettextComponentMarker; +begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('======================================================================'); + DebugWriteln ('RetranslateComponent() was called for a component with name '+AnObject.Name+'.'); + {$endif} + comp:=AnObject.FindComponent('GNUgettextMarker') as TGnuGettextComponentMarker; + if comp=nil then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Retranslate was called on an object that has not been translated before. An Exception is being raised.'); + {$endif} + raise EGGProgrammingError.Create ('Retranslate was called on an object that has not been translated before. Please use TranslateComponent() before RetranslateComponent().'); + end else begin + if comp.LastLanguage<>curlang then begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('The retranslator is being executed.'); + {$endif} + comp.Retranslator.Execute; + end else begin + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('The language has not changed. The retranslator is not executed.'); + {$endif} + end; + end; + comp.LastLanguage:=curlang; + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('======================================================================'); + {$endif} +end; + +procedure TGnuGettextInstance.TP_IgnoreClass(IgnClass: TClass); +var + cm:TClassMode; + i:integer; +begin + for i:=0 to TP_ClassHandling.Count-1 do begin + cm:=TObject(TP_ClassHandling.Items[i]) as TClassMode; + if cm.HClass=IgnClass then + raise EGGProgrammingError.Create ('You cannot add a class to the ignore list that is already on that list: '+IgnClass.ClassName+'.'); + if IgnClass.InheritsFrom(cm.HClass) then begin + // This is the place to insert this class + cm:=TClassMode.Create; + cm.HClass:=IgnClass; + TP_ClassHandling.Insert(i,cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Locally, class '+IgnClass.ClassName+' is being ignored.'); + {$endif} + exit; + end; + end; + cm:=TClassMode.Create; + cm.HClass:=IgnClass; + TP_ClassHandling.Add(cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Locally, class '+IgnClass.ClassName+' is being ignored.'); + {$endif} +end; + +procedure TGnuGettextInstance.TP_IgnoreClassProperty(IgnClass: TClass; + propertyname: ComponentNameString); +var + cm:TClassMode; + i:integer; +begin + propertyname:=uppercase(propertyname); + for i:=0 to TP_ClassHandling.Count-1 do begin + cm:=TObject(TP_ClassHandling.Items[i]) as TClassMode; + if cm.HClass=IgnClass then begin + if Assigned(cm.SpecialHandler) then + raise EGGProgrammingError.Create ('You cannot ignore a class property for a class that has a handler set.'); + cm.PropertiesToIgnore.Add(propertyname); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Globally, the '+propertyname+' property of class '+IgnClass.ClassName+' is being ignored.'); + {$endif} + exit; + end; + if IgnClass.InheritsFrom(cm.HClass) then begin + // This is the place to insert this class + cm:=TClassMode.Create; + cm.HClass:=IgnClass; + cm.PropertiesToIgnore.Add(propertyname); + TP_ClassHandling.Insert(i,cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Locally, the '+propertyname+' property of class '+IgnClass.ClassName+' is being ignored.'); + {$endif} + exit; + end; + end; + cm:=TClassMode.Create; + cm.HClass:=IgnClass; + cm.PropertiesToIgnore.Add(propertyname); + TP_GlobalClassHandling.Add(cm); + {$ifdef DXGETTEXTDEBUG} + DebugWriteln ('Locally, the '+propertyname+' property of class '+IgnClass.ClassName+' is being ignored.'); + {$endif} +end; + +procedure TGnuGettextInstance.FreeTP_ClassHandlingItems; +begin + while TP_ClassHandling.Count<>0 do begin + TObject(TP_ClassHandling.Items[0]).Free; + TP_ClassHandling.Delete(0); + end; +end; + +{$ifndef UNICODE} +function TGnuGettextInstance.ansi2wideDTCP(const s: ansistring): MsgIdString; +{$ifdef MSWindows} +var + len:integer; +{$endif} +begin +{$ifdef MSWindows} + if DesignTimeCodePage=CP_ACP then begin + // No design-time codepage specified. Using runtime codepage instead. +{$endif} + Result:=s; +{$ifdef MSWindows} + end else begin + len:=length(s); + if len=0 then + Result:='' + else begin + SetLength (Result,len); + len:=MultiByteToWideChar(DesignTimeCodePage,0,pansichar(s),len,pwidechar(Result),len); + if len=0 then + raise EGGAnsi2WideConvError.Create ('Cannot convert string to widestring:'+sLineBreak+s); + SetLength (Result,len); + end; + end; +{$endif} +end; +{$endif} + +{$ifndef DELPHI5OROLDER} +{$ifndef UNICODE} +function TGnuGettextInstance.dngettext(const szDomain: DomainString; const singular, + plural: ansistring; Number: Integer): TranslatedUnicodeString; +begin + Result:=dngettext (szDomain, ansi2wideDTCP(singular), ansi2wideDTCP(plural), Number); +end; +{$endif} +{$endif} + +{ TClassMode } + +constructor TClassMode.Create; +begin + PropertiesToIgnore:=TStringList.Create; + PropertiesToIgnore.Sorted:=True; + PropertiesToIgnore.Duplicates:=dupError; + {$ifndef DELPHI5OROLDER} + PropertiesToIgnore.CaseSensitive:=False; + {$endif} +end; + +destructor TClassMode.Destroy; +begin + FreeAndNil (PropertiesToIgnore); + inherited; +end; + +{ TFileLocator } + +procedure TFileLocator.Analyze; +var + s:ansistring; + i:integer; + offset:int64; + fs:TFileStream; + fi:TEmbeddedFileInfo; + filename:FilenameString; +begin + s:='6637DB2E-62E1-4A60-AC19-C23867046A89'#0#0#0#0#0#0#0#0; + s:=MidStr(s,length(s)-7,8); + offset:=0; + for i:=8 downto 1 do + offset:=offset shl 8+ord(s[i]); + if offset=0 then + exit; + BaseDirectory:=ExtractFilePath(ExecutableFilename); + try + fs:=TFileStream.Create(ExecutableFilename,fmOpenRead or fmShareDenyNone); + try + while true do begin + fs.Seek(offset,soFromBeginning); + offset:=ReadInt64(fs); + if offset=0 then + exit; + fi:=TEmbeddedFileInfo.Create; + try + fi.Offset:=ReadInt64(fs); + fi.Size:=ReadInt64(fs); + SetLength (filename, offset-fs.position); + fs.ReadBuffer (filename[1],offset-fs.position); + filename:=trim(filename); + if PreferExternal and sysutils.fileexists(basedirectory+filename) then begin + // Disregard the internal version and use the external version instead + FreeAndNil (fi); + end else + filelist.AddObject(filename,fi); + except + FreeAndNil (fi); + raise; + end; + end; + finally + FreeAndNil (fs); + end; + except + {$ifdef DXGETTEXTDEBUG} + raise; + {$endif} + end; +end; + +constructor TFileLocator.Create; +begin + MoFilesCS:=TMultiReadExclusiveWriteSynchronizer.Create; + MoFiles:=TStringList.Create; + filelist:=TStringList.Create; + {$ifdef LINUX} + filelist.Duplicates:=dupError; + filelist.CaseSensitive:=True; + {$endif} + MoFiles.Sorted:=True; + {$ifndef DELPHI5OROLDER} + MoFiles.Duplicates:=dupError; + MoFiles.CaseSensitive:=False; + {$ifdef MSWINDOWS} + filelist.Duplicates:=dupError; + filelist.CaseSensitive:=False; + {$endif} + {$endif} + filelist.Sorted:=True; +end; + +destructor TFileLocator.Destroy; +begin + while filelist.count<>0 do begin + filelist.Objects[0].Free; + filelist.Delete (0); + end; + FreeAndNil (filelist); + FreeAndNil (MoFiles); + FreeAndNil (MoFilesCS); + inherited; +end; + +function TFileLocator.FileExists(filename: FilenameString): boolean; +var + idx:integer; +begin + if LeftStr(filename,length(basedirectory))=basedirectory then begin + // Cut off basedirectory if the file is located beneath that base directory + filename:=MidStr(filename,length(basedirectory)+1,maxint); + end; + Result:=filelist.Find(filename,idx); +end; + +function TFileLocator.GetMoFile(filename: FilenameString; DebugLogger:TDebugLogger): TMoFile; +var + fi:TEmbeddedFileInfo; + idx:integer; + idxname:FilenameString; + Offset, Size: Int64; + realfilename:FilenameString; +begin + // Find real filename + offset:=0; + size:=0; + realfilename:=filename; + if LeftStr(filename,length(basedirectory))=basedirectory then begin + filename:=MidStr(filename,length(basedirectory)+1,maxint); + idx:=filelist.IndexOf(filename); + if idx<>-1 then begin + fi:=filelist.Objects[idx] as TEmbeddedFileInfo; + realfilename:=ExecutableFilename; + offset:=fi.offset; + size:=fi.size; + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('Instead of '+filename+', using '+realfilename+' from offset '+IntTostr(offset)+', size '+IntToStr(size)); + {$endif} + end; + end; + + + {$ifdef DXGETTEXTDEBUG} + DebugLogger ('Reading .mo data from file '''+filename+''''); + {$endif} + + // Find TMoFile object + MoFilesCS.BeginWrite; + try + idxname:=realfilename+' //\\ '+IntToStr(offset); + if MoFiles.Find(idxname, idx) then begin + Result:=MoFiles.Objects[idx] as TMoFile; + end else begin + Result:=TMoFile.Create (realfilename, Offset, Size); + MoFiles.AddObject(idxname, Result); + end; + Inc (Result.Users); + finally + MoFilesCS.EndWrite; + end; +end; + +function TFileLocator.ReadInt64(str: TStream): int64; +begin + Assert (sizeof(Result)=8); + str.ReadBuffer(Result,8); +end; + +procedure TFileLocator.ReleaseMoFile(mofile: TMoFile); +var + i:integer; +begin + Assert (mofile<>nil); + + MoFilesCS.BeginWrite; + try + dec (mofile.Users); + if mofile.Users<=0 then begin + i:=MoFiles.Count-1; + while i>=0 do begin + if MoFiles.Objects[i]=mofile then begin + MoFiles.Delete(i); + FreeAndNil (mofile); + break; + end; + dec (i); + end; + end; + finally + MoFilesCS.EndWrite; + end; +end; + +{ TTP_Retranslator } + +constructor TTP_Retranslator.Create; +begin + list:=TList.Create; +end; + +destructor TTP_Retranslator.Destroy; +var + i:integer; +begin + for i:=0 to list.Count-1 do + TObject(list.Items[i]).Free; + FreeAndNil (list); + inherited; +end; + +procedure TTP_Retranslator.Execute; +var + i:integer; + sl:TStrings; + item:TTP_RetranslatorItem; + newvalue:TranslatedUnicodeString; + comp:TGnuGettextComponentMarker; + {$ifndef DELPHI5OROLDER} + ppi:PPropInfo; + {$endif} +begin + for i:=0 to list.Count-1 do begin + item:=TObject(list.items[i]) as TTP_RetranslatorItem; + if item.obj is TComponent then begin + comp:=TComponent(item.obj).FindComponent('GNUgettextMarker') as TGnuGettextComponentMarker; + if Assigned(comp) and (self<>comp.Retranslator) then begin + comp.Retranslator.Execute; + Continue; + end; + end; + if item.obj is TStrings then begin + // Since we don't know the order of items in sl, and don't have + // the original .Objects[] anywhere, we cannot anticipate anything + // about the current sl.Strings[] and sl.Objects[] values. We therefore + // have to discard both values. We can, however, set the original .Strings[] + // value into the list and retranslate that. + sl:=TStringList.Create; + try + sl.Text:=item.OldValue; + Instance.TranslateStrings(sl,textdomain); + (item.obj as TStrings).BeginUpdate; + try + (item.obj as TStrings).Text:=sl.Text; + finally + (item.obj as TStrings).EndUpdate; + end; + finally + FreeAndNil (sl); + end; + end else begin + newValue:=instance.dgettext(textdomain,item.OldValue); + {$ifdef DELPHI5OROLDER} + SetStrProp(item.obj, item.PropName, newValue); + {$endif} + {$ifndef DELPHI5OROLDER} + ppi:=GetPropInfo(item.obj, item.Propname); + if ppi<>nil then begin + SetWideStrProp(item.obj, ppi, newValue); + end else begin + {$ifdef DXGETTEXTDEBUG} + Instance.DebugWriteln ('ERROR: On retranslation, property disappeared: '+item.Propname+' for object of type '+item.obj.ClassName); + {$endif} + end; + {$endif} + end; + end; +end; + +procedure TTP_Retranslator.Remember(obj: TObject; PropName: ComponentNameString; + OldValue: TranslatedUnicodeString); +var + item:TTP_RetranslatorItem; +begin + item:=TTP_RetranslatorItem.Create; + item.obj:=obj; + item.Propname:=Propname; + item.OldValue:=OldValue; + list.Add(item); +end; + +{ TGnuGettextComponentMarker } + +destructor TGnuGettextComponentMarker.Destroy; +begin + FreeAndNil (Retranslator); + inherited; +end; + +{ THook } + +constructor THook.Create(OldProcedure, NewProcedure: pointer; FollowJump:boolean=false); +{ Idea and original code from Igor Siticov } +{ Modified by Jacques Garcia Vazquez and Lars Dybdahl } +begin + {$ifndef CPU386} + raise Exception.Create ('This procedure only works on Intel i386 compatible processors.'); + {$endif} + + oldproc:=OldProcedure; + newproc:=NewProcedure; + + Reset (FollowJump); +end; + +destructor THook.Destroy; +begin + Shutdown; + inherited; +end; + +procedure THook.Disable; +begin + Assert (PatchPosition<>nil,'Patch position in THook was nil when Disable was called'); + PatchPosition[0]:=Original[0]; + PatchPosition[1]:=Original[1]; + PatchPosition[2]:=Original[2]; + PatchPosition[3]:=Original[3]; + PatchPosition[4]:=Original[4]; +end; + +procedure THook.Enable; +begin + Assert (PatchPosition<>nil,'Patch position in THook was nil when Enable was called'); + PatchPosition[0]:=Patch[0]; + PatchPosition[1]:=Patch[1]; + PatchPosition[2]:=Patch[2]; + PatchPosition[3]:=Patch[3]; + PatchPosition[4]:=Patch[4]; +end; + +procedure THook.Reset(FollowJump: boolean); +var + offset:integer; + {$ifdef LINUX} + p:pointer; + pagesize:integer; + {$endif} + {$ifdef MSWindows} + ov: cardinal; + {$endif} +begin + if PatchPosition<>nil then + Shutdown; + + patchPosition := OldProc; + if FollowJump and (Word(OldProc^) = $25FF) then begin + // This finds the correct procedure if a virtual jump has been inserted + // at the procedure address + Inc(Integer(patchPosition), 2); // skip the jump + patchPosition := pansiChar(Pointer(pointer(patchPosition)^)^); + end; + offset:=integer(NewProc)-integer(pointer(patchPosition))-5; + + Patch[0] := ansichar($E9); + Patch[1] := ansichar(offset and 255); + Patch[2] := ansichar((offset shr 8) and 255); + Patch[3] := ansichar((offset shr 16) and 255); + Patch[4] := ansichar((offset shr 24) and 255); + + Original[0]:=PatchPosition[0]; + Original[1]:=PatchPosition[1]; + Original[2]:=PatchPosition[2]; + Original[3]:=PatchPosition[3]; + Original[4]:=PatchPosition[4]; + + {$ifdef MSWINDOWS} + if not VirtualProtect(Pointer(PatchPosition), 5, PAGE_EXECUTE_READWRITE, @ov) then + RaiseLastOSError; + {$endif} + {$ifdef LINUX} + pageSize:=sysconf (_SC_PAGE_SIZE); + p:=pointer(PatchPosition); + p:=pointer((integer(p) + PAGESIZE-1) and not (PAGESIZE-1) - pageSize); + if mprotect (p, pageSize, PROT_READ + PROT_WRITE + PROT_EXEC) <> 0 then + RaiseLastOSError; + {$endif} +end; + +procedure THook.Shutdown; +begin + Disable; + PatchPosition:=nil; +end; + +procedure HookIntoResourceStrings (enabled:boolean=true; SupportPackages:boolean=false); +begin + HookLoadResString.Reset (SupportPackages); + HookLoadStr.Reset (SupportPackages); + HookFmtLoadStr.Reset (SupportPackages); + if enabled then begin + HookLoadResString.Enable; + HookLoadStr.Enable; + HookFmtLoadStr.Enable; + end; +end; + +{ TMoFile } + +function TMoFile.autoswap32(i: cardinal): cardinal; +var + cnv1, cnv2: + record + case integer of + 0: (arr: array[0..3] of byte); + 1: (int: cardinal); + end; +begin + if doswap then begin + cnv1.int := i; + cnv2.arr[0] := cnv1.arr[3]; + cnv2.arr[1] := cnv1.arr[2]; + cnv2.arr[2] := cnv1.arr[1]; + cnv2.arr[3] := cnv1.arr[0]; + Result := cnv2.int; + end else + Result := i; +end; + +function TMoFile.CardinalInMem(baseptr: PansiChar; Offset: Cardinal): Cardinal; +var pc:^Cardinal; +begin + inc (baseptr,offset); + pc:=Pointer(baseptr); + Result:=pc^; + if doswap then + autoswap32(Result); +end; + +constructor TMoFile.Create(filename: FilenameString; Offset,Size:int64); +var + i:cardinal; + nn:integer; + {$ifdef linux} + mofile:TFileStream; + {$endif} +begin + if sizeof(i) <> 4 then + raise EGGProgrammingError.Create('TDomain in gnugettext is written for an architecture that has 32 bit integers.'); + + {$ifdef mswindows} + // Map the mo file into memory and let the operating system decide how to cache + mo:=createfile (PChar(filename),GENERIC_READ,FILE_SHARE_READ,nil,OPEN_EXISTING,0,0); + if mo=INVALID_HANDLE_VALUE then + raise EGGIOError.Create ('Cannot open file '+filename); + momapping:=CreateFileMapping (mo, nil, PAGE_READONLY, 0, 0, nil); + if momapping=0 then + raise EGGIOError.Create ('Cannot create memory map on file '+filename); + momemoryHandle:=MapViewOfFile (momapping,FILE_MAP_READ,0,0,0); + if momemoryHandle=nil then begin + raise EGGIOError.Create ('Cannot map file '+filename+' into memory. Reason: '+GetLastWinError); + end; + momemory:=momemoryHandle+offset; + {$endif} + {$ifdef linux} + // Read the whole file into memory + mofile:=TFileStream.Create (filename, fmOpenRead or fmShareDenyNone); + try + if size=0 then + size:=mofile.Size; + Getmem (momemoryHandle,size); + momemory:=momemoryHandle; + mofile.Seek(offset,soFromBeginning); + mofile.ReadBuffer(momemory^,size); + finally + FreeAndNil (mofile); + end; + {$endif} + + // Check the magic number + doswap:=False; + i:=CardinalInMem(momemory,0); + if (i <> $950412DE) and (i <> $DE120495) then + raise EGGIOError.Create('This file is not a valid GNU gettext mo file: ' + filename); + doswap := (i = $DE120495); + + + // Find the positions in the file according to the file format spec + CardinalInMem(momemory,4); // Read the version number, but don't use it for anything. + N:=CardinalInMem(momemory,8); // Get string count + O:=CardinalInMem(momemory,12); // Get offset of original strings + T:=CardinalInMem(momemory,16); // Get offset of translated strings + + // Calculate start conditions for a binary search + nn := N; + startindex := 1; + while nn <> 0 do begin + nn := nn shr 1; + startindex := startindex shl 1; + end; + startindex := startindex shr 1; + startstep := startindex shr 1; +end; + +destructor TMoFile.Destroy; +begin + {$ifdef mswindows} + UnMapViewOfFile (momemoryHandle); + CloseHandle (momapping); + CloseHandle (mo); + {$endif} + {$ifdef linux} + FreeMem (momemoryHandle); + {$endif} + inherited; +end; + +function TMoFile.gettext(const msgid: RawUtf8String;var found:boolean): RawUtf8String; +var + i, step: cardinal; + offset, pos: cardinal; + CompareResult:integer; + msgidptr,a,b:PAnsiChar; + abidx:integer; + size, msgidsize:integer; +begin + found:=false; + msgidptr:=PAnsiChar(msgid); + msgidsize:=length(msgid); + + // Do binary search + i:=startindex; + step:=startstep; + while true do begin + // Get string for index i + pos:=O+8*(i-1); + offset:=CardinalInMem (momemory,pos+4); + size:=CardinalInMem (momemory,pos); + a:=msgidptr; + b:=momemory+offset; + abidx:=size; + if msgidsize0 do begin + CompareResult:=integer(byte(a^))-integer(byte(b^)); + if CompareResult<>0 then + break; + dec (abidx); + inc (a); + inc (b); + end; + if CompareResult=0 then + CompareResult:=msgidsize-size; + if CompareResult=0 then begin // msgid=s + // Found the msgid + pos:=T+8*(i-1); + offset:=CardinalInMem (momemory,pos+4); + size:=CardinalInMem (momemory,pos); + SetString (Result,momemory+offset,size); + found:=True; + break; + end; + if step=0 then begin + // Not found + Result:=msgid; + break; + end; + if CompareResult<0 then begin // msgids + i := i + step; + if i > N then + i := N; + step := step shr 1; + end; + end; +end; + +var + param0:string; + +initialization + {$ifdef DXGETTEXTDEBUG} + {$ifdef MSWINDOWS} + MessageBox (0,'gnugettext.pas debugging is enabled. Turn it off before releasing this piece of software.','Information',MB_OK); + {$endif} + {$ifdef LINUX} + writeln (stderr,'gnugettext.pas debugging is enabled. Turn it off before releasing this piece of software.'); + {$endif} + {$endif} + {$ifdef FPC} + {$ifdef LINUX} + SetLocale(LC_ALL, ''); + SetCWidestringManager; + {$endif LINUX} + {$endif FPC} + if IsLibrary then begin + // Get DLL/shared object filename + SetLength (ExecutableFilename,300); + {$ifdef MSWINDOWS} + SetLength (ExecutableFilename,GetModuleFileName(FindClassHInstance(TGnuGettextInstance), PChar(ExecutableFilename), length(ExecutableFilename))); + {$else} + SetLength (ExecutableFilename,GetModuleFileName(0, PAnsiChar(ExecutableFilename), length(ExecutableFilename))); + {$endif} + end else + ExecutableFilename:=Paramstr(0); + FileLocator:=TFileLocator.Create; + FileLocator.Analyze; + ResourceStringDomainList:=TStringList.Create; + ResourceStringDomainList.Add(DefaultTextDomain); + ResourceStringDomainListCS:=TMultiReadExclusiveWriteSynchronizer.Create; + DefaultInstance:=TGnuGettextInstance.Create; + {$ifdef MSWINDOWS} + Win32PlatformIsUnicode := (Win32Platform = VER_PLATFORM_WIN32_NT); + {$endif} + + // replace Borlands LoadResString with gettext enabled version: + {$ifdef UNICODE} + HookLoadResString:=THook.Create (@system.LoadResString, @LoadResStringW); + {$else} + HookLoadResString:=THook.Create (@system.LoadResString, @LoadResStringA); + {$endif} + HookLoadStr:=THook.Create (@sysutils.LoadStr, @SysUtilsLoadStr); + HookFmtLoadStr:=THook.Create (@sysutils.FmtLoadStr, @SysUtilsFmtLoadStr); + param0:=lowercase(extractfilename(paramstr(0))); + if (param0<>'delphi32.exe') and (param0<>'kylix') and (param0<>'bds.exe') then + HookIntoResourceStrings (AutoCreateHooks,false); + param0:=''; + +finalization + FreeAndNil (DefaultInstance); + FreeAndNil (ResourceStringDomainListCS); + FreeAndNil (ResourceStringDomainList); + FreeAndNil (HookFmtLoadStr); + FreeAndNil (HookLoadStr); + FreeAndNil (HookLoadResString); + FreeAndNil (FileLocator); + +end. + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/langcodes.txt b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/langcodes.txt new file mode 100644 index 0000000..789face --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/langcodes.txt @@ -0,0 +1,15 @@ +[de] German +[en] English +[es] Spanish +[fi] Finnish +[fr] French +[ja] Japanese +[ko] Korean +[nl] Dutch +[pt_BR] Brazilian Portuguese +[ru] Russian +[sr_Cyrillic] Serbian Cyrillic +[sr_Latin] Serbian Latin +[sv] Swedish +[tr] Turkish +[zh_CN] Chinese \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/de/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/de/LC_MESSAGES/default.mo new file mode 100644 index 0000000..79cd84e Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/de/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/de/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/de/LC_MESSAGES/default.po new file mode 100644 index 0000000..3aee8a9 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/de/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2005-12-29 22:43+0100\n" +"Last-Translator: Thomas Speck \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Standard" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Neu" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Öffnen" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Speichern" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Ausschneiden" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Kopieren" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Einfügen" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Suchen" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Themen" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Format" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Schriftname" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Schriftgröße" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Fett" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "Kursiv" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Unterstrichen" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Menü" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Datei" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Öffnen..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Drucken" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Beenden" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "B&earbeiten" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Alles markieren" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Format" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Links ausrichten" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Zentriert" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Rechts ausrichten" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "Aufzählungszeichen" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Sortierte Aufzählungszeichen" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Ansicht" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "&Navigationsbereich einrichten" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "&Kommandoprotokoll" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Optionen" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Hilfe" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Toolbars" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "&Standardleiste" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "&Layoutleiste" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "&Formatleiste" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "&Navigationsleiste" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "&Info" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Layouts" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Kommandoprotokoll" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Anpassungsoptionen" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Hilfe" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Rechtsklick auf die Leiste, um das Abspielen zu beginnen" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Navigation" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Zurück" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Vor" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Aktualisieren" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Stop" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Suchen" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Dateien" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Bearbeiten" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Favoriten" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "Anpassung" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Anpassen..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Eingebettetes Anpassen..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Optionen" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Eigenschaften" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Druckereinstellungen" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "Chronik" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Favoriten" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Anpassungsprogramm" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "OK" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Abbrechen" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Übernehmen" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Speichere Layout" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Speichere aktuelles Layout als:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Ausgeführt" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/default.po new file mode 100644 index 0000000..f9c44d4 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/default.po @@ -0,0 +1,497 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2005-08-09 16:55\n" +"Last-Translator: Somebody \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#: Unit1.dfm:37 +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#: Unit1.dfm:159 +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:1559 +msgid "New" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#: Unit1.dfm:45 +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#: Unit1.dfm:167 +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#: Unit1.dfm:318 +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:1573 +msgid "Save" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#: Unit1.dfm:51 +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#: Unit1.dfm:184 +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#: Unit1.dfm:55 +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#: Unit1.dfm:188 +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#: Unit1.dfm:60 +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#: Unit1.dfm:192 +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#: Unit1.dfm:67 +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#: Unit1.dfm:206 +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:1612 +msgid "Find" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "" + +#. Form1..SpTBXDock1..tbFormat..Caption +#: Unit1.dfm:99 +#. Form1..TntActionList1..aBold..Category +#: Unit1.dfm:1618 +#. Form1..TntActionList1..aItalic..Category +#: Unit1.dfm:1625 +#. Form1..TntActionList1..aUnderline..Category +#: Unit1.dfm:1632 +#. Form1..TntActionList1..aLeftJustify..Category +#: Unit1.dfm:1639 +#. Form1..TntActionList1..aRightJustify..Category +#: Unit1.dfm:1645 +#. Form1..TntActionList1..aCentered..Category +#: Unit1.dfm:1651 +#. Form1..TntActionList1..aBullets..Category +#: Unit1.dfm:1657 +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:1663 +msgid "Format" +msgstr "" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#: Unit1.dfm:132 +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#: Unit1.dfm:213 +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#: Unit1.dfm:136 +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#: Unit1.dfm:217 +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#: Unit1.dfm:140 +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#: Unit1.dfm:221 +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#: Unit1.dfm:163 +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#: Unit1.dfm:171 +#. Form1..TntActionList1..aPrint..Caption +#: Unit1.dfm:1670 +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:1744 +msgid "Print" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#: Unit1.dfm:177 +#. Form1..TntActionList1..aExit..Caption +#: Unit1.dfm:1580 +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#: Unit1.dfm:198 +#. Form1..TntActionList1..aSelectAll..Caption +#: Unit1.dfm:1606 +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#: Unit1.dfm:227 +#. Form1..TntActionList1..aLeftJustify..Caption +#: Unit1.dfm:1640 +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#: Unit1.dfm:231 +#. Form1..TntActionList1..aCentered..Caption +#: Unit1.dfm:1652 +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#: Unit1.dfm:235 +#. Form1..TntActionList1..aRightJustify..Caption +#: Unit1.dfm:1646 +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#: Unit1.dfm:241 +#. Form1..TntActionList1..aBullets..Caption +#: Unit1.dfm:1658 +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#: Unit1.dfm:245 +#. Form1..TntActionList1..aNumberedBullets..Caption +#: Unit1.dfm:1664 +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#: Unit1.dfm:262 +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#: Unit1.dfm:286 +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:288 +msgid "&Help" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#: Unit1.dfm:298 +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#: Unit1.dfm:305 +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#: Unit1.dfm:402 +#. Form1..TntActionList1..aBack..Category +#: Unit1.dfm:1675 +#. Form1..TntActionList1..aForward..Category +#: Unit1.dfm:1681 +#. Form1..TntActionList1..aStop..Category +#: Unit1.dfm:1687 +#. Form1..TntActionList1..aRefresh..Category +#: Unit1.dfm:1693 +#. Form1..TntActionList1..aSearch..Category +#: Unit1.dfm:1699 +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#: Unit1.dfm:409 +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:1676 +msgid "Back" +msgstr "" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#: Unit1.dfm:413 +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#: Unit1.dfm:417 +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#: Unit1.dfm:421 +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#: Unit1.dfm:425 +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:1700 +msgid "Search" +msgstr "" + +#. Form1..TntActionList1..aNew..Category +#: Unit1.dfm:1558 +#. Form1..TntActionList1..aOpen..Category +#: Unit1.dfm:1565 +#. Form1..TntActionList1..aSave..Category +#: Unit1.dfm:1572 +#. Form1..TntActionList1..aExit..Category +#: Unit1.dfm:1579 +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1669 +msgid "Files" +msgstr "" + +#. Form1..TntActionList1..aCut..Category +#: Unit1.dfm:1584 +#. Form1..TntActionList1..aCopy..Category +#: Unit1.dfm:1591 +#. Form1..TntActionList1..aPaste..Category +#: Unit1.dfm:1598 +#. Form1..TntActionList1..aSelectAll..Category +#: Unit1.dfm:1605 +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "" + +#. Form1..TntActionList1..aFavs..Caption +#: Unit1.dfm:1706 +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "" + +#. Form1..TntActionList1..aCustomize..Category +#: Unit1.dfm:1711 +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "" + +#. Form1..TntActionList1..aCustomize..Caption +#: Unit1.dfm:1712 +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "" + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#: Unit1.dfm:1717 +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "" + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#: Unit2.dfm:85 +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/es/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/es/LC_MESSAGES/default.mo new file mode 100644 index 0000000..5980c53 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/es/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/es/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/es/LC_MESSAGES/default.po new file mode 100644 index 0000000..18306a4 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/es/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2005-08-09 17:23-0300\n" +"Last-Translator: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Estándar" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Nuevo" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Abrir" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Guardar" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Cortar" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Copiar" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Pegar" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Buscar" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Temas" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Formato" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Fuente" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Tamaño" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Negrita" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "Italica" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Subrayado" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Menu" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Archivo" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Abrir..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Imprimir" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Salir" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "&Editar" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Seleccionar todo" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Formato" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Justificar texto a la izquierda" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Centrado" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Justificar texto a la derecha" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "Viñetas" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Viñetas numeradas" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Vista" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "&Barras laterales" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "Registro de &comandos" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Opciones" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "A&yuda" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Barra de herramientas" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "Barra &estándar" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "Barra de &disposición" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "Barra de &formato" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "Barra de &navegación" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "&Acerca de..." + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Disposición" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Registro de comandos" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Opciones de personalizador" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Ayuda" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Click derecho en las barras de herramientas para comenzar" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Navegación" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Atrás" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Adelante" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Actualizar" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Detener" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Buscar" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Archivos" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Editar" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Favoritos" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "Personalización de barra de herramientas" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Personalizar..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Personalizar incrustado..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Opciones" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Propiedades" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Configurar página" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "Historial" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Favoritos" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Personalizador" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "Aceptar" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Cancelar" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Aplicar" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Guardar disposición" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Guardar disposición como:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Ejecutado" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fi/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fi/LC_MESSAGES/default.mo new file mode 100644 index 0000000..0728e5a Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fi/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fi/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fi/LC_MESSAGES/default.po new file mode 100644 index 0000000..528d413 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fi/LC_MESSAGES/default.po @@ -0,0 +1,497 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2006-02-03 00:41-0300\n" +"Last-Translator: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Vakio" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Uusi" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Avaa" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Tallenna" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Leikkaa" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Kopioi" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Liitä" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Etsi" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Teemat" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Muotoilu" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Fontin nimi" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Fontin koko" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Lihavoitu" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "Keno" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Alleviivattu" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Valikko" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Tiedosto" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Avaa..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Tulosta" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Poistu" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "&Muokkaa" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Valitse kaikki" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Muotoile" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Tasaa vasemmalle" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Keskitetty" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Tasaa oikealle" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "luettelomerkit" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Numeroidut luettelomerkit" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Näytä" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "Sivupalkki" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "&Komentoloki" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Asetukset" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Ohje" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Työkalurivit" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "&Vakio työkalurivi" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "&Asettelu työkalurivi" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "&Muotoilu työkalurivi" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "&Navigointi työkalurivi" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "&Tietoja" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Asettelut" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Komentoloki" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Mukautuksen asetukset" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Ohje" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Aloita pelaaminen oikeaklikkaamalla työkalurivejä" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Navigointi" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Takaisin" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Eteenpäin" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Päivitä" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Lopeta" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Etsi" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Tiedostot" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Muokkaa" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Kirjanmerkit" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "Mukautus" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Mukauta..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Liitetty mukautus" + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Asetukset" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Ominaisuudet" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Sivun asetukset" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "Historia" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Kirjanmerkit" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Mukauttaja" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "OK" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Peruuta" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Käytä" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Tallenna asettelu" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Tallenna nykyinen asettelu nimellä:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Suoritettu" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fr/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fr/LC_MESSAGES/default.mo new file mode 100644 index 0000000..a93a540 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fr/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fr/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fr/LC_MESSAGES/default.po new file mode 100644 index 0000000..e32c8d8 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/fr/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2005-10-06 19:10-0300\n" +"Last-Translator: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Standard" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Nouveau" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Ouvrir" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Enregistrer" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Couper" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Copier" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Coller" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Chercher" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Thèmes" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Format" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Nom" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Taille" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Gras" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "Italique" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Souligné" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Menu" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Fichier" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Ouvrir..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Imprimer" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Quitter" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "&Édition" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Tout sélectionner" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Format" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Aligné a gauche" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Centré" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Aligné a droite" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "Puces" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Numérotation" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Affichage" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "Barre &latérale" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "Log Commandes" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Options" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Aide" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Barres d'outils" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "Barre d'outil &Standard" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "Barre d'outil &Disposition" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "Barre d'outil &Format" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "Barre d'outil &Navigation" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "À &propos..." + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Disposition" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Log commandes" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Options de personnalisation" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Aide" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Cliquer avec le bouton droit sur une barre d'outil pour la personnaliser" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Navigation" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Précédent" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Suivant" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Rafraîchir" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Arrêter" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Chercher" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Fichiers" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Édition" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Favoris" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "Personnalisation" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Personnaliser..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "" + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Options" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Propriétés" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Configurer l'impression" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "Historique" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Favoris" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Personnalisation" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "OK" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Annuler" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Appliquer" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Enregistrer disposition" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Enregistrer disposition sous:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Exécuté" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ignore.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ignore.po new file mode 100644 index 0000000..eec136a --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ignore.po @@ -0,0 +1,62 @@ +#. Form1..SpTBXTabControl1..SpTBXTabItem2..CaptionW +#: Unit1.dfm:445 +#. Form1..SpTBXTabControl1..SpTBXTabSheet2..Caption +#: Unit1.dfm:452 +msgid "Advanced Techniques.txt" +msgstr "" + +#. Form1..SpTBXTabControl1..SpTBXTabItem1..CaptionW +#: Unit1.dfm:441 +#. Form1..SpTBXTabControl1..SpTBXTabSheet1..Caption +#: Unit1.dfm:471 +msgid "FAQ.txt" +msgstr "" + +# Doesn't look like text +#. Form1..Caption +#: Unit1.dfm:6 +msgid "Form1" +msgstr "" + +# Seems like a Font.Name extract +#. Form1..Font.Name +#: Unit1.dfm:11 +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..LinkFont.Name +#: Unit1.dfm:387 +#. Form2..Font.Name +#: Unit2.dfm:14 +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..LinkFont.Name +#: Unit2.dfm:129 +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..LinkFont.Name +#: Unit2.dfm:144 +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..LinkFont.Name +#: Unit2.dfm:159 +#. Form2..LeftPanel..TitlePanel..LinkFont.Name +#: Unit2.dfm:182 +msgid "MS Shell Dlg 2" +msgstr "" + +# Doesn't look like text +#. Form1..SpTBXTabControl1..SpTBXTabSheet1..TabItem +#: Unit1.dfm:473 +msgid "SpTBXTabItem1" +msgstr "" + +# Doesn't look like text +#. Form1..SpTBXTabControl1..SpTBXTabSheet2..TabItem +#: Unit1.dfm:454 +msgid "SpTBXTabItem2" +msgstr "" + +# Doesn't look like text +#. Form2..SpTBXDock1..SpTBXToolbar1..Caption +#: Unit2.dfm:32 +msgid "SpTBXToolbar1" +msgstr "" + +# Seems like a Font.Name extract +#. Form2..LeftPanel..TitlePanel..Font.Name +#: Unit2.dfm:175 +msgid "Tahoma" +msgstr "" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ja/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ja/LC_MESSAGES/default.mo new file mode 100644 index 0000000..0118be8 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ja/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ja/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ja/LC_MESSAGES/default.po new file mode 100644 index 0000000..3ad9fad --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ja/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2008-09-13 07:16+0900\n" +"Last-Translator: TIMEFUL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "標準" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "æ–°è¦" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "é–‹ã" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "ä¿å­˜" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "切りå–り" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "コピー" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "貼り付ã‘" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "検索" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "テーマ" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "書å¼" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "フォントå" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "フォントサイズ" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "太字" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "斜体" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "下線" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "メニュー" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "ファイル(&F)" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "é–‹ã..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "å°åˆ·" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "終了" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "編集(&E)" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "ã™ã¹ã¦é¸æŠž" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "書å¼(&F)" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "左寄ã›" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "中央" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "å³å¯„ã›" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "ç®‡æ¡æ›¸ã" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "段è½ç•ªå·" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "表示(&V)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "サイドãƒãƒ¼(&S)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "コマンドログ(&C)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "オプション(&O)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "ヘルプ(&H)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "ツールãƒãƒ¼(&T)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "標準ãƒãƒ¼(&S)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "レイアウトãƒãƒ¼(&L)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "書å¼ãƒãƒ¼(&F)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "ナビゲーションãƒãƒ¼(&N)" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "情報(&A)" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "レイアウト" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "コマンド ログ" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "カスタマイザ オプション" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "ヘルプ" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "ãƒãƒ¼ã‚’å³ã‚¯ãƒªãƒƒã‚¯ã§é–‹å§‹ã—ã¾ã™" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "ナビゲーション" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "戻る" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "進む" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "リフレッシュ" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "åœæ­¢" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "検索" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "ファイル" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "編集" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "ãŠæ°—ã«å…¥ã‚Š" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "カスタマイゼーション" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "カスタマイズ..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "カスタマイズ 埋ã‚è¾¼ã¿..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "オプション" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "プロパティ" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "プリンタã®è¨­å®š" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "履歴" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "ãŠæ°—ã«å…¥ã‚Š" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "カスタマイザ" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "OK" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "キャンセル" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "é©ç”¨" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "レイアウトä¿å­˜" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "レイアウトã«åå‰ã‚’付ã‘ã¦ä¿å­˜" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "実行完了" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ko/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ko/LC_MESSAGES/default.mo new file mode 100644 index 0000000..12c822e Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ko/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ko/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ko/LC_MESSAGES/default.po new file mode 100644 index 0000000..fb1294f --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ko/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2005-08-09 17:45-0300\n" +"Last-Translator: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "새로운" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "열기" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "저장" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "잘ë¼ë‚´ê¸°" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "복사" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "붙여넣기" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "찾기" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "테마" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "형ì‹" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "ê¸€ìž í¬ê¸°" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "굵게" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "기울임" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "밑줄" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "파ì¼(&F)" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "열기(&O)" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "ì¸ì‡„" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "편집(&E)" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "ëª¨ë‘ ì„ íƒ(A)" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "형ì‹(&F)" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "왼쪽으로 ì •ë ¬" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "오른쪽으로 ì •ë ¬" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "보기(&V)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "가장ìžë¦¬ì¤„(&S)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "옵션(&O)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "ë„움ë§(&H)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "ì •ë³´(&A)" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "ë„움ë§" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "뒤로" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "앞으로" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "새로고침" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "멈추기" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "검색" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "파ì¼" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "편집" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "" + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "" + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "옵션" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "히스토리" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "확ì¸" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "취소" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/nl/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/nl/LC_MESSAGES/default.mo new file mode 100644 index 0000000..350e6f7 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/nl/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/nl/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/nl/LC_MESSAGES/default.po new file mode 100644 index 0000000..42a48c9 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/nl/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2009-04-02 13:16-0300\n" +"Last-Translator: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Standaard" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Nieuw" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Open" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Opslaan" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Knippen" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Kopiëren" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Plakken" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Zoeken" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Thema's" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Opmaak" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Font Naam" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Font Grootte" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Vet" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "Cursief" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Onderstreept" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Menu" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Bestand" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Open..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Afdrukken" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Afsluiten" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "Be&werken" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Alles Selecteren" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Opmaak" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Links Uitlijnen" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Centreren" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Rechts Uitlijnen" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "Opsommingstekens" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Nummering" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "Beel&d" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "&Zijbalk" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "&Commando's Log" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Opties" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Help" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Werkbalken" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "&Standaard Werkbalk" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "&Weergave Werkbalk" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "&Opmaak Werkbalk" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "&Navigatie Werkbalk" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "&Over" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Weergaven" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Opdrachtenlog" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Opties voor Aanpassingen" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Help" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Rechtsklik op de werkbalk om af te spelen" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Navigatie" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Terug" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Vooruit" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Vernieuwen" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Stoppen" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Zoeken" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Bestanden" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Bewerken" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Favs" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "Aanpassingen" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Aanpassen..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Geïntegreerd Aanpassen..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Opties" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Eigenschappen" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Pagina Instellingen" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "Geschiedenis" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Favorieten" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Aanpassen" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "OK" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Annuleren" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Toepassen" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Weergave Opslaan" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Huidige weergave opslaan als:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Uitgevoerd" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/pt_BR/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/pt_BR/LC_MESSAGES/default.mo new file mode 100644 index 0000000..015377d Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/pt_BR/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/pt_BR/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/pt_BR/LC_MESSAGES/default.po new file mode 100644 index 0000000..cda389f --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/pt_BR/LC_MESSAGES/default.po @@ -0,0 +1,499 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2007-12-27 19:22-0300\n" +"Last-Translator: Mauricio Magnani \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Padrão" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Novo" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Abrir" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Salvar" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Recortar" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Copiar" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Colar" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Localizar" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Temas" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Formatação" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Fonte" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Tamanho" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Negrito" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "Itálico" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Sublinhado" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Menu" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Arquivo" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Abrir..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Imprimir" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Sair" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "&Editar" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Selecionar Tudo" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Formatar" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Alinhar à esquerda" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Centralizar" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Alinhar à direita" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "Marcadores" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Numeração" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Exibir" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "Barra &Lateral" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "Registro de &Comandos" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Opções" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "Aj&uda" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Barras de Ferramentas" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "Barra &Padrão" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "Barra de &Disposições" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "Barra de &Formatação" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "Barra de &Navegação" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "&Sobre" + +# Though unusual, Disposição is a good translation in this case. Some editors keep the English term, others may prefer Arranjo, Ãrea de Trabalho or even Leiaute (Houaiss, c1965) +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Disposições" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Registro de Comandos" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Opções de Personalização" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Ajuda" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Clique nas barras com o botão direito para inciar animação" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Navegação" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Voltar" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Avançar" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Atualizar" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Parar" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Pesquisar" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Arquivos" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Editar" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Favoritos" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "Personalização" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Personalizar..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Personalizar encaixado..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Opções" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Propriedades" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Configurar página" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "Histórico" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Favoritos" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Personalização" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "OK" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Cancelar" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Aplicar" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Salvar disposição" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Salvar disposição atual como:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Executado" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ru/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ru/LC_MESSAGES/default.mo new file mode 100644 index 0000000..89827b9 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ru/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ru/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ru/LC_MESSAGES/default.po new file mode 100644 index 0000000..fdd39ec --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/ru/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2006-02-13 21:45-0300\n" +"Last-Translator: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Стандартное" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Ðовый" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Открыть" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Сохранить" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Вырезать" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Копировать" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Ð’Ñтавить" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "ПоиÑк" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Темы" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Формат" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Шрифт" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Размер шрифта" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Полужирный" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "КурÑив" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Подчёркнутый" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Меню" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Файл" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Открыть..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Печать" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Выйти" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "&Правка" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Выделить вÑÑ‘" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Формат" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "По ширине" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "По центру" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "По ширине" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "СпиÑок" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Ðумерованный ÑпиÑок" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Вид" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "Панель &задач" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "ИÑÑ‚Ð¾Ñ€Ð¸Ñ &команд" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Параметры" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Справка" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "Панели &инÑтрументов" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "&СтандартнаÑ" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "&РаÑположение" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "&Форматирование" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "&ÐавигациÑ" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "&О программе" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "РаÑположениÑ" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "ИÑÑ‚Ð¾Ñ€Ð¸Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "ÐšÐ¾Ð½Ñ„Ð¸Ð³ÑƒÑ€Ð°Ñ†Ð¸Ñ Ð½Ð°Ñтройки" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Справка" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "ИÑпользуйте контекÑтное меню панелей инÑтрументов" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "ÐавигациÑ" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Ðазад" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Вперёд" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Обновить" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Стоп" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "ПоиÑк" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr " файлы" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Правка" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Избранное" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "ÐаÑтройка" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "ÐаÑтройка..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Ð’ÑÑ‚Ñ€Ð¾ÐµÐ½Ð½Ð°Ñ Ð½Ð°Ñтройка..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Параметры" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "СвойÑтва" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Параметры Ñтраницы" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "ИÑториÑ" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Избранное" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "ÐаÑтройщик" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "OK" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Отмена" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Применить" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Сохранить раÑположение" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Сохранить текущее раÑположение как..." + +#: Unit1.pas:248 +msgid "Executed" +msgstr "выполнено" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Cyrillic/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Cyrillic/LC_MESSAGES/default.mo new file mode 100644 index 0000000..3098e82 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Cyrillic/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Cyrillic/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Cyrillic/LC_MESSAGES/default.po new file mode 100644 index 0000000..4a40d43 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Cyrillic/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2005-08-22 17:41-0300\n" +"Last-Translator: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Стандардно" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Ðово" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Отвори" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Сачувај" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "ИÑеци" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Копирај" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Ðалепи" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Ðађи" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Тема" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Формат" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Име фонта" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Величина фонта" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Подебљано" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "КоÑо" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Подвучено" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Мени" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Фајл" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Отвори..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Штампај" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Изађи" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "Ур&еђивање" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Селектуј Ñве" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Формат" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Поравнато лево" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Центрирано" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Поравнато деÑно" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "Тачке" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Бројеви" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Изглед" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "&Помоћни панели" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "&Дневник команди" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Опције" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Помоћ" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Палете алата" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "&Стандардна палета" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "Па&лета изгледа" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "Палета за &форматирање" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "&Ðавигациона палета" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "О прогр&аму" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Изгледи" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Дневник команди" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Опције алата за прилагођавање" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Помоћ" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Кликните деÑним таÑтером на палете алата да биÑте почели Ñа игром" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Ðавигација" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Ðазад" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Ðапред" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "ОÑвежи" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Стани" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Тражи" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Фајлови" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Уређивање" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Омиљено" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "Прилагођавање" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Прилагоди..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Прилагоди (угњеждено)..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Опције" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "СвојÑтва" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Подешавање Ñтране" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "ИÑторија" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Омиљено" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Ðлат за прилагођавање" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "У реду" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Поништи" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Примени" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Сачувај изглед" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Сачувај тренутни изглед као:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Извршено" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Latin/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Latin/LC_MESSAGES/default.mo new file mode 100644 index 0000000..5752d36 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Latin/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Latin/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Latin/LC_MESSAGES/default.po new file mode 100644 index 0000000..7d5b10d --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sr_Latin/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2005-08-19 11:44+0100\n" +"Last-Translator: Marko Binic \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Standardno" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Novo" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Otvori" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "SaÄuvaj" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Iseci" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Kopiraj" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Nalepi" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "NaÄ‘i" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Teme" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Format" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Ime fonta" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "VeliÄina fonta" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Podebljano" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "Koso" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "PodvuÄeno" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Meni" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Fajl" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Otvori..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Å tampaj" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "IzaÄ‘i" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "Ur&eÄ‘ivanje" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Selektuj sve" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Format" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Poravnato levo" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Centrirano" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Poravnato Desno" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "TaÄke" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Brojevi" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Izgled" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "&Pomoćni paneli" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "&Dnevnik komandi" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Opcije" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Pomoć" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Palete alata" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "&Standardna paleta" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "Pa&leta izgleda" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "Paleta za &formatiranje" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "&Navigaciona paleta" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "O progr&amu" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Izgledi" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Dnevnik komandi" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Opcije alata za prilagoÄ‘avanje" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Pomoć" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Kliknite desnim tasterom na palete alata da biste poÄeli sa igrom" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Navigacija" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Nazad" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "Napred" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Osveži" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Stani" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Traži" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Fajlovi" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "UreÄ‘ivanje" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Omiljeno" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "PrilagoÄ‘avanje" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Prilagodi..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Prilagodi (ugnježdeno)..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Opcije" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Svojstva" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "PodeÅ¡avanje strane" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "Istorija" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Omiljeno" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Alat za prilagoÄ‘avanje" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "U redu" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "PoniÅ¡ti" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Primeni" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "SaÄuvaj izgled" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "SaÄuvaj trenutni izgled kao:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "IzvrÅ¡eno" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sv/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sv/LC_MESSAGES/default.mo new file mode 100644 index 0000000..9f1a3ab Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sv/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sv/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sv/LC_MESSAGES/default.po new file mode 100644 index 0000000..cc2e970 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/sv/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2008-04-17 15:20+0100\n" +"Last-Translator: Mattias Andersson \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Standard" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Nytt" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Öppna" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Spara" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Klipp ut" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Kopiera" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Klistra in" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Sök" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Teman" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Formatera" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Teckensnitt" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Storlek" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Fet" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "Kursiv" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Understreck" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Meny" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Arkiv" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Öppna..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Skriv ut" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Avsluta" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "&Redigera" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Markera allt" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Formatera" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Vänsterjustera" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Centrera" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "Högerjustera" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "Punktlista" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Numrerad lista" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Visa" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "&Sidpanel" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "&Kommandohistorik" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Alternativ" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Hjälp" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Verktygsfält" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "&Standardfält" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "&Layoutfält" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "&Anpassa Verktygsfält" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "&Navigationsfält" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "&Om" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Layouter" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Kommandohistorik" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Alternativ" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Hjälp" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Högerklicka pÃ¥ verktygsfälten för att komma igÃ¥ng" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Navigation" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Tillbaka" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "FramÃ¥t" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Uppdatera" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Avbryt" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Sök" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Arkiv" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Redigera" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Favoriter" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "Anpassning" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "Anpassa..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Inbyggd Anpassning..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Alternativ" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Egenskaper" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Sidlayout" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "Historik" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Favoriter" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "Anpassa" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "OK" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Avbryt" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Verkställ" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Spara Layout" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Spara nuvarande layout som:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Exekverat" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/tr/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/tr/LC_MESSAGES/default.mo new file mode 100644 index 0000000..00b901f Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/tr/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/tr/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/tr/LC_MESSAGES/default.po new file mode 100644 index 0000000..f3a2cac --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/tr/LC_MESSAGES/default.po @@ -0,0 +1,498 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2008-05-07 18:01+0200\n" +"Last-Translator: Zylar \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "Standart" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mNew..CaptionW +#. Form1..TntActionList1..aNew..Caption +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "Yeni" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "Aç" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mFile..mSave..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayoutSave..CaptionW +#. Form1..TntActionList1..aSave..Caption +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "Kaydet" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCut..CaptionW +#. Form1..TntActionList1..aCut..Caption +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "Kes" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mCopy..CaptionW +#. Form1..TntActionList1..aCopy..Caption +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "Kopyala" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mPaste..CaptionW +#. Form1..TntActionList1..aPaste..Caption +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "Yapıştır" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mFind..CaptionW +#. Form1..TntActionList1..aFind..Caption +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "Ara" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "Temalar" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aBold..Category +#. Form1..TntActionList1..aItalic..Category +#. Form1..TntActionList1..aUnderline..Category +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aRightJustify..Category +#. Form1..TntActionList1..aCentered..Category +#. Form1..TntActionList1..aBullets..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "Biçim" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "Yazı Tipi Adı" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "Yazı Tipi Boyutu" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBold..CaptionW +#. Form1..TntActionList1..aBold..Caption +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "Kalın" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mItalic..CaptionW +#. Form1..TntActionList1..aItalic..Caption +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "İtalik" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mUnderline..CaptionW +#. Form1..TntActionList1..aUnderline..Caption +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "Altı Çizgili" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "Menü" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "&Dosya" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#. Form1..TntActionList1..aOpen..Caption +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "Aç..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#. Form1..TntActionList1..aPrint..Caption +#. Form1..SpTBXCustomizer1..cPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "Yazdır" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#. Form1..TntActionList1..aExit..Caption +#. Form1..SpTBXCustomizer1..cExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "Çıkış" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "&Düzelt" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#. Form1..TntActionList1..aSelectAll..Caption +#. Form1..SpTBXCustomizer1..cSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "Hepsini Seç" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "&Biçim" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#. Form1..TntActionList1..aLeftJustify..Caption +#. Form1..SpTBXCustomizer1..cLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "Sola Dayalı" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#. Form1..TntActionList1..aCentered..Caption +#. Form1..SpTBXCustomizer1..cCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "Ortalanmış" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#. Form1..TntActionList1..aRightJustify..Caption +#. Form1..SpTBXCustomizer1..cRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "SaÄŸa Dayalı" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#. Form1..TntActionList1..aBullets..Caption +#. Form1..SpTBXCustomizer1..cBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "Simgeler" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#. Form1..TntActionList1..aNumberedBullets..Caption +#. Form1..SpTBXCustomizer1..cNumBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "Numaralandırılmış Simgeler" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "&Görünüm" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "&Kenar Paneli" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "&Komut Günlüğü" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "&Seçenekler" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..CaptionW +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mmmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "&Yardım" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "&Araç Çubukları" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "&Standart Araç ÇubuÄŸu" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "&Araç ÇubuÄŸu Düzeni" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "&Araç ÇubuÄŸu Biçimlendiriliyor" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "&Gezinim Araç ÇubuÄŸu" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "&Hakkında" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#. Form1..SpTBXDock1..tbLayouts..Layouts..SpTBXLabelItem1..CaptionW +#. Form1..SpTBXDock1..tbLayouts..Layouts..tLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "Düzenler" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "Komut Günlüğü" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "Seçenek Düzenleyicisi" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "Yardım" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to start playing" +msgstr "Çalmaya baÅŸlamak için araç çubuÄŸuna mouse ile saÄŸ tıklayın" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aBack..Category +#. Form1..TntActionList1..aForward..Category +#. Form1..TntActionList1..aStop..Category +#. Form1..TntActionList1..aRefresh..Category +#. Form1..TntActionList1..aSearch..Category +#. Form1..TntActionList1..aFavs..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "Gezinim" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#. Form1..TntActionList1..aBack..Caption +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "Geri" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#. Form1..TntActionList1..aForward..Caption +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "İleri" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#. Form1..TntActionList1..aRefresh..Caption +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "Yenile" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#. Form1..TntActionList1..aStop..Caption +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "Dur" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#. Form1..TntActionList1..aSearch..Caption +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "Ara" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aOpen..Category +#. Form1..TntActionList1..aSave..Category +#. Form1..TntActionList1..aExit..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr "Dosyalar" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aCopy..Category +#. Form1..TntActionList1..aPaste..Category +#. Form1..TntActionList1..aSelectAll..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "Düzelt" + +#. Form1..TntActionList1..aFavs..Caption +#. Form1..SpTBXCustomizer1..cFavs..CaptionW +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "Favs" + +#. Form1..TntActionList1..aCustomize..Category +#. Form1..TntActionList1..aEmbeddedCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "ÖzelleÅŸtirmek" + +#. Form1..TntActionList1..aCustomize..Caption +#. Form1..SpTBXPopupMenu1..pCustomize..CaptionW +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "ÖzelleÅŸtir..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#. Form1..SpTBXPopupMenu1..pEmbeddedCustomize..CaptionW +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "Gömülü BileÅŸenleri ÖzelleÅŸtir" + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "Seçenekler" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "Özellikler" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "Sayfa Düzeni" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "GeçmiÅŸ" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "Favoriler" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#. Form2..LeftPanel..TitlePanel..Caption +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "ÖzelleÅŸtir" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "Tamam" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "Vazgeç" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "Uygula" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "Düzeni Kaydet" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "Geçerli düzeni kaydet:" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "Çalıştırıldı" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/zh_CN/LC_MESSAGES/default.mo b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/zh_CN/LC_MESSAGES/default.mo new file mode 100644 index 0000000..493e91f Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/zh_CN/LC_MESSAGES/default.mo differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/zh_CN/LC_MESSAGES/default.po b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/zh_CN/LC_MESSAGES/default.po new file mode 100644 index 0000000..52185f3 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/locale/zh_CN/LC_MESSAGES/default.po @@ -0,0 +1,431 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Customizer Demo\n" +"POT-Creation-Date: 2005-08-09 16:55\n" +"PO-Revision-Date: 2007-02-08 15:00-0300\n" +"Last-Translator: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: dxgettext 1.2\n" +"Language-Team: \n" + +#. Form1..SpTBXDock1..tbStandard..Caption +#: Unit1.dfm:29 +msgid "Standard" +msgstr "标准" + +#. Form1..SpTBXDock1..tbStandard..tNew..CaptionW +#: Unit1.dfm:37 +#: Unit1.dfm:159 +#: Unit1.dfm:1559 +msgid "New" +msgstr "新建" + +#. Form1..SpTBXDock1..tbStandard..tOpen..CaptionW +#: Unit1.dfm:41 +msgid "Open" +msgstr "打开" + +#. Form1..SpTBXDock1..tbStandard..tSave..CaptionW +#: Unit1.dfm:45 +#: Unit1.dfm:167 +#: Unit1.dfm:318 +#: Unit1.dfm:1573 +msgid "Save" +msgstr "ä¿å­˜" + +#. Form1..SpTBXDock1..tbStandard..tCut..CaptionW +#: Unit1.dfm:51 +#: Unit1.dfm:184 +#: Unit1.dfm:1585 +msgid "Cut" +msgstr "剪切" + +#. Form1..SpTBXDock1..tbStandard..tCopy..CaptionW +#: Unit1.dfm:55 +#: Unit1.dfm:188 +#: Unit1.dfm:1592 +msgid "Copy" +msgstr "å¤åˆ¶" + +#. Form1..SpTBXDock1..tbStandard..tPaste..CaptionW +#: Unit1.dfm:60 +#: Unit1.dfm:192 +#: Unit1.dfm:1599 +msgid "Paste" +msgstr "粘贴" + +#. Form1..SpTBXDock1..tbStandard..tFind..CaptionW +#: Unit1.dfm:67 +#: Unit1.dfm:206 +#: Unit1.dfm:1612 +msgid "Find" +msgstr "查找" + +#. Form1..SpTBXDock1..tbStandard..tThemes..CaptionW +#: Unit1.dfm:73 +msgid "Themes" +msgstr "主题" + +#. Form1..SpTBXDock1..tbFormat..Caption +#. Form1..TntActionList1..aLeftJustify..Category +#. Form1..TntActionList1..aNumberedBullets..Category +#: Unit1.dfm:99 +#: Unit1.dfm:1618 +#: Unit1.dfm:1625 +#: Unit1.dfm:1632 +#: Unit1.dfm:1639 +#: Unit1.dfm:1645 +#: Unit1.dfm:1651 +#: Unit1.dfm:1657 +#: Unit1.dfm:1663 +msgid "Format" +msgstr "æ ¼å¼" + +#. Form1..SpTBXDock1..tbFormat..tFont..Caption +#: Unit1.dfm:106 +msgid "Font Name" +msgstr "字体" + +#. Form1..SpTBXDock1..tbFormat..tFontSize..Caption +#: Unit1.dfm:116 +msgid "Font Size" +msgstr "字体大å°" + +#. Form1..SpTBXDock1..tbFormat..tBold..CaptionW +#: Unit1.dfm:132 +#: Unit1.dfm:213 +#: Unit1.dfm:1619 +msgid "Bold" +msgstr "粗体" + +#. Form1..SpTBXDock1..tbFormat..tItalic..CaptionW +#: Unit1.dfm:136 +#: Unit1.dfm:217 +#: Unit1.dfm:1626 +msgid "Italic" +msgstr "斜体" + +#. Form1..SpTBXDock1..tbFormat..tUnderline..CaptionW +#: Unit1.dfm:140 +#: Unit1.dfm:221 +#: Unit1.dfm:1633 +msgid "Underline" +msgstr "下划线" + +#. Form1..SpTBXDock1..tbMenuBar..Caption +#: Unit1.dfm:146 +msgid "Menu" +msgstr "èœå•" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..CaptionW +#: Unit1.dfm:156 +msgid "&File" +msgstr "文件(&F)" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mOpen..CaptionW +#: Unit1.dfm:163 +#: Unit1.dfm:1566 +msgid "Open..." +msgstr "打开..." + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mPrint..CaptionW +#: Unit1.dfm:171 +#: Unit1.dfm:1670 +#: Unit1.dfm:1744 +msgid "Print" +msgstr "打å°" + +#. Form1..SpTBXDock1..tbMenuBar..mFile..mExit..CaptionW +#: Unit1.dfm:177 +#: Unit1.dfm:1580 +#: Unit1.dfm:1776 +msgid "Exit" +msgstr "退出" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..CaptionW +#: Unit1.dfm:181 +msgid "&Edit" +msgstr "编辑(&E)" + +#. Form1..SpTBXDock1..tbMenuBar..mEdit..mSelectAll..CaptionW +#: Unit1.dfm:198 +#: Unit1.dfm:1606 +#: Unit1.dfm:1772 +msgid "Select All" +msgstr "全选" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..CaptionW +#: Unit1.dfm:210 +msgid "&Format" +msgstr "æ ¼å¼(&F)" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mLeftJustify..CaptionW +#: Unit1.dfm:227 +#: Unit1.dfm:1640 +#: Unit1.dfm:1748 +msgid "Left Justify" +msgstr "文本两端对é½" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mCentered..CaptionW +#: Unit1.dfm:231 +#: Unit1.dfm:1652 +#: Unit1.dfm:1752 +msgid "Centered" +msgstr "居中" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mRightJustify..CaptionW +#: Unit1.dfm:235 +#: Unit1.dfm:1646 +#: Unit1.dfm:1756 +msgid "Right Justify" +msgstr "文本两端对é½" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mBullets..CaptionW +#: Unit1.dfm:241 +#: Unit1.dfm:1658 +#: Unit1.dfm:1760 +msgid "Bullets" +msgstr "项目符å·" + +#. Form1..SpTBXDock1..tbMenuBar..SpTBXSubmenuItem1..mNumberedBullets..CaptionW +#: Unit1.dfm:245 +#: Unit1.dfm:1664 +#: Unit1.dfm:1764 +msgid "Numbered Bullets" +msgstr "æ•°å­—ç¼–å·" + +#. Form1..SpTBXDock1..tbMenuBar..mView..CaptionW +#: Unit1.dfm:249 +msgid "&View" +msgstr "查看(&V)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..CaptionW +#: Unit1.dfm:251 +msgid "&Sidebar" +msgstr "ä¾§è¾¹æ (&S)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mCommandsLog..CaptionW +#: Unit1.dfm:254 +msgid "&Commands Log" +msgstr "命令日志(&C)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mOptions..CaptionW +#: Unit1.dfm:258 +msgid "&Options" +msgstr "选项(&O)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mSidebar..mmHelp..CaptionW +#: Unit1.dfm:262 +#: Unit1.dfm:286 +#: Unit1.dfm:288 +msgid "&Help" +msgstr "帮助(&H)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..CaptionW +#: Unit1.dfm:266 +msgid "&Toolbars" +msgstr "工具æ (&T)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mStandardToolbar..CaptionW +#: Unit1.dfm:269 +msgid "&Standard Toolbar" +msgstr "标准工具æ (&S)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..tLayoutsToolbar..CaptionW +#: Unit1.dfm:273 +msgid "&Layouts Toolbar" +msgstr "布局工具æ (&L)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mFormattingToolbar..CaptionW +#: Unit1.dfm:277 +msgid "&Formatting Toolbar" +msgstr "æ ¼å¼å·¥å…·æ (&F)" + +#. Form1..SpTBXDock1..tbMenuBar..mView..mToolbars..mNavigationToolbar..CaptionW +#: Unit1.dfm:281 +msgid "&Navigation Toolbar" +msgstr "导航工具æ (&N)" + +#. Form1..SpTBXDock1..tbMenuBar..mHelp..mAbout..CaptionW +#: Unit1.dfm:291 +msgid "&About" +msgstr "关于(&A)" + +#. Form1..SpTBXDock1..tbLayouts..Caption +#: Unit1.dfm:298 +#: Unit1.dfm:305 +#: Unit1.dfm:308 +msgid "Layouts" +msgstr "布局" + +#. Form1..SpTBXMultiDock1..dpLog..Caption +#: Unit1.dfm:332 +msgid "Commands Log" +msgstr "命令日志" + +#. Form1..SpTBXMultiDock1..dpOptions..Caption +#: Unit1.dfm:352 +msgid "Customizer Options" +msgstr "自定义选项" + +#. Form1..SpTBXMultiDock2..dpHelp..Caption +#: Unit1.dfm:368 +msgid "Help" +msgstr "帮助" + +#. Form1..SpTBXMultiDock2..dpHelp..SpTBXLabel1..Caption +#: Unit1.dfm:380 +msgid "Right click the toolbars to customize them" +msgstr "在工具æ ä¸Šå•击å³é”®è¿›è¡Œè‡ªå®šä¹‰" + +#. Form1..SpTBXDock2..tbNavigation..Caption +#. Form1..TntActionList1..aRefresh..Category +#: Unit1.dfm:402 +#: Unit1.dfm:1675 +#: Unit1.dfm:1681 +#: Unit1.dfm:1687 +#: Unit1.dfm:1693 +#: Unit1.dfm:1699 +#: Unit1.dfm:1705 +msgid "Navigation" +msgstr "导航" + +#. Form1..SpTBXDock2..tbNavigation..tBack..CaptionW +#: Unit1.dfm:409 +#: Unit1.dfm:1676 +msgid "Back" +msgstr "åŽé€€" + +#. Form1..SpTBXDock2..tbNavigation..tForward..CaptionW +#: Unit1.dfm:413 +#: Unit1.dfm:1682 +msgid "Forward" +msgstr "å‰è¿›" + +#. Form1..SpTBXDock2..tbNavigation..tRefresh..CaptionW +#: Unit1.dfm:417 +#: Unit1.dfm:1694 +msgid "Refresh" +msgstr "刷新" + +#. Form1..SpTBXDock2..tbNavigation..tStop..CaptionW +#: Unit1.dfm:421 +#: Unit1.dfm:1688 +msgid "Stop" +msgstr "åœæ­¢" + +#. Form1..SpTBXDock2..tbNavigation..tSearch..CaptionW +#: Unit1.dfm:425 +#: Unit1.dfm:1700 +msgid "Search" +msgstr "æœç´¢" + +#. Form1..TntActionList1..aNew..Category +#. Form1..TntActionList1..aPrint..Category +#: Unit1.dfm:1558 +#: Unit1.dfm:1565 +#: Unit1.dfm:1572 +#: Unit1.dfm:1579 +#: Unit1.dfm:1669 +msgid "Files" +msgstr " 文件" + +#. Form1..TntActionList1..aCut..Category +#. Form1..TntActionList1..aFind..Category +#: Unit1.dfm:1584 +#: Unit1.dfm:1591 +#: Unit1.dfm:1598 +#: Unit1.dfm:1605 +#: Unit1.dfm:1611 +msgid "Edit" +msgstr "编辑" + +#. Form1..TntActionList1..aFavs..Caption +#: Unit1.dfm:1706 +#: Unit1.dfm:1768 +msgid "Favs" +msgstr "æ”¶è—" + +#. Form1..TntActionList1..aCustomize..Category +#: Unit1.dfm:1711 +#: Unit1.dfm:1716 +msgid "Customization" +msgstr "自定义" + +#. Form1..TntActionList1..aCustomize..Caption +#: Unit1.dfm:1712 +#: Unit1.dfm:1731 +msgid "Customize..." +msgstr "自定义..." + +#. Form1..TntActionList1..aEmbeddedCustomize..Caption +#: Unit1.dfm:1717 +#: Unit1.dfm:1735 +msgid "Embedded Customize..." +msgstr "嵌入å¼è‡ªå®šä¹‰..." + +#. Form2..Caption +#: Unit2.dfm:7 +msgid "Options" +msgstr "选项" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tProperties..CaptionW +#: Unit2.dfm:49 +msgid "Properties" +msgstr "属性" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tPageSetup..CaptionW +#: Unit2.dfm:58 +msgid "Page Setup" +msgstr "页é¢è®¾ç½®" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tHistory..CaptionW +#: Unit2.dfm:67 +msgid "History" +msgstr "历å²" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tFavorites..CaptionW +#: Unit2.dfm:76 +msgid "Favorites" +msgstr "æ”¶è—" + +#. Form2..SpTBXDock1..SpTBXToolbar1..tCustomize..CaptionW +#: Unit2.dfm:85 +#: Unit2.dfm:168 +msgid "Customizer" +msgstr "自定义" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton1..Caption +#: Unit2.dfm:122 +msgid "OK" +msgstr "确定" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton2..Caption +#: Unit2.dfm:137 +msgid "Cancel" +msgstr "å–æ¶ˆ" + +#. Form2..LeftPanel..ButtonsPanel..SpTBXButton3..Caption +#: Unit2.dfm:152 +msgid "Apply" +msgstr "应用" + +#: Unit1.pas:235 +msgid "Save Layout" +msgstr "ä¿å­˜å¸ƒå±€" + +#: Unit1.pas:235 +msgid "Save current layout as:" +msgstr "将当å‰å¸ƒå±€ä¿å­˜ä¸ºï¼š" + +#: Unit1.pas:248 +msgid "Executed" +msgstr "被执行" + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/translations.txt b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/translations.txt new file mode 100644 index 0000000..116bb46 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Customizer/translations.txt @@ -0,0 +1,27 @@ + +The Customizer Demo uses dxgettext (http://dybdahl.dk/dxgettext/) to translate the strings to various languages. +Unfortunately the translations are not complete: + +de (German): 100% translated (Thomas Speck) +es (Spanish): 100% translated (Robert Lee) +fi (Finnish): 100% translated (Tapio Saarikumpu) +fr (French): 100% translated (Bob Baudewyns) +ja (Japanese): 100% translated (Minoru Yoshida) +ko (Korean): 60% translated +nl (Dutch): 100% translated (Alfred Vink) +pt_BR (Brazilian): 100% translated (Mauricio Magnani) +ru (Russian): 100% translated (Alexey Naumov) +sr_Cyrillic (Serbian): 100% translated (Marko Binic) +sr_Latin (Serbian): 100% translated (Marko Binic) +sv (Swedish): 100% translated (Mattias Andersson) +tr (Turkish): 100% translated (Zylar) +zh_CN (Chinese): 100% translated (Beta Xiong) + +You can edit the translations with Notepad, just open the corresponding po file of the language. +For example to edit the Chinese translation open the \locale\zh_CN\LC_MESSAGES\default.po file with Notepad and edit the msgstr entries. +You can also use a PoEdit (http://poedit.sourceforge.net) to edit the files. + +To create a new translation for a different language use the default.po file template located in the locale directory. + +If you improve one of the translations please send it to me, my mail address is on: +http://www.silverpointdevelopment.com/sptbxlib/support.htm \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/FormPopupMenu.dpr b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/FormPopupMenu.dpr new file mode 100644 index 0000000..be00fa9 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/FormPopupMenu.dpr @@ -0,0 +1,17 @@ +program FormPopupMenu; + +uses + Forms, + Unit1 in 'Unit1.pas' {Form1}, + Unit2 in 'Unit2.pas' {Form2}, + Unit3 in 'Unit3.pas' {Form3}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.CreateForm(TForm2, Form2); + Application.CreateForm(TForm3, Form3); + Application.Run; +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit1.dfm b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit1.dfm new file mode 100644 index 0000000..e026cd8 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit1.dfm @@ -0,0 +1,200 @@ +object Form1: TForm1 + Left = 312 + Top = 215 + Caption = 'Form1' + ClientHeight = 387 + ClientWidth = 531 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [] + OldCreateOrder = False + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object SpTBXTitleBar1: TSpTBXTitleBar + Left = 0 + Top = 0 + Width = 531 + Height = 387 + Caption = 'Form1' + DesignSize = ( + 531 + 387) + object SpTBXSubmenuItem2: TSpTBXSubmenuItem + Caption = 'Skins' + Options = [tboDropdownArrow] + OnDrawItem = SpTBXSubmenuItem2DrawItem + LinkSubitems = SpTBXSubmenuItem3 + end + object SpTBXStatusBar1: TSpTBXStatusBar + Left = 4 + Top = 360 + Width = 523 + Height = 23 + object SpTBXLabelItem1: TSpTBXLabelItem + Caption = 'Panel 1' + end + object SpTBXSeparatorItem2: TSpTBXSeparatorItem + end + object SpTBXLabelItem2: TSpTBXLabelItem + Caption = 'Panel 2' + end + end + object SpTBXDock2: TSpTBXDock + Left = 4 + Top = 26 + Width = 523 + Height = 23 + object SpTBXToolbar2: TSpTBXToolbar + Left = 0 + Top = 0 + CloseButton = False + DockPos = -8 + FullSize = True + MenuBar = True + ProcessShortCuts = True + ShrinkMode = tbsmWrap + Stretch = True + TabOrder = 0 + Caption = 'SpTBXToolbar2' + object SpTBXSubmenuItem1: TSpTBXSubmenuItem + Tag = 100 + Caption = '&File' + object SpTBXItem1: TSpTBXItem + Caption = '&New' + end + object SpTBXItem2: TSpTBXItem + Caption = '&Open' + end + object SpTBXSeparatorItem1: TSpTBXSeparatorItem + end + object SpTBXItem3: TSpTBXItem + Caption = '&Exit' + end + end + object SpTBXSubmenuItem3: TSpTBXSubmenuItem + Caption = '&Skins' + object SpTBXSkinGroupItem1: TSpTBXSkinGroupItem + end + end + end + end + object SpTBXMultiDock1: TSpTBXMultiDock + Left = 4 + Top = 49 + Width = 178 + Height = 311 + object SpTBXDockablePanel1: TSpTBXDockablePanel + Left = 0 + Top = 0 + Width = 178 + Height = 311 + Caption = 'Form Popup Options' + DockPos = 0 + TabOrder = 0 + Options.Close = False + object SpTBXRadioGroup1: TSpTBXRadioGroup + Left = 7 + Top = 56 + Width = 161 + Height = 97 + Caption = 'BorderStyle' + TabOrder = 1 + OnClick = SpTBXRadioGroup1Click + ItemIndex = 3 + Items.Strings = ( + 'pbsFrame' + 'pbsSizeable' + 'pbsSizeableBottom' + 'pbsSizeableRightBottom') + end + object SpTBXCheckBox1: TSpTBXCheckBox + Left = 11 + Top = 32 + Width = 69 + Height = 21 + Caption = 'Set focus' + TabOrder = 2 + OnClick = SpTBXCheckBox1Click + end + end + end + object SpTBXGroupBox1: TSpTBXGroupBox + Left = 192 + Top = 64 + Width = 329 + Height = 73 + Caption = 'Calendar Popup' + Anchors = [akLeft, akTop, akRight] + TabOrder = 4 + object SpTBXButtonEdit1: TSpTBXButtonEdit + Left = 16 + Top = 33 + Width = 121 + Height = 21 + TabOrder = 0 + EditButton.Left = 97 + EditButton.Top = 0 + EditButton.Width = 20 + EditButton.Height = 17 + EditButton.Align = alRight + EditButton.DropDownMenu = SpTBXFormPopupMenu1 + end + object SpTBXButton1: TSpTBXButton + Left = 184 + Top = 32 + Width = 121 + Height = 25 + Caption = 'Date' + TabOrder = 1 + DropDownMenu = SpTBXFormPopupMenu1 + end + end + object SpTBXGroupBox2: TSpTBXGroupBox + Left = 192 + Top = 168 + Width = 329 + Height = 81 + Caption = 'Treeview Popup' + Anchors = [akLeft, akTop, akRight] + TabOrder = 5 + object SpTBXButtonEdit2: TSpTBXButtonEdit + Left = 16 + Top = 33 + Width = 121 + Height = 21 + TabOrder = 0 + EditButton.Left = 97 + EditButton.Top = 0 + EditButton.Width = 20 + EditButton.Height = 17 + EditButton.Align = alRight + EditButton.DropDownMenu = SpTBXFormPopupMenu2 + end + object SpTBXButton2: TSpTBXButton + Left = 184 + Top = 32 + Width = 121 + Height = 25 + Caption = 'Colors' + TabOrder = 1 + DropDownMenu = SpTBXFormPopupMenu2 + end + end + end + object SpTBXFormPopupMenu1: TSpTBXFormPopupMenu + BorderStyle = pbsSizeableRightBottom + OnBeforeClosePopup = SpTBXFormPopupMenu1BeforeClosePopup + Left = 200 + Top = 304 + end + object SpTBXFormPopupMenu2: TSpTBXFormPopupMenu + BorderStyle = pbsSizeableRightBottom + OnBeforeClosePopup = SpTBXFormPopupMenu2BeforeClosePopup + Left = 240 + Top = 304 + end +end diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit1.pas b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit1.pas new file mode 100644 index 0000000..07f5a3c --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit1.pas @@ -0,0 +1,123 @@ +unit Unit1; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ExtCtrls, ImgList, Menus, ComCtrls, + TB2Dock, TB2Toolbar, TB2Item, TB2ExtItems, + SpTBXSkins, SpTBXItem, SpTBXControls, SpTBXEditors, SpTBXFormPopupMenu, + SpTBXDkPanels; + +type + TForm1 = class(TForm) + SpTBXDock2: TSpTBXDock; + SpTBXToolbar2: TSpTBXToolbar; + SpTBXSubmenuItem1: TSpTBXSubmenuItem; + SpTBXStatusBar1: TSpTBXStatusBar; + SpTBXTitleBar1: TSpTBXTitleBar; + SpTBXSubmenuItem2: TSpTBXSubmenuItem; + SpTBXItem1: TSpTBXItem; + SpTBXItem2: TSpTBXItem; + SpTBXSeparatorItem1: TSpTBXSeparatorItem; + SpTBXItem3: TSpTBXItem; + SpTBXMultiDock1: TSpTBXMultiDock; + SpTBXDockablePanel1: TSpTBXDockablePanel; + SpTBXRadioGroup1: TSpTBXRadioGroup; + SpTBXCheckBox1: TSpTBXCheckBox; + SpTBXGroupBox1: TSpTBXGroupBox; + SpTBXGroupBox2: TSpTBXGroupBox; + SpTBXButtonEdit1: TSpTBXButtonEdit; + SpTBXButton1: TSpTBXButton; + SpTBXButtonEdit2: TSpTBXButtonEdit; + SpTBXButton2: TSpTBXButton; + SpTBXFormPopupMenu1: TSpTBXFormPopupMenu; + SpTBXFormPopupMenu2: TSpTBXFormPopupMenu; + SpTBXSubmenuItem3: TSpTBXSubmenuItem; + SpTBXSkinGroupItem1: TSpTBXSkinGroupItem; + SpTBXLabelItem1: TSpTBXLabelItem; + SpTBXSeparatorItem2: TSpTBXSeparatorItem; + SpTBXLabelItem2: TSpTBXLabelItem; + procedure SpTBXSubmenuItem2DrawItem(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); + procedure SpTBXCheckBox1Click(Sender: TObject); + procedure SpTBXRadioGroup1Click(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure SpTBXFormPopupMenu1BeforeClosePopup(Sender: TObject; + Selected: Boolean); + procedure SpTBXFormPopupMenu2BeforeClosePopup(Sender: TObject; + Selected: Boolean); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.dfm} + +uses + Unit2, Unit3; + +{ TForm1 } + +procedure TForm1.FormShow(Sender: TObject); +begin + SpTBXFormPopupMenu1.PopupForm := Form2; + SpTBXFormPopupMenu2.PopupForm := Form3; +end; + +procedure TForm1.SpTBXCheckBox1Click(Sender: TObject); +begin + SpTBXFormPopupMenu1.PopupFocus := SpTBXCheckBox1.Checked; + SpTBXFormPopupMenu2.PopupFocus := SpTBXCheckBox1.Checked; +end; + +procedure TForm1.SpTBXRadioGroup1Click(Sender: TObject); +var + I: Integer; +begin + I := SpTBXRadioGroup1.ItemIndex; + if I > -1 then begin + SpTBXFormPopupMenu1.BorderStyle := TSpTBXPopupBorderStyleType(I); + SpTBXFormPopupMenu2.BorderStyle := TSpTBXPopupBorderStyleType(I); + end; +end; + +procedure TForm1.SpTBXSubmenuItem2DrawItem(Sender: TObject; + ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + // Don't draw the items background + if (PaintStage = pstPrePaint) and (CurrentSkin.SkinName = 'Default') then + PaintDefault := False; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Popups } + +procedure TForm1.SpTBXFormPopupMenu1BeforeClosePopup(Sender: TObject; + Selected: Boolean); +begin + if Selected then begin + SpTBXButton1.Caption := DateTimeToStr(Form2.MonthCalendar1.Date); + SpTBXButtonEdit1.Text := DateTimeToStr(Form2.MonthCalendar1.Date); + end; +end; + +procedure TForm1.SpTBXFormPopupMenu2BeforeClosePopup(Sender: TObject; + Selected: Boolean); +begin + if Selected then begin + SpTBXButton2.Caption := Form3.TreeView1.Selected.Text; + SpTBXButtonEdit2.Text := Form3.TreeView1.Selected.Text; + end; +end; + +end. + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit2.dfm b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit2.dfm new file mode 100644 index 0000000..4828692 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit2.dfm @@ -0,0 +1,27 @@ +object Form2: TForm2 + Left = 0 + Top = 0 + Caption = 'Form2' + ClientHeight = 166 + ClientWidth = 180 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object MonthCalendar1: TMonthCalendar + Left = 0 + Top = 0 + Width = 180 + Height = 166 + Align = alClient + AutoSize = True + Date = 38924.819285115740000000 + TabOrder = 0 + end +end diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit2.pas b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit2.pas new file mode 100644 index 0000000..89faf97 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit2.pas @@ -0,0 +1,50 @@ +unit Unit2; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, ComCtrls, CommCtrl, ExtCtrls, SpTBXFormPopupMenu; + +type + TForm2 = class(TForm) + MonthCalendar1: TMonthCalendar; + procedure FormCreate(Sender: TObject); + private + { Private declarations } + FOldWndProc: TWndMethod; + procedure NewWndProc(var Message: TMessage); + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} + +procedure TForm2.FormCreate(Sender: TObject); +begin + // We can't use the MonthCalendar.OnClick event because + // it gets fired even when clicking on the Prev/Next month + // buttons. We have to subclass it and handle the + // MCN_SELECT notification + MonthCalendar1.DoubleBuffered := True; + FOldWndProc := MonthCalendar1.WindowProc; + MonthCalendar1.WindowProc := NewWndProc; +end; + +procedure TForm2.NewWndProc(var Message: TMessage); +begin + FOldWndProc(Message); // default WndProc + if Message.Msg = CN_NOTIFY then + if TWMNotify(Message).NMHdr^.code = MCN_SELECT then begin + // Inform the ActiveFormPopupMenu that a selection was made. + if Assigned(ActiveFormPopupMenu) then + ActiveFormPopupMenu.ClosePopup(True); + end; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit3.dfm b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit3.dfm new file mode 100644 index 0000000..21fa118 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit3.dfm @@ -0,0 +1,36 @@ +object Form3: TForm3 + Left = 0 + Top = 0 + Caption = 'Form3' + ClientHeight = 105 + ClientWidth = 174 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object TreeView1: TTreeView + Left = 0 + Top = 0 + Width = 174 + Height = 105 + Align = alClient + BorderStyle = bsNone + HideSelection = False + HotTrack = True + Images = ImageList1 + Indent = 19 + StateImages = ImageList1 + TabOrder = 0 + OnMouseUp = TreeView1MouseUp + end + object ImageList1: TImageList + Left = 48 + Top = 64 + end +end diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit3.pas b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit3.pas new file mode 100644 index 0000000..584a423 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/FormPopupMenu/Unit3.pas @@ -0,0 +1,102 @@ +unit Unit3; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ComCtrls, ImgList, SpTBXFormPopupMenu; + +type + TForm3 = class(TForm) + TreeView1: TTreeView; + ImageList1: TImageList; + procedure FormCreate(Sender: TObject); + procedure TreeView1MouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + private + { Private declarations } + public + { Public declarations } + function AddIcon(Fill: TColor; Circular: Boolean = False): Integer; + procedure CreateNodesProc(const S: string); + end; + +var + Form3: TForm3; + +implementation + +{$R *.dfm} + +function TForm3.AddIcon(Fill: TColor; Circular: Boolean = False): Integer; +var + B: TBitmap; + R: TRect; +begin + B := TBitmap.Create; + try + B.Width := 16; + B.Height := 16; + B.Canvas.Brush.Color := Fill; + R := Rect(0, 0, B.Width, B.Height); + InflateRect(R, -1, -1); + if Circular then + B.Canvas.Ellipse(R) + else + B.Canvas.Rectangle(R); + Result := ImageList1.Add(B, nil); + finally + B.Free; + end; +end; + +procedure TForm3.CreateNodesProc(const S: string); +var + ParentNode: TTreeNode; + C: TColor; +begin + // Add the color node + C := StringToColor(S); + ParentNode := TreeView1.Items.GetFirstNode; + if C < 0 then + ParentNode := ParentNode.getNextSibling; + with TreeView1.Items.AddChildObject(ParentNode, S, Pointer(C)) do begin + ImageIndex := AddIcon(C); + SelectedIndex := ImageIndex; + end; +end; + +procedure TForm3.FormCreate(Sender: TObject); +var + I: Integer; +begin + I := AddIcon(clWhite, True); + // Add the parent nodes to the TreeView + with TreeView1.Items.Add(nil, 'Standard Colors') do begin + ImageIndex := I; + SelectedIndex := ImageIndex; + end; + with TreeView1.Items.Add(nil, 'System Colors') do begin + ImageIndex := I; + SelectedIndex := ImageIndex; + end; + // Add the color nodes + GetColorValues(CreateNodesProc); +end; + +procedure TForm3.TreeView1MouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + Node: TTreeNode; +begin + if Button = mbLeft then begin + Node := TreeView1.GetNodeAt(X, Y); + if Assigned(Node) and Node.Selected and (Node.Level > 0) then begin + // Inform the ActiveFormPopupMenu that a selection was made. + if Assigned(ActiveFormPopupMenu) then + ActiveFormPopupMenu.ClosePopup(True); + end; + end; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Overview.dpr b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Overview.dpr new file mode 100644 index 0000000..5ead0c3 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Overview.dpr @@ -0,0 +1,13 @@ +program Overview; + +uses + Forms, + Unit1 in 'Unit1.pas' {Form1}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Skins/WMP11.skn b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Skins/WMP11.skn new file mode 100644 index 0000000..2cf772c --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Skins/WMP11.skn @@ -0,0 +1,380 @@ +; =============================================================================================================== +; +; Syntax: +; [Component] +; State.Part = Value +; +; Component can be: +; Single state components: Dock, DockablePanel, DockablePanelTitleBar, Gutter, MenuBar, OpenToolbarItem, +; Panel, Popup, Separator, Splitter, StatusBar, StatusBarGrip, TabBackground, +; TabToolbar, Toolbar, ToolbarGrip, Window, WindowTitleBar +; Multiple state componentes: MenuBarItem, MenuItem, ToolbarItem, Button, CheckBox, EditButton, EditFrame, +; Header, Label, ListItem, ProgressBar, RadioButton, Tab, TrackBar, TrackBarButton +; +; State can be: Normal, Disabled, HotTrack, Pushed, Checked, CheckedAndHotTrack +; +; Part can be: Body, Borders, TextColor +; +; =============================================================================================================== +; +; Value syntax: +; +; Body = GradientType, GradientColor1, GradientColor2, GradientColor3, GradientColor4 +; Body represents the controls client area, GradientType can be one of the +; following values: +; 0 (Solid, uses Color1) +; 1 (Vertical Gradient, uses 2 colors) +; 2 (Horizontal Gradient, uses 2 colors) +; 3 (Vertical Glass Gradient, uses 4 colors) +; 4 (Horizontal Glass Gradient, uses 4 colors) +; 5 (Vertical Mirror Gradient, uses 4 colors) +; 6 (Horizontal Mirror Gradient, uses 4 colors) +; 7 (Vertical Top Mirror Gradient, uses 4 colors) +; 8 (Horizontal Top Mirror Gradient, uses 4 colors) +; 9 (Vertical 9 Pixel Mirror Gradient, uses 4 colors) +; 10 (Horizontal 9 Pixel Mirror Gradient, uses 4 colors) +; +; Example, this will draw a white/gray vertical gradient on the buttons normal state: +; [Button] +; Normal.Body = 1, clWhite, $DCD8D0 +; +; +; Borders = BorderType, TopLeftColor, BottomRightColor, Internal TopLeftColor, Internal BottomRightColor +; Borders represents the controls borders, BorderType can be one of the +; following values: +; 0 (Rectangle border) +; 1 (Rounded border) +; 2 (Double rounded) +; +; Example, this will draw a white/black rounded beveled border on the buttons normal state: +; [Button] +; Normal.Borders = 1, clWhite, clBlack +; +; =============================================================================================================== +; +; Notes: +; +; 1) Colors must be in Delphi notation, for example: clWhite or $FFFFFF are valid +; 2) clNone is used as the empty fill color +; 3) Non used colors can be omited + + +[Skin] +Name=WMP11 +Author = Ricardo Cardona +ColorBtnFace=clSilver +OfficeStatusBar=0 +OfficeIcons=0 +TitleBarBorderSize=4 + +[Dock] +Normal.Body=0, clBlack, clNone, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite + +[DockablePanel] +Normal.Body=1, $007F665C, $007F665C, clNone, clNone +Normal.Borders=0, clBlack, clBlack, clNone, clNone +Normal.TextColor=clWhite + +[DockablePanelTitleBar] +Normal.Body=3, $00130F0D, $00080606, $00423630, $0082695F +Normal.Borders=1, $00765E56, clBlack, clNone, clNone +Normal.TextColor=clWhite + +[MenuBar] +Normal.Body=1, clSilver, $000E0B0A, clNone, clNone +Normal.Borders=2, $00B0B0B0, $00B0B0B0, clNone, clNone +Normal.TextColor=clWhite + +[Panel] +Normal.Body=0, $007F665C, clBlack, clNone, clNone +Normal.Borders=2, clGray, clGray, $00ADA492, clGray +Normal.TextColor=clWhite + +[Popup] +Normal.Body=0, $007F665C, clNone, clNone, clNone +Normal.Borders=0, clSilver, clSilver, clNone, clNone +Normal.TextColor=clWhite + +[Separator] +Normal.Body=0, clBlack, $007F665C, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clNone + +[Splitter] +Normal.Body=2, $007F665C, $007F665C, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clNone + +[StatusBar] +Normal.Body=1, $00131211, $00744C42, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite + +[StatusBarGrip] +Normal.Body=1, clBlack, $007F665C, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite + +[TabBackground] +Normal.Body=3, clBlack, clBlack, clBlack, $007F665C +Normal.Borders=0, clGray, clGray, clNone, clNone +Normal.TextColor=clNone + +[Toolbar] +Normal.Body=1, clBlack, $007F665C, clNone, clNone +Normal.Borders=2, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite + +[ToolbarGrip] +Normal.Body=1, clBlack, $007F665C, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite + +[Window] +Normal.Body=1, clBlack, $007F665C, clNone, clNone +Normal.Borders=0, clGray, clGray, clSilver, $007F665C +Normal.TextColor=clWhite + +[WindowTitleBar] +Normal.Body=1, clBlack, $007F665C, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite + +[MenuBarItem] +Normal.Body=0, clNone, clNone, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite +Disabled.Body=0, clNone, clNone, clNone, clNone +Disabled.Borders=0, clNone, clNone, clNone, clNone +Disabled.TextColor=clSilver +HotTrack.Body=5, $00D1D1D1, $00ADA492, $00603518, clBlack +HotTrack.Borders=1, $00909090, $00909090, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=1, clBlack, $00603518, clNone, clNone +Pushed.Borders=1, clGray, clGray, $00ADA492, $00E8E19D +Pushed.TextColor=clWhite +Checked.Body=3, clWhite, clBlack, clBlack, $00765F55 +Checked.Borders=1, clGray, clGray, $00B0D4DF, clSilver +Checked.TextColor=clWhite +CheckedAndHotTrack.Body=3, clBlack, $00603518, $00ADA492, clWhite +CheckedAndHotTrack.Borders=1, clGray, clGray, $00ADA492, $00E8E19D +CheckedAndHotTrack.TextColor=clWhite + +[MenuItem] +Normal.Body=0, clNone, clNone, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite +Disabled.Body=0, clNone, clNone, clNone, clNone +Disabled.Borders=0, clNone, clNone, clNone, clNone +Disabled.TextColor=clSilver +HotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +HotTrack.Borders=1, $00909090, $00909090, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=1, clSilver, clWhite, clNone, clNone +Pushed.Borders=1, $00909090, $00909090, clNone, clNone +Pushed.TextColor=clWhite +Checked.Body=5, clBlack, $00765F55, $00765F55, clBlack +Checked.Borders=1, clGray, clGray, $00B0D4DF, $00F0FDFF +Checked.TextColor=clWhite +CheckedAndHotTrack.Body=5, clBlack, $00603518, $00ADA492, clWhite +CheckedAndHotTrack.Borders=1, clGray, clGray, $00ADA492, $00E8E19D +CheckedAndHotTrack.TextColor=clWhite + +[ToolbarItem] +Normal.Body=0, clNone, clNone, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite +Disabled.Body=0, clNone, $00392E2B, $005A4A44, $00866E65 +Disabled.Borders=0, clNone, clNone, clNone, clNone +Disabled.TextColor=clSilver +HotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +HotTrack.Borders=1, $00909090, $00909090, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=5, clGray, clBlack, clBlack, clGray +Pushed.Borders=1, $00909090, $00909090, clNone, clNone +Pushed.TextColor=clWhite +Checked.Body=5, clGray, clBlack, clBlack, clGray +Checked.Borders=1, clGray, clGray, $00B0D4DF, $00F0FDFF +Checked.TextColor=clWhite +CheckedAndHotTrack.Body=5, clBlack, $00603518, $00ADA492, clWhite +CheckedAndHotTrack.Borders=1, clGray, clGray, $00ADA492, $00E8E19D +CheckedAndHotTrack.TextColor=clWhite + +[Button] +Normal.Body=3, clWhite, clBlack, clBlack, $00765F55 +Normal.Borders=1, $00909090, $00909090, $00909090, $00909090 +Normal.TextColor=clWhite +Disabled.Body=1, clBlack, $009E9E9E, clNone, clNone +Disabled.Borders=1, $00909090, $00909090, clNone, clNone +Disabled.TextColor=clSilver +HotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +HotTrack.Borders=1, $00909090, $00909090, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=5, clBlack, $00603518, $00ADA492, clWhite +Pushed.Borders=1, $00909090, $00909090, clNone, clNone +Pushed.TextColor=clWhite +Checked.Body=5, $00765F55, clBlack, clBlack, $00765F55 +Checked.Borders=1, clGray, clGray, $00B0D4DF, $00F0FDFF +Checked.TextColor=clWhite +CheckedAndHotTrack.Body=5, clBlack, $00550000, $007B7B7B, clWhite +CheckedAndHotTrack.Borders=1, clGray, clGray, $00ADA492, $00E8E19D +CheckedAndHotTrack.TextColor=clWhite + +[CheckBox] +Normal.Body=0, clBlack, clNone, clNone, clNone +Normal.Borders=0, clGray, clGray, clNone, clNone +Normal.TextColor=clWhite +Disabled.Body=0, clNone, clNone, clNone, clNone +Disabled.Borders=0, $0099A8AC, $0099A8AC, clNone, clNone +Disabled.TextColor=clSilver +HotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +HotTrack.Borders=1, $00909090, $00909090, $000E0B0A, $00090706 +HotTrack.TextColor=clWhite +Pushed.Body=5, $00E8E19D, $00603518, $00ADA492, clWhite +Pushed.Borders=1, $00E8E19D, $00603518, $00ADA492, clWhite +Pushed.TextColor=clWhite +Checked.Body=0, $00010101, $00F0FDFF, clNone, clNone +Checked.Borders=1, clGray, clGray, clBlack, clBlack +Checked.TextColor=clWhite +CheckedAndHotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +CheckedAndHotTrack.Borders=0, clGray, clGray, $00ADA492, $00E8E19D +CheckedAndHotTrack.TextColor=clWhite + +[EditButton] +Normal.Body=5, clWhite, clBlack, clBlack, $00765F55 +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite +HotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +HotTrack.Borders=1, $00909090, $00909090, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=5, $00E8E19D, $00603518, $00ADA492, clWhite +Pushed.Borders=1, $00909090, $00909090, clNone, clNone +Pushed.TextColor=clNone +Checked.Body=5, $00D2F9FF, $00F0FDFF, clNone, clNone +Checked.Borders=1, clGray, clGray, $00B0D4DF, $00F0FDFF +Checked.TextColor=clNone +CheckedAndHotTrack.Body=5, clWhite, $00E8E19D, clNone, clNone +CheckedAndHotTrack.Borders=1, clGray, clGray, $00ADA492, $00E8E19D +CheckedAndHotTrack.TextColor=clNone + +[EditFrame] +Normal.Body=0, clNone, clNone, clNone, clNone +Normal.Borders=1, clNone, clNone, $00D0D0D0, $00D0D0D0 +Normal.TextColor=clNone +Disabled.Body=0, clNone, clNone, clNone, clNone +Disabled.Borders=1, clNone, clNone, $0099A8AC, $0099A8AC +Disabled.TextColor=clNone +HotTrack.Body=0, clNone, clNone, clNone, clNone +HotTrack.Borders=1, clNone, clNone, $00909090, $00909090 +HotTrack.TextColor=clNone + +[Label] +Normal.Body=0, clNone, clNone, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clWhite +Disabled.Body=0, clNone, clNone, clNone, clNone +Disabled.Borders=0, clNone, clNone, clNone, clNone +Disabled.TextColor=clSilver +HotTrack.Body=0, clNone, clNone, clNone, clNone +HotTrack.Borders=0, clNone, clNone, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=0, clNone, clNone, clNone, clNone +Pushed.Borders=0, clNone, clNone, clNone, clNone +Pushed.TextColor=clWhite + +[ListItem] +Normal.Body=0, $00765F55, clNone, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clNone +Disabled.Body=0, $00765F55, clNone, clNone, clNone +Disabled.Borders=0, clNone, clNone, clNone, clNone +Disabled.TextColor=clSilver +HotTrack.Body=0, $00765F55, $00E5E2DB, clNone, clNone +HotTrack.Borders=1, $00909090, $00909090, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=0, $00765F55, clWhite, clNone, clNone +Pushed.Borders=1, $00909090, $00909090, clNone, clNone +Pushed.TextColor=clNone +Checked.Body=0, $00765F55, $00F0FDFF, clNone, clNone +Checked.Borders=1, clGray, clGray, $00B0D4DF, $00F0FDFF +Checked.TextColor=clNone +CheckedAndHotTrack.Body=0, $00765F55, $00E8E19D, clNone, clNone +CheckedAndHotTrack.Borders=1, clGray, clGray, $00ADA492, $00E8E19D +CheckedAndHotTrack.TextColor=clNone + +[ProgressBar] +Normal.Body=2, $007F665C, $007F665C, clNone, clNone +Normal.Borders=2, $005E4B44, $00765F55, clNone, clNone +Normal.TextColor=clNone +HotTrack.Body=3, $00FFC584, $00CD410F, $00FF966E, $00866E65 +HotTrack.Borders=2, $005E4B44, $00765F55, clNone, clNone +HotTrack.TextColor=clNone + +[RadioButton] +Normal.Body=0, clNone, clNone, clNone, clNone +Normal.Borders=0, clGray, clGray, clNone, clNone +Normal.TextColor=clWhite +Disabled.Body=0, clNone, clNone, clNone, clNone +Disabled.Borders=0, $0099A8AC, $0099A8AC, clNone, clNone +Disabled.TextColor=clSilver +HotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +HotTrack.Borders=1, clWhite, clWhite, clWhite, clWhite +HotTrack.TextColor=clWhite +Pushed.Body=0, clNone, clWhite, clNone, clNone +Pushed.Borders=1, $00909090, $00909090, clNone, clNone +Pushed.TextColor=clWhite +Checked.Body=0, clNone, $00F0FDFF, clNone, clNone +Checked.Borders=1, clGray, clGray, $00B0D4DF, $00F0FDFF +Checked.TextColor=clWhite +CheckedAndHotTrack.Body=5, $00E8E19D, $00603518, $00ADA492, clBlack +CheckedAndHotTrack.Borders=1, clWhite, clWhite, clWhite, clWhite +CheckedAndHotTrack.TextColor=clWhite + +[Tab] +Normal.Body=0, clNone, clNone, clNone, clNone +Normal.Borders=0, clNone, clNone, clNone, clNone +Normal.TextColor=clSilver +HotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +HotTrack.Borders=1, $00A0A0A0, $00A0A0A0, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=0, clNone, clWhite, clNone, clNone +Pushed.Borders=1, $00909090, $00909090, clNone, clNone +Pushed.TextColor=clWhite +Checked.Body=3, clWhite, clBlack, clBlack, clBlack +Checked.Borders=1, $00ADA492, $00ADA492, $00603518, clBlack +Checked.TextColor=clWhite +CheckedAndHotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +CheckedAndHotTrack.Borders=1, clGray, clGray, $00ADA492, $00E8E19D +CheckedAndHotTrack.TextColor=clWhite + +[TrackBar] +Normal.Body=3, $00FFC584, $00CD410F, $00FF966E, $00866E65 +Normal.Borders=2, $005E4B44, $00765F55, clNone, clNone +Normal.TextColor=clNone +HotTrack.Body=1, clWhite, clBlack, clNone, clNone +HotTrack.Borders=2, clNone, clNone, clNone, clNone +HotTrack.TextColor=clNone + +[TrackBarButton] +Normal.Body=3, clWhite, clBlack, clBlack, $00765F55 +Normal.Borders=2, $00909090, $00909090, clNone, clNone +Normal.TextColor=clNone +HotTrack.Body=5, clWhite, $00ADA492, $00603518, $00E8E19D +HotTrack.Borders=0, clNone, clNone, clNone, clNone +HotTrack.TextColor=clNone +Pushed.Body=5, $00765F55, clBlack, clBlack, clWhite +Pushed.Borders=2, clGray, clGray, $00F0D4DF, clNone +Pushed.TextColor=clNone + +[Header] +Normal.Body=3, clWhite, clBlack, clBlack, $00765F55 +Normal.Borders=0, $00D0D0D0, $00909090, clNone, clNone +Normal.TextColor=clWhite +HotTrack.Body=5, clWhite, $00ADA492, $00603518, clBlack +HotTrack.Borders=0, $00909090, $00909090, clNone, clNone +HotTrack.TextColor=clWhite +Pushed.Body=5, $00E8E19D, $00603518, $00ADA492, clWhite +Pushed.Borders=0, $00909090, $00909090, clNone, clNone +Pushed.TextColor=clWhite \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Unit1.dfm b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Unit1.dfm new file mode 100644 index 0000000..1d2b7b8 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Unit1.dfm @@ -0,0 +1,1901 @@ +object Form1: TForm1 + Left = 279 + Top = 147 + Caption = 'SpTBXLib Demo' + ClientHeight = 555 + ClientWidth = 716 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [] + OldCreateOrder = False + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object SpTBXSplitter1: TSpTBXSplitter + Left = 273 + Top = 72 + Height = 457 + Cursor = crSizeWE + end + object SpTBXSplitter2: TSpTBXSplitter + Left = 575 + Top = 72 + Height = 457 + Cursor = crSizeWE + Align = alRight + end + object SpTBXMultiDock1: TSpTBXMultiDock + Left = 0 + Top = 72 + Width = 273 + Height = 457 + object SpTBXDockablePanel1: TSpTBXDockablePanel + Left = 0 + Top = 0 + Width = 273 + Height = 303 + Caption = 'Options Panel' + DockPos = 0 + TabOrder = 0 + object SpTBXSubmenuItem1: TSpTBXSubmenuItem + Options = [tboDropdownArrow] + CustomHeight = 15 + LinkSubitems = subSkins + end + object SpTBXTabControl2: TSpTBXTabControl + Left = 0 + Top = 19 + Width = 269 + Height = 280 + Align = alClient + OnResize = SpTBXTabControl2Resize + ActiveTabIndex = 0 + HiddenItems = <> + object SpTBXTabItem1: TSpTBXTabItem + Caption = 'Controls' + Checked = True + end + object SpTBXTabItem6: TSpTBXTabItem + Caption = 'Editors' + end + object SpTBXTabItem3: TSpTBXTabItem + Caption = 'Misc' + end + object SpTBXTabSheet3: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 269 + Height = 257 + Caption = 'Misc' + ImageIndex = -1 + DesignSize = ( + 269 + 257) + TabItem = 'SpTBXTabItem3' + object SpTBXGroupBox5: TSpTBXGroupBox + Left = 8 + Top = 8 + Width = 252 + Height = 177 + Caption = 'Links' + Anchors = [akLeft, akTop, akRight] + TabOrder = 0 + object SpTBXLabel2: TSpTBXLabel + Left = 8 + Top = 24 + Width = 151 + Height = 19 + Caption = 'Go to Silverpoint Development' + LinkText = 'http://www.silverpointdevelopment.com' + end + object SpTBXLabel3: TSpTBXLabel + Left = 8 + Top = 48 + Width = 156 + Height = 19 + Caption = 'Go to Toolbar2000 newsgroups' + LinkText = 'news://news.jrsoftware.org' + end + object SpTBXLabel4: TSpTBXLabel + Left = 8 + Top = 72 + Width = 128 + Height = 19 + Caption = 'Open the Windows folder' + end + object SpTBXLabel7: TSpTBXLabel + Left = 8 + Top = 144 + Width = 105 + Height = 19 + Cursor = crHandPoint + Caption = 'View the sourcecode' + LinkText = 'notepad.exe' + end + object SpTBXLabel5: TSpTBXLabel + Left = 8 + Top = 96 + Width = 106 + Height = 19 + Caption = 'Open it with the tree' + end + object SpTBXLabel6: TSpTBXLabel + Left = 8 + Top = 120 + Width = 74 + Height = 19 + Caption = 'Open WinAmp' + end + end + end + object SpTBXTabSheet6: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 269 + Height = 257 + Caption = 'Editors' + ImageIndex = -1 + DesignSize = ( + 269 + 257) + TabItem = 'SpTBXTabItem6' + object SpTBXPanel2: TSpTBXPanel + Left = 8 + Top = 112 + Width = 252 + Height = 124 + Anchors = [akLeft, akTop, akRight, akBottom] + TabOrder = 4 + HotTrack = True + object Memo2: TMemo + Left = 2 + Top = 22 + Width = 248 + Height = 100 + Align = alClient + BorderStyle = bsNone + Lines.Strings = ( + 'To add hottrack borders to your controls:' + '1) Drop a TSpTBXPanel and set HotTrack to true' + '2) Drop a control inside' + '3) Set the control Align to alClient' + '4) Set the control BorderStyle to bsNone' + '4) Change the skin to other than Default') + TabOrder = 0 + end + object Panel2: TPanel + Left = 2 + Top = 2 + Width = 248 + Height = 20 + Align = alTop + BevelOuter = bvNone + TabOrder = 1 + object SpTBXSpeedButton1: TSpTBXSpeedButton + Left = 0 + Top = 0 + Width = 81 + Height = 20 + Caption = 'Column 1' + Align = alLeft + OnDraw = SpTBXSpeedButton1Draw + end + object SpTBXSpeedButton2: TSpTBXSpeedButton + Left = 81 + Top = 0 + Width = 96 + Height = 20 + Caption = 'Column 2' + Align = alLeft + OnDraw = SpTBXSpeedButton1Draw + end + object SpTBXSpeedButton3: TSpTBXSpeedButton + Left = 177 + Top = 0 + Width = 71 + Height = 20 + Caption = 'Column 3' + Align = alClient + OnDraw = SpTBXSpeedButton1Draw + end + end + end + object SpTBXButtonEdit1: TSpTBXButtonEdit + Left = 8 + Top = 48 + Width = 121 + Height = 21 + TabOrder = 2 + Text = 'SpTBXButtonEdit' + EditButton.Left = 97 + EditButton.Top = 0 + EditButton.Width = 20 + EditButton.Height = 17 + EditButton.Caption = '...' + EditButton.Align = alRight + end + object SpTBXComboBox2: TSpTBXComboBox + Left = 136 + Top = 16 + Width = 121 + Height = 21 + ItemHeight = 13 + TabOrder = 1 + Text = 'SpTBXComboBox' + end + object SpTBXEdit1: TSpTBXEdit + Left = 8 + Top = 16 + Width = 121 + Height = 21 + TabOrder = 0 + Text = 'SpTBXEdit' + end + object SpTBXSpinEdit1: TSpTBXSpinEdit + Left = 136 + Top = 48 + Width = 121 + Height = 21 + TabOrder = 3 + SpinButton.Left = 100 + SpinButton.Top = 0 + SpinButton.Width = 17 + SpinButton.Height = 17 + SpinButton.Align = alRight + end + object SpTBXColorEdit1: TSpTBXColorEdit + Left = 8 + Top = 80 + Width = 121 + Height = 21 + TabOrder = 5 + SelectedColor = clBlack + end + object SpTBXFontComboBox1: TSpTBXFontComboBox + Left = 136 + Top = 80 + Width = 121 + Height = 21 + ItemHeight = 23 + ItemIndex = 0 + TabOrder = 6 + Text = 'Arial' + SelectedFont = 'Arial' + end + end + object SpTBXTabSheet1: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 269 + Height = 257 + Caption = 'Controls' + ImageIndex = -1 + DesignSize = ( + 269 + 257) + TabItem = 'SpTBXTabItem1' + object progressAnimate: TSpTBXButton + Left = 80 + Top = 98 + Width = 65 + Height = 25 + Caption = 'Animate' + TabOrder = 5 + OnClick = progressAnimateClick + end + object progressInc: TSpTBXButton + Left = 48 + Top = 98 + Width = 33 + Height = 25 + Caption = '+' + TabOrder = 4 + OnClick = progressIncClick + Repeating = True + end + object SpTBXGroupBox6: TSpTBXGroupBox + Left = 8 + Top = 52 + Width = 252 + Height = 17 + Caption = 'ProgressBar' + Anchors = [akLeft, akTop, akRight] + TabOrder = 2 + Borders = False + end + object SpTBXGroupBox1: TSpTBXGroupBox + Left = 8 + Top = 8 + Width = 252 + Height = 17 + Caption = 'Button' + Anchors = [akLeft, akTop, akRight] + TabOrder = 0 + Borders = False + end + object SpTBXGroupBox2: TSpTBXGroupBox + Left = 8 + Top = 130 + Width = 252 + Height = 17 + Caption = 'Trackbar' + Anchors = [akLeft, akTop, akRight] + TabOrder = 8 + Borders = False + end + object SpTBXButton1: TSpTBXButton + Left = 110 + Top = 24 + Width = 75 + Height = 25 + Caption = 'Button' + TabOrder = 1 + end + object progressDec: TSpTBXButton + Left = 16 + Top = 98 + Width = 33 + Height = 25 + Caption = '-' + TabOrder = 3 + OnClick = progressDecClick + Repeating = True + end + object progressFiles: TSpTBXCheckBox + Left = 160 + Top = 102 + Width = 85 + Height = 21 + Caption = 'File progress' + TabOrder = 6 + OnClick = progressFilesClick + end + object SpTBXProgressBar1: TSpTBXProgressBar + Left = 80 + Top = 71 + Width = 150 + Height = 17 + Caption = '30%' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [fsBold] + ParentFont = False + Position = 30 + OnProgressChange = SpTBXProgressBar1ProgressChange + end + object SpTBXTrackBar1: TSpTBXTrackBar + Left = 72 + Top = 147 + Width = 150 + Height = 45 + TabOrder = 9 + end + object trackTickmarks: TSpTBXRadioGroup + Left = 13 + Top = 194 + Width = 241 + Height = 49 + Caption = 'Tickmarks' + Anchors = [akLeft, akTop, akRight] + TabOrder = 10 + TabStop = True + OnClick = TrackbarTickMarksRadioClick + Columns = 4 + ItemIndex = 0 + Items.Strings = ( + 'Bottom' + 'Top' + 'Both' + 'Center') + end + end + end + end + object SpTBXDockablePanel2: TSpTBXDockablePanel + Left = 0 + Top = 303 + Width = 273 + Height = 154 + Caption = 'Skins Options' + DockPos = 303 + TabOrder = 1 + DesignSize = ( + 269 + 150) + object rgSkinType: TSpTBXRadioGroup + Left = 8 + Top = 32 + Width = 252 + Height = 105 + Caption = 'Skin Type' + Anchors = [akLeft, akTop, akRight] + TabOrder = 1 + TabStop = True + OnClick = rgSkinTypeClick + ItemIndex = 2 + Items.Strings = ( + '&None' + '&Windows' + '&Skins') + end + object skinButton: TSpTBXSpeedButton + Left = 70 + Top = 111 + Width = 86 + Height = 18 + Caption = 'Load Skin ...' + OnClick = skinButtonClick + end + end + end + object SpTBXDock1: TSpTBXDock + Left = 0 + Top = 0 + Width = 716 + Height = 72 + object SpTBXToolbar1: TSpTBXToolbar + Left = 0 + Top = 0 + ShrinkMode = tbsmNone + Stretch = True + TabOrder = 0 + Caption = 'SpTBXToolbar1' + object SpTBXLabelItem4: TSpTBXLabelItem + Caption = 'Options:' + end + object subLang: TSpTBXSubmenuItem + Caption = 'Languages' + Options = [tboDropdownArrow] + end + object subSkins: TSpTBXSubmenuItem + Caption = 'Skins' + Options = [tboDropdownArrow] + object SpTBXSkinGroupItem1: TSpTBXSkinGroupItem + end + end + object subColor: TSpTBXSubmenuItem + Caption = 'Color' + Options = [tboDropdownArrow, tboToolbarStyle] + ToolBoxPopup = True + object SpTBXColorPalette1: TSpTBXColorPalette + end + object SpTBXSeparatorItem1: TSpTBXSeparatorItem + end + object SpTBXItem5: TSpTBXItem + Caption = 'More Colors...' + end + end + object SpTBXSeparatorItem8: TSpTBXSeparatorItem + end + object SpTBXItem2: TSpTBXItem + Caption = 'Options Panel' + Control = SpTBXDockablePanel1 + end + object SpTBXItem7: TSpTBXItem + Caption = 'TabControl' + Control = SpTBXTabControl1 + end + end + object SpTBXToolbar3: TSpTBXToolbar + Left = 0 + Top = 23 + DockPos = 0 + DockRow = 1 + ShrinkMode = tbsmNone + Stretch = True + TabOrder = 1 + Caption = 'SpTBXToolbar3' + DesignSize = ( + 706 + 22) + object SpTBXLabelItem3: TSpTBXLabelItem + Caption = '&Address:' + Control = SpTBXComboBox1 + end + object TBControlItem3: TTBControlItem + Control = SpTBXComboBox1 + end + object SpTBXSeparatorItem6: TSpTBXSeparatorItem + Blank = True + end + object SpTBXItem1: TSpTBXItem + Caption = 'Go' + DisplayMode = nbdmImageAndText + ImageIndex = 1 + Images = ImageList1 + end + object SpTBXComboBox1: TSpTBXComboBox + Left = 53 + Top = 0 + Width = 605 + Height = 21 + Anchors = [akLeft, akTop, akRight] + ItemHeight = 13 + TabOrder = 0 + Text = + 'The AccelChar (Alt+A) of the Address label will focus the ComboB' + + 'ox control' + end + end + object SpTBXToolbar2: TSpTBXToolbar + Left = 0 + Top = 49 + DockPos = 8 + DockRow = 2 + ShrinkMode = tbsmNone + Stretch = True + TabOrder = 2 + Caption = 'SpTBXToolbar2' + object SpTBXItem3: TSpTBXItem + Caption = 'Custom Sized Item (Width = 200)' + CustomWidth = 200 + end + object SpTBXSeparatorItem7: TSpTBXSeparatorItem + end + object SpTBXItem4: TSpTBXItem + Caption = 'Anchored Item' + Anchored = True + CustomWidth = 497 + end + end + end + object SpTBXMultiDock3: TSpTBXMultiDock + Left = 580 + Top = 72 + Width = 136 + Height = 457 + Position = dpxRight + object DP1: TSpTBXDockablePanel + Left = 0 + Top = 0 + Width = 136 + Height = 159 + Caption = 'Panel1' + DockPos = 0 + TabOrder = 0 + Images = ImageList1 + Options.Close = False + Options.Minimize = True + Options.Maximize = True + object SpTBXLabel1: TSpTBXLabel + Left = 8 + Top = 32 + Width = 0 + Height = 33 + Caption = 'Panel Properties:' + Wrapping = twWrap + Underline = True + UnderlineColor = clBlue + end + object SpTBXLabel8: TSpTBXLabel + Left = 8 + Top = 48 + Width = 58 + Height = 19 + Caption = '- Resizable' + end + object SpTBXLabel9: TSpTBXLabel + Left = 8 + Top = 64 + Width = 74 + Height = 19 + Caption = '- Can minimize' + end + object SpTBXLabel10: TSpTBXLabel + Left = 8 + Top = 80 + Width = 78 + Height = 19 + Caption = '- Can maximize' + end + end + object DP2: TSpTBXDockablePanel + Left = 0 + Top = 159 + Width = 136 + Height = 134 + Caption = 'Panel2' + DockPos = 159 + TabOrder = 1 + Images = ImageList1 + Options.ButtonBorders = False + Options.Close = False + Options.Minimize = True + Options.MinimizeImageIndex = 5 + Options.MaximizeImageIndex = 8 + Options.RestoreImageIndex = 6 + object SpTBXLabel11: TSpTBXLabel + Left = 8 + Top = 32 + Width = 0 + Height = 33 + Caption = 'Panel Properties:' + Wrapping = twWrap + Underline = True + UnderlineColor = clBlue + end + object SpTBXLabel12: TSpTBXLabel + Left = 8 + Top = 48 + Width = 58 + Height = 19 + Caption = '- Resizable' + end + object SpTBXLabel13: TSpTBXLabel + Left = 8 + Top = 64 + Width = 74 + Height = 19 + Caption = '- Can minimize' + end + end + object DP3: TSpTBXDockablePanel + Left = 0 + Top = 293 + Width = 136 + Height = 164 + Caption = 'Panel3' + DockPos = 293 + TabOrder = 2 + Images = ImageList1 + Options.ButtonBorders = False + Options.Close = False + Options.Minimize = True + Options.MinimizeImageIndex = 5 + Options.MaximizeImageIndex = 8 + Options.RestoreImageIndex = 6 + object SpTBXLabel15: TSpTBXLabel + Left = 8 + Top = 32 + Width = 0 + Height = 33 + Caption = 'Panel Properties:' + Wrapping = twWrap + Underline = True + UnderlineColor = clBlue + end + object SpTBXLabel16: TSpTBXLabel + Left = 8 + Top = 48 + Width = 58 + Height = 19 + Caption = '- Resizable' + end + object SpTBXLabel17: TSpTBXLabel + Left = 8 + Top = 64 + Width = 74 + Height = 19 + Caption = '- Can minimize' + end + end + end + object Panel1: TPanel + Left = 278 + Top = 72 + Width = 297 + Height = 457 + Align = alClient + BevelOuter = bvNone + TabOrder = 2 + object Image1: TImage + Left = 16 + Top = 248 + Width = 100 + Height = 72 + AutoSize = True + Picture.Data = { + 07544269746D617096540000424D965400000000000036000000280000006400 + 000048000000010018000000000060540000C40E0000C40E0000000000000000 + 0000CAE0DCCAE0DCC8DFDCC7DFDBC6DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDB + C5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DE + DBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5 + DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDB + C5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DE + DBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5 + DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDB + C5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DE + DBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5DEDBC5 + DEDBC5DEDBC5DEDBC4DEDBC2DCD9CACFD0B0B4B5B3BABAE4EEEFE0EDEFDFECEF + DFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFEC + EFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDF + ECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEF + DFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFEC + EFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDF + ECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEF + DFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFEC + EFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDF + ECEFDFECEFDFECEFDFECEFDFECEFDFECEFDFECEFDEECEEDAE9EBC5C6C1C3C5C0 + C2C5C0C0C4C0BEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBFC5 + C1DFE6E7DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DBE2E2DFE5E5DF + E5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5 + DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5 + E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DF + E5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5 + DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE5E5DFE6E7DDE4E5DFE6E8DFE6E8DFE6 + E8DFE6E8DFE6E8DFE6E8DFE6E8DFE6E8DFE6E8DFE6E8DFE6E8C1C6C3BEC3BFBE + C3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BFBEC3BF + BACCC9B4CBC6B7B3A8B7B3A8B7B3A8B7B3A8B7B3A8B7B3A8B7B3A8B7B3A8B7B3 + A8B7B3A8B7B3A8B7B3A8BAB7ADFFFEFD92887F91877EA1968BA0968BCBBDB0B9 + ADA1A69B90968C82B2A69A9F948AAFA398A99E93FFEEDDFFEEDDFFEEDDFFEEDD + FFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEE + DDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFF + EEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDD + FFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFFA + F5FAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFBEBAB1B7B3A8B7B3A8B7B3A8B7B3A8B7B3A8B7B3A8B7B3A8B7B3A8 + B7B3A8B7B3A8B7B3A8B7B3A8BBCDC4B1CBC1B8B4A9B8B4A9B8B4A9B8B4A9B8B4 + A9B8B4A9B8B4A9B8B4A9B8B4A9B8B4A9B8B4A9B8B4A9BBB7ADFFFEFEFFFAF5FF + FAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5 + FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFA + F5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FFFAF5FF + FAF5FFFAF5FFFAF5FFFAF5F9F4EFEFEBE5EFEBE5EFEBE5EFEBE5EFEBE5EFEBE5 + EFEBE5EFEBE5EFEBE5EFEBE5EFEBE5EFEBE5EFEBE5EFEBE5EFEBE5EFEBE5EFEB + E5EFEBE5F8F4EFFFFAF5FFFDFCFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBEBBB1B8B4A9B8B4A9B8B4A9B8B4A9 + B8B4A9B8B4A9B8B4A9B8B4A9B8B4A9B8B4A9B8B4A9B8B4A9E1E6E4EFF3F3B9B5 + AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9 + B5AABCB8AEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2F3F2EFF3F4EFF3F4 + EFF3F4EFF3F4EFF3F4EFF3F4EFF3F4EFF3F4EFF3F4EFF3F4EFF3F4EFF3F4EFF3 + F4EFF3F4EFF3F4EFF3F4EFF3F4EFF3F4EDEEEEFFFFFFFFFFFFFAFAFAFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFBCB2 + B9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5AAB9B5 + AAB9B5AAE6EAE9F7FAFABAB7ACBAB7ACBAB7ACBAB7ACBAB7ACBAB7ACBAB7ACBA + B7ACBAB7ACBAB7ACBAB7ACBAB7ACBDB9B0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFF2F3F2EEF3F4EAE8CBEBECDBCED2D3DBE0E1D6DBDCD6DBDCD1D6D7D3D7 + D8D4D8D9D6DADBD4D8D9ECF1F2EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4ECEEEEFF + FFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFC0BDB4BAB7ACBAB7ACBAB7ACBAB7ACBAB7ACBAB7ACBAB7 + ACBAB7ACBAB7ACBAB7ACBAB7ACBAB7ACE6EAE9F7FAFAB9B7ACB9B7ACB9B7ACB9 + B7ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACBCBAB0FFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2F3F2EEF3F4C9B598E0D2BBC8CDCDC0C4 + C5C1C5C6C9CECEC4C8C9C2C6C6CED3D3CBCFD0CBCFD0EBF0F1EEF3F4EEF3F4EE + F3F4EEF3F4EEF3F4ECEEEEFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFBDB4B9B7ACB9B7ACB9B7 + ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACB9B7ACE6EAEAF7 + FAFABAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8AD + BAB8ADBAB8ADBDBBB1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2F3F2EEF3 + F4EBEFF0ECF1F1EBF0F1EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EE + F3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4ECEEEEFFFFFFFFFFFFFAFAFA + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFC0BEB5BAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBAB8ADBA + B8ADBAB8ADBAB8ADE6EAEAF7FAFABCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAF + BCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBEBCB2FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF2F3F2EEF3F4EAEBEBE1E4E4ABAFB0AEB2B2B3B7B7B4B8B9B5 + B9BAA5A8A9B7BBBCBDC1C2EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4 + ECEEEEFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFC1BFB6BCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBC + BAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFE6EAEAF7FAFABCBAAFBCBAAF + BCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBEBD + B3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2F3F2EEF3F4E9EDEEEBEFF0EE + F3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4EEF3F4 + EEF3F4EEF3F4EEF3F4EEF3F4ECEEEEFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC2C0B7BCBAAFBC + BAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAFBCBAAF + E6EBEAF7FAFABEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBC + B1BEBCB1BEBCB1BEBCB1C0BEB4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2 + F3F2EFF3F4E3E1DCDBDBD8CBCFD0CFD2D3C1C5C6C6CACBE5EAEAEFF3F4EEF3F4 + EEF3F4EFF3F4EEF3F4EFF3F4EEF3F4EFF3F4EFF3F4EFF3F4EDEEEEFFFFFFFFFF + FFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFC3C1B8BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1 + BEBCB1BEBCB1BEBCB1BEBCB1E7EBEAF7FAFABEBCB1BEBCB1BEBCB1BEBCB1BEBC + B1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1C0BFB5FFFFFFF0F0F0D5 + D5D5D5D5D5D8D8D8CDCDCDD0D0D0E4E4E4D5D5D5EBEBEBD0D0D0C9C9C9D6D6D6 + D2D2D2D4D4D4E9E9E9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFF3F3F2F1F4F5E2E1DCE1E2DEDFE2E3DFE2E3E9EDED + DEE1E2EFF2F3F0F4F5F0F4F5F0F4F5F1F4F5F0F4F5F0F4F5F1F4F5F0F4F5F0F4 + F5F1F4F5EDEEEEFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC3C2B8BEBCB1BEBCB1BEBCB1BEBCB1 + BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1BEBCB1E7EBEAF7FAFAC0BE + B3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0 + BEB3C1C0B6FFFFFFFAFAFAE4E4E4D6D6D6E3E3E3D0D0D0DBDBDBE1E1E1E3E3E3 + E5E5E5D6D6D6D1D1D1DADADAE5E5E5EEEEEEF2F2F2FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3F2F3F6F6E7E5DF + E8E7E3EAEDEEE2E5E6E4E6E7F1F4F5F3F6F6F3F5F6F3F5F6F3F5F6F3F5F6F3F5 + F6F3F5F6F3F5F6F3F5F6F3F5F6F3F6F6EDEFEEFFFFFFFFFFFFFAFAFAFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC4C3B9 + C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BEB3C0BE + B3C0BEB3E7EBEAF7FAFAC1BFB4C1BFB4C1BFB4C1BFB4C1BFB4C1BFB4C1BFB4C1 + BFB4C1BFB4C1BFB4C1BFB4C1BFB4C3C1B7FFFFFFF3F3F3D7D7D7DDDDDDE3E3E3 + E0E0E0D9D9D9DADADAE5E5E5EFEFEFD8D8D8DEDEDEE2E2E2D7D7D7FDFDFDFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFF3F3F2F5F7F7BFCBB1CACCBECDCECFD7D8D9CFD0D0EDEEEFF5F7F7F5F7 + F7F5F7F7F5F7F7F5F7F7F5F7F7F5F7F7F5F7F7F5F7F7F5F7F7F5F7F7EDEFEEFF + FFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFC6C4BBC1BFB4C1BFB4C1BFB4C1BFB4C1BFB4C1BFB4C1BF + B4C1BFB4C1BFB4C1BFB4C1BFB4C1BFB4E7EBEBF7FAFAC2C0B5C2C0B5C2C0B5C2 + C0B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5C4C2B8FFFFFF + F1F1F1CFCFCFCDCDCDBFBFBFCECECEDCDCDCCCCCCCC5C5C5C3C3C3CACACAD8D8 + D8D3D3D3C8C8C8C4C4C4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4F4F3F8F8F9F7F8F8F8F9F8F7F8F9F8F8 + F9F7F8F9F8F8F9F8F8F9F8F8F8F8F8F9F7F8F8F7F8F8F8F8F8F7F8F9F8F8F9F8 + F8F8F8F8F9F8F8F9EEEFEEFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7C5BCC2C0B5C2C0B5C2C0 + B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5C2C0B5E7EBEBF7 + FAFAC3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7 + C3C1B7C3C1B7C4C3BAFEFEFEBFBFBFC7C7C7CFCFCFC5C5C5E8E8E8C7C7C7C7C7 + C7CDCDCDC5C5C5DCDCDCD3D3D3C2C2C2D8D8D8D7D7D7D5D5D5C4C4C4C9C9C9C1 + C1C1CACACAFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4F4F3FAF9 + FACACACAACACACA1A1A1DADADAFAF9FAFAFAFAFAFAFAFAFAFAFAF9FAFAFAFAFA + FAFAFAF9FAFAFAFAFAFAFAFAF9FAFAF9FAFAF9FAEEEFEEFFFFFFFFFFFFFAFAFA + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFC7C5BDC3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3C1B7C3 + C1B7C3C1B7C3C1B7E7EBEBF7FAFAC4C2B8C4C2B8C4C2B8C4C2B8C4C2B8C4C2B8 + C4C2B8C4C2B8C4C2B8C4C2B8C4C2B8C4C2B8C5C4BAFFFFFFF1F1F1E9E9E9D6D6 + D6DFDFDFDDDDDDD9D9D9D0D0D0E8E8E8D0D0D0D5D5D5DCDCDCD9D9D9E3E3E3EC + ECECD1D1D1F1F1F1CECECEDFDFDFCBCBCBF2F2F2E4E4E4DEDEDEECECECDBDBDB + DADADAD9D9D9E7E7E7D5D5D5E0E0E0E9E9E9E0E0E0DEDEDEE0E0E0FFFFFFFFFF + FFFFFFFFFFFFFFF4F4F3FCFBFAE9E7E8DCDADBDBDADAEEEDEDFCFBFAFCFBFBFC + FBFBFCFBFBFCFBFBFCFBFBFCFBFAFCFBFAFCFAFBFCFBFBFCFBFBFCFBFBFCFBFB + EEEFEEFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFC8C6BEC4C2B8C4C2B8C4C2B8C4C2B8C4C2B8C4 + C2B8C4C2B8C4C2B8C4C2B8C4C2B8C4C2B8C4C2B8E8ECEBF7FAFAC5C3B8C5C3B8 + C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C6C4 + BBFFFFFFFAFAFABFBFBFE1E1E1D4D4D4DCDCDCD7D7D7E7E7E7DADADAD7D7D7DA + DADADCDCDCECECECF2F2F2F7F7F7F1F1F1F5F5F5ECECECEFEFEFE4E4E4F4F4F4 + DADADAE7E7E7E9E9E9E7E7E7ECECECEEEEEEF6F6F6F2F2F2EAEAEAEDEDEDE6E6 + E6EAEAEAE0E0E0FFFFFFFFFFFFFFFFFFFFFFFFF5F4F3FDFBFBFDFBFBFDFBFBFD + FBFCFDFBFBFDFBFBFDFBFBFDFBFCFDFBFBFDFBFBFDFBFBFDFBFBFDFCFBFDFCFB + FDFBFBFDFBFBFDFBFBFDFBFBEEEFEFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9C7BEC5C3B8C5 + C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8C5C3B8 + E8ECEBF7FAFAC6C4BAC6C4BAC6C4BAC6C4BAC6C4BAC6C4BAC6C4BAC6C4BAC6C4 + BAC6C4BAC6C4BAC6C4BAC7C5BCFFFFFFEEEEEEB8B8B8CBCBCBD0D0D0B8B8B8CE + CECEEAEAEADADADADBDBDBD9D9D9E4E4E4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5 + F4F3EDEBEBDBD9D9DEDCDCE8E6E6E1E5E4DBE4E4DAE4E4D8E3E4D7E3E3D6E3E3 + D5E2E3D4E2E3D3E2E3D2E1E3D1E1E2D0E1E2CFE0E2CEE0E2EAF2F3FFFFFFFFFF + FFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFCAC8BFC6C4BAC6C4BAC6C4BAC6C4BAC6C4BAC6C4BAC6C4BAC6C4BA + C6C4BAC6C4BAC6C4BAC6C4BAE8ECECF7FAFAC7C5BBC7C5BBC7C5BBC7C5BBC7C5 + BBC7C5BBC7C5BBC7C5BBC7C5BBC7C5BBC7C5BBC7C5BBC8C7BEFFFFFFBBBBBBCC + CCCCCACACAD8D8D8C4C4C4DCDCDCC9C9C9CDCDCDBCBCBCCACACACDCDCDDFDFDF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFEAEEF3BFCBDDB1BED0B5C2D3BDCADCDCE4EAEBF0F0 + E9F0F0E8EFF0E6EFF0E4EFEFE3EEEFE1EEEFE0EDEFDEECEFDCECEFDBEBEED9EB + EED7EAEEEEF6F8FFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCBC9C1C7C5BBC7C5BBC7C5BBC7C5BB + C7C5BBC7C5BBC7C5BBC7C5BBC7C5BBC7C5BBC7C5BBC7C5BBE8ECECF7FAFAC8C6 + BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8 + C6BCC9C7BEFFFEFEE8E4DFE5E1DDECE8E3E9E4E0F2EDE8F0EBE6ECE8E3EDE8E4 + E6E2DEEDE9E4F3EEE9E9E5E0ECE8E3F0EBE6EFEAE6E7E3DEECE8E3E7E3DFEBE7 + E2EBE7E2EBE7E2F5F0EBF0EBE7EAE6E1E5E1DCE7E3DEEBE6E2F0ECE7EBE6E2EE + EAE5FFF9F3FFF9F3FFF9F3FFF9F3FFF9F3FFF9F3FFF9F3FBF6F2EDEDEEEDEDEE + EDEDEEEDEDEEF7F4F0FCF6F1FBF6F1FBF6F1FBF6F1FAF6F0FAF6F0FAF6F0FAF6 + F0F9F6F0F9F6F0F9F5F0F8F5F0F8F5F0FCF7F2FFF9F3FFFDFBFAFAFAFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCCCAC2 + C8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6BCC8C6 + BCC8C6BCE8ECECF7FAFAC9C7BDC9C7BDC9C7BDC9C7BDC9C7BDC9C7BDC9C7BDC9 + C7BDC9C7BDC9C7BDC9C7BDC9C7BDCAC8BFFFFEFDCDC0B2AA9F93B2A69AD3C5B7 + D3C5B7B6AA9EB2A69AB2A69AACA095C4B7AAD2C4B6BBAEA2BBAFA2B5A89CB5A9 + 9DABA094AEA296A0958ABEB1A4A79C91B6AA9ED9CBBCC8BBADB5A99DB5A99DBD + B0A3AFA398C7BAADA0958BD8CABBFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDD + FFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEE + DDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFFEEDDFF + EEDDFFFAF5FAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFCDCBC3C9C7BDC9C7BDC9C7BDC9C7BDC9C7BDC9C7BDC9C7 + BDC9C7BDC9C7BDC9C7BDC9C7BDC9C7BDE8ECECF7FAFACBC9BFCBC9BFCBC9BFCB + C9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9C1FFFEFE + FFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFE + FEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFF + FEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFE + FFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFDFDFCF9F9 + F9F8F9F8F8F9F8F8F9F9F8F9F9F8F9F9F8F9F9F9F9F9F8F9F9F8F9F9FAFBFAFF + FEFEFFFEFEFFFEFEFFFEFEFFFEFEFFFEFEFAFAFAFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCECCC4CBC9BFCBC9BFCBC9 + BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFCBC9BFE8EDECF7 + FAFACCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0 + CCCAC0CCCAC0CCCBC2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF9F9F9E9EAEAE4E5E5E4E5E5E4E5E5E4E5E5E4E5E5E4E5E5E4 + E5E5E4E5E5E4E5E5E1E3E4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFA + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFCFCDC5CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CCCAC0CC + CAC0CCCAC0CCCAC0E9EDECF7FAFACDCBC1CDCBC1CDCBC1CDCBC1CDCBC1CDCBC1 + CDCBC1CDCBC1CDCBC1CDCBC1CDCBC1CDCBC1CDCBC2FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F6F6F6F6F6F6F6F6F6BC + BCBCC4C4C4C9C9C9BBBBBBDEDEDEF6F6F6F6F6F6E4E5E5FFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFCFCEC5CDCBC1CDCBC1CDCBC1CDCBC1CDCBC1CD + CBC1CDCBC1CDCBC1CDCBC1CDCBC1CDCBC1CDCBC1E9EDEDF7FAFACECCC2CECCC2 + CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECC + C4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8 + F8F8F6F6F6F6F6F6F6F6F6EDEDEDF3F3F3F6F6F6F6F6F6F3F3F3F6F6F6F6F6F6 + E5E5E6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0CFC6CECCC2CE + CCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2CECCC2 + E9EDEDF7FAFACECDC3CECDC3CECDC3CECDC3CECDC3CECDC3CECDC3CECDC3CECD + C3CECDC3CECDC3CECDC3CECDC4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFF8F8F8F7F7F7F7F7F7F7F7F7C9C9C9C7C7C7C4C4C4 + E4E4E4F7F7F7F7F7F7F7F7F7E5E5E6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFD0CFC7CECDC3CECDC3CECDC3CECDC3CECDC3CECDC3CECDC3CECDC3 + CECDC3CECDC3CECDC3CECDC3E9EDEDF7FAFACFCEC4CFCEC4CFCEC4CFCEC4CFCE + C4CFCEC4CFCEC4CFCEC4CFCEC4CFCEC4CFCEC4CFCEC4CFCEC5FFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F6F6F6F6F6F6 + F6F6F6E8E8E8F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6E6E6E6FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD1D0C8CFCEC4CFCEC4CFCEC4CFCEC4 + CFCEC4CFCEC4CFCEC4CFCEC4CFCEC4CFCEC4CFCEC4CFCEC4E9EDEDF7FAFAD0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFF8F8F8F7F7F7F7F7F7F7F7F7D3D3D3CFCFCFE0E0E0F7F7F7F7F7F7F7F7 + F7F7F7F7E6E6E6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5E9EDEDF7FAFAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F6F6F6F6F6F6F6F6F6F6F6F6F6F6 + F6F2F2F2F6F6F6F6F6F6F6F6F6F6F6F6E7E6E6FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5E9EDEDF7FAFAD0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F7F7 + F7F7F7F7F7F7F7E7E7E7EFEFEFD8D8D8F2F2F2F7F7F7F7F7F7F7F7F7E7E7E7FF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5E9EDEDF7 + FAFAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF8F8F8F6F6F6F6F6F6F6F6F6DBDBDBDBDBDBDEDEDEECECECF6 + F6F6F6F6F6F6F6F6E8E7E7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFA + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFD2D1C9D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5E9EDEDF7FAFAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F7F7F7F7F7F7F7F7F7F1 + F1F1DBDBDBDEDEDEEEEEEEF7F7F7F7F7F7F7F7F7E8E7E7FFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5E9EDEDF7FAFAD0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8 + F8F8F7F7F7F7F7F7F7F7F7B3B3B39C9C9CA6A6A6D4D4D4F7F7F7F7F7F7F7F7F7 + E9E7E7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + E9EDEDF7FAFAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFF8F8F8F6F6F6F6F6F6F6F6F6E4E4E4F4F4F4EBEBEB + EDEDEDF6F6F6F6F6F6F6F6F6E5E5E5FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5E9EDEDF7FAFAD0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F7F7F7F7F7F7 + F7F7F7ABABABB8B8B8A4A4A4BDBDBDF7F7F7F7F7F7F7F7F7E9E8E8FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5E9EDEDF7FAFAD0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC6FFFFFFF3F3F3C2C2C2CDCDCDD0D0D0CECECEC8C8C8E6E6E6CBCBCB + C4C4C4C2C2C2CECECECECECEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFF8F7F7F1DCA3F5E8B2E9C37DE8BF78E8BF78E8BF78E8BF78E8BF78E8BF + 78E9C483E0E0DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5E9EDEDF7FAFAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFF0F0F0DCDCDCCDCDCDE1E1E1 + D0D0D0CDCDCDD9D9D9CFCFCFEEEEEECBCBCBD9D9D9E4E4E4FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8E9C775EDD790E3A73AE8B967E8B5 + 5CE9B760E8B459E2A232E2A232E4A942E4E4E4FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5E9EDEDF7FAFAD0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFF + F7F7F7DDDDDDD3D3D3DBDBDBE0E0E0D8D8D8E6E6E6D4D4D4E4E4E4D8D8D8EAEA + EAF7F7F7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8F0DA + B6F2E0C4EBCB94ECCD97EDD09DEDD09EEBCB93EACA90EACA90EBCD98E6E5C4FF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFAFAFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5C0D1CAB1 + CAC1D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC6FFFFFFF6F6F6CBCBCBE2E2E2D3D3D3DBDBDBD2D2D2E8E8 + E8CECECEDBDBDBE8E8E8FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4F4 + F4FEFEFEFFFFFFF8F8F8F7F7F7F7F7F7F7F7F7BBBBBBB8B8B8B6B6B6CDCDCDF7 + F7F7F7F7F7F7F7F7D2C39BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6F6F6 + F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 + F9D2D1C8D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5B2C9BE94B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFF1F1F1CFCFCFCDCD + CDBFBFBFCECECEDCDCDCBABABAD2D2D2DCDCDCCDCDCDD3D3D3FFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF5F5F5BEBEBEFAFAFAFFFFFFF8F8F8F6F6F6F6F6F6F6F6F6EE + EEEEF6F6F6EAEAEAF2F2F2F6F6F6F6F6F6F6F6F6CECBC9FFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFEDEDECD3CEC3CDC7BAB8AF9BC9C2B4CCC7B9E1DFD9ECEB + EAECEBEAECEBEAECEBEAECEBEAD1D0C7D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B1C9BE93B7AAD0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C6FFFFFFF1F1F1DADADACDCDCDC3C3C3CECECED8D8D8CCCCCCC8C8C8C7C7C7C1 + C1C1D8D8D8D3D3D3C8C8C8C7C7C7FAFAFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5F5F5E2E2E2FFFFFFFFFFFFF7 + F7F7F6F6F6F6F6F6F6F6F6C7C7C7B0B0B0BEBEBEE9E9E9F6F6F6F6F6F6F6F6F6 + ABC0BAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBEBEADFDED8E6E6E3E5E4 + E0E5E5E1E3E2DDE5E4E0E9E9E7E9E9E7E9E9E7E9E9E7E9E9E7D1D0C7D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + B1C9BE93B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFF3F3F3BDBDBDD6D6D6D0D0D0C7C7C7D6 + D6D6EBEBEBDEDEDEDADADAFFFFFFFFFFFFFFFFFFFFFFFFFBFBFBFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFF1F1F1F1F1F1F1F1F1F1F1F1E0E0E0E7E7E7E3E3E3 + F0F0F0F1F1F1F1F1F1F1F1F1B5C1BDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFEDECEBD2CEC3D1CCC1C8C2B4CFCABFCAC4B6D7D3CACFCABECBC5B8D0CCC0C6 + C0B1E6E6E2D1D0C7D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5B1C9BE93B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFF8F8F8C1 + C1C1D6D6D6D4D4D4C4C4C4D9D9D9E0E0E0D0D0D0DADADAF3F3F3F4F4F4FFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F8F8E3E3E3E7E7E7 + DADADAE0E0E0E6E6E6ECECECD6D6D6D1D1D1C9C9C9DFDFDFF6F6F6FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFECECEBDBD8D0E4E3DFDDDBD3E6E5E1E2E1DBE2 + E0DBDEDCD5DCDAD2E4E3DEE3E2DDE8E8E5D1D0C7D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B2C9BE94B7AAD0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC6FFFFFFEDEDEDB1B1B1C6C6C6CBCBCBB1B1B1CACACAEAEAEAD2D2D2 + CECECED5D5D5DDDDDDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFF6F6F6BEBEBEBEBEBEB1B1B1BDBDBDCBCBCBE4E4E4DBDBDBE0E0E0E5E5 + E5E1E1E1F5F5F5FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBEBEAD5D1C8D0 + CBC1CDC8BCCAC4B6D1CDC3C8C2B4CBC5B8E8E7E5E9E9E8E9E9E8E9E9E8D1D0C7 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5B2C9BE94B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFEFED9D2CBD3CCC6D4CDC6D1CAC4 + CCC6C0D6CFC8ECE4DCD8D1CACAC4BED3CCC5CBC4BEE9E1D9D6CFC9D7D0C9D6CF + C8DED7CFDED6CFCBC5BFD0C9C3D8D1CADAD3CBFFF5EBFFF5EBFFF5EBFFF5EBFF + F5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EB + FFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5 + EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFFF5EBFF + F5EBFFFCF9EDECEBDAD7CFE2E0DAE0DED7D9D5CCE2E0DBE2E0DBD8D5CBEAEAE7 + EBEBE8EBEBE8EBEBE8D1D0C7D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B2C9BE94B7AAD0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFEFE + C8BEB4C9BFB5D5CABFD4C9BEC0B6ADCBC1B7D9CDC2DBD0C4C2B8AFCDC3B8CFC5 + BAD8CDC2CDC2B8D2C7BCD5CABFD9CEC3D5CABFC9BFB5D6CBC0D2C7BCD9CEC3FF + F1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3 + FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1 + E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FFF1E3FF + F1E3FFF1E3FFF1E3FFF1E3FFF1E3FFFBF7EBEBEAD8D5CDCFCABFD5D1C8D1CCC2 + D7D3CBCAC5B8E9E9E7E9E9E7E9E9E7E9E9E7E9E9E7D1D0C7D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B2C9BE94 + B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFECECEA + D9D6CDDDDBD4CFCABED1CDC1DDDAD3D0CBBFEAEAE7EAEAE7EAEAE7EAEAE7EAEA + E7D1D0C7D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5B2C9BE94B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6EEEEEED7D7D7E2E2E2DEDE + DEDBDBDBE4E4E4DFDFDFE0E0E0E9E9E9DCDCDCD9D9D9E6E6E6DEDEDEDFDFDFD6 + D6D6DDDDDDD2D2D2CBCBCBEEEEEEE0E0E0F4F4F4DCDCDCEBEBEBDEDEDEDEDEDE + D4D4D4DBDBDBD7D7D7DFDFDFE0E0E0EAEAEAE8E8E8D3D3D3D8D8D8EAEAEADBDB + DBE3E3E3E4E4E4D8D8D8D9D9D9DEDEDEDADADADADADAD7D7D7DCDCDCD5D5D5E4 + E4E4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFECECEBDDDBD5D4D1C7D2CEC4D9D6CEEAEAE9EAEAE9EAEA + E9EAEAE9EAEAE9EAEAE9EAEAE9D1D0C7D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B1C9BE93B7AAD0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C6EFEFEFEDEDEDDADADAE8E8E8EBEBEBEBEBEBF0F0F0F6F6F6F2F2F2F5F5F5E4 + E4E4EDEDEDEFEFEFF2F2F2F3F3F3E9E9E9F2F2F2EDEDEDE9E9E9ECECECE9E9E9 + E1E1E1EFEFEFEFEFEFECECECEDEDEDF0F0F0EEEEEEE7E7E7F1F1F1F1F1F1F2F2 + F2E7E7E7E7E7E7ECECECE7E7E7EDEDEDE8E8E8E2E2E2F3F3F3ECECECF2F2F2E1 + E1E1EDEDEDF0F0F0EBEBEBF2F2F2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFECECEAD5D2C8D8D4CBD6D2 + C8DBD8D0EAE9E7EAE9E7EAE9E7EAE9E7EAE9E7EAE9E7EAE9E7D1D0C7D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + B1CABF93B8ABD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC6FAFAFAFAFAFAD5D5D5FAFAFAFAFAFAFAFAFAFA + FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA + FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA + FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA + FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA + FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA + FAF8F9F8F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 + F9F9F9F9F9D2D1C8D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5B2CAC095B9ACD0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6D3D3D371717173 + 73739999999A9A9AA3A3A37979799D9D9D9595957979798686868787879A9A9A + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B2C9BE94B7AAD0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC6AEAEAE6F6F6FADADADADADAD626262777777565656898989989898 + 8888889F9F9F737373B6B6B6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5B2C9BE94B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9F9F9F8F8F8FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B1C9BE93B7AAD0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC6FEFEFE + E4E4E4E3E3E3E2E2E2F0F0F0F8F8F8EAEAEAE4E4E4E7E7E7E7E7E7EAEAEAE0E0 + E0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2D1C9D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B1C9BE93 + B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5EBEAE7E7E7E4EBEAE7EBEAE7EBEAE7E8E8E5E5E5E1E9E9 + E6E2E2DFE8E7E4E7E7E4E7E7E4EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EB + EAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7 + EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEA + E7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EB + EAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7 + EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEAE7EBEA + E7D1D0C7D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5B1C9BE93B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B2C9BE94B7AAD0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5C5C4BAC6C5BBD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5CBCAC0C0BFB5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + B2C9BE94B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5A5A49C7877719F9F97 + 91918A8E8D867D7D77B6B5AD7A79738F8F88888881908F88545450A3A29A6F6F + 69A7A69E898982888881888881888781AEADA5BDBDB36D6C678C8C859E9D9579 + 7872ADACA4797973A8A79F7776708E8D869998916E6E6899989145444193938C + 93928B8888818888818E8D867B7A748888818E8D86A7A69E8A8982D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5B2C9BE94B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5A5A49C4F4F4B7776716565605454505A5A5661615C3A393764645F4241 + 3E7C7B7559585441403D71706B62625D5757533D3D3A4D4D49484844BEBDB4B1 + B0A775746E52514D5756524A4A465B5B5661605B5655514D4D4964645F4C4C48 + 73726C61605B5454504A49464545413A3A374645424646424A494653534F3F3F + 3C72716C8D8C85D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B2C9BE94B7AAD0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5A09F9871716B9A9992919089676762C0BF + B6BCBBB2BAB9B0C3C2B9B8B7AEBAB9B0B0AFA6CAC9C0B1B0A8CBCAC08C8B84B6 + B5ACBEBEB474746EC2C1B7B8B7AE5D5C5875756FC8C7BEB5B4ABB9B8AFC5C4BB + C3C2B8B1B0A8908F88A6A59DB0AFA7C9C8BFB0AFA6C1C0B7B3B2AABCBBB2BAB9 + B0C3C2B8BABAB1BBBAB1BAB9B096958EA1A098D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5B2C9BE94B7AAD0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5B8CEC49FBFB3D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0 + CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5 + D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CF + C5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5D0CFC5BDCFC7AE + C8BED0D4CECDD1CCCED2CDCED2CDCDD2CDCDD1CCCED2CDCED2CDCDD1CCCDD2CD + CDD2CCCDD2CDCDD2CDCCD1CCCDD2CDCDD2CDCDD2CCCDD2CDC5CEC7C4CDC6C4CD + C6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4 + CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6C4CDC6 + C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CD + C6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3 + CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6C3CDC6 + C2CDC6C2CDC6C2CDC6C2CDC6C2CDC6C2CDC6C2CDC6C2CDC6C9D1CCC8CFCAC9D1 + CCC9D1CCC9D1CCC2CDC6C2CDC6C2CDC6C2CDC6C2CDC6C2CDC6C2CDC6C2CDC6C2 + CDC6C2CDC6C2CDC6BACFCAB6CCC8DBE0E0C0C4C4E0E6E6E2E8E8D5DADAC0C4C4 + E2E9EAE1E5E6E4B39CE0B19EE1E8E8CDD1D1DAE1E2A7AFB0A4AEC0C5E0D080BD + 8DDCE7E8E4E3DDEDD3C6EFEFEFCDCDCDCFCFCFCECECECACACAD8D8D8C9C9C9B9 + B9B9CECECEC9C9C9D7D7D7C9C9C9CFCFCFCDCDCDC5C5C5C4C4C4C7C7C7CACACA + D0D0D0C8C8C8C5C5C5D2D2D2C2C2C2CFCFCFC1C1C1D4D4D4DADADACBCBCBF9F9 + F9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB1CA + C0A1C1B6CBDADDA9BDA9CAD2D2B0C0C3CCDFE2DAD0BDCDC8C1E2E2E2FFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD5E5E6E7E9E9D1D3D2 + E6EAE9E4E8E7E3E6E5CCCFCEE7ECEBE5E7E6F1D9CEE3BAAAEAEFEEE1E5E4E4E9 + E9CCAD9FC9C5C2DBE5E7C2DDD7D7E1E3E4E7E1EBDDD4EAEEEDE3E7E6EFF3F2E3 + E7E6E8ECEAE9EDECE9EDECE7EBEAEFF3F2E5EAE8F0F4F3EDF1F0E9EDECE7EBE9 + EFF3F1EDF1F0E7ECEAE6EAE8EFF4F2E8EDEBE1E6E4EEF2F0DDE1E0E5E9E7E8EC + EAF0F4F3E7ECEAE8EDEBF5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5 + F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8 + F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9 + F8F5F9F8F5F9F8F5F9F8BBD2C8ACC9BED3E4E7B7CEC3CCD8DAC4D6D8D5E8EBD7 + D4C2CBD4CFF5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8F5F9F8 + F5F9F8D2E4E4EBEEEDE9ECEBE9ECEBE9ECEBE9ECEBE8ECEBE8ECEBE8ECEBE8EC + EBE7ECEBE7ECEBE7ECEBE7ECEBE7ECEBE7EBEBE6EBEBE6EBEBE6EBEBE4EAE9E3 + EAE9E3E9E9E3E9E9E3E9E9E2E9E9E2E9E9E1E9E9E1E9E9CADEE2CADDE2E1E9E9 + DBE3E2D3D9D9DBE4E8D3DCE7DBE4E7E0E9E9DFE9E9DFE8E8DFE8E8DFE8E8DEE8 + E8DEE8E8DEE8E8DDE8E8DDE8E8DDE8E8DDE8E8DDE8E8DCE8E8DCE8E8DCE8E8DC + E7E8DBE7E8DBE7E8DBE7E8DBE7E8DAE7E8DAE7E8DAE7E8DAE7E8DAE7E8D9E7E8 + D9E7E8D9E7E8D9E7E8D8E7E8D8E6E8D8E7E8D8E6E8D8E6E8D7E6E8D7E6E8D7E6 + E8D7E6E8D7E6E8D6E6E8D6E6E8D6E6E7D5E6E7D5E6E7D5E6E8D5E6E8D7E7E9D7 + E7E9D6E7E9D6E6E9D6E6E9D3E5E7D3E5E7D3E5E7D3E5E7D2E5E7D2E5E7D2E4E7 + D2E4E7D1E4E7D1E4E7D1E4E7CFE3E6C7DBDFDFDEDDA8A7A6DCDBDAF4F4F29F9E + 9DBBBAB9F4F4F2B6B6B5B9B9B8DCDDDCF2F3F2A4A5A4E4E5E4DADBDAA9A9A9B3 + B4B3BBBCBBABACABC8C9C9F0F2F2C6C8C8B7B8B8BBBDBCEFF2F1B4B6B5A2A4A3 + D9DCDBBBDDE7B4C5C3DCE6E8AEC0C7C6BBB8DBDFF1A7B1F5D5DAEDECF1F1EBF1 + F1EBF0F0EBF0F1EAF0F1EAF0F1EAF0F0EAF0F0E9F0F0E9F0F0E8F0F0E8F0F0E8 + F0F0E7F0F0E7F0F0E7EFF0E6EFF0E6EFF0E6EFF0E6EFF0E5EFF0E5EFF0E4EFF0 + E4EEF0E4EFF0E4EEF0E3EEF0E3EEF0E3EEF0E2EEF0E2EEF0E2EEF0E2EEF0E1ED + F0E1EDF0E1EDF0E0EDEFE0EDEFE0EDEFE0EDEFDFEDEFDFEDEFDFECEFDEEDEFDE + ECEFDEECEFDDECEFDDECEFDCECEFDCECEFDCECEFDBECEFDBEBEFDBEBEFDAEBEF + DAEBEEDAEBEFDAEBEFDAEBEED9EBEED9EBEED8EBEED3DFE1C5C7D3CAD8DCF2F2 + F0EFEFEDF0F1EFF0F1EFF0F1EEEFF0EDF0F1EEF0F1EFEFF1EFEFF1EFEFF1EFEF + F1EFEFF0EFEEF0EEEEF0EFECEEEDEEF0EFECEFEDEDF0EEEDF0EEEDF0EEEDF0EE + EAEEECECEFEEEBEFEEEAEDECEBEFEEE4E9E8E0CDC3E9EDEDC7D7E0DBE1E1E9EF + EED6DCEFE9EFEEE9EEEEE9EEEDE8EEEEE8EEEEE8EEEEE7EEEDE7EEEDE7EEEDE6 + EEEDE6EDEDE6EDEDE6EDEDE5EDEDE5EDEDE5EDEDE4EDEDE4EDEDE4EDEDE4EDED + E3ECEDE3EDEDE3ECEDE3ECEDE2ECEDE2ECEDE2ECEDE2ECEDE1ECEDE1ECEDE1EC + ECE1EBECE1EBEDE0EBEDE0EBECE0EBECDFEBECDFEBECDFEBECDEEBECDEEBECDE + EBECDDEAECDDEAECDDEAECDDEAECDCEAECDCEAECDCEAECDCEAECDBEAECDBEAEC + DBEAECDAE9ECDAE9ECDAE9ECDAE9ECD9E9ECD9E9EBD9E9ECD8E9EBD8E9EBD8E8 + EBD1DDDED8E8EBCFDFE25884A0709CA398C0B696BCB38CB2AB94B9B292B6AF94 + BAB28EB8AE95BBB392B8B08BB2AB94B8B199BAB493B9B18AB2AA92BBB18DBDB0 + 97BBB393B8B18CB5AC95B9B292BBB18DB8AE91B7AF8FB7AF91B7AF8DBEB18EBF + B18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18E + BFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB1 + 8EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBF + B18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18E + BFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB1 + 8EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBFB18EBF + B18EBFB193BFB289B2A696BBAF87B0A386A6C56D8EB46D95A48EAB9AA4C9C09F + C4BB9CC4B99BC3B99CC4B99EC5BB9AC3B8A5C8BF9BC4B99BC3B8A0C5BB9EC5BA + 9DC5BA9AC3B89DC5BA91BEB1A2C7BE99C2B7A1C6BC9CC2B89FC7BC99BFB69CC4 + B99EC3BA9CC4B990BEB191BEB191BEB191BEB191BEB191BEB191BEB190BEB190 + BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB1 + 90BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BE + B190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BEB190BDB190 + BDB190BDB190BDB190BDB190BDB190BDB190BDB190BDB190BDB190BDB190BDB1 + 90BDB190BDB190BDB190BDB190BDB190BDB190BDB190BDB190BDB190BDB190BD + B190BDB190BDB190BDB190BDB190BDB19EC6BA9FC4B8B0CEC5ADCCC3A8C1D980 + 9CC0} + Visible = False + end + object SpTBXTabControl1: TSpTBXTabControl + Left = 0 + Top = 0 + Width = 297 + Height = 457 + Align = alClient + ActiveTabIndex = -1 + Images = ImageList1 + HiddenItems = <> + object SpTBXRightAlignSpacerItem1: TSpTBXRightAlignSpacerItem + CustomWidth = 210 + end + object SpTBXSubmenuItem2: TSpTBXSubmenuItem + Options = [tboDropdownArrow] + LinkSubitems = subLang + end + object tabLeft: TSpTBXItem + Action = Action1 + ImageIndex = 3 + end + object tabRight: TSpTBXItem + Action = Action2 + ImageIndex = 4 + end + object tabClose: TSpTBXItem + ImageIndex = 2 + OnClick = tabCloseClick + end + end + end + object SpTBXStatusBar1: TSpTBXStatusBar + Left = 0 + Top = 529 + Width = 716 + Height = 26 + ParentShowHint = False + ShowHint = True + object TBControlItem2: TTBControlItem + Control = SpTBXProgressBar2 + end + object SpTBXSeparatorItem2: TSpTBXSeparatorItem + end + object hintLabel: TSpTBXLabelItem + Caption = 'Custom painted hint' + OnDrawHint = hintLabelDrawHint + end + object SpTBXSeparatorItem4: TSpTBXSeparatorItem + end + object SpTBXLabelItem6: TSpTBXLabelItem + Caption = 'C:\Mozilla' + ImageIndex = 0 + Images = ImageList1 + end + object SpTBXSeparatorItem3: TSpTBXSeparatorItem + end + object subLang2: TSpTBXSubmenuItem + Caption = 'Languages' + Options = [tboDropdownArrow] + LinkSubitems = subLang + end + object SpTBXSeparatorItem5: TSpTBXSeparatorItem + end + object SpTBXSpinEditItem1: TSpTBXSpinEditItem + end + object SpTBXProgressBar2: TSpTBXProgressBar + Left = 0 + Top = 1 + Width = 140 + Height = 19 + Caption = '30%' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [fsBold] + ParentFont = False + Position = 30 + end + end + object LangListBox: TSpTBXListBox + Left = 336 + Top = 424 + Width = 177 + Height = 81 + ItemHeight = 16 + Items.Strings = ( + 'English' + 'Espa'#241'ol' + #54620#44397#50612 + #26085#26412#35486 + #20013#22269#30340 + #1506#1489#1512#1497#1514 + #1593#1585#1576#1609 + #1056#1091#1089#1089#1082#1080#1081 + #917#955#955#951#957#953#954#940) + TabOrder = 5 + Visible = False + end + object ActionList1: TActionList + OnUpdate = ActionList1Update + Left = 376 + Top = 352 + object Action1: TAction + OnExecute = Action1Execute + end + object Action2: TAction + OnExecute = Action2Execute + end + end + object ImageList1: TImageList + Left = 408 + Top = 352 + Bitmap = { + 494C01010A000E00040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000003000000001002000000000000030 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 + 0000B7CEC400C5DED600C3DAD100C5DBD200C4DAD100C2DAD200C7E2DA000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B7CEC400BCD1C500C6D8CE00CBDBD300CBDBD300C6D8CE00BDD2C700B8D0 + C500000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0084B58400107310001873 + 18001873180018731800187B1800187B1800107B1000107B1000087B0800087B + 0800007B0000007300007BB57B00FFFFFF00000000000000000000000000BFD5 + CA00C8D9CF00DDE7E100E7EEEA00EEF3F000EBF1EE00E0E9E400CCDBD300B7CD + C00000000000000000000000000000000000000000000000000000000000B8CE + C100D4E2DB00E9F1EE00F0F6F400F0F6F500EFF5F300EDF3F100E4EDE900D0DF + D700BACFC3000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0010841000218C21002994 + 2900319431003194310029942900299C2900219C210018A5180018A5180010A5 + 100008A5080000940000006B0000FFFFFF000000000000000000BBD0C400DBE6 + E000F7F9F800FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FDFEFD00E7EE + EA00C2D4CA000000000000000000000000000000000000000000BACFC300E0EA + E500F7FAFA00F6F9F800F7FAFA00F7FAFA00F6F9F800F4F8F700F1F6F500EEF4 + F200D8E5DF00BBD0C50000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00188C180029942900399C + 3900399C3900399C3900FFFFFF00A5D6A5004AA54A004AA54A004AA54A0029A5 + 290018A51800009C0000007B0000FFFFFF0000000000BCD1C600DDE7E100FDFE + FD00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00F1F5F300C3D5CB00000000000000000000000000B8CDC100E3ECE700FBFC + FC00FBFCFC00FBFCFC00FDFEFE001C674B00FDFEFE00FBFCFC00F8FBFA00F3F8 + F700EFF5F300D8E4DE00B9CFC300000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0021942100399C390042A5 + 420042A5420042A54200FFFFFF00FFFFFF00A5D6A5004AA54A004AA54A0039A5 + 390021A5210008A50800087B0800FFFFFF00C2DAD200D1DFD800FBFCFC00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00ECF2EF00B9CEC20000000000BED5CB00D3E1D900FDFEFD00FEFF + FE00FEFFFE00FFFFFF001C674B001C674B001C674B00FFFFFF00FDFEFE00FAFC + FC00F4F8F700EDF3F100C9DAD100BBD6CC000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0029942900429C42004AA5 + 4A0052A552004AA54A00FFFFFF00FFFFFF00FFFFFF00A5D6A5004AA54A0039A5 + 390021A5210010A5100008840800FFFFFF00BFD5C900EBF1EE00FFFFFF00FFFF + FF001C674B001C674B00FFFFFF00FFFFFF00FFFFFF001C674B001C674B00FFFF + FF00FEFFFE00FDFEFE00D1DFD700BED8CE00BCD1C600EEF3F000FFFFFF00FFFF + FF00FFFFFF001C674B001C674B00FFFFFF001C674B001C674B00FFFFFF00FDFE + FE00F9FBFB00F3F8F700DDE8E300BAD2C9000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00319C31004AA54A0052A5 + 52004AA54A004AA54A00FFFFFF00FFFFFF00FFFFFF00FFFFFF00A5D6A50039A5 + 390021A5210018A5180010841000FFFFFF00C7D8CE00F9FBFA00FFFFFF00FFFF + FF00FFFFFF001C674B001C674B00FFFFFF001C674B001C674B00FFFFFF00FFFF + FF00FEFFFE00FBFCFC00E4EDE900BBD3CA00C4D6CC00FBFCFC00FFFFFF00FFFF + FF001C674B001C674B00FFFFFF00FFFFFF00FFFFFF001C674B001C674B00FEFF + FE00FBFCFC00F6F9F800E7EFEC00BCD3C8000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00429C420052A552004AA5 + 4A004AA54A004AA54A00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00A5D6 + A500219C2100219C210018841800FFFFFF00CDDCD300FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF001C674B001C674B001C674B00FFFFFF00FFFFFF00FFFF + FF00FDFEFE00FAFCFC00EAF1EE00BCD2C900CCDBD300FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF001C674B00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FCFDFD00F9FBFB00EBF1EF00BED5CA000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0042A5420052A5520052A5 + 52004AA54A004AA54A00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00A5D6 + A500219C2100219C2100217B2100FFFFFF00CCDBD300FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF001C674B00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FCFDFD00F9FBFB00EBF1EF00BED5CA00CDDCD300FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF001C674B001C674B001C674B00FFFFFF00FFFFFF00FFFF + FF00FDFEFE00FAFCFC00EAF1EE00BCD2C9000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0052A552005AAD5A005AAD + 5A0052A552004AA54A00FFFFFF00FFFFFF00FFFFFF00FFFFFF00A5D6A5003194 + 31002994290029942900217B2100FFFFFF00C4D6CC00FBFCFC00FFFFFF00FFFF + FF001C674B001C674B00FFFFFF00FFFFFF00FFFFFF001C674B001C674B00FEFF + FE00FBFCFC00F6F9F800E7EFEC00BCD3C800C7D8CE00F9FBFA00FFFFFF00FFFF + FF00FFFFFF001C674B001C674B00FFFFFF001C674B001C674B00FFFFFF00FFFF + FF00FEFFFE00FBFCFC00E4EDE900BBD3CA000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0052A552006BB56B006BB5 + 6B005AAD5A0052AD5200FFFFFF00FFFFFF00FFFFFF00A5D6A500399C39003194 + 31002994290029942900217B2100FFFFFF00BCD1C600EEF3F000FFFFFF00FFFF + FF00FFFFFF001C674B001C674B00FFFFFF001C674B001C674B00FFFFFF00FDFE + FE00F9FBFB00F3F8F700DDE8E300BAD2C900BFD5C900EBF1EE00FFFFFF00FFFF + FF001C674B001C674B00FFFFFF00FFFFFF00FFFFFF001C674B001C674B00FFFF + FF00FEFFFE00FDFEFE00D1DFD700BED8CE000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF005AAD5A007BBD7B0073BD + 730063AD63005AAD5A00FFFFFF00FFFFFF00A5D6A500429C4200429C4200399C + 39003194310031943100217B2100FFFFFF00BED5CB00D3E1D900FDFEFD00FEFF + FE00FEFFFE00FFFFFF001C674B001C674B001C674B00FFFFFF00FDFEFE00FAFC + FC00F4F8F700EDF3F100C9DAD100BBD6CC00C2DAD200D1DFD800FBFCFC00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00ECF2EF00B9CEC200000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF006BB56B008CC68C007BBD + 7B006BB56B0063B56300FFFFFF00A5D6A5005AAD5A0052A552004AA54A0042A5 + 4200399C390031943100217B2100FFFFFF0000000000B8CDC100E3ECE700FBFC + FC00FBFCFC00FBFCFC00FDFEFE001C674B00FDFEFE00FBFCFC00F8FBFA00F3F8 + F700EFF5F300D8E4DE00B9CFC3000000000000000000BCD1C600DDE7E100FDFE + FD00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00F1F5F300C3D5CB0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0073BD73009CCE9C008CC6 + 8C007BBD7B0073BD73006BB56B0063B5630063AD63005AAD5A0052AD52004AA5 + 4A0042A542003194310018731800FFFFFF000000000000000000BACFC300E0EA + E500F7FAFA00F6F9F800F7FAFA00F7FAFA00F6F9F800F4F8F700F1F6F500EEF4 + F200D8E5DF00BBD0C50000000000000000000000000000000000BBD0C400DBE6 + E000F7F9F800FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FDFEFD00E7EE + EA00C2D4CA000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00B5DEB50073BD730063B5 + 63005AAD5A0052A5520052A552004AA54A004AA54A0042A54200429C4200399C + 390031943100218C21008CBD8C00FFFFFF00000000000000000000000000B8CE + C100D4E2DB00E9F1EE00F0F6F400F0F6F500EFF5F300EDF3F100E4EDE900D0DF + D700BACFC300000000000000000000000000000000000000000000000000BFD5 + CA00C8D9CF00DDE7E100E7EEEA00EEF3F000EBF1EE00E0E9E400CCDBD300B7CD + C000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 + 0000B7CEC400BCD1C500C6D8CE00CBDBD300CBDBD300C6D8CE00BDD2C700B8D0 + C500000000000000000000000000000000000000000000000000000000000000 + 0000B7CEC400C5DED600C3DAD100C5DBD200C4DAD100C2DAD200C7E2DA000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 + 0000B8BDBD000000870000007600110000006565650000000000000000000000 + 000000000000000000000000000000000000FFFFFF0084B58400107310001873 + 18001873180018731800187B1800187B1800107B1000107B1000087B0800087B + 0800007B0000007300007BB57B00FFFFFF00FFFFFF0052ADFF0018529400185A + 9C00185A9C00185A9C00185AA500185AA500185A9C00185A9C00185294001852 + 940018528C00184A84004AADFF00FFFFFF00FFFFFF0084B58400107310001873 + 18001873180018731800187B1800187B1800107B1000107B1000087B0800087B + 0800007B0000007300007BB57B00FFFFFF000000000000000000B8BDBD003232 + 32000000A9000000FF000000DD00000043005454540000000000000000000000 + 000000000000000000000000000000000000FFFFFF0010841000218C21002994 + 2900319431003194310029942900299C2900219C210018A5180018A5180010A5 + 100008A5080000940000006B0000FFFFFF00FFFFFF00185AA500186BBD001873 + CE001873CE001873CE001873CE001873CE001873CE001873CE001873CE00186B + C600186BBD00185AA500104A7B00FFFFFF00FFFFFF0010841000218C21002994 + 2900319431003194310029942900299C2900219C210018A5180018A5180010A5 + 100008A5080000940000006B0000FFFFFF000000000000000000767676000000 + 43000000FF000000FF0000008700003298002121210000000000000000000000 + 000000000000000000000000000000000000FFFFFF00188C180029942900399C + 3900399C3900399C390039A53900A5D6A500FFFFFF0021AD210018AD180010B5 + 100008AD0800009C0000007B0000FFFFFF00FFFFFF001863AD001873CE00187B + DE00187BDE00187BE7001884E700188CF700188CF700188CF700188CF700187B + DE00186BC6001863AD0018528C00FFFFFF00FFFFFF00188C180029942900399C + 3900399C3900399C390039A539004AA54A00A5D6A500FFFFFF004AA54A0031A5 + 310018A51800009C0000007B0000FFFFFF000000000088898900B8BDBE000000 + 4300000087000000EE000000FF000000CC000000320076767600000000000000 + 000000000000000000000000000000000000FFFFFF0021942100399C390042A5 + 42004AA54A0042A5420042A54200FFFFFF00FFFFFF00FFFFFF0021B5210018B5 + 180010AD100008A50800087B0800FFFFFF00FFFFFF00186BC600187BDE001884 + EF00FFFFFF0084C6FF00188CF700188CF700188CF700188CF70084C6FF00FFFF + FF001873CE00186BBD0018529400FFFFFF00FFFFFF0021942100399C390042A5 + 420042A5420042A542004AA54A00A5D6A500FFFFFF00FFFFFF004AA54A0039A5 + 390021A5210008A50800087B0800FFFFFF000000000000000000001100000000 + A9000000FF000000FF000000FF000000DD001111110000002100545454007676 + 76003200980000323200A0A2A20000000000FFFFFF0029942900429C42004AA5 + 4A0052A552004AA54A0042A5420042AD4200FFFFFF00FFFFFF00FFFFFF0018B5 + 180010AD100010A5100008840800FFFFFF00FFFFFF001873CE001884E700188C + F700188CFF00FFFFFF0084C6FF00188CF700188CF70084C6FF00FFFFFF001884 + E7001873D600186BC600185A9C00FFFFFF00FFFFFF0029942900429C42004AA5 + 4A0052A552004AA54A00A5D6A500FFFFFF00FFFFFF00FFFFFF004AA54A0039A5 + 390021A5210010A5100008840800FFFFFF0000000000B9BEBF00110000000000 + 87000000FF000000CC000000EE0000008700000087000000FF000000BA000000 + 870000006500767676000021000065656500FFFFFF00319C31004AA54A0052A5 + 520052A552004AA54A004AA54A0042A5420039AD3900FFFFFF00FFFFFF00FFFF + FF0018AD180018A5180010841000FFFFFF00FFFFFF00187BDE00188CF700188C + FF00188CF700188CF700FFFFFF0084C6FF0084C6FF00FFFFFF00188CF7001884 + E7001873D6001873CE00185AA500FFFFFF00FFFFFF00319C31004AA54A0052A5 + 52004AA54A00A5D6A500FFFFFF00FFFFFF00FFFFFF00FFFFFF004AA54A0039A5 + 390021A5210018A5180010841000FFFFFF000000000021212100000021000000 + A9000000FF0000004300000087000000FF000000FF0000007600000043000000 + 430076767600323265000000A90000006500FFFFFF00429C420052A55200FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00219C210018841800FFFFFF00FFFFFF001884E700188CFF00188C + F700188CF700188CF700188CF700FFFFFF0084C6FF00188CF7001884EF00187B + DE001873CE001873CE001863AD00FFFFFF00FFFFFF00429C420052A552004AA5 + 4A00A5D6A500FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0042A5420031A5 + 3100219C2100219C210018841800FFFFFF000000000088888800000098000000 + FF000000EE00000076000000EE000000FF000000EE0000003200110000005454 + 54000000EE000000FF000000DD0032326500FFFFFF0042A542005AAD5A00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00219C2100217B2100FFFFFF00FFFFFF001884EF00188CFF00188C + FF00188CF700188CF70084C6FF00FFFFFF00FFFFFF0084C6FF001884E7001873 + D6001873CE001873CE001863AD00FFFFFF00FFFFFF0042A5420052A5520052A5 + 5200A5D6A500FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00399C3900299C + 2900219C2100219C2100217B2100FFFFFF000000000011000000000043000032 + CC000000FF00000098000000FF000000FF000000EE00000076000000A9000000 + CC000000FF000000FF000000A90021212100FFFFFF0052A5520063AD630063AD + 63005AAD5A0052A552004AA54A00429C4200399C3900FFFFFF00FFFFFF00FFFF + FF00299C290029942900217B2100FFFFFF00FFFFFF00188CFF002194FF002194 + FF00188CFF0084C6FF00FFFFFF001884F7001884EF00FFFFFF0084C6FF001873 + CE001873CE001873CE001863AD00FFFFFF00FFFFFF0052A552005AAD5A005AAD + 5A0052A55200A5D6A500FFFFFF00FFFFFF00FFFFFF00FFFFFF00399C39003194 + 31002994290029942900217B2100FFFFFF000000000088898900000000000000 + A9000000FF000000EE0000007600000054000032CC000000A9000000EE000000 + EE000000BA0000006500BABEBE0000000000FFFFFF0052A552006BB56B006BB5 + 6B005AAD5A0052A552004AA54A00429C4200FFFFFF00FFFFFF00FFFFFF002994 + 29002994290029942900217B2100FFFFFF00FFFFFF00188CFF0039A5FF0039A5 + FF0084C6FF00FFFFFF00188CFF00188CFF001884EF001884E700FFFFFF0084C6 + FF001873CE001873CE001863AD00FFFFFF00FFFFFF0052A552006BB56B006BB5 + 6B005AAD5A0052AD5200A5D6A500FFFFFF00FFFFFF00FFFFFF00399C39003194 + 31002994290029942900217B2100FFFFFF000000000000000000000000000000 + 54000000FF000000BA000032CC000000A900000076003200CC00545454002121 + 21000000A900000000000000000000000000FFFFFF005AAD5A007BBD7B0073BD + 730063AD63005AAD5A0052A55200FFFFFF00FFFFFF00FFFFFF00319C3100319C + 31003194310031943100217B2100FFFFFF00FFFFFF002194FF0052ADFF004AAD + FF00FFFFFF002194FF002194FF001894FF00188CF7001884EF001884E700FFFF + FF001873CE001873CE001863AD00FFFFFF00FFFFFF005AAD5A007BBD7B0073BD + 730063AD63005AAD5A005AAD5A00A5D6A500FFFFFF00FFFFFF00429C4200399C + 39003194310031943100217B2100FFFFFF0000000000A0A2A200000000000000 + 54000000A90000005400000076000032FF000000760000005400212121000000 + 110000000000000000000000000000000000FFFFFF006BB56B008CC68C007BBD + 7B006BB56B0063B5630063AD6300B5DEB500FFFFFF004AA54A004AA54A0042A5 + 4200399C390031943100217B2100FFFFFF00FFFFFF0039A5FF006BBDFF0052AD + FF0039A5FF00319CFF00299CFF00299CFF002194FF00188CFF001884F7001884 + EF00187BDE001873CE001863AD00FFFFFF00FFFFFF006BB56B008CC68C007BBD + 7B006BB56B0063B5630063AD630063AD6300A5D6A500FFFFFF004AA54A0042A5 + 4200399C390031943100217B2100FFFFFF000000000000000000000000003232 + 3200000043000000CC000000A9000000DD00000065000000430000004300BBBF + BF0000000000000000000000000000000000FFFFFF0073BD73009CCE9C008CC6 + 8C007BBD7B0073BD73006BB56B0063B5630063AD63005AAD5A0052AD52004AA5 + 4A0042A542003194310018731800FFFFFF00FFFFFF004AADFF0084C6FF006BBD + FF0052ADFF004AADFF0039A5FF00319CFF00299CFF002194FF001894FF00188C + F7001884EF001873CE00185A9C00FFFFFF00FFFFFF0073BD73009CCE9C008CC6 + 8C007BBD7B0073BD73006BB56B0063B5630063AD63005AAD5A0052AD52004AA5 + 4A0042A542003194310018731800FFFFFF000000000000000000000000000000 + 00008888880021212100000043003232320089898900BDC0C100000000000000 + 000000000000000000000000000000000000FFFFFF00B5DEB50073BD730063B5 + 63005AAD5A0052A5520052A552004AA54A004AA54A0042A54200429C4200399C + 390031943100218C21008CBD8C00FFFFFF00FFFFFF00ADDEFF004AADFF00319C + FF002194FF00188CFF00188CFF00188CF700188CF7001884EF001884E700187B + DE001873CE00186BBD0063B5FF00FFFFFF00FFFFFF00B5DEB50073BD730063B5 + 63005AAD5A0052A5520052A552004AA54A004AA54A0042A54200429C4200399C + 390031943100218C21008CBD8C00FFFFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF0000000000424D3E000000000000003E000000 + 2800000040000000300000000100010000000000800100000000000000000000 + 000000000000000000000000FFFFFF00FFFFFFFF00000000FFFFFFFF00000000 + FFFFFFFF00000000F00FF03F00000000F7EFF7BF00000000F7EFF7BF00000000 + F7EFF78F00000000F7EFF02F00000000F7EFF02F00000000F00FFDEF00000000 + F00FFC0F00000000FFFFFC0F00000000FFFFFFFF00000000FFFFFFFF00000000 + FFFFFFFF00000000FFFFFFFF000000008001F01FF00FFFFF0000E00FE007FFFF + 0000C007C003FFFF000080038001FFFF000000010000F81F000000000000F81F + 000000000000FFFF000000000000FFFF000000000000FFFF000000000000FFFF + 000000000000FFFF000000000001FFFF000080018003FFFF0000C003C007FFFF + 0000E007E00FFFFF8001F00FF01FFFFFFFFF800180018001F07F000000000000 + C07F000000000000C07F000000000000003F0000000000008001000000000000 + 0000000000000000800000000000000000000000000000008000000000000000 + 00010000000000008007000000000000800F000000000000E00F000000000000 + F03F000000000000FFFF80018001800100000000000000000000000000000000 + 000000000000} + end + object Timer1: TTimer + Enabled = False + Interval = 50 + OnTimer = Timer1Timer + Left = 344 + Top = 384 + end + object OpenDialog1: TOpenDialog + Filter = 'Skin files|*.skn' + Left = 344 + Top = 352 + end +end diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Unit1.pas b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Unit1.pas new file mode 100644 index 0000000..1dcf388 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/Unit1.pas @@ -0,0 +1,431 @@ +unit Unit1; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, + Dialogs, ExtCtrls, StdCtrls, ActnList, ImgList, ExtDlgs, ComCtrls, + // TB2K + TB2Item, TB2Toolbar, TB2Dock, TB2ExtItems, + // SpTBXLib + SpTBXSkins, SpTBXItem, SpTBXDkPanels, SpTBXTabs, SpTBXEditors, SpTBXControls, + SpTBXExtEditors; + +type + TForm1 = class(TForm) + SpTBXDock1: TSpTBXDock; + SpTBXMultiDock1: TSpTBXMultiDock; + SpTBXMultiDock3: TSpTBXMultiDock; + SpTBXDockablePanel1: TSpTBXDockablePanel; + SpTBXToolbar1: TSpTBXToolbar; + Panel1: TPanel; + SpTBXTabControl1: TSpTBXTabControl; + SpTBXRightAlignSpacerItem1: TSpTBXRightAlignSpacerItem; + tabClose: TSpTBXItem; + SpTBXSubmenuItem1: TSpTBXSubmenuItem; + SpTBXSubmenuItem2: TSpTBXSubmenuItem; + SpTBXItem2: TSpTBXItem; + tabRight: TSpTBXItem; + tabLeft: TSpTBXItem; + SpTBXToolbar3: TSpTBXToolbar; + SpTBXLabelItem3: TSpTBXLabelItem; + SpTBXItem7: TSpTBXItem; + subColor: TSpTBXSubmenuItem; + SpTBXLabelItem4: TSpTBXLabelItem; + subLang: TSpTBXSubmenuItem; + subSkins: TSpTBXSubmenuItem; + SpTBXSkinGroupItem1: TSpTBXSkinGroupItem; + SpTBXTabControl2: TSpTBXTabControl; + SpTBXTabItem1: TSpTBXTabItem; + SpTBXTabSheet1: TSpTBXTabSheet; + ActionList1: TActionList; + Action1: TAction; + Action2: TAction; + SpTBXButton1: TSpTBXButton; + SpTBXStatusBar1: TSpTBXStatusBar; + SpTBXSeparatorItem2: TSpTBXSeparatorItem; + hintLabel: TSpTBXLabelItem; + SpTBXSeparatorItem3: TSpTBXSeparatorItem; + ImageList1: TImageList; + SpTBXLabelItem6: TSpTBXLabelItem; + SpTBXSeparatorItem4: TSpTBXSeparatorItem; + subLang2: TSpTBXSubmenuItem; + Image1: TImage; + SpTBXSeparatorItem5: TSpTBXSeparatorItem; + SpTBXSeparatorItem8: TSpTBXSeparatorItem; + SpTBXTabItem3: TSpTBXTabItem; + SpTBXTabSheet3: TSpTBXTabSheet; + SpTBXGroupBox5: TSpTBXGroupBox; + SpTBXLabel2: TSpTBXLabel; + SpTBXLabel3: TSpTBXLabel; + SpTBXLabel4: TSpTBXLabel; + SpTBXLabel7: TSpTBXLabel; + SpTBXLabel5: TSpTBXLabel; + SpTBXToolbar2: TSpTBXToolbar; + SpTBXItem1: TSpTBXItem; + SpTBXSeparatorItem6: TSpTBXSeparatorItem; + SpTBXItem3: TSpTBXItem; + SpTBXItem4: TSpTBXItem; + SpTBXSeparatorItem7: TSpTBXSeparatorItem; + SpTBXLabel6: TSpTBXLabel; + DP1: TSpTBXDockablePanel; + DP2: TSpTBXDockablePanel; + DP3: TSpTBXDockablePanel; + SpTBXLabel1: TSpTBXLabel; + SpTBXLabel8: TSpTBXLabel; + SpTBXLabel9: TSpTBXLabel; + SpTBXLabel10: TSpTBXLabel; + SpTBXLabel11: TSpTBXLabel; + SpTBXLabel12: TSpTBXLabel; + SpTBXLabel13: TSpTBXLabel; + SpTBXLabel15: TSpTBXLabel; + SpTBXLabel16: TSpTBXLabel; + SpTBXLabel17: TSpTBXLabel; + Timer1: TTimer; + SpTBXGroupBox6: TSpTBXGroupBox; + progressDec: TSpTBXButton; + progressInc: TSpTBXButton; + progressAnimate: TSpTBXButton; + SpTBXProgressBar1: TSpTBXProgressBar; + progressFiles: TSpTBXCheckBox; + SpTBXProgressBar2: TSpTBXProgressBar; + TBControlItem2: TTBControlItem; + SpTBXTrackBar1: TSpTBXTrackBar; + SpTBXComboBox1: TSpTBXComboBox; + TBControlItem3: TTBControlItem; + SpTBXPanel2: TSpTBXPanel; + Memo2: TMemo; + SpTBXSplitter1: TSpTBXSplitter; + SpTBXSplitter2: TSpTBXSplitter; + SpTBXTabItem6: TSpTBXTabItem; + SpTBXTabSheet6: TSpTBXTabSheet; + SpTBXButtonEdit1: TSpTBXButtonEdit; + SpTBXComboBox2: TSpTBXComboBox; + SpTBXEdit1: TSpTBXEdit; + SpTBXSpinEdit1: TSpTBXSpinEdit; + LangListBox: TSpTBXListBox; + rgSkinType: TSpTBXRadioGroup; + SpTBXGroupBox1: TSpTBXGroupBox; + SpTBXGroupBox2: TSpTBXGroupBox; + trackTickmarks: TSpTBXRadioGroup; + skinButton: TSpTBXSpeedButton; + SpTBXDockablePanel2: TSpTBXDockablePanel; + OpenDialog1: TOpenDialog; + SpTBXSeparatorItem1: TSpTBXSeparatorItem; + SpTBXColorPalette1: TSpTBXColorPalette; + SpTBXItem5: TSpTBXItem; + SpTBXSpinEditItem1: TSpTBXSpinEditItem; + Panel2: TPanel; + SpTBXSpeedButton1: TSpTBXSpeedButton; + SpTBXSpeedButton2: TSpTBXSpeedButton; + SpTBXSpeedButton3: TSpTBXSpeedButton; + SpTBXColorEdit1: TSpTBXColorEdit; + SpTBXFontComboBox1: TSpTBXFontComboBox; + procedure FormShow(Sender: TObject); + procedure tabCloseClick(Sender: TObject); + procedure ActionList1Update(Action: TBasicAction; + var Handled: Boolean); + procedure Action1Execute(Sender: TObject); + procedure Action2Execute(Sender: TObject); + procedure SpTBXTabControl2Resize(Sender: TObject); + procedure rgSkinTypeClick(Sender: TObject); + procedure hintLabelDrawHint(Sender: TObject; + AHintBitmap: TBitmap; var AHint: WideString; + var PaintDefault: Boolean); + procedure progressDecClick(Sender: TObject); + procedure progressIncClick(Sender: TObject); + procedure progressAnimateClick(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + procedure SpTBXProgressBar1ProgressChange(Sender: TObject; + NewPosition: Integer); + procedure progressFilesClick(Sender: TObject); + procedure TrackbarTickMarksRadioClick(Sender: TObject); + procedure skinButtonClick(Sender: TObject); + procedure SpTBXSpeedButton1Draw(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); + private + { Private declarations } + procedure LangClick(Sender: TObject); + public + AppPath: String; + end; + +var + Form1: TForm1; + +implementation + +uses + Registry; + +{$R *.dfm} + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Utility functions } + +function SpGetWindowsDir: String; +var + Z: Cardinal; +begin + Z := GetWindowsDirectory(nil, 0); + if Z > 0 then begin + SetLength(Result, Z); + GetWindowsDirectory(PChar(Result), Z); + Result := IncludeTrailingPathDelimiter(Result); + end + else + Result := ''; +end; + +function SpGetWinAmpDir: String; +var + Registry: TRegistry; +begin + Registry := TRegistry.Create; + try + Registry.RootKey := HKEY_CURRENT_USER; + // False because we do not want to create it if it doesn't exist + Registry.OpenKey('\Software\Winamp', False); + Result := Registry.ReadString(''); + if Length(Result) > 0 then + Result := IncludeTrailingPathDelimiter(Result); + finally + Registry.Free; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Form } + +procedure TForm1.FormShow(Sender: TObject); +var + A: TSpTBXItem; + D: String; + I: Integer; +begin + // Set skin type to sknTBX + SkinManager.ChangeControlSkinType(Self, sknSkin); + + // Add the Languages to the Languages menu item and TabControl + for I := 0 to LangListBox.Items.Count - 1 do begin + A := TSpTBXItem.Create(nil); + try + A.Caption := LangListBox.Items[I]; + A.GroupIndex := 100; + A.AutoCheck := True; + A.Tag := I; + A.OnClick := LangClick; + subLang.Add(A); + with SpTBXTabControl1.Add(LangListBox.Items[I]) do + Tag := I; + except + A.Free; + end; + end; + + // Select the first Language + subLang.Items[0].Click; + SpTBXTabControl1.ActiveTabIndex := 0; + SpTBXTabControl2.ActiveTabIndex := 0; + + // Load default button Skin + AppPath := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)); + + // Initialize the link labels + D := SpGetWindowsDir; + if Length(D) > 0 then begin + SpTBXLabel4.LinkText := D; + SpTBXLabel5.LinkText := 'explorer.exe'; + SpTBXLabel5.LinkTextParams := '/e, ' + D; + end; + D := SpGetWinAmpDir; + if Length(D) > 0 then + SpTBXLabel6.LinkText := D + 'winamp.exe'; + if FileExists(AppPath + 'unit1.pas') then + SpTBXLabel7.LinkTextParams := '"' + AppPath + 'unit1.pas' + '"'; +end; + +procedure TForm1.LangClick(Sender: TObject); +var + A: TSpTBXItem; +begin + A := Sender as TSpTBXItem; + subLang.Caption := A.Caption; + subLang2.Caption := A.Caption; + SpTBXTabControl1.ActiveTabIndex := subLang.IndexOf(A); +end; + +procedure TForm1.tabCloseClick(Sender: TObject); +begin + SpTBXTabControl1.Visible := False; +end; + +procedure TForm1.ActionList1Update(Action: TBasicAction; var Handled: Boolean); +var + L, R: Boolean; +begin + SpTBXTabControl1.ScrollState(L, R); + Action1.Enabled := L; + Action2.Enabled := R; +end; + +procedure TForm1.Action1Execute(Sender: TObject); +begin + SpTBXTabControl1.ScrollLeft; +end; + +procedure TForm1.Action2Execute(Sender: TObject); +begin + SpTBXTabControl1.ScrollRight; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Options Panel } + +procedure TForm1.rgSkinTypeClick(Sender: TObject); +begin + SkinManager.ChangeControlSkinType(Self, TSpTBXSkinType(rgSkinType.ItemIndex)); +end; + +procedure TForm1.skinButtonClick(Sender: TObject); +var + S: string; + I: Integer; +begin + S := AppPath + 'Skins'; + if DirectoryExists(S) then + OpenDialog1.InitialDir := S; + + if OpenDialog1.Execute then + if FileExists(OpenDialog1.FileName) then begin + // Load the skin file and add it to the SkinList + I := SkinManager.SkinsList.AddSkinFromFile(OpenDialog1.FileName); + if I > -1 then begin + // Set the new skin + SkinManager.SetSkin(SkinManager.SkinsList[I]); + // Recreate the SkinGroupItem + SpTBXSkinGroupItem1.Recreate; + end; + end; +end; + +procedure TForm1.SpTBXTabControl2Resize(Sender: TObject); +begin + SpTBXButton1.Left := (SpTBXTabControl2.Width - SpTBXButton1.Width) div 2; + SpTBXProgressBar1.Left := (SpTBXTabControl2.Width - SpTBXProgressBar1.Width) div 2; + SpTBXTrackBar1.Left := (SpTBXTabControl2.Width - SpTBXTrackBar1.Width) div 2; +end; + +procedure TForm1.SpTBXSpeedButton1Draw(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +var + SB: TSpTBXSpeedButton; +begin + if PaintStage = pstPrePaint then begin + PaintDefault := False; + SB := TSpTBXSpeedButton(Sender); + SpDrawXPHeader(ACanvas, ARect, SB.MouseInControl, SB.Pushed, sknSkin); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ StatusBar } + +procedure TForm1.hintLabelDrawHint(Sender: TObject; + AHintBitmap: TBitmap; var AHint: WideString; var PaintDefault: Boolean); +var + R, GR, TR: TRect; + WS: WideString; +begin + PaintDefault := False; + AHintBitmap.Width := Image1.Picture.Bitmap.Width + 115; + AHintBitmap.Height := Image1.Picture.Bitmap.Height + 30; + with AHintBitmap.Canvas do begin + Brush.Color := clInfoBk; + Font.Color := clInfoText; + R := Rect(0, 0, AHintBitmap.Width, AHintBitmap.Height); + FillRect(R); + + GR := Bounds(5, 5, Image1.Picture.Bitmap.Width, Image1.Picture.Bitmap.Height); + Draw(GR.Left, GR.Top, Image1.Picture.Bitmap); + + WS := 'Language: ' + subLang.Caption + #13#10 + + 'Skin: ' + SkinManager.CurrentSkinName + #13#10 + + 'Time: ' + TimeToStr(Now); + TR := Rect(GR.Right + 5, 10, R.Right, R.Bottom); + SpDrawXPText(AHintBitmap.Canvas, WS, TR, DT_WORDBREAK); + + Font.Color := clBlue; + Font.Style := [fsUnderline]; + TR := Rect(GR.Left, GR.Bottom + 5, R.Right, R.Bottom); + WS := 'http://www.silverpointdevelopment.com'; + SpDrawXPText(AHintBitmap.Canvas, WS, TR, DT_WORDBREAK); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ ProgressBar } + +procedure TForm1.progressDecClick(Sender: TObject); +begin + SpTBXProgressBar1.StepIt(-10); + SpTBXProgressBar2.StepIt(-10); +end; + +procedure TForm1.progressIncClick(Sender: TObject); +begin + SpTBXProgressBar1.StepIt(10); + SpTBXProgressBar2.StepIt(10); +end; + +procedure TForm1.progressAnimateClick(Sender: TObject); +begin + SpTBXProgressBar1.Position := 0; + SpTBXProgressBar2.Position := 0; + Timer1.Enabled := True; +end; + +procedure TForm1.Timer1Timer(Sender: TObject); +begin + SpTBXProgressBar1.StepIt; + SpTBXProgressBar2.StepIt; + if SpTBXProgressBar1.Position >= SpTBXProgressBar1.Max then + Timer1.Enabled := False; +end; + +procedure TForm1.SpTBXProgressBar1ProgressChange(Sender: TObject; + NewPosition: Integer); +var + I: Integer; + WS: WideString; +begin + if progressFiles.Checked then begin + I := (NewPosition div 10) - 1; + if I < 0 then I := 0; + if I > LangListBox.Items.Count - 1 then I := LangListBox.Items.Count - 1; + WS := 'C:\Lang\' + LangListBox.Items[I] + '.txt'; + SpTBXProgressBar1.Caption := WS; + SpTBXProgressBar2.Caption := WS; + end; +end; + +procedure TForm1.ProgressFilesClick(Sender: TObject); +begin + if progressFiles.Checked then + SpTBXProgressBar1.CaptionType := pctDefault + else + SpTBXProgressBar1.CaptionType := pctPercentage; + SpTBXProgressBar2.CaptionType := SpTBXProgressBar1.CaptionType; + SpTBXProgressBar1ProgressChange(SpTBXProgressBar1, SpTBXProgressBar1.Position); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TrackBar } + +procedure TForm1.TrackbarTickMarksRadioClick(Sender: TObject); +begin + SpTBXTrackBar1.TickMarks := TSpTBXTickMark(trackTickmarks.ItemIndex); +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/hint.bmp b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/hint.bmp new file mode 100644 index 0000000..3d32889 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Demos/Overview/hint.bmp differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/LICENSE.txt b/official/2.2.2+2.4.2/SpTBXLib/LICENSE.txt new file mode 100644 index 0000000..79e0329 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/LICENSE.txt @@ -0,0 +1,9 @@ +Use and/or distribution of the files requires compliance with the +SpTBXLib License, found in SpTBXLib-LICENSE.txt or at: + + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, at your option, the files may be used and/or distributed under +the terms of the Mozilla Public License Version 1.1, found in MPL-LICENSE.txt or at: + + http://www.mozilla.org/MPL \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXColorPickerForm.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXColorPickerForm.dcu new file mode 100644 index 0000000..21beb9d Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXColorPickerForm.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXControls.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXControls.dcu new file mode 100644 index 0000000..0386cd3 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXControls.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXCustomizer.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXCustomizer.dcu new file mode 100644 index 0000000..1b7c74a Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXCustomizer.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXCustomizerForm.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXCustomizerForm.dcu new file mode 100644 index 0000000..904e5e3 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXCustomizerForm.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXDefaultSkins.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXDefaultSkins.dcu new file mode 100644 index 0000000..5d25194 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXDefaultSkins.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXDkPanels.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXDkPanels.dcu new file mode 100644 index 0000000..b36365f Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXDkPanels.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXEditors.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXEditors.dcu new file mode 100644 index 0000000..8cee500 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXEditors.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXExtEditors.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXExtEditors.dcu new file mode 100644 index 0000000..a77ff79 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXExtEditors.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXFormPopupMenu.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXFormPopupMenu.dcu new file mode 100644 index 0000000..7362bf7 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXFormPopupMenu.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXItem.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXItem.dcu new file mode 100644 index 0000000..d8fce1c Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXItem.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.bpl b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.bpl new file mode 100644 index 0000000..10f734b Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.bpl differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.dcp b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.dcp new file mode 100644 index 0000000..91560fa Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.dcp differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.dcu new file mode 100644 index 0000000..6280c93 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLibDsgn_d12.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.bpl b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.bpl new file mode 100644 index 0000000..57ec8d5 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.bpl differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.dcp b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.dcp new file mode 100644 index 0000000..cb4b28f Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.dcp differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.dcu new file mode 100644 index 0000000..dfe560e Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXLib_d12.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXMDIMRU.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXMDIMRU.dcu new file mode 100644 index 0000000..8b48746 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXMDIMRU.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXReg.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXReg.dcu new file mode 100644 index 0000000..3070270 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXReg.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXSkins.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXSkins.dcu new file mode 100644 index 0000000..f34dfb8 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXSkins.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXTabs.dcu b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXTabs.dcu new file mode 100644 index 0000000..edd8243 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Lib/D12/SpTBXTabs.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/MPL-LICENSE.txt b/official/2.2.2+2.4.2/SpTBXLib/MPL-LICENSE.txt new file mode 100644 index 0000000..04d4a55 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/MPL-LICENSE.txt @@ -0,0 +1,469 @@ + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/BuildPackages_D12.groupproj b/official/2.2.2+2.4.2/SpTBXLib/Packages/BuildPackages_D12.groupproj new file mode 100644 index 0000000..42f6ce1 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/BuildPackages_D12.groupproj @@ -0,0 +1,48 @@ + + + {AC99A436-DF99-402F-B9A7-1589C5A8F86D} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.bdsproj b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.bdsproj new file mode 100644 index 0000000..3549e3d --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.bdsproj @@ -0,0 +1,175 @@ + + + + + + + + + + + + SpTBXLibDsgn_d10.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + True + + + + 0 + 0 + False + 1 + False + False + False + 16384 + 1048576 + 1333788672 + Toolbar2000 -- SpTBXLib Design Package + + + + + + + + + + + False + + + + + + False + + + True + False + + + + $00000000 + + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.dpk new file mode 100644 index 0000000..7d622d0 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.dpk @@ -0,0 +1,42 @@ +package SpTBXLibDsgn_d10; + +{$R *.res} +{$R '..\Source\SpTBXReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4F800000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib Design Package'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + TntUnicodeVcl, + TntUnicodeVcl_Design, + tb2k_d10, + tb2kdsgn_d10, + SpTBXLib_d10, + dclstd, + vcl; + +contains + SpTBXReg in '..\Source\SpTBXReg.pas'; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d10.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.bdsproj b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.bdsproj new file mode 100644 index 0000000..a1e48d5 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.bdsproj @@ -0,0 +1,175 @@ + + + + + + + + + + + + SpTBXLibDsgn_d11.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + True + + + + 0 + 0 + False + 1 + False + False + False + 16384 + 1048576 + 1333788672 + Toolbar2000 -- SpTBXLib Design Package + + + + + + + + + + + False + + + + + + False + + + True + False + + + + $00000000 + + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.dpk new file mode 100644 index 0000000..51307da --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.dpk @@ -0,0 +1,42 @@ +package SpTBXLibDsgn_d11; + +{$R *.res} +{$R '..\Source\SpTBXReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4F800000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib Design Package'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + TntUnicodeVcl, + TntUnicodeVcl_Design, + tb2k_d11, + tb2kdsgn_d11, + SpTBXLib_d11, + dclstd, + vcl; + +contains + SpTBXReg in '..\Source\SpTBXReg.pas'; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d11.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.bpi b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.bpi new file mode 100644 index 0000000..840e749 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.bpi differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dcu b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dcu new file mode 100644 index 0000000..a4694a2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dpk new file mode 100644 index 0000000..1669b52 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dpk @@ -0,0 +1,40 @@ +package SpTBXLibDsgn_d12; + +{$R *.res} +{$R '..\Source\SpTBXReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4F800000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib Design Package'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + tb2k_d12, + tb2kdsgn_d12, + SpTBXLib_d12, + dclstd, + vcl; + +contains + SpTBXReg in '..\Source\SpTBXReg.pas'; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dproj b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dproj new file mode 100644 index 0000000..16e35dd --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.dproj @@ -0,0 +1,116 @@ + + + {0CD140C3-3ADC-4BF2-8A9C-6B5FAA587036} + SpTBXLibDsgn_d12.dpk + Debug + DCC32 + 12.0 + + + true + + + true + Base + true + + + true + Base + true + + + true + All + 4F800000 + 1 + SpTBXLibDsgn_d12.bpl + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias) + x86 + Toolbar2000 -- SpTBXLib Design Package + true + false + true + false + true + false + false + + + false + RELEASE;$(DCC_Define) + 0 + false + + + DEBUG;$(DCC_Define) + + + + MainSource + + + + + + + + + + Base + + + Cfg_2 + Base + + + Cfg_1 + Base + + + + + Delphi.Personality.12 + Package + + + + SpTBXLibDsgn_d12.dpk + + + False + True + False + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + 12 + + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.hpp b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.hpp new file mode 100644 index 0000000..919f007 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.hpp @@ -0,0 +1,106 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxlibdsgn_d12.pas' rev: 20.00 + +#ifndef Sptbxlibdsgn_d12HPP +#define Sptbxlibdsgn_d12HPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxlibdsgn_d12 +{ +//-- type declarations ------------------------------------------------------- +//-- var, const, procedure --------------------------------------------------- + +} /* namespace Sptbxlibdsgn_d12 */ +using namespace Sptbxlibdsgn_d12; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // Sptbxlibdsgn_d12HPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.lib b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.lib new file mode 100644 index 0000000..ca76999 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.lib differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d12.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d7.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d7.dpk new file mode 100644 index 0000000..e3a57af --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d7.dpk @@ -0,0 +1,42 @@ +package SpTBXLibDsgn_d7; + +{$R *.res} +{$R '..\Source\SpTBXReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4F800000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib Design Package'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + TntUnicodeVcl_R70, + TntUnicodeVcl_D70, + tb2k_d7, + tb2kdsgn_d7, + SpTBXLib_d7, + dclstd, + vcl; + +contains + SpTBXReg in '..\Source\SpTBXReg.pas'; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d7.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d7.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d7.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d9.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d9.dpk new file mode 100644 index 0000000..282eb87 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d9.dpk @@ -0,0 +1,42 @@ +package SpTBXLibDsgn_d9; + +{$R *.res} +{$R '..\Source\SpTBXReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4F800000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib Design Package'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + TntUnicodeVcl_R90, + TntUnicodeVcl_D90, + tb2k_d9, + tb2kdsgn_d9, + SpTBXLib_d9, + dclstd, + vcl; + +contains + SpTBXReg in '..\Source\SpTBXReg.pas'; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d9.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d9.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLibDsgn_d9.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.bdsproj b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.bdsproj new file mode 100644 index 0000000..1f6ec4f --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.bdsproj @@ -0,0 +1,175 @@ + + + + + + + + + + + + SpTBXLib_d10.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + True + + + + 0 + 0 + False + 1 + False + False + False + 16384 + 1048576 + 1337982976 + Toolbar2000 -- SpTBXLib + + + + + + + + + + + False + + + + + + False + + + True + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.dpk new file mode 100644 index 0000000..2033886 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.dpk @@ -0,0 +1,50 @@ +package SpTBXLib_d10; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4FC00000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + tb2k_d10, + TntUnicodeVcl, + rtl; + +contains + SpTBXItem in '..\Source\SpTBXItem.pas', + SpTBXControls in '..\Source\SpTBXControls.pas', + SpTBXTabs in '..\Source\SpTBXTabs.pas', + SpTBXDkPanels in '..\Source\SpTBXDkPanels.pas', + SpTBXEditors in '..\Source\SpTBXEditors.pas', + SpTBXExtEditors in '..\Source\SpTBXExtEditors.pas', + SpTBXColorPickerForm in '..\Source\SpTBXColorPickerForm.pas', + SpTBXMDIMRU in '..\Source\SpTBXMDIMRU.pas', + SpTBXFormPopupMenu in '..\Source\SpTBXFormPopupMenu.pas', + SpTBXCustomizer in '..\Source\SpTBXCustomizer.pas', + SpTBXCustomizerForm in '..\Source\SpTBXCustomizerForm.pas', + SpTBXSkins in '..\Source\SpTBXSkins.pas', + SpTBXDefaultSkins in '..\Source\SpTBXDefaultSkins.pas'; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d10.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.bdsproj b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.bdsproj new file mode 100644 index 0000000..a04ffdd --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.bdsproj @@ -0,0 +1,175 @@ + + + + + + + + + + + + SpTBXLib_d11.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + True + + + + 0 + 0 + False + 1 + False + False + False + 16384 + 1048576 + 1337982976 + Toolbar2000 -- SpTBXLib + + + + + + + + + + + False + + + + + + False + + + True + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.dpk new file mode 100644 index 0000000..88083c9 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.dpk @@ -0,0 +1,50 @@ +package SpTBXLib_d11; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4FC00000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + tb2k_d11, + TntUnicodeVcl, + rtl; + +contains + SpTBXItem in '..\Source\SpTBXItem.pas', + SpTBXControls in '..\Source\SpTBXControls.pas', + SpTBXTabs in '..\Source\SpTBXTabs.pas', + SpTBXDkPanels in '..\Source\SpTBXDkPanels.pas', + SpTBXEditors in '..\Source\SpTBXEditors.pas', + SpTBXExtEditors in '..\Source\SpTBXExtEditors.pas', + SpTBXColorPickerForm in '..\Source\SpTBXColorPickerForm.pas', + SpTBXMDIMRU in '..\Source\SpTBXMDIMRU.pas', + SpTBXFormPopupMenu in '..\Source\SpTBXFormPopupMenu.pas', + SpTBXCustomizer in '..\Source\SpTBXCustomizer.pas', + SpTBXCustomizerForm in '..\Source\SpTBXCustomizerForm.pas', + SpTBXSkins in '..\Source\SpTBXSkins.pas', + SpTBXDefaultSkins in '..\Source\SpTBXDefaultSkins.pas'; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d11.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.bpi b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.bpi new file mode 100644 index 0000000..74d289c Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.bpi differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dcu b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dcu new file mode 100644 index 0000000..36f5285 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dpk new file mode 100644 index 0000000..f7a1e78 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dpk @@ -0,0 +1,50 @@ +package SpTBXLib_d12; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4FC00000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + tb2k_d12, + rtl, + vclx; + +contains + SpTBXItem in '..\Source\SpTBXItem.pas', + SpTBXControls in '..\Source\SpTBXControls.pas', + SpTBXTabs in '..\Source\SpTBXTabs.pas', + SpTBXDkPanels in '..\Source\SpTBXDkPanels.pas', + SpTBXEditors in '..\Source\SpTBXEditors.pas', + SpTBXExtEditors in '..\Source\SpTBXExtEditors.pas', + SpTBXColorPickerForm in '..\Source\SpTBXColorPickerForm.pas', + SpTBXMDIMRU in '..\Source\SpTBXMDIMRU.pas', + SpTBXFormPopupMenu in '..\Source\SpTBXFormPopupMenu.pas', + SpTBXCustomizer in '..\Source\SpTBXCustomizer.pas', + SpTBXCustomizerForm in '..\Source\SpTBXCustomizerForm.pas', + SpTBXSkins in '..\Source\SpTBXSkins.pas', + SpTBXDefaultSkins in '..\Source\SpTBXDefaultSkins.pas'; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dproj b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dproj new file mode 100644 index 0000000..081bf7d --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.dproj @@ -0,0 +1,127 @@ + + + {1EB74E79-E290-4976-B63E-8E6B50611D5F} + SpTBXLib_d12.dpk + Debug + DCC32 + 12.0 + + + true + + + true + Base + true + + + true + Base + true + + + true + All + $(BDSCOMMONDIR)\DCP + SpTBXLib_d12.bpl + 4FC00000 + 1 + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias) + x86 + Toolbar2000 -- SpTBXLib + true + false + true + false + true + false + false + + + false + RELEASE;$(DCC_Define) + 0 + false + + + DEBUG;$(DCC_Define) + + + + MainSource + + + + + + + + + + + + + + + + + + + + Base + + + Cfg_2 + Base + + + Cfg_1 + Base + + + + + Delphi.Personality.12 + Package + + + + SpTBXLib_d12.dpk + + + False + True + False + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + 12 + + diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.hpp b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.hpp new file mode 100644 index 0000000..c8b71bd --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.hpp @@ -0,0 +1,82 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxlib_d12.pas' rev: 20.00 + +#ifndef Sptbxlib_d12HPP +#define Sptbxlib_d12HPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxlib_d12 +{ +//-- type declarations ------------------------------------------------------- +//-- var, const, procedure --------------------------------------------------- + +} /* namespace Sptbxlib_d12 */ +using namespace Sptbxlib_d12; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // Sptbxlib_d12HPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.lib b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.lib new file mode 100644 index 0000000..318a587 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.lib differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d12.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d7.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d7.dpk new file mode 100644 index 0000000..5189670 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d7.dpk @@ -0,0 +1,50 @@ +package SpTBXLib_d7; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4FC00000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + tb2k_d7, + TntUnicodeVcl_R70, + rtl; + +contains + SpTBXItem in '..\Source\SpTBXItem.pas', + SpTBXControls in '..\Source\SpTBXControls.pas', + SpTBXTabs in '..\Source\SpTBXTabs.pas', + SpTBXDkPanels in '..\Source\SpTBXDkPanels.pas', + SpTBXEditors in '..\Source\SpTBXEditors.pas', + SpTBXExtEditors in '..\Source\SpTBXExtEditors.pas', + SpTBXColorPickerForm in '..\Source\SpTBXColorPickerForm.pas', + SpTBXMDIMRU in '..\Source\SpTBXMDIMRU.pas', + SpTBXFormPopupMenu in '..\Source\SpTBXFormPopupMenu.pas', + SpTBXCustomizer in '..\Source\SpTBXCustomizer.pas', + SpTBXCustomizerForm in '..\Source\SpTBXCustomizerForm.pas', + SpTBXSkins in '..\Source\SpTBXSkins.pas', + SpTBXDefaultSkins in '..\Source\SpTBXDefaultSkins.pas'; + +end. \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d7.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d7.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d7.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d9.dpk b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d9.dpk new file mode 100644 index 0000000..8b8047f --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d9.dpk @@ -0,0 +1,50 @@ +package SpTBXLib_d9; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $4FC00000} +{$DESCRIPTION 'Toolbar2000 -- SpTBXLib'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + tb2k_d9, + TntUnicodeVcl_R90, + rtl; + +contains + SpTBXItem in '..\Source\SpTBXItem.pas', + SpTBXControls in '..\Source\SpTBXControls.pas', + SpTBXTabs in '..\Source\SpTBXTabs.pas', + SpTBXDkPanels in '..\Source\SpTBXDkPanels.pas', + SpTBXEditors in '..\Source\SpTBXEditors.pas', + SpTBXExtEditors in '..\Source\SpTBXExtEditors.pas', + SpTBXColorPickerForm in '..\Source\SpTBXColorPickerForm.pas', + SpTBXMDIMRU in '..\Source\SpTBXMDIMRU.pas', + SpTBXFormPopupMenu in '..\Source\SpTBXFormPopupMenu.pas', + SpTBXCustomizer in '..\Source\SpTBXCustomizer.pas', + SpTBXCustomizerForm in '..\Source\SpTBXCustomizerForm.pas', + SpTBXSkins in '..\Source\SpTBXSkins.pas', + SpTBXDefaultSkins in '..\Source\SpTBXDefaultSkins.pas'; + +end. \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d9.res b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d9.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Packages/SpTBXLib_d9.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Readme.txt b/official/2.2.2+2.4.2/SpTBXLib/Readme.txt new file mode 100644 index 0000000..1a8fe1d --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Readme.txt @@ -0,0 +1,63 @@ +[SpTBXLib] + +SpTBXLib is an add on package for TB2K components, it adds the following features: +- Skins +- Unicode support for items captions and hints properties. +- Custom painting events. +- Custom item size. +- Anchored items. +- Right aligned items. +- Accel char handling. +- Button, Label, Checkbox, RadioButton, with unicode support. +- TabControl with toolbar items support. +- DockablePanel with unicode toolbar items support. +- Panel and GroupBox with transparency and unicode support. +- Titlebar and Form Popup components with unicode support. + +For more info go to: +http://www.silverpointdevelopment.com + +[License] + +Use and/or distribution of the files requires compliance with the +SpTBXLib License, found in SpTBXLib-LICENSE.txt or at: + + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, at your option, the files may be used and/or distributed under +the terms of the Mozilla Public License Version 1.1, found in MPL-LICENSE.txt or at: + + http://www.mozilla.org/MPL + + +[Installation] + +Requirements: +- Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +- Troy Wolbrink's TNT Unicode Controls (not needed for Delphi/C++Builder 2009) + http://www.tntware.com/delphicontrols/unicode/ + Mirror: http://www.silverpointdevelopment.com/sptbxlib/TntUnicodeControls.zip + +To install SpTBXLib manually: +- If you have a previous version of SpTBXLib installed in the IDE remove it from Component->Install Packages, select SpTBXLib from the list and press the Remove button. +- Add the SpTBXLib 'Source' directory to Tools->Environment Options->Library->Library Path. +- Open the SpTBXLibDsgn_*.dpk design package corresponding to the IDE version, press Compile and then press Install, close the package window (don't save the changes). + +To install SpTBXLib with Silverpoint MultiInstaller (http://www.silverpointdevelopment.com/multiinstaller/index.htm): +- Create a new folder for the installation. +- Download all the component zips to a folder: SpTBXLib + TNT + TB2K +- Download the MultiInstaller and the Setup.Ini, extract them to the folder: + +The installation folder will end up with this files: +C:\MyInstall + |- SpTBXLib.zip + |- TntUnicodeControls.zip + |- tb2k-2.2.2.zip + |- MultiInstaller.exe + |- Setup.ini + +You are ready to install the component packages, just run the MultiInstaller, select the destination folder, and all the components will be unziped, patched, compiled and installed on the Delphi IDE. + +For more info go to: +http://www.silverpointdevelopment.com/sptbxlib/support/index.htm \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Registration.txt b/official/2.2.2+2.4.2/SpTBXLib/Registration.txt new file mode 100644 index 0000000..0627a0e --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Registration.txt @@ -0,0 +1,27 @@ +REGISTRATION AND DONATIONS + +Registration is required only if you choose the SpTBXLib License +wich allows you to not include an acknowledgement in your +application's about box or help file, and also allows you to keep the +modifications you've made to SpTBXLib without having to make them public. + +The cost of a single developer license is US$100. This license permits +usage of SpTBXLib in applications created/maintained by only a single +developer. +A site license costs US$200, and permits usage of SpTBXLib in applications +created/maintained by any number of developers at your organization. +Payments are accepted via PayPal and Kagi: + http://www.silverpointdevelopment.com/sptbxlib/registration.htm + +No registration is required if you choose to use SpTBXLib under the +Mozilla Public License Version 1.1 +However, if you wish to express your appreciation for the time I +spend on developing, documenting and supporting it, I do accept and +appreciate donations. +Donations are accepted via PayPal and Kagi: + http://www.silverpointdevelopment.com/sptbxlib/registration.htm + +Thank you for your support. + +Robert Lee +http://www.silverpointdevelopment.com \ No newline at end of file diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.dcu new file mode 100644 index 0000000..a74a090 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.dfm b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.dfm new file mode 100644 index 0000000..e14b2f5 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.dfm @@ -0,0 +1,2895 @@ +object SpTBXColorPickerForm: TSpTBXColorPickerForm + Left = 156 + Top = 89 + ClientHeight = 193 + ClientWidth = 213 + Color = clBtnFace + Constraints.MinHeight = 211 + Constraints.MinWidth = 217 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [] + OldCreateOrder = False + Position = poDesigned + OnCreate = FormCreate + OnDestroy = FormDestroy + OnResize = FormResize + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object SpTBXTabControl1: TSpTBXTabControl + Left = 0 + Top = 26 + Width = 213 + Height = 167 + Align = alClient + ActiveTabIndex = 0 + OnActiveTabChange = SpTBXTabControl1ActiveTabChange + HiddenItems = <> + object SpTBXTabItem1: TSpTBXTabItem + Caption = 'Palette' + Checked = True + end + object SpTBXTabItem2: TSpTBXTabItem + Caption = 'Swatches' + end + object SpTBXTabItem3: TSpTBXTabItem + Caption = 'Eye Dropper' + end + object SpTBXTabSheet3: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 213 + Height = 144 + Caption = 'Eye Dropper' + ImageIndex = -1 + DesignSize = ( + 213 + 144) + TabItem = 'SpTBXTabItem3' + object imgColorPicker: TImage + Left = 2 + Top = 0 + Width = 207 + Height = 140 + Align = alClient + Visible = False + end + object btnColorPicker: TSpTBXSpeedButton + Left = 48 + Top = 59 + Width = 113 + Height = 22 + Caption = 'Click && Drag' + Anchors = [] + DragMode = dmAutomatic + OnEndDrag = btnColorPickerEndDrag + OnStartDrag = btnColorPickerStartDrag + end + end + object SpTBXTabSheet2: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 213 + Height = 144 + Caption = 'Swatches' + ImageIndex = -1 + DesignSize = ( + 213 + 144) + TabItem = 'SpTBXTabItem2' + object SpTBXColorListBox1: TSpTBXColorListBox + Left = 5 + Top = 5 + Width = 200 + Height = 132 + Style = [clbsSystemColors, clbsIncludeNone, clbsIncludeDefault, clbsPrettyNames, clbsNoneAsTransparent] + Anchors = [akLeft, akTop, akRight, akBottom] + IntegralHeight = True + ItemHeight = 16 + TabOrder = 0 + OnClick = SpTBXColorListBox1Click + Selected = clActiveBorder + end + end + object SpTBXTabSheet1: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 213 + Height = 144 + Caption = 'Palette' + ImageIndex = -1 + TabItem = 'SpTBXTabItem1' + object imgPalette: TImage + Left = 5 + Top = 4 + Width = 200 + Height = 137 + Cursor = crHandPoint + AutoSize = True + Picture.Data = { + 07544269746D61704E410100424D4E410100000000003600000028000000C800 + 000089000000010018000000000018410100130B0000130B0000000000000000 + 0000010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101080942 + 080942080942080942080C42080F42081142081342071642071843071A43071C + 43071E43072043072243062444062644062844062A44062C45052D45052F4505 + 3145053345043446043646043846043946043946043946043946033B46033C46 + 033E47023F4702414702424701444702434602424403424203414003403E043F + 3C043F3A053E38053D36053C33063C31063B2E073A2C07392908382608382308 + 372009361C0935180A34140A340F0A33080B32010B31000B30000C30000C2F00 + 0C2F000C2F000C2E000D2E000D2D000D2C000D2C000F2C00112C00132C00152C + 00162C00182C001A2B001C2B001D2B001F2B00212B00232B00252B00262B0028 + 2B002A2B002C2B002D2B002F2B00312B00332A00342A00362A00372A00392A00 + 3A2A003C2A003D2A003F29004029004229004128004027003F26003F25003E24 + 003D22003C21003B20003A1F00391E00381C00371B0036190035180034160033 + 1500321300311100300F002F0E002E0B002D09002C07002C05002B03002A0100 + 29000228000427000527000726000825000A25000A25000D2500102500132500 + 1624001824001A24001D24001F23002123002323002523002722002922002B22 + 002D22002F21003121003221003421003621003720003920003A20003C20003E + 20003F1F00411F00421F00431F00451E00461D00461D00461C00451B00451A00 + 451A004519004518004518004517004416004415004414004414004413014412 + 02431102431103431004430F04430E05430E06430D06430C07420C07420B0842 + 0A08420A08420909420809420809420101010101010C0C5C0C0C5C0C0C5C0C0C + 5C0C115C0C155C0C195C0B1C5D0B1F5D0B225D0B255E0A285E0A2A5E092D5E09 + 305F09335F083660083860073B60073E61064061064362054562044862044A63 + 034C63024E63025164025164025164025164015364005564005765005965005B + 65005D66005F66005E64005D61005C5F005B5D015A5A02595703585504575205 + 564F06554C0854490953460A52420B513F0C4F3B0D4E370D4D340E4C300F4B2B + 104A2611492111471B1246131245091344001443001442001442001442001441 + 00154000153F00163E00163D00193D001B3D001E3D00203D00223D00243D0027 + 3E00293E002B3E002E3E00303E00333E00353E00373E003A3E003C3E003E3E00 + 413E00433E00453E00483E004A3E004C3E004E3E00503E00523E00543E00563E + 00593E005A3E005C3E005B3D005A3C00593A0058390057370056360055350054 + 3300523200513000502E004F2D004E2B004C29004B28004A2600482400472200 + 462000441E00431C00421A004118003F16003E14003D12003C0F003B0D023A0A + 0539080738050937020B37020B36021136021636011A36011E36002135002435 + 002735002A35002D34003034003234003634003833003B33003D330040320042 + 32004532004732004932004B31004E3100503100523100543100563100583000 + 5A30005C30005D2F005F2E005F2D005F2C005F2B005F2A005F29005E28005E26 + 005E25005E24005E23005E22005E21015E1F025D1E035D1D045D1C055D1B055D + 1A065D18075D17085D16095D15095C140A5C130A5C120B5C100B5C0F0B5C0E0C + 5C0D0C5C0C0C5C010101010101100E74100E74100E74100E74101475101A750F + 1F750F23760F27760E2B760E2F770D33770D36780C3A780B3D790A41790A447A + 09487A084B7B074F7B06527C04557D03587D025B7E015E7E00617F00647F0067 + 80006780006780006780006A80006C81006F8100718200748200778300798300 + 788000777D00757A00747700737400727100706D026F6A046E66066C63086B5F + 0A695B0C68570D67530F654E10644A116246136140145F3B155E35165C2F175B + 281859201958171956071A55001B54001B54001B54001C52001C51001D50001D + 4F001E4D00214D00244D00274E002A4E002C4E002F4E00324E00354E00384E00 + 3B4F003E4F00414F00444F00474F004A4F004D4F005050005350005650005950 + 005B50005E50006150006350006651006951006B51006E510071510073510075 + 5100745000734E00724C00704B006F49006D47006C46006B4400694200684000 + 663E00653C00633A006138006036005E34005D32005B3000592E00582B005629 + 005427005325005122005020004E1D004D1B004C19004A160349140648110A46 + 0E0D460E0D460D15460D1B460C20460B25450A2945092D450831450735440639 + 44053C44044043034343024743004A42004D4200504200534200564100594100 + 5C41005F41006140006440006640006940006C40006E4000704000733F00753E + 00773D00773B00773A0077390077370077360077340077330077310077300076 + 2F00762D00762B01762A02762803762704762505762406762207752108751F09 + 751D0A751C0A751A0B75190B75170C75160C75140D74130D74120E74100E7401 + 0101010101130E8B130E8B130E8B130E8B13178B131E8C12248C12298D112E8D + 11338E10388E0F3C8F0E418F0E45900D49910B4E910A5292085693075A93055E + 94036295026695006996006D97007197007498007899007B99007B99007B9900 + 7B99007E9A00829B00859B00889C008B9D008E9D00919E00909A008E97008D93 + 008B9000898C00888800868400858000837C038177068073097E6E0C7C6A0E7A + 6511795F13775A14755516744F1772491970431A6E3C1B6C341D6B2B1E69211F + 6712206600216400216400216400216200226100235F00245E00245C00285C00 + 2B5C002F5C00325C00365D00395D003D5D00405D00435D00475E004A5E004E5E + 00525E00555F00595F005C5F00605F006360006660006A60006D600070600074 + 61007761007A61007D61008061008361008762008962008C62008B6000895E00 + 885C00865A008459008357008155008053007E50007C4E007A4C00784A007748 + 007545007343007140006F3E006D3C006B3900693600673400653100632F0061 + 2C005F29005E27005C24005B2100591F00581C0556190A54160E54160E541518 + 54151F54142654132C53133153123653113B52103F520E43520D47510C4B510A + 5051085450065750055B50035F4F01634F00664F00694F006D4E00704E00734E + 00764E00794E007D4D00804D00824D00854D00884D008B4B008E4A008E48008E + 46008D45008D43008D41008D40008D3E008D3C008D3A008D39008D37008D3500 + 8D33018C31028C2F038C2E048C2C058C2A068C28078C26088C24098C220A8C20 + 0B8B1E0B8B1D0C8B1B0C8B190D8B170D8B150E8B130E8B010101010101160CA1 + 160CA1160CA1160CA11618A21521A21529A3142FA41335A4123BA51140A51046 + A60F4BA70E50A80D55A80B5AA9095FAA0664AB0468AC016DAD0072AD0076AE00 + 7AAF007FB00083B10087B2008BB2008FB3008FB3008FB3008FB30093B40097B5 + 009AB6009EB600A2B700A5B800A9B900A7B500A5B000A3AC00A2A800A0A4009E + 9F009C9A009A9600989100968C01948705928109907C0D8E76118C70138A6A16 + 886518865E1A84571C824F1E7F481F7D3F217B3522792A23771A247500257300 + 257300257300267100277000286E00296C002A6A002E6A00326A00366B003A6B + 003E6B00426B00466B004A6C004E6C00526C00566D005B6D005F6D00626E0067 + 6E006B6E006F6F00736F00776F007B6F007F70008270008670008A70008E7100 + 9171009571009871009C72009F7200A37200A170009F6E009D6C009C6A009A67 + 00986500966300946100925E00905C008E59008C5700895400875100854F0083 + 4C008049007E46007C4400794100773E00753B007338007135006E32006D2F00 + 6B2C0069290067260065230463200A621C0F621C0F611C1B611B24611A2C611A + 3360193960183E6016445F15495F144E5E13525E12575E105C5D0E615D0C655D + 0A695C076E5C05725C02765C007A5B007E5B00825B00855B00895A008C5A0090 + 5A00935A00975A009A5A009E5900A15700A45600A45400A45200A45000A44E00 + A44C00A34A00A34800A34600A34400A34200A34000A33E00A33C00A33900A337 + 00A33500A33301A33102A22E04A22C05A22A05A22807A22507A22308A22109A2 + 1F0AA21D0AA21B0BA2180CA2160CA10101010101011807B71807B71807B71807 + B71718B81723B9162DB91534BA143BBB1342BB1248BC114FBD0F54BE0D5ABF0B + 60BF0866C1056BC20271C20076C3007CC50081C60086C6008BC80090C90095CA + 0099CA009ECB00A2CC00A2CC00A2CC00A2CC00A7CD00ABCE00AFCF00B4D000B8 + D100BCD200C0D300BECE00BCC900BAC500B8C000B5BB00B3B600B1B000AFAB00 + ADA500AAA000A89A00A69404A38E0AA1870F9E80139C79169A7319976C1C9564 + 1E925B209053228E49248B3E2589322786222884002982002982002982002B80 + 002C7E002D7C002E79002F77003377003878003D78004178004679004A79004F + 7900547900587A005D7A00617A00667B006B7B006F7C00747C00797C007D7D00 + 827D00867E008B7E008F7E00937F00987F009C7F00A08000A48000A88000AC81 + 00B18100B48100B88100B67F00B47D00B27A00B07800AE7500AC7300A97000A7 + 6E00A56B00A26800A065009E62009B6000995D00965A009356009154008E5000 + 8C4D00894A008646008443008140007F3D007C39007A3600783300762F00742C + 0072290370250B6E21116E21116D211F6D20296D1F326C1E396C1D406C1C466B + 1B4C6B1A526B19586A175D6A16626A146869126D691072680D76680A7C680780 + 67048567018967008E67009266009666009A66009E6600A36600A66500AA6500 + AE6500B26500B66300B96100B95F00B95D00B95A00B95800B95600B95400B952 + 00B94F00B94D00B94B00B94800B94600B94300B94100B93F00B93C00B83A00B8 + 3700B83400B83200B82F00B82D01B82A02B82802B82503B82304B82005B81E05 + B81B06B81807B70101010101011900CD1900CD1900CD1900CD1817CE1825CE17 + 31CF1639D01541D11349D11250D21057D30E5ED40B64D5086AD60472D70178D9 + 007EDA0084DB008ADC0090DD0095DE009BE000A1E100A6E200ABE300B0E400B5 + E500B5E500B5E500B5E500BBE600BFE700C4E900C9EA00CEEB00D2EC00D7ED00 + D4E700D2E200CFDD00CDD700CAD200C8CC00C5C600C3C000C0B900BEB300BBAC + 00B8A600B69F03B3970BB09011AD8815AB8119A8791CA5701FA36722A05E249D + 53269A4728983A2A95292B93072D90002D90002D90002E8E002F8B0030890032 + 86003384003884003E84004385004885004D85005286005786005C8600618700 + 6687006B88007188007689007B8900808A00868A008B8B00908B00958B009A8C + 009F8C00A38D00A88D00AD8D00B28E00B68E00BB8F00BF8F00C48F00C89000CD + 9000CA8D00C88B00C68800C38500C18300BF8000BC7D00B97A00B77700B47400 + B27100AF6E00AC6A00A96700A66400A36000A15D009E5A009B5600985200954F + 00924B008F47008C4400894000873C008439008235008031007D2E047B2A0D79 + 251379251378252378242E78233877224077214777204E761F55761E5B761C61 + 751B6775196D75177374157974137E731083730D8973098E7204937201987200 + 9E7200A27100A77100AB7100B07100B57000B97000BD7000C17000C67000CA6D + 00CE6B00CE6900CE6700CE6400CE6200CE6000CE5D00CE5B00CE5800CE5600CE + 5300CE5000CE4E00CE4B00CE4800CE4600CE4300CE4000CE3D00CE3A00CE3700 + CE3400CD3100CD2E00CD2C00CD2900CD2600CD2300CD2000CD1D00CD1900CD01 + 01010101011A00E21A00E21A00E21A00E21916E31827E41734E5163EE51547E6 + 134FE71158E80F60E90C67EA086EEB0475EC007DEE0084EF008AF00091F20098 + F3009EF400A4F600AAF700B1F800B7FA00BCFB00C2FC00C7FD00C7FD00C7FD00 + C7FD00CEFF00D3FF00D8FF00DDFF00E3FF00E8FF00EDFF00EAFF00E7FA00E4F4 + 00E2EE00DFE800DCE100D9DB00D6D400D3CD00D1C600CEBE00CBB700C8AF00C5 + A704C29F0DBE9713BC8F18B9861CB67C20B27323AF6826AC5D28A9502AA6422C + A3302EA10F309E00309E00309E00319B003398003496003593003690003D9000 + 4391004991004E91005492005992005F93006593006A94007094007594007C95 + 008196008796008C97009397009898009D9800A39900A99900AE9A00B39A00B8 + 9B00BD9B00C39B00C89C00CD9C00D29D00D79D00DC9D00E09E00DE9B00DB9800 + D99500D69200D48F00D18C00CE8900CB8600C88300C57F00C27C00BF7800BC75 + 00B97100B66E00B26A00B06600AC6200A95F00A55A00A256009F53009C4F0099 + 4A00964600934200903E008D3A008B3600883206862E10832917832917832827 + 82283382273E82264681254E81245681225D80216480206B801E717F1C777F1A + 7E7F18847E158A7E12907E0E967D0A9C7D05A17D00A77C00AD7C00B27C00B77B + 00BC7B00C17B00C67B00CB7B00D07A00D47A00D97A00DE7700E27500E27300E2 + 7000E26E00E36B00E36900E36600E36300E36100E35E00E35B00E35800E35500 + E35200E34F00E34C00E34900E34600E34300E34000E33C00E23900E23600E233 + 00E22F00E22C00E22900E22500E22200E21E00E21A00E20101010101012A3DE5 + 2A3DE52A3DE52A3DE52B45E62B4CE72B54E82C5BE92C62EA2C68EB2C70EC2D76 + ED2D7CEE2D82EF2D88F02D8FF12D94F22D9AF32D9FF42DA5F52DAAF72CAFF82C + B5F92BBAFA2ABFFB2AC4FC29C9FD28CEFE28CEFE28CEFE28CEFE27D3FF26D8FF + 24DCFF23E1FF21E6FF1FEAFF1DEEFF21ECFF24EAFB27E7F629E5F12CE2EB2EE0 + E530DDE032DBDA34D8D436D6CE37D3C839D1C13ACEBB3CCCB43DC9AD3EC6A63F + C4A040C19942BF9143BC8944B98145B67845B36F46B16647AE5C48AB5049A944 + 49A94449A94449A6354AA41E4AA1004B9F004C9C00519D00569D005C9D00619E + 00669E006B9F00719F0076A0007BA00080A00085A1008BA10090A20095A2009A + A3009FA300A4A400A9A400ADA500B3A500B7A600BCA600C0A600C5A700CAA700 + CEA800D3A800D7A800DCA900E0A900E4A900E2A700DFA400DDA100DB9E00D89C + 00D69900D39600D19300CE9000CC8C00C98900C68600C48300C17F00BE7C00BB + 7800B87500B57200B26E00AF6A00AC660CA96318A65F1FA35B25A0572A9D532E + 9A4F32974B3595473892433A8F3F3C8D3B3E8D3B3E8D3B478D3B4E8C3B568C3B + 5D8C3B638C3B698C3B708C3B768C3B7B8C3B818B3B878B3B8D8B3B928B3B978B + 3B9C8B3BA18B3AA68B3AAB8B3AB08B3AB58B3ABA8A3ABE8A3AC38A39C78A39CC + 8A39D08A39D58A39D98A38DD8A38E18838E58538E58339E68139E67E39E67C3A + E6793AE6763AE6743AE6713BE66E3BE66B3BE6693BE6663BE6633BE6603CE65D + 3CE65A3CE6573CE6543CE6503CE64D3CE64A3CE6463CE6433CE6403CE63C3CE6 + 393CE6353CE6323CE52E3DE52A3DE5010101010101405FE9405FE9405FE9405F + E94164EA426AEB4370EC4476EC457BED4680EE4786EF488BF04990F14A95F24B + 9AF34C9FF44DA4F54DA9F64EADF74FB2F850B7F950BBF951BFFA51C4FB52C9FC + 52CDFD53D1FE53D5FF53D5FF53D5FF53D5FF54D9FF54DDFF54E1FF55E4FF55E9 + FF55EDFF56F0FF56EEFF57ECFC58EAF858E8F359E6EE59E4EA5AE2E55AE0E05B + DEDB5CDCD65CD9D05CD7CB5DD5C65DD3C05ED1BB5ECEB55ECCB05FCAAA5FC8A4 + 60C69E60C39760C19060BE8A61BC8261BA7B61B77461B56C61B56C61B56C62B3 + 6362B05A62AE5062AC4562A93967AA376CAA3671AB3476AB337AAB317FAC2F83 + AC2D88AD2B8DAD2991AD2796AE249BAE219FAF1DA3AF1AA8B016ADB010B1B109 + B5B100B9B100BEB200C2B200C5B200C9B300CDB300D1B400D5B400D9B400DCB5 + 00E1B500E4B500E8B600E6B300E4B000E2AE00E0AB00DEA900DBA600D9A308D7 + A015D59E1DD29B23D09829CE952DCB9231C98F35C68C39C4893CC2863EBF8341 + BD7F44BA7C46B77949B4754BB2724DAF6E4FAC6A51A96752A66354A45F55A15C + 579E58589C545999505B99505B99516199516699526D9952729953789A547D9A + 54829A55879A558C9A56919A57959A579B9A589F9A58A49A59A89A59AD9A5AB2 + 9A5AB69B5BBA9B5BBF9B5CC39B5CC79B5DCB9B5DCE9B5ED29B5ED69B5FDA9B5F + DD9B60E29B60E59961E99761E99561E99261E99061E98D61E98B61E98861E986 + 60E98360E98160E97E60E97B60E97960E97660E97360E97160E96E60E96B60E9 + 6860E96460E96160E95E5FE95B5FE9585FE9545FE9515FE94E5FE94A5FE9475F + E9435FE9405FE90101010101015A7DED5A7DED5A7DED5A7DED5C81EE5D86EF5F + 8BF0608FF06194F16398F2649CF365A0F466A4F468A8F569ACF66AB0F76BB4F7 + 6CB8F86DBCF96EBFFA6FC3FA70C6FB71CAFC72CEFD73D2FD74D5FE75D8FF76DC + FF76DCFF76DCFF76DCFF76DFFF77E2FF78E5FF79E9FF79ECFF7AF0FF7BF3FF7B + F1FF7BEFFD7BEEF97BECF57CEAF17CE8ED7CE7E97CE5E57CE3E17CE1DD7CE0D9 + 7CDED47CDCD07CDACC7CD8C77CD7C27CD5BF7CD3BA7CD1B57CCFB07CCEAB7CCC + A67CCAA17CC89C7CC6967CC4917CC28B7CC28B7CC28B7CC0857CBE7F7CBC787C + BA727CB86B80B86A84B96A89B9698CB96890BA6894BA6798BB679CBB66A0BB65 + A4BC64A7BC64ACBC63AFBD62B3BD62B6BD61BABE60BDBE5FC1BE5EC4BF5EC8BF + 5DCCC05CCFC05BD2C05AD5C059D9C159DCC158DFC157E2C256E6C255E9C254EC + C353EAC055E9BE56E7BC58E5B959E3B75BE1B45CDFB25DDEB05EDCAD60DAAA61 + D8A862D6A564D4A365D2A066D09D67CE9B68CC9869CA956AC7936BC5906CC38D + 6DC18A6DBE876EBC846FBA8170B77D71B57A72B27772B07473AE7074AB6D75A9 + 6975A96975A96A7AA96B7FA96C84A96D89AA6E8DAA6F91AA6F96AA709AAA719E + AB72A2AB73A6AB74AAAB74AEAB75B2AB76B6AC77B9AC77BDAC78C1AC79C4AC7A + C8AD7BCCAD7BCFAD7CD2AD7DD6AD7DD9AD7EDCAE7FE0AE7FE3AE80E6AE81EAAC + 81EDAA81EDA881EDA681EDA381EDA181ED9F81ED9C81ED9A80ED9880ED9580ED + 9380ED9080ED8E80ED8B80ED8980ED877FED847FED817FED7F7FED7C7FED797F + ED767EED737EED707EED6D7EED6A7EED677EED647DED617DED5E7DED5A7DED01 + 01010101017999F27999F27999F27999F27A9DF27BA0F37DA4F47EA7F47FABF5 + 81AEF582B1F683B4F784B7F785BAF886BDF888C1F989C4F98AC6FA8BC9FB8CCC + FB8DCFFC8ED2FC8FD5FD90D8FE91DBFE92DDFF93E0FF94E3FF94E3FF94E3FF94 + E3FF95E5FF96E8FF97EAFF97EDFF98F0FF99F3FF9AF5FF9AF4FF9AF3FD9AF1FA + 9AF0F79AEFF49AEDF19AECEE9AEAEB9AE9E799E8E499E6E199E5DD99E3DA99E2 + D699E0D399DFCF99DECC98DCC898DBC598D9C198D8BD98D6B998D5B598D3B197 + D2AD97D0A997CFA597CFA597CFA597CDA197CB9D96CA9896C89496C78F99C78F + 9CC78EA0C88EA4C88EA7C88DAAC98DADC98DB0C98CB3C98CB6CA8CB9CA8BBCCA + 8BBFCB8AC2CB8AC5CB8AC8CC89CACC89CDCC89D0CC88D3CD88D6CD87D9CD87DB + CD87DECE86E0CE86E3CE85E6CF85E8CF85EBCF84EECF84F0D083EFCE84EDCC84 + ECC985EAC785E9C586E7C386E6C187E4BF87E3BD87E1BB88E0B988DEB689DCB4 + 89DBB28AD9B08AD7AD8AD6AB8BD4A98BD2A68BD1A48CCFA28CCD9F8CCB9D8DC9 + 9A8DC7988DC6958EC4938EC2908EC08D8FBE8B8FBC888FBA8590BA8590BA8693 + BA8797BB889BBB899FBB8AA2BB8BA6BC8BA9BC8CACBC8DB0BC8EB3BC8FB6BD90 + BABD91BDBD91C0BD92C3BE93C6BE94C9BE95CCBE95CFBF96D2BF97D5BF98D8BF + 99DBBF99DDC09AE0C09BE3C09CE6C09CE8C09DEBC19EEEBF9EF1BD9EF1BB9EF1 + B99EF1B79EF1B59EF1B39EF1B19DF1AF9DF1AD9DF1AB9DF1A99DF1A69DF1A49C + F1A29CF1A09CF19E9CF19B9CF1999CF1979BF2949BF2929BF2909BF28D9BF28B + 9BF2889AF2869AF2839AF2819AF27E9AF27B9AF27999F20101010101019AB5F6 + 9AB5F69AB5F69AB5F69BB7F79CBAF79DBCF79EBEF89FC0F8A0C3F8A1C6F9A2C8 + F9A3CAFAA4CCFAA5CEFBA6D1FBA7D3FBA8D5FCA9D7FCAADAFDABDCFDACDEFDAD + E0FEAEE2FEAFE4FFAFE6FFB0E8FFB1EAFFB1EAFFB1EAFFB1EAFFB2ECFFB3EEFF + B4F0FFB5F2FFB6F4FFB6F6FFB7F8FFB7F7FFB7F6FEB7F5FCB7F4F9B6F3F7B6F2 + F5B6F1F2B6F0F0B6EFEDB6EEEBB6EDE9B5ECE6B5EBE4B5EAE1B5E8DEB5E7DCB5 + E6D9B4E5D7B4E4D4B4E3D1B4E2CFB4E1CCB3E0C9B3DFC7B3DEC4B3DDC1B3DBBE + B3DBBEB3DBBEB2DABBB2D9B8B2D8B5B2D7B2B2D6AFB4D6AFB6D6AFB8D6AFBBD7 + AFBDD7AEBFD7AEC2D7AEC4D8AEC7D8AEC9D8ADCBD8ADCDD8ADCFD9ADD1D9ADD3 + D9ACD6D9ACD8DAACDADAACDCDAABDEDAABE0DAABE2DBABE4DBABE6DBABE9DBAA + EBDCAAEDDCAAEFDCAAF1DCA9F2DCA9F4DDA9F3DBA9F2D9A9F1D8A9F0D6A9EFD4 + A9EED3AAECD1AAEBCFAAEACEAAE9CCAAE8CAAAE6C8AAE5C7AAE4C5AAE3C3AAE1 + C1AAE0C0AADFBEAADEBCABDCBAABDBB8ABDAB6ABD8B5ABD7B3ABD6B1ABD4AFAB + D3ADABD2ABABD0A9ABCFA7ABCDA5ABCCA3ABCCA3ABCCA4AECCA4B1CDA5B3CDA6 + B6CDA7B8CDA8BBCEA9BECEA9C0CEAAC3CEABC5CFACC8CFACCACFADCCCFAECFCF + AED1D0AFD4D0B0D6D0B1D8D0B1DBD0B2DDD1B3DFD1B4E1D1B4E3D1B5E5D2B6E8 + D2B7EAD2B7ECD2B8EED2B9F1D3B9F3D1BAF5CFBAF5CEB9F5CCB9F5CBB9F5C9B9 + F5C7B9F5C6B9F5C4B9F5C2B8F5C1B8F5BFB8F5BDB8F5BBB8F5BAB8F5B8B8F5B6 + B7F5B4B7F6B3B7F6B1B7F6AFB7F6ADB7F6ABB6F6A9B6F6A7B6F6A6B6F6A4B6F6 + A2B6F6A0B5F69EB5F69CB5F69AB5F6010101010101BBCFFABBCFFABBCFFABBCF + FABCD0FABDD2FABDD3FBBED5FBBFD6FBC0D8FBC1DAFCC1DBFCC2DDFCC3DEFCC4 + DFFCC4E1FDC5E2FDC6E3FDC6E5FEC7E6FEC8E8FEC8E9FEC9EAFFCAECFFCAEDFF + CBEEFFCCEFFFCCF1FFCCF1FFCCF1FFCCF1FFCDF3FFCEF4FFCFF5FFCFF7FFD0F8 + FFD1F9FFD1FAFFD1FAFFD1F9FED1F8FDD1F8FBD0F7FAD0F6F8D0F6F6D0F5F5D0 + F4F3D0F4F2D0F3F0CFF2EFCFF2EDCFF1EBCFF0EACFF0E8CFEFE6CFEEE5CEEDE3 + CEEDE1CEECE0CEEBDECEEBDCCEEADACDE9D9CDE8D7CDE8D5CDE8D5CDE8D5CDE7 + D3CDE6D2CDE6D0CCE5CECCE4CCCEE4CCCFE4CCD1E5CCD2E5CCD4E5CCD5E5CCD7 + E5CBD9E5CBDAE6CBDBE6CBDDE6CBDEE6CBE0E6CBE1E6CBE2E6CBE4E7CBE5E7CA + E6E7CAE8E7CAE9E7CAEAE7CAECE7CAEDE7CAEEE8CAF0E8CAF2E8C9F3E8C9F4E8 + C9F6E8C9F7E9C9F8E9C9F7E8C9F7E6C9F6E5C9F5E4C9F4E3C9F3E2C9F3E0C9F2 + DFC8F1DEC8F0DDC8F0DCC8EFDBC8EED9C8EDD8C8ECD7C8EBD6C8EBD4C8EAD3C8 + E9D2C8E8D1C8E7CFC8E6CEC8E6CDC8E5CCC8E4CAC7E3C9C7E2C8C7E1C6C7E0C5 + C7DFC4C7DFC3C7DEC1C7DEC1C7DEC2C9DEC2CADEC3CCDEC3CEDFC4CFDFC5D1DF + C5D3DFC6D5DFC7D7DFC7D8E0C8DAE0C8DBE0C9DDE0C9DEE0CAE0E0CAE2E1CBE3 + E1CCE5E1CCE6E1CDE8E1CDE9E1CEEBE2CEECE2CFEDE2D0F0E2D0F1E2D1F3E2D1 + F4E3D2F5E3D2F7E2D3F8E0D3F8DFD2F9DED2F9DDD2F9DCD2F9DBD2F9D9D2F9D8 + D2F9D7D2F9D6D1F9D5D1F9D3D1F9D2D1F9D1D1F9D0D1F9CFD1F9CDD1F9CCD1F9 + CBD0F9C9D0F9C8D0F9C7D0F9C6D0F9C4D0F9C3D0FAC2D0FAC0CFFABFCFFABECF + FABCCFFABBCFFA010101010101DDE8FDDDE8FDDDE8FDDDE8FDDDE8FDDEE9FDDE + EAFDDEEAFDDFEBFDDFECFDE0ECFEE0EDFEE0EEFEE1EEFEE1EFFEE2F0FEE2F0FE + E2F1FEE3F2FFE3F3FFE4F4FFE4F4FFE4F5FFE5F6FFE5F6FFE6F7FFE6F8FFE6F8 + FFE6F8FFE6F8FFE6F8FFE7F9FFE7FAFFE7FAFFE8FBFFE8FBFFE9FCFFE9FDFFE9 + FCFFE9FCFFE9FCFEE9FBFDE9FBFCE8FBFCE8FAFBE8FAFAE8FAF9E8F9F8E8F9F8 + E8F9F7E8F8F6E8F8F5E8F8F4E8F7F4E7F7F3E7F7F2E7F6F1E7F6F0E7F6F0E7F5 + EFE7F5EEE7F5EDE7F4ECE7F4ECE7F4EBE7F4EBE7F4EBE6F3EAE6F3E9E6F3E8E6 + F2E7E6F2E7E7F2E7E8F2E7E8F2E7E9F2E7EAF2E6EAF2E6EBF2E6ECF2E6ECF3E6 + EDF3E6EEF3E6EEF3E6EFF3E6F0F3E6F0F3E6F2F3E6F2F3E6F3F3E6F4F3E6F4F3 + E6F5F3E6F6F4E6F6F4E6F7F4E6F8F4E5F8F4E5F9F4E5FAF4E5FAF4E5FBF4E5FC + F4E5FBF4E5FBF3E5FBF2E5FAF2E5FAF1E5F9F0E5F9F0E5F8EFE5F8EFE5F8EEE5 + F7EDE5F7EDE4F6ECE4F6EBE4F6EBE4F5EAE4F5EAE4F4E9E4F4E8E4F4E8E4F3E7 + E4F3E6E4F2E6E4F2E5E4F2E4E4F1E4E4F1E3E3F0E3E3F0E2E3EFE1E3EFE1E3EF + E0E3EFE0E3EFE0E4EFE1E5EFE1E5EFE1E6EFE1E7EFE2E8EFE2E9EFE2E9EFE3EA + F0E3EBF0E3ECF0E4EDF0E4EDF0E4EEF0E5EFF0E5F0F0E5F1F0E6F2F0E6F3F1E6 + F3F1E7F4F1E7F5F1E7F6F1E8F7F1E8F7F1E8F8F1E8F9F1E9FAF1E9FAF1E9FBF1 + EAFCF0EAFCF0E9FCEFE9FCEEE9FCEEE9FCEDE9FCECE9FCECE9FCEBE9FCEBE9FC + EAE9FCE9E9FCE9E9FCE8E9FCE7E9FCE7E9FCE6E9FCE5E8FCE5E8FCE4E8FCE4E8 + FDE3E8FDE2E8FDE2E8FDE1E8FDE0E8FDE0E8FDDFE8FDDEE8FDDEE8FDDDE8FD01 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101FF00FF + FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF0000000000000000 + 00000000000000000000000000000000000000000000FF0099FF0099FF0099FF + 0099FF0099FF0099FF0099FF0099FF0099010101FF3399FF3399FF3399FF3399 + FF3399FF3399FF3399FF3399FF3399010101FF6699FF6699FF6699FF6699FF66 + 99FF6699FF6699FF6699FF6699010101FF9999FF9999FF9999FF9999FF9999FF + 9999FF9999FF9999FF9999010101FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99 + FFCC99FFCC99FFCC99010101FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF + 99FFFF99FFFF99010101FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF + 00CCFF00CC010101FF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC + FF33CC010101FF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66 + CC010101FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CC01 + 0101FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC010101 + FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC010101FF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF010101FF33FFFF + 33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FF010101FF66FFFF66FF + FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FF010101FF99FFFF99FFFF99 + FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF010101FFCCFFFFCCFFFFCCFFFF + CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF010101FFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF010101010101FF00FFFF00FFFF00FFFF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FF00000000000000000000000000000000 + 0000000000000000000000000000FF0099FF0099FF0099FF0099FF0099FF0099 + FF0099FF0099FF0099010101FF3399FF3399FF3399FF3399FF3399FF3399FF33 + 99FF3399FF3399010101FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF + 6699FF6699010101FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999 + FF9999010101FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC + 99010101FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF9901 + 0101FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CC010101 + FF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC010101FF66 + CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CC010101FF99CCFF + 99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CC010101FFCCCCFFCCCC + FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC010101FFFFCCFFFFCCFFFF + CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC010101FF00FFFF00FFFF00FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF00FF010101FF33FFFF33FFFF33FFFF33FF + FF33FFFF33FFFF33FFFF33FFFF33FF010101FF66FFFF66FFFF66FFFF66FFFF66 + FFFF66FFFF66FFFF66FFFF66FF010101FF99FFFF99FFFF99FFFF99FFFF99FFFF + 99FFFF99FFFF99FFFF99FF010101FFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF + FFCCFFFFCCFFFFCCFF010101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFF010101010101FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00FF000000000000000000000000000000000000000000000000 + 000000000000FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF00 + 99010101FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF339901 + 0101FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699010101 + FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999010101FFCC + 99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99010101FFFF99FF + FF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99010101FF00CCFF00CC + FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CC010101FF33CCFF33CCFF33 + CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC010101FF66CCFF66CCFF66CCFF + 66CCFF66CCFF66CCFF66CCFF66CCFF66CC010101FF99CCFF99CCFF99CCFF99CC + FF99CCFF99CCFF99CCFF99CCFF99CC010101FFCCCCFFCCCCFFCCCCFFCCCCFFCC + CCFFCCCCFFCCCCFFCCCCFFCCCC010101FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF + FFCCFFFFCCFFFFCCFFFFCC010101FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF00FF010101FF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33 + FFFF33FFFF33FF010101FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF + 66FFFF66FF010101FF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF + FF99FF010101FFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC + FF010101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF01 + 0101010101FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + 000000000000000000000000000000000000000000000000000000000000FF00 + 99FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099010101FF3399FF + 3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399010101FF6699FF6699 + FF6699FF6699FF6699FF6699FF6699FF6699FF6699010101FF9999FF9999FF99 + 99FF9999FF9999FF9999FF9999FF9999FF9999010101FFCC99FFCC99FFCC99FF + CC99FFCC99FFCC99FFCC99FFCC99FFCC99010101FFFF99FFFF99FFFF99FFFF99 + FFFF99FFFF99FFFF99FFFF99FFFF99010101FF00CCFF00CCFF00CCFF00CCFF00 + CCFF00CCFF00CCFF00CCFF00CC010101FF33CCFF33CCFF33CCFF33CCFF33CCFF + 33CCFF33CCFF33CCFF33CC010101FF66CCFF66CCFF66CCFF66CCFF66CCFF66CC + FF66CCFF66CCFF66CC010101FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99 + CCFF99CCFF99CC010101FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFF + CCCCFFCCCC010101FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC + FFFFCC010101FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 + FF010101FF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FF01 + 0101FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FF010101 + FF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF010101FFCC + FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF010101FFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF010101010101FF00FF + FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF0000000000000000 + 00000000000000000000000000000000000000000000FF0099FF0099FF0099FF + 0099FF0099FF0099FF0099FF0099FF0099010101FF3399FF3399FF3399FF3399 + FF3399FF3399FF3399FF3399FF3399010101FF6699FF6699FF6699FF6699FF66 + 99FF6699FF6699FF6699FF6699010101FF9999FF9999FF9999FF9999FF9999FF + 9999FF9999FF9999FF9999010101FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99 + FFCC99FFCC99FFCC99010101FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF + 99FFFF99FFFF99010101FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF + 00CCFF00CC010101FF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC + FF33CC010101FF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66 + CC010101FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CC01 + 0101FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC010101 + FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC010101FF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF010101FF33FFFF + 33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FF010101FF66FFFF66FF + FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FF010101FF99FFFF99FFFF99 + FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF010101FFCCFFFFCCFFFFCCFFFF + CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF010101FFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF010101010101FF00FFFF00FFFF00FFFF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FF00000000000000000000000000000000 + 0000000000000000000000000000FF0099FF0099FF0099FF0099FF0099FF0099 + FF0099FF0099FF0099010101FF3399FF3399FF3399FF3399FF3399FF3399FF33 + 99FF3399FF3399010101FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF + 6699FF6699010101FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999 + FF9999010101FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC + 99010101FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF9901 + 0101FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CC010101 + FF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC010101FF66 + CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CC010101FF99CCFF + 99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CC010101FFCCCCFFCCCC + FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC010101FFFFCCFFFFCCFFFF + CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC010101FF00FFFF00FFFF00FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF00FF010101FF33FFFF33FFFF33FFFF33FF + FF33FFFF33FFFF33FFFF33FFFF33FF010101FF66FFFF66FFFF66FFFF66FFFF66 + FFFF66FFFF66FFFF66FFFF66FF010101FF99FFFF99FFFF99FFFF99FFFF99FFFF + 99FFFF99FFFF99FFFF99FF010101FFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF + FFCCFFFFCCFFFFCCFF010101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFF010101010101FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00FF000000000000000000000000000000000000000000000000 + 000000000000FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF00 + 99010101FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF339901 + 0101FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699010101 + FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999010101FFCC + 99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99010101FFFF99FF + FF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99010101FF00CCFF00CC + FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CC010101FF33CCFF33CCFF33 + CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC010101FF66CCFF66CCFF66CCFF + 66CCFF66CCFF66CCFF66CCFF66CCFF66CC010101FF99CCFF99CCFF99CCFF99CC + FF99CCFF99CCFF99CCFF99CCFF99CC010101FFCCCCFFCCCCFFCCCCFFCCCCFFCC + CCFFCCCCFFCCCCFFCCCCFFCCCC010101FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF + FFCCFFFFCCFFFFCCFFFFCC010101FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF00FF010101FF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33 + FFFF33FFFF33FF010101FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF + 66FFFF66FF010101FF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF + FF99FF010101FFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC + FF010101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF01 + 0101010101FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + 000000000000000000000000000000000000000000000000000000000000FF00 + 99FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099010101FF3399FF + 3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399010101FF6699FF6699 + FF6699FF6699FF6699FF6699FF6699FF6699FF6699010101FF9999FF9999FF99 + 99FF9999FF9999FF9999FF9999FF9999FF9999010101FFCC99FFCC99FFCC99FF + CC99FFCC99FFCC99FFCC99FFCC99FFCC99010101FFFF99FFFF99FFFF99FFFF99 + FFFF99FFFF99FFFF99FFFF99FFFF99010101FF00CCFF00CCFF00CCFF00CCFF00 + CCFF00CCFF00CCFF00CCFF00CC010101FF33CCFF33CCFF33CCFF33CCFF33CCFF + 33CCFF33CCFF33CCFF33CC010101FF66CCFF66CCFF66CCFF66CCFF66CCFF66CC + FF66CCFF66CCFF66CC010101FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99 + CCFF99CCFF99CC010101FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFF + CCCCFFCCCC010101FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC + FFFFCC010101FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 + FF010101FF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FF01 + 0101FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FF010101 + FF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF010101FFCC + FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF010101FFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF010101010101FF00FF + FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF0000000000000000 + 00000000000000000000000000000000000000000000FF0099FF0099FF0099FF + 0099FF0099FF0099FF0099FF0099FF0099010101FF3399FF3399FF3399FF3399 + FF3399FF3399FF3399FF3399FF3399010101FF6699FF6699FF6699FF6699FF66 + 99FF6699FF6699FF6699FF6699010101FF9999FF9999FF9999FF9999FF9999FF + 9999FF9999FF9999FF9999010101FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99 + FFCC99FFCC99FFCC99010101FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF + 99FFFF99FFFF99010101FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF + 00CCFF00CC010101FF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC + FF33CC010101FF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66 + CC010101FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CC01 + 0101FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC010101 + FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCC010101FF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF010101FF33FFFF + 33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FF010101FF66FFFF66FF + FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FF010101FF99FFFF99FFFF99 + FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF010101FFCCFFFFCCFFFFCCFFFF + CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF010101FFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0101010101010101010101010101010101 + 0101010101010101010101010101010100000000000000000000000000000000 + 0000000000000000000000000000010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 01010101010101010101010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF00000000000000000000000000000000000000000000000000 + 000000000000CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC00 + 99010101CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC339901 + 0101CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699010101 + CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999010101CCCC + 99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99010101CCFF99CC + FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99010101CC00CCCC00CC + CC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CC010101CC33CCCC33CCCC33 + CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC010101CC66CCCC66CCCC66CCCC + 66CCCC66CCCC66CCCC66CCCC66CCCC66CC010101CC99CCCC99CCCC99CCCC99CC + CC99CCCC99CCCC99CCCC99CCCC99CC010101CCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCC010101CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC + FFCCCCFFCCCCFFCCCCFFCC010101CC00FFCC00FFCC00FFCC00FFCC00FFCC00FF + CC00FFCC00FFCC00FF010101CC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33 + FFCC33FFCC33FF010101CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC + 66FFCC66FF010101CC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FF + CC99FF010101CCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC + FF010101CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFF01 + 0101010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 + 000000000000000000000000000000000000000000000000000000000000CC00 + 99CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099010101CC3399CC + 3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399010101CC6699CC6699 + CC6699CC6699CC6699CC6699CC6699CC6699CC6699010101CC9999CC9999CC99 + 99CC9999CC9999CC9999CC9999CC9999CC9999010101CCCC99CCCC99CCCC99CC + CC99CCCC99CCCC99CCCC99CCCC99CCCC99010101CCFF99CCFF99CCFF99CCFF99 + CCFF99CCFF99CCFF99CCFF99CCFF99010101CC00CCCC00CCCC00CCCC00CCCC00 + CCCC00CCCC00CCCC00CCCC00CC010101CC33CCCC33CCCC33CCCC33CCCC33CCCC + 33CCCC33CCCC33CCCC33CC010101CC66CCCC66CCCC66CCCC66CCCC66CCCC66CC + CC66CCCC66CCCC66CC010101CC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99 + CCCC99CCCC99CC010101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCC010101CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCC + CCFFCC010101CC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00 + FF010101CC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FF01 + 0101CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FF010101 + CC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FF010101CCCC + FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFF010101CCFFFFCC + FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFF010101010101FFFF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF000000000000000000 + 00000000000000000000000000000000000000000000CC0099CC0099CC0099CC + 0099CC0099CC0099CC0099CC0099CC0099010101CC3399CC3399CC3399CC3399 + CC3399CC3399CC3399CC3399CC3399010101CC6699CC6699CC6699CC6699CC66 + 99CC6699CC6699CC6699CC6699010101CC9999CC9999CC9999CC9999CC9999CC + 9999CC9999CC9999CC9999010101CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99 + CCCC99CCCC99CCCC99010101CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF + 99CCFF99CCFF99010101CC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC + 00CCCC00CC010101CC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC + CC33CC010101CC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66 + CC010101CC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CC01 + 0101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC010101 + CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCC010101CC00 + FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FF010101CC33FFCC + 33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FF010101CC66FFCC66FF + CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FF010101CC99FFCC99FFCC99 + FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FF010101CCCCFFCCCCFFCCCCFFCC + CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFF010101CCFFFFCCFFFFCCFFFFCCFFFF + CCFFFFCCFFFFCCFFFFCCFFFFCCFFFF010101010101FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF0000000000000000000000000000000000 + 0000000000000000000000000000CC0099CC0099CC0099CC0099CC0099CC0099 + CC0099CC0099CC0099010101CC3399CC3399CC3399CC3399CC3399CC3399CC33 + 99CC3399CC3399010101CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC + 6699CC6699010101CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999 + CC9999010101CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC + 99010101CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF9901 + 0101CC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CC010101 + CC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC010101CC66 + CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CC010101CC99CCCC + 99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CC010101CCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC010101CCFFCCCCFFCCCCFF + CCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCC010101CC00FFCC00FFCC00FFCC + 00FFCC00FFCC00FFCC00FFCC00FFCC00FF010101CC33FFCC33FFCC33FFCC33FF + CC33FFCC33FFCC33FFCC33FFCC33FF010101CC66FFCC66FFCC66FFCC66FFCC66 + FFCC66FFCC66FFCC66FFCC66FF010101CC99FFCC99FFCC99FFCC99FFCC99FFCC + 99FFCC99FFCC99FFCC99FF010101CCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFF + CCCCFFCCCCFFCCCCFF010101CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF + FFCCFFFFCCFFFF010101010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF00000000000000000000000000000000000000000000000000 + 000000000000CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC00 + 99010101CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC339901 + 0101CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699010101 + CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999010101CCCC + 99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99010101CCFF99CC + FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99010101CC00CCCC00CC + CC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CC010101CC33CCCC33CCCC33 + CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC010101CC66CCCC66CCCC66CCCC + 66CCCC66CCCC66CCCC66CCCC66CCCC66CC010101CC99CCCC99CCCC99CCCC99CC + CC99CCCC99CCCC99CCCC99CCCC99CC010101CCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCC010101CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC + FFCCCCFFCCCCFFCCCCFFCC010101CC00FFCC00FFCC00FFCC00FFCC00FFCC00FF + CC00FFCC00FFCC00FF010101CC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33 + FFCC33FFCC33FF010101CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC + 66FFCC66FF010101CC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FF + CC99FF010101CCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC + FF010101CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFF01 + 0101010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 + 000000000000000000000000000000000000000000000000000000000000CC00 + 99CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099010101CC3399CC + 3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399010101CC6699CC6699 + CC6699CC6699CC6699CC6699CC6699CC6699CC6699010101CC9999CC9999CC99 + 99CC9999CC9999CC9999CC9999CC9999CC9999010101CCCC99CCCC99CCCC99CC + CC99CCCC99CCCC99CCCC99CCCC99CCCC99010101CCFF99CCFF99CCFF99CCFF99 + CCFF99CCFF99CCFF99CCFF99CCFF99010101CC00CCCC00CCCC00CCCC00CCCC00 + CCCC00CCCC00CCCC00CCCC00CC010101CC33CCCC33CCCC33CCCC33CCCC33CCCC + 33CCCC33CCCC33CCCC33CC010101CC66CCCC66CCCC66CCCC66CCCC66CCCC66CC + CC66CCCC66CCCC66CC010101CC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99 + CCCC99CCCC99CC010101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCC010101CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCC + CCFFCC010101CC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00 + FF010101CC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FF01 + 0101CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FF010101 + CC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FF010101CCCC + FFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFF010101CCFFFFCC + FFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFF010101010101FFFF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF000000000000000000 + 00000000000000000000000000000000000000000000CC0099CC0099CC0099CC + 0099CC0099CC0099CC0099CC0099CC0099010101CC3399CC3399CC3399CC3399 + CC3399CC3399CC3399CC3399CC3399010101CC6699CC6699CC6699CC6699CC66 + 99CC6699CC6699CC6699CC6699010101CC9999CC9999CC9999CC9999CC9999CC + 9999CC9999CC9999CC9999010101CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99 + CCCC99CCCC99CCCC99010101CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF + 99CCFF99CCFF99010101CC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC + 00CCCC00CC010101CC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC + CC33CC010101CC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66 + CC010101CC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CC01 + 0101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC010101 + CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCC010101CC00 + FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FF010101CC33FFCC + 33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FF010101CC66FFCC66FF + CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FF010101CC99FFCC99FFCC99 + FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FF010101CCCCFFCCCCFFCCCCFFCC + CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFF010101CCFFFFCCFFFFCCFFFFCCFFFF + CCFFFFCCFFFFCCFFFFCCFFFFCCFFFF010101010101FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF0000000000000000000000000000000000 + 0000000000000000000000000000CC0099CC0099CC0099CC0099CC0099CC0099 + CC0099CC0099CC0099010101CC3399CC3399CC3399CC3399CC3399CC3399CC33 + 99CC3399CC3399010101CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC + 6699CC6699010101CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999 + CC9999010101CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC + 99010101CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF9901 + 0101CC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CC010101 + CC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC010101CC66 + CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CC010101CC99CCCC + 99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CC010101CCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC010101CCFFCCCCFFCCCCFF + CCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCC010101CC00FFCC00FFCC00FFCC + 00FFCC00FFCC00FFCC00FFCC00FFCC00FF010101CC33FFCC33FFCC33FFCC33FF + CC33FFCC33FFCC33FFCC33FFCC33FF010101CC66FFCC66FFCC66FFCC66FFCC66 + FFCC66FFCC66FFCC66FFCC66FF010101CC99FFCC99FFCC99FFCC99FFCC99FFCC + 99FFCC99FFCC99FFCC99FF010101CCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFF + CCCCFFCCCCFFCCCCFF010101CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFF + FFCCFFFFCCFFFF010101010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF00000000000000000000000000000000000000000000000000 + 000000000000CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC00 + 99010101CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC339901 + 0101CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699010101 + CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999010101CCCC + 99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99010101CCFF99CC + FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99010101CC00CCCC00CC + CC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CC010101CC33CCCC33CCCC33 + CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC010101CC66CCCC66CCCC66CCCC + 66CCCC66CCCC66CCCC66CCCC66CCCC66CC010101CC99CCCC99CCCC99CCCC99CC + CC99CCCC99CCCC99CCCC99CCCC99CC010101CCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCC010101CCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC + FFCCCCFFCCCCFFCCCCFFCC010101CC00FFCC00FFCC00FFCC00FFCC00FFCC00FF + CC00FFCC00FFCC00FF010101CC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33 + FFCC33FFCC33FF010101CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC + 66FFCC66FF010101CC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FF + CC99FF010101CCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCCFFCCCC + FF010101CCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFFCCFFFF01 + 0101010101010101010101010101010101010101010101010101010101010101 + 0000000000000000000000000000000000000000000000000000000000000101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 010101010101010101010101010101010101010101010101010101010100FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF0000000000000000 + 0000000000000000000000000000000000000000000099009999009999009999 + 0099990099990099990099990099990099010101993399993399993399993399 + 9933999933999933999933999933990101019966999966999966999966999966 + 9999669999669999669999669901010199999999999999999999999999999999 + 999999999999999999999901010199CC9999CC9999CC9999CC9999CC9999CC99 + 99CC9999CC9999CC9901010199FF9999FF9999FF9999FF9999FF9999FF9999FF + 9999FF9999FF990101019900CC9900CC9900CC9900CC9900CC9900CC9900CC99 + 00CC9900CC0101019933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC + 9933CC0101019966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966 + CC0101019999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC01 + 010199CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC010101 + 99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC0101019900 + FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF0101019933FF99 + 33FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF0101019966FF9966FF + 9966FF9966FF9966FF9966FF9966FF9966FF9966FF0101019999FF9999FF9999 + FF9999FF9999FF9999FF9999FF9999FF9999FF01010199CCFF99CCFF99CCFF99 + CCFF99CCFF99CCFF99CCFF99CCFF99CCFF01010199FFFF99FFFF99FFFF99FFFF + 99FFFF99FFFF99FFFF99FFFF99FFFF01010101010100FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF00FFFF00FFFF00FFFF00000000000000000000000000000000 + 0000000000000000000000000000990099990099990099990099990099990099 + 9900999900999900990101019933999933999933999933999933999933999933 + 9999339999339901010199669999669999669999669999669999669999669999 + 6699996699010101999999999999999999999999999999999999999999999999 + 99999901010199CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC + 9901010199FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9901 + 01019900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC010101 + 9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC0101019966 + CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC0101019999CC99 + 99CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC01010199CCCC99CCCC + 99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC01010199FFCC99FFCC99FF + CC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC0101019900FF9900FF9900FF99 + 00FF9900FF9900FF9900FF9900FF9900FF0101019933FF9933FF9933FF9933FF + 9933FF9933FF9933FF9933FF9933FF0101019966FF9966FF9966FF9966FF9966 + FF9966FF9966FF9966FF9966FF0101019999FF9999FF9999FF9999FF9999FF99 + 99FF9999FF9999FF9999FF01010199CCFF99CCFF99CCFF99CCFF99CCFF99CCFF + 99CCFF99CCFF99CCFF01010199FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF + FF99FFFF99FFFF01010101010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 + FFFF00FFFF00FFFF000000000000000000000000000000000000000000000000 + 0000000000009900999900999900999900999900999900999900999900999900 + 9901010199339999339999339999339999339999339999339999339999339901 + 0101996699996699996699996699996699996699996699996699996699010101 + 99999999999999999999999999999999999999999999999999999901010199CC + 9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9901010199FF9999 + FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF990101019900CC9900CC + 9900CC9900CC9900CC9900CC9900CC9900CC9900CC0101019933CC9933CC9933 + CC9933CC9933CC9933CC9933CC9933CC9933CC0101019966CC9966CC9966CC99 + 66CC9966CC9966CC9966CC9966CC9966CC0101019999CC9999CC9999CC9999CC + 9999CC9999CC9999CC9999CC9999CC01010199CCCC99CCCC99CCCC99CCCC99CC + CC99CCCC99CCCC99CCCC99CCCC01010199FFCC99FFCC99FFCC99FFCC99FFCC99 + FFCC99FFCC99FFCC99FFCC0101019900FF9900FF9900FF9900FF9900FF9900FF + 9900FF9900FF9900FF0101019933FF9933FF9933FF9933FF9933FF9933FF9933 + FF9933FF9933FF0101019966FF9966FF9966FF9966FF9966FF9966FF9966FF99 + 66FF9966FF0101019999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF + 9999FF01010199CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CC + FF01010199FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF01 + 010101010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF + 0000000000000000000000000000000000000000000000000000000000009900 + 9999009999009999009999009999009999009999009999009901010199339999 + 3399993399993399993399993399993399993399993399010101996699996699 + 9966999966999966999966999966999966999966990101019999999999999999 + 9999999999999999999999999999999999999901010199CC9999CC9999CC9999 + CC9999CC9999CC9999CC9999CC9999CC9901010199FF9999FF9999FF9999FF99 + 99FF9999FF9999FF9999FF9999FF990101019900CC9900CC9900CC9900CC9900 + CC9900CC9900CC9900CC9900CC0101019933CC9933CC9933CC9933CC9933CC99 + 33CC9933CC9933CC9933CC0101019966CC9966CC9966CC9966CC9966CC9966CC + 9966CC9966CC9966CC0101019999CC9999CC9999CC9999CC9999CC9999CC9999 + CC9999CC9999CC01010199CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99 + CCCC99CCCC01010199FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC + 99FFCC0101019900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900 + FF0101019933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF01 + 01019966FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF010101 + 9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF01010199CC + FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF01010199FFFF99 + FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF01010101010100FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF0000000000000000 + 0000000000000000000000000000000000000000000099009999009999009999 + 0099990099990099990099990099990099010101993399993399993399993399 + 9933999933999933999933999933990101019966999966999966999966999966 + 9999669999669999669999669901010199999999999999999999999999999999 + 999999999999999999999901010199CC9999CC9999CC9999CC9999CC9999CC99 + 99CC9999CC9999CC9901010199FF9999FF9999FF9999FF9999FF9999FF9999FF + 9999FF9999FF990101019900CC9900CC9900CC9900CC9900CC9900CC9900CC99 + 00CC9900CC0101019933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC + 9933CC0101019966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966 + CC0101019999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC01 + 010199CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC010101 + 99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC0101019900 + FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF0101019933FF99 + 33FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF0101019966FF9966FF + 9966FF9966FF9966FF9966FF9966FF9966FF9966FF0101019999FF9999FF9999 + FF9999FF9999FF9999FF9999FF9999FF9999FF01010199CCFF99CCFF99CCFF99 + CCFF99CCFF99CCFF99CCFF99CCFF99CCFF01010199FFFF99FFFF99FFFF99FFFF + 99FFFF99FFFF99FFFF99FFFF99FFFF01010101010100FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF00FFFF00FFFF00FFFF00000000000000000000000000000000 + 0000000000000000000000000000990099990099990099990099990099990099 + 9900999900999900990101019933999933999933999933999933999933999933 + 9999339999339901010199669999669999669999669999669999669999669999 + 6699996699010101999999999999999999999999999999999999999999999999 + 99999901010199CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC + 9901010199FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9901 + 01019900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC010101 + 9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC0101019966 + CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC0101019999CC99 + 99CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC01010199CCCC99CCCC + 99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC01010199FFCC99FFCC99FF + CC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC0101019900FF9900FF9900FF99 + 00FF9900FF9900FF9900FF9900FF9900FF0101019933FF9933FF9933FF9933FF + 9933FF9933FF9933FF9933FF9933FF0101019966FF9966FF9966FF9966FF9966 + FF9966FF9966FF9966FF9966FF0101019999FF9999FF9999FF9999FF9999FF99 + 99FF9999FF9999FF9999FF01010199CCFF99CCFF99CCFF99CCFF99CCFF99CCFF + 99CCFF99CCFF99CCFF01010199FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FF + FF99FFFF99FFFF01010101010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00 + FFFF00FFFF00FFFF000000000000000000000000000000000000000000000000 + 0000000000009900999900999900999900999900999900999900999900999900 + 9901010199339999339999339999339999339999339999339999339999339901 + 0101996699996699996699996699996699996699996699996699996699010101 + 99999999999999999999999999999999999999999999999999999901010199CC + 9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9901010199FF9999 + FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF990101019900CC9900CC + 9900CC9900CC9900CC9900CC9900CC9900CC9900CC0101019933CC9933CC9933 + CC9933CC9933CC9933CC9933CC9933CC9933CC0101019966CC9966CC9966CC99 + 66CC9966CC9966CC9966CC9966CC9966CC0101019999CC9999CC9999CC9999CC + 9999CC9999CC9999CC9999CC9999CC01010199CCCC99CCCC99CCCC99CCCC99CC + CC99CCCC99CCCC99CCCC99CCCC01010199FFCC99FFCC99FFCC99FFCC99FFCC99 + FFCC99FFCC99FFCC99FFCC0101019900FF9900FF9900FF9900FF9900FF9900FF + 9900FF9900FF9900FF0101019933FF9933FF9933FF9933FF9933FF9933FF9933 + FF9933FF9933FF0101019966FF9966FF9966FF9966FF9966FF9966FF9966FF99 + 66FF9966FF0101019999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF + 9999FF01010199CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CC + FF01010199FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF01 + 010101010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF + 0000000000000000000000000000000000000000000000000000000000009900 + 9999009999009999009999009999009999009999009999009901010199339999 + 3399993399993399993399993399993399993399993399010101996699996699 + 9966999966999966999966999966999966999966990101019999999999999999 + 9999999999999999999999999999999999999901010199CC9999CC9999CC9999 + CC9999CC9999CC9999CC9999CC9999CC9901010199FF9999FF9999FF9999FF99 + 99FF9999FF9999FF9999FF9999FF990101019900CC9900CC9900CC9900CC9900 + CC9900CC9900CC9900CC9900CC0101019933CC9933CC9933CC9933CC9933CC99 + 33CC9933CC9933CC9933CC0101019966CC9966CC9966CC9966CC9966CC9966CC + 9966CC9966CC9966CC0101019999CC9999CC9999CC9999CC9999CC9999CC9999 + CC9999CC9999CC01010199CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99 + CCCC99CCCC01010199FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC + 99FFCC0101019900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900 + FF0101019933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF01 + 01019966FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF010101 + 9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF9999FF01010199CC + FF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF99CCFF01010199FFFF99 + FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF99FFFF01010101010100FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF0000000000000000 + 0000000000000000000000000000000000000000000099009999009999009999 + 0099990099990099990099990099990099010101993399993399993399993399 + 9933999933999933999933999933990101019966999966999966999966999966 + 9999669999669999669999669901010199999999999999999999999999999999 + 999999999999999999999901010199CC9999CC9999CC9999CC9999CC9999CC99 + 99CC9999CC9999CC9901010199FF9999FF9999FF9999FF9999FF9999FF9999FF + 9999FF9999FF990101019900CC9900CC9900CC9900CC9900CC9900CC9900CC99 + 00CC9900CC0101019933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC + 9933CC0101019966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966 + CC0101019999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC9999CC01 + 010199CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC99CCCC010101 + 99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC99FFCC0101019900 + FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF0101019933FF99 + 33FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF0101019966FF9966FF + 9966FF9966FF9966FF9966FF9966FF9966FF9966FF0101019999FF9999FF9999 + FF9999FF9999FF9999FF9999FF9999FF9999FF01010199CCFF99CCFF99CCFF99 + CCFF99CCFF99CCFF99CCFF99CCFF99CCFF01010199FFFF99FFFF99FFFF99FFFF + 99FFFF99FFFF99FFFF99FFFF99FFFF0101010101010101010101010101010101 + 0101010101010101010101010101010100000000000000000000000000000000 + 0000000000000000000000000000010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 01010101010101010101010101FF0000FF0000FF0000FF0000FF0000FF0000FF + 0000FF0000FF0000000000000000000000000000000000000000000000000000 + 0000000000006600996600996600996600996600996600996600996600996600 + 9901010166339966339966339966339966339966339966339966339966339901 + 0101666699666699666699666699666699666699666699666699666699010101 + 66999966999966999966999966999966999966999966999966999901010166CC + 9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9901010166FF9966 + FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF990101016600CC6600CC + 6600CC6600CC6600CC6600CC6600CC6600CC6600CC0101016633CC6633CC6633 + CC6633CC6633CC6633CC6633CC6633CC6633CC0101016666CC6666CC6666CC66 + 66CC6666CC6666CC6666CC6666CC6666CC0101016699CC6699CC6699CC6699CC + 6699CC6699CC6699CC6699CC6699CC01010166CCCC66CCCC66CCCC66CCCC66CC + CC66CCCC66CCCC66CCCC66CCCC01010166FFCC66FFCC66FFCC66FFCC66FFCC66 + FFCC66FFCC66FFCC66FFCC0101016600FF6600FF6600FF6600FF6600FF6600FF + 6600FF6600FF6600FF0101016633FF6633FF6633FF6633FF6633FF6633FF6633 + FF6633FF6633FF0101016666FF6666FF6666FF6666FF6666FF6666FF6666FF66 + 66FF6666FF0101016699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF + 6699FF01010166CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CC + FF01010166FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF01 + 0101010101FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000 + 0000000000000000000000000000000000000000000000000000000000006600 + 9966009966009966009966009966009966009966009966009901010166339966 + 3399663399663399663399663399663399663399663399010101666699666699 + 6666996666996666996666996666996666996666990101016699996699996699 + 9966999966999966999966999966999966999901010166CC9966CC9966CC9966 + CC9966CC9966CC9966CC9966CC9966CC9901010166FF9966FF9966FF9966FF99 + 66FF9966FF9966FF9966FF9966FF990101016600CC6600CC6600CC6600CC6600 + CC6600CC6600CC6600CC6600CC0101016633CC6633CC6633CC6633CC6633CC66 + 33CC6633CC6633CC6633CC0101016666CC6666CC6666CC6666CC6666CC6666CC + 6666CC6666CC6666CC0101016699CC6699CC6699CC6699CC6699CC6699CC6699 + CC6699CC6699CC01010166CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66 + CCCC66CCCC01010166FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC + 66FFCC0101016600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600 + FF0101016633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF01 + 01016666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF010101 + 6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF01010166CC + FF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF01010166FFFF66 + FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF010101010101FF0000 + FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00000000000000000000 + 0000000000000000000000000000000000000000000066009966009966009966 + 0099660099660099660099660099660099010101663399663399663399663399 + 6633996633996633996633996633990101016666996666996666996666996666 + 9966669966669966669966669901010166999966999966999966999966999966 + 999966999966999966999901010166CC9966CC9966CC9966CC9966CC9966CC99 + 66CC9966CC9966CC9901010166FF9966FF9966FF9966FF9966FF9966FF9966FF + 9966FF9966FF990101016600CC6600CC6600CC6600CC6600CC6600CC6600CC66 + 00CC6600CC0101016633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC + 6633CC0101016666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666 + CC0101016699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC01 + 010166CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC010101 + 66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC0101016600 + FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF0101016633FF66 + 33FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF0101016666FF6666FF + 6666FF6666FF6666FF6666FF6666FF6666FF6666FF0101016699FF6699FF6699 + FF6699FF6699FF6699FF6699FF6699FF6699FF01010166CCFF66CCFF66CCFF66 + CCFF66CCFF66CCFF66CCFF66CCFF66CCFF01010166FFFF66FFFF66FFFF66FFFF + 66FFFF66FFFF66FFFF66FFFF66FFFF010101010101FF0000FF0000FF0000FF00 + 00FF0000FF0000FF0000FF0000FF000000000000000000000000000000000000 + 0000000000000000000000000000660099660099660099660099660099660099 + 6600996600996600990101016633996633996633996633996633996633996633 + 9966339966339901010166669966669966669966669966669966669966669966 + 6699666699010101669999669999669999669999669999669999669999669999 + 66999901010166CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC + 9901010166FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9901 + 01016600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC010101 + 6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC0101016666 + CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC0101016699CC66 + 99CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC01010166CCCC66CCCC + 66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC01010166FFCC66FFCC66FF + CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC0101016600FF6600FF6600FF66 + 00FF6600FF6600FF6600FF6600FF6600FF0101016633FF6633FF6633FF6633FF + 6633FF6633FF6633FF6633FF6633FF0101016666FF6666FF6666FF6666FF6666 + FF6666FF6666FF6666FF6666FF0101016699FF6699FF6699FF6699FF6699FF66 + 99FF6699FF6699FF6699FF01010166CCFF66CCFF66CCFF66CCFF66CCFF66CCFF + 66CCFF66CCFF66CCFF01010166FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FF + FF66FFFF66FFFF010101010101FF0000FF0000FF0000FF0000FF0000FF0000FF + 0000FF0000FF0000000000000000000000000000000000000000000000000000 + 0000000000006600996600996600996600996600996600996600996600996600 + 9901010166339966339966339966339966339966339966339966339966339901 + 0101666699666699666699666699666699666699666699666699666699010101 + 66999966999966999966999966999966999966999966999966999901010166CC + 9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9901010166FF9966 + FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF990101016600CC6600CC + 6600CC6600CC6600CC6600CC6600CC6600CC6600CC0101016633CC6633CC6633 + CC6633CC6633CC6633CC6633CC6633CC6633CC0101016666CC6666CC6666CC66 + 66CC6666CC6666CC6666CC6666CC6666CC0101016699CC6699CC6699CC6699CC + 6699CC6699CC6699CC6699CC6699CC01010166CCCC66CCCC66CCCC66CCCC66CC + CC66CCCC66CCCC66CCCC66CCCC01010166FFCC66FFCC66FFCC66FFCC66FFCC66 + FFCC66FFCC66FFCC66FFCC0101016600FF6600FF6600FF6600FF6600FF6600FF + 6600FF6600FF6600FF0101016633FF6633FF6633FF6633FF6633FF6633FF6633 + FF6633FF6633FF0101016666FF6666FF6666FF6666FF6666FF6666FF6666FF66 + 66FF6666FF0101016699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF + 6699FF01010166CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CC + FF01010166FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF01 + 0101010101FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000 + 0000000000000000000000000000000000000000000000000000000000006600 + 9966009966009966009966009966009966009966009966009901010166339966 + 3399663399663399663399663399663399663399663399010101666699666699 + 6666996666996666996666996666996666996666990101016699996699996699 + 9966999966999966999966999966999966999901010166CC9966CC9966CC9966 + CC9966CC9966CC9966CC9966CC9966CC9901010166FF9966FF9966FF9966FF99 + 66FF9966FF9966FF9966FF9966FF990101016600CC6600CC6600CC6600CC6600 + CC6600CC6600CC6600CC6600CC0101016633CC6633CC6633CC6633CC6633CC66 + 33CC6633CC6633CC6633CC0101016666CC6666CC6666CC6666CC6666CC6666CC + 6666CC6666CC6666CC0101016699CC6699CC6699CC6699CC6699CC6699CC6699 + CC6699CC6699CC01010166CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66 + CCCC66CCCC01010166FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC + 66FFCC0101016600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600 + FF0101016633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF01 + 01016666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF010101 + 6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF01010166CC + FF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF01010166FFFF66 + FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF010101010101FF0000 + FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00000000000000000000 + 0000000000000000000000000000000000000000000066009966009966009966 + 0099660099660099660099660099660099010101663399663399663399663399 + 6633996633996633996633996633990101016666996666996666996666996666 + 9966669966669966669966669901010166999966999966999966999966999966 + 999966999966999966999901010166CC9966CC9966CC9966CC9966CC9966CC99 + 66CC9966CC9966CC9901010166FF9966FF9966FF9966FF9966FF9966FF9966FF + 9966FF9966FF990101016600CC6600CC6600CC6600CC6600CC6600CC6600CC66 + 00CC6600CC0101016633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC + 6633CC0101016666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666 + CC0101016699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC01 + 010166CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC010101 + 66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC0101016600 + FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF0101016633FF66 + 33FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF0101016666FF6666FF + 6666FF6666FF6666FF6666FF6666FF6666FF6666FF0101016699FF6699FF6699 + FF6699FF6699FF6699FF6699FF6699FF6699FF01010166CCFF66CCFF66CCFF66 + CCFF66CCFF66CCFF66CCFF66CCFF66CCFF01010166FFFF66FFFF66FFFF66FFFF + 66FFFF66FFFF66FFFF66FFFF66FFFF010101010101FF0000FF0000FF0000FF00 + 00FF0000FF0000FF0000FF0000FF000000000000000000000000000000000000 + 0000000000000000000000000000660099660099660099660099660099660099 + 6600996600996600990101016633996633996633996633996633996633996633 + 9966339966339901010166669966669966669966669966669966669966669966 + 6699666699010101669999669999669999669999669999669999669999669999 + 66999901010166CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC + 9901010166FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9901 + 01016600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC010101 + 6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC0101016666 + CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC0101016699CC66 + 99CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC01010166CCCC66CCCC + 66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC01010166FFCC66FFCC66FF + CC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC0101016600FF6600FF6600FF66 + 00FF6600FF6600FF6600FF6600FF6600FF0101016633FF6633FF6633FF6633FF + 6633FF6633FF6633FF6633FF6633FF0101016666FF6666FF6666FF6666FF6666 + FF6666FF6666FF6666FF6666FF0101016699FF6699FF6699FF6699FF6699FF66 + 99FF6699FF6699FF6699FF01010166CCFF66CCFF66CCFF66CCFF66CCFF66CCFF + 66CCFF66CCFF66CCFF01010166FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FF + FF66FFFF66FFFF010101010101FF0000FF0000FF0000FF0000FF0000FF0000FF + 0000FF0000FF0000000000000000000000000000000000000000000000000000 + 0000000000006600996600996600996600996600996600996600996600996600 + 9901010166339966339966339966339966339966339966339966339966339901 + 0101666699666699666699666699666699666699666699666699666699010101 + 66999966999966999966999966999966999966999966999966999901010166CC + 9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9901010166FF9966 + FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF990101016600CC6600CC + 6600CC6600CC6600CC6600CC6600CC6600CC6600CC0101016633CC6633CC6633 + CC6633CC6633CC6633CC6633CC6633CC6633CC0101016666CC6666CC6666CC66 + 66CC6666CC6666CC6666CC6666CC6666CC0101016699CC6699CC6699CC6699CC + 6699CC6699CC6699CC6699CC6699CC01010166CCCC66CCCC66CCCC66CCCC66CC + CC66CCCC66CCCC66CCCC66CCCC01010166FFCC66FFCC66FFCC66FFCC66FFCC66 + FFCC66FFCC66FFCC66FFCC0101016600FF6600FF6600FF6600FF6600FF6600FF + 6600FF6600FF6600FF0101016633FF6633FF6633FF6633FF6633FF6633FF6633 + FF6633FF6633FF0101016666FF6666FF6666FF6666FF6666FF6666FF6666FF66 + 66FF6666FF0101016699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF + 6699FF01010166CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CC + FF01010166FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF01 + 0101010101010101010101010101010101010101010101010101010101010101 + 0000000000000000000000000000000000000000000000000000000000000101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 010101010101010101010101010101010101010101010101010101010100FF00 + 00FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF000000000000000000 + 0000000000000000000000000000000000000000000033009933009933009933 + 0099330099330099330099330099330099010101333399333399333399333399 + 3333993333993333993333993333990101013366993366993366993366993366 + 9933669933669933669933669901010133999933999933999933999933999933 + 999933999933999933999901010133CC9933CC9933CC9933CC9933CC9933CC99 + 33CC9933CC9933CC9901010133FF9933FF9933FF9933FF9933FF9933FF9933FF + 9933FF9933FF990101013300CC3300CC3300CC3300CC3300CC3300CC3300CC33 + 00CC3300CC0101013333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC + 3333CC0101013366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366 + CC0101013399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC01 + 010133CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC010101 + 33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC0101013300 + FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF0101013333FF33 + 33FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF0101013366FF3366FF + 3366FF3366FF3366FF3366FF3366FF3366FF3366FF0101013399FF3399FF3399 + FF3399FF3399FF3399FF3399FF3399FF3399FF01010133CCFF33CCFF33CCFF33 + CCFF33CCFF33CCFF33CCFF33CCFF33CCFF01010133FFFF33FFFF33FFFF33FFFF + 33FFFF33FFFF33FFFF33FFFF33FFFF01010101010100FF0000FF0000FF0000FF + 0000FF0000FF0000FF0000FF0000FF0000000000000000000000000000000000 + 0000000000000000000000000000330099330099330099330099330099330099 + 3300993300993300990101013333993333993333993333993333993333993333 + 9933339933339901010133669933669933669933669933669933669933669933 + 6699336699010101339999339999339999339999339999339999339999339999 + 33999901010133CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC + 9901010133FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9901 + 01013300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC010101 + 3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC0101013366 + CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC0101013399CC33 + 99CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC01010133CCCC33CCCC + 33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC01010133FFCC33FFCC33FF + CC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC0101013300FF3300FF3300FF33 + 00FF3300FF3300FF3300FF3300FF3300FF0101013333FF3333FF3333FF3333FF + 3333FF3333FF3333FF3333FF3333FF0101013366FF3366FF3366FF3366FF3366 + FF3366FF3366FF3366FF3366FF0101013399FF3399FF3399FF3399FF3399FF33 + 99FF3399FF3399FF3399FF01010133CCFF33CCFF33CCFF33CCFF33CCFF33CCFF + 33CCFF33CCFF33CCFF01010133FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FF + FF33FFFF33FFFF01010101010100FF0000FF0000FF0000FF0000FF0000FF0000 + FF0000FF0000FF00000000000000000000000000000000000000000000000000 + 0000000000003300993300993300993300993300993300993300993300993300 + 9901010133339933339933339933339933339933339933339933339933339901 + 0101336699336699336699336699336699336699336699336699336699010101 + 33999933999933999933999933999933999933999933999933999901010133CC + 9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC9901010133FF9933 + FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF990101013300CC3300CC + 3300CC3300CC3300CC3300CC3300CC3300CC3300CC0101013333CC3333CC3333 + CC3333CC3333CC3333CC3333CC3333CC3333CC0101013366CC3366CC3366CC33 + 66CC3366CC3366CC3366CC3366CC3366CC0101013399CC3399CC3399CC3399CC + 3399CC3399CC3399CC3399CC3399CC01010133CCCC33CCCC33CCCC33CCCC33CC + CC33CCCC33CCCC33CCCC33CCCC01010133FFCC33FFCC33FFCC33FFCC33FFCC33 + FFCC33FFCC33FFCC33FFCC0101013300FF3300FF3300FF3300FF3300FF3300FF + 3300FF3300FF3300FF0101013333FF3333FF3333FF3333FF3333FF3333FF3333 + FF3333FF3333FF0101013366FF3366FF3366FF3366FF3366FF3366FF3366FF33 + 66FF3366FF0101013399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF + 3399FF01010133CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC + FF01010133FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF01 + 010101010100FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00 + 0000000000000000000000000000000000000000000000000000000000003300 + 9933009933009933009933009933009933009933009933009901010133339933 + 3399333399333399333399333399333399333399333399010101336699336699 + 3366993366993366993366993366993366993366990101013399993399993399 + 9933999933999933999933999933999933999901010133CC9933CC9933CC9933 + CC9933CC9933CC9933CC9933CC9933CC9901010133FF9933FF9933FF9933FF99 + 33FF9933FF9933FF9933FF9933FF990101013300CC3300CC3300CC3300CC3300 + CC3300CC3300CC3300CC3300CC0101013333CC3333CC3333CC3333CC3333CC33 + 33CC3333CC3333CC3333CC0101013366CC3366CC3366CC3366CC3366CC3366CC + 3366CC3366CC3366CC0101013399CC3399CC3399CC3399CC3399CC3399CC3399 + CC3399CC3399CC01010133CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33 + CCCC33CCCC01010133FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC + 33FFCC0101013300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300 + FF0101013333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF01 + 01013366FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF010101 + 3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF01010133CC + FF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF01010133FFFF33 + FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF01010101010100FF00 + 00FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF000000000000000000 + 0000000000000000000000000000000000000000000033009933009933009933 + 0099330099330099330099330099330099010101333399333399333399333399 + 3333993333993333993333993333990101013366993366993366993366993366 + 9933669933669933669933669901010133999933999933999933999933999933 + 999933999933999933999901010133CC9933CC9933CC9933CC9933CC9933CC99 + 33CC9933CC9933CC9901010133FF9933FF9933FF9933FF9933FF9933FF9933FF + 9933FF9933FF990101013300CC3300CC3300CC3300CC3300CC3300CC3300CC33 + 00CC3300CC0101013333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC + 3333CC0101013366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366 + CC0101013399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC01 + 010133CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC010101 + 33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC0101013300 + FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF0101013333FF33 + 33FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF0101013366FF3366FF + 3366FF3366FF3366FF3366FF3366FF3366FF3366FF0101013399FF3399FF3399 + FF3399FF3399FF3399FF3399FF3399FF3399FF01010133CCFF33CCFF33CCFF33 + CCFF33CCFF33CCFF33CCFF33CCFF33CCFF01010133FFFF33FFFF33FFFF33FFFF + 33FFFF33FFFF33FFFF33FFFF33FFFF01010101010100FF0000FF0000FF0000FF + 0000FF0000FF0000FF0000FF0000FF0000000000000000000000000000000000 + 0000000000000000000000000000330099330099330099330099330099330099 + 3300993300993300990101013333993333993333993333993333993333993333 + 9933339933339901010133669933669933669933669933669933669933669933 + 6699336699010101339999339999339999339999339999339999339999339999 + 33999901010133CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC + 9901010133FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9901 + 01013300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC010101 + 3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC0101013366 + CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC0101013399CC33 + 99CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC01010133CCCC33CCCC + 33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC01010133FFCC33FFCC33FF + CC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC0101013300FF3300FF3300FF33 + 00FF3300FF3300FF3300FF3300FF3300FF0101013333FF3333FF3333FF3333FF + 3333FF3333FF3333FF3333FF3333FF0101013366FF3366FF3366FF3366FF3366 + FF3366FF3366FF3366FF3366FF0101013399FF3399FF3399FF3399FF3399FF33 + 99FF3399FF3399FF3399FF01010133CCFF33CCFF33CCFF33CCFF33CCFF33CCFF + 33CCFF33CCFF33CCFF01010133FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FF + FF33FFFF33FFFF01010101010100FF0000FF0000FF0000FF0000FF0000FF0000 + FF0000FF0000FF00000000000000000000000000000000000000000000000000 + 0000000000003300993300993300993300993300993300993300993300993300 + 9901010133339933339933339933339933339933339933339933339933339901 + 0101336699336699336699336699336699336699336699336699336699010101 + 33999933999933999933999933999933999933999933999933999901010133CC + 9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC9901010133FF9933 + FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF990101013300CC3300CC + 3300CC3300CC3300CC3300CC3300CC3300CC3300CC0101013333CC3333CC3333 + CC3333CC3333CC3333CC3333CC3333CC3333CC0101013366CC3366CC3366CC33 + 66CC3366CC3366CC3366CC3366CC3366CC0101013399CC3399CC3399CC3399CC + 3399CC3399CC3399CC3399CC3399CC01010133CCCC33CCCC33CCCC33CCCC33CC + CC33CCCC33CCCC33CCCC33CCCC01010133FFCC33FFCC33FFCC33FFCC33FFCC33 + FFCC33FFCC33FFCC33FFCC0101013300FF3300FF3300FF3300FF3300FF3300FF + 3300FF3300FF3300FF0101013333FF3333FF3333FF3333FF3333FF3333FF3333 + FF3333FF3333FF0101013366FF3366FF3366FF3366FF3366FF3366FF3366FF33 + 66FF3366FF0101013399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF + 3399FF01010133CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CC + FF01010133FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF01 + 010101010100FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00 + 0000000000000000000000000000000000000000000000000000000000003300 + 9933009933009933009933009933009933009933009933009901010133339933 + 3399333399333399333399333399333399333399333399010101336699336699 + 3366993366993366993366993366993366993366990101013399993399993399 + 9933999933999933999933999933999933999901010133CC9933CC9933CC9933 + CC9933CC9933CC9933CC9933CC9933CC9901010133FF9933FF9933FF9933FF99 + 33FF9933FF9933FF9933FF9933FF990101013300CC3300CC3300CC3300CC3300 + CC3300CC3300CC3300CC3300CC0101013333CC3333CC3333CC3333CC3333CC33 + 33CC3333CC3333CC3333CC0101013366CC3366CC3366CC3366CC3366CC3366CC + 3366CC3366CC3366CC0101013399CC3399CC3399CC3399CC3399CC3399CC3399 + CC3399CC3399CC01010133CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33 + CCCC33CCCC01010133FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC + 33FFCC0101013300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300 + FF0101013333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF01 + 01013366FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF010101 + 3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF01010133CC + FF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF01010133FFFF33 + FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF01010101010100FF00 + 00FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF000000000000000000 + 0000000000000000000000000000000000000000000033009933009933009933 + 0099330099330099330099330099330099010101333399333399333399333399 + 3333993333993333993333993333990101013366993366993366993366993366 + 9933669933669933669933669901010133999933999933999933999933999933 + 999933999933999933999901010133CC9933CC9933CC9933CC9933CC9933CC99 + 33CC9933CC9933CC9901010133FF9933FF9933FF9933FF9933FF9933FF9933FF + 9933FF9933FF990101013300CC3300CC3300CC3300CC3300CC3300CC3300CC33 + 00CC3300CC0101013333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC + 3333CC0101013366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366 + CC0101013399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC01 + 010133CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC010101 + 33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC0101013300 + FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF0101013333FF33 + 33FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF0101013366FF3366FF + 3366FF3366FF3366FF3366FF3366FF3366FF3366FF0101013399FF3399FF3399 + FF3399FF3399FF3399FF3399FF3399FF3399FF01010133CCFF33CCFF33CCFF33 + CCFF33CCFF33CCFF33CCFF33CCFF33CCFF01010133FFFF33FFFF33FFFF33FFFF + 33FFFF33FFFF33FFFF33FFFF33FFFF0101010101010101010101010101010101 + 0101010101010101010101010101010100000000000000000000000000000000 + 0000000000000000000000000000010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 010101010101010101010101010000FF0000FF0000FF0000FF0000FF0000FF00 + 00FF0000FF0000FF000000000000000000000000000000000000000000000000 + 0000000000000000990000990000990000990000990000990000990000990000 + 9901010100339900339900339900339900339900339900339900339900339901 + 0101006699006699006699006699006699006699006699006699006699010101 + 00999900999900999900999900999900999900999900999900999901010100CC + 9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9901010100FF9900 + FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF990101010000CC0000CC + 0000CC0000CC0000CC0000CC0000CC0000CC0000CC0101010033CC0033CC0033 + CC0033CC0033CC0033CC0033CC0033CC0033CC0101010066CC0066CC0066CC00 + 66CC0066CC0066CC0066CC0066CC0066CC0101010099CC0099CC0099CC0099CC + 0099CC0099CC0099CC0099CC0099CC01010100CCCC00CCCC00CCCC00CCCC00CC + CC00CCCC00CCCC00CCCC00CCCC01010100FFCC00FFCC00FFCC00FFCC00FFCC00 + FFCC00FFCC00FFCC00FFCC0101010000FF0000FF0000FF0000FF0000FF0000FF + 0000FF0000FF0000FF0101010033FF0033FF0033FF0033FF0033FF0033FF0033 + FF0033FF0033FF0101010066FF0066FF0066FF0066FF0066FF0066FF0066FF00 + 66FF0066FF0101010099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF + 0099FF01010100CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CC + FF01010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF01 + 01010101010000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF + 0000000000000000000000000000000000000000000000000000000000000000 + 9900009900009900009900009900009900009900009900009901010100339900 + 3399003399003399003399003399003399003399003399010101006699006699 + 0066990066990066990066990066990066990066990101010099990099990099 + 9900999900999900999900999900999900999901010100CC9900CC9900CC9900 + CC9900CC9900CC9900CC9900CC9900CC9901010100FF9900FF9900FF9900FF99 + 00FF9900FF9900FF9900FF9900FF990101010000CC0000CC0000CC0000CC0000 + CC0000CC0000CC0000CC0000CC0101010033CC0033CC0033CC0033CC0033CC00 + 33CC0033CC0033CC0033CC0101010066CC0066CC0066CC0066CC0066CC0066CC + 0066CC0066CC0066CC0101010099CC0099CC0099CC0099CC0099CC0099CC0099 + CC0099CC0099CC01010100CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00 + CCCC00CCCC01010100FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC + 00FFCC0101010000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000 + FF0101010033FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF01 + 01010066FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF010101 + 0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF01010100CC + FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF01010100FFFF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF0101010101010000FF + 0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000000000000000 + 0000000000000000000000000000000000000000000000009900009900009900 + 0099000099000099000099000099000099010101003399003399003399003399 + 0033990033990033990033990033990101010066990066990066990066990066 + 9900669900669900669900669901010100999900999900999900999900999900 + 999900999900999900999901010100CC9900CC9900CC9900CC9900CC9900CC99 + 00CC9900CC9900CC9901010100FF9900FF9900FF9900FF9900FF9900FF9900FF + 9900FF9900FF990101010000CC0000CC0000CC0000CC0000CC0000CC0000CC00 + 00CC0000CC0101010033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC + 0033CC0101010066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066 + CC0101010099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC01 + 010100CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC010101 + 00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC0101010000 + FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0101010033FF00 + 33FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0101010066FF0066FF + 0066FF0066FF0066FF0066FF0066FF0066FF0066FF0101010099FF0099FF0099 + FF0099FF0099FF0099FF0099FF0099FF0099FF01010100CCFF00CCFF00CCFF00 + CCFF00CCFF00CCFF00CCFF00CCFF00CCFF01010100FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF0101010101010000FF0000FF0000FF0000 + FF0000FF0000FF0000FF0000FF0000FF00000000000000000000000000000000 + 0000000000000000000000000000000099000099000099000099000099000099 + 0000990000990000990101010033990033990033990033990033990033990033 + 9900339900339901010100669900669900669900669900669900669900669900 + 6699006699010101009999009999009999009999009999009999009999009999 + 00999901010100CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC + 9901010100FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9901 + 01010000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC010101 + 0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0101010066 + CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0101010099CC00 + 99CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC01010100CCCC00CCCC + 00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC01010100FFCC00FFCC00FF + CC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC0101010000FF0000FF0000FF00 + 00FF0000FF0000FF0000FF0000FF0000FF0101010033FF0033FF0033FF0033FF + 0033FF0033FF0033FF0033FF0033FF0101010066FF0066FF0066FF0066FF0066 + FF0066FF0066FF0066FF0066FF0101010099FF0099FF0099FF0099FF0099FF00 + 99FF0099FF0099FF0099FF01010100CCFF00CCFF00CCFF00CCFF00CCFF00CCFF + 00CCFF00CCFF00CCFF01010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF0101010101010000FF0000FF0000FF0000FF0000FF0000FF00 + 00FF0000FF0000FF000000000000000000000000000000000000000000000000 + 0000000000000000990000990000990000990000990000990000990000990000 + 9901010100339900339900339900339900339900339900339900339900339901 + 0101006699006699006699006699006699006699006699006699006699010101 + 00999900999900999900999900999900999900999900999900999901010100CC + 9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9901010100FF9900 + FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF990101010000CC0000CC + 0000CC0000CC0000CC0000CC0000CC0000CC0000CC0101010033CC0033CC0033 + CC0033CC0033CC0033CC0033CC0033CC0033CC0101010066CC0066CC0066CC00 + 66CC0066CC0066CC0066CC0066CC0066CC0101010099CC0099CC0099CC0099CC + 0099CC0099CC0099CC0099CC0099CC01010100CCCC00CCCC00CCCC00CCCC00CC + CC00CCCC00CCCC00CCCC00CCCC01010100FFCC00FFCC00FFCC00FFCC00FFCC00 + FFCC00FFCC00FFCC00FFCC0101010000FF0000FF0000FF0000FF0000FF0000FF + 0000FF0000FF0000FF0101010033FF0033FF0033FF0033FF0033FF0033FF0033 + FF0033FF0033FF0101010066FF0066FF0066FF0066FF0066FF0066FF0066FF00 + 66FF0066FF0101010099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF + 0099FF01010100CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CC + FF01010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF01 + 01010101010000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF + 0000000000000000000000000000000000000000000000000000000000000000 + 9900009900009900009900009900009900009900009900009901010100339900 + 3399003399003399003399003399003399003399003399010101006699006699 + 0066990066990066990066990066990066990066990101010099990099990099 + 9900999900999900999900999900999900999901010100CC9900CC9900CC9900 + CC9900CC9900CC9900CC9900CC9900CC9901010100FF9900FF9900FF9900FF99 + 00FF9900FF9900FF9900FF9900FF990101010000CC0000CC0000CC0000CC0000 + CC0000CC0000CC0000CC0000CC0101010033CC0033CC0033CC0033CC0033CC00 + 33CC0033CC0033CC0033CC0101010066CC0066CC0066CC0066CC0066CC0066CC + 0066CC0066CC0066CC0101010099CC0099CC0099CC0099CC0099CC0099CC0099 + CC0099CC0099CC01010100CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00 + CCCC00CCCC01010100FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC + 00FFCC0101010000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000 + FF0101010033FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF01 + 01010066FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF010101 + 0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF01010100CC + FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF01010100FFFF00 + FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF0101010101010000FF + 0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000000000000000 + 0000000000000000000000000000000000000000000000009900009900009900 + 0099000099000099000099000099000099010101003399003399003399003399 + 0033990033990033990033990033990101010066990066990066990066990066 + 9900669900669900669900669901010100999900999900999900999900999900 + 999900999900999900999901010100CC9900CC9900CC9900CC9900CC9900CC99 + 00CC9900CC9900CC9901010100FF9900FF9900FF9900FF9900FF9900FF9900FF + 9900FF9900FF990101010000CC0000CC0000CC0000CC0000CC0000CC0000CC00 + 00CC0000CC0101010033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC + 0033CC0101010066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066 + CC0101010099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC01 + 010100CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC010101 + 00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC0101010000 + FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0101010033FF00 + 33FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0101010066FF0066FF + 0066FF0066FF0066FF0066FF0066FF0066FF0066FF0101010099FF0099FF0099 + FF0099FF0099FF0099FF0099FF0099FF0099FF01010100CCFF00CCFF00CCFF00 + CCFF00CCFF00CCFF00CCFF00CCFF00CCFF01010100FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00FFFF00FFFF00FFFF0101010101010000FF0000FF0000FF0000 + FF0000FF0000FF0000FF0000FF0000FF00000000000000000000000000000000 + 0000000000000000000000000000000099000099000099000099000099000099 + 0000990000990000990101010033990033990033990033990033990033990033 + 9900339900339901010100669900669900669900669900669900669900669900 + 6699006699010101009999009999009999009999009999009999009999009999 + 00999901010100CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC + 9901010100FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9901 + 01010000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC010101 + 0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0101010066 + CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0101010099CC00 + 99CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC01010100CCCC00CCCC + 00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC01010100FFCC00FFCC00FF + CC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC0101010000FF0000FF0000FF00 + 00FF0000FF0000FF0000FF0000FF0000FF0101010033FF0033FF0033FF0033FF + 0033FF0033FF0033FF0033FF0033FF0101010066FF0066FF0066FF0066FF0066 + FF0066FF0066FF0066FF0066FF0101010099FF0099FF0099FF0099FF0099FF00 + 99FF0099FF0099FF0099FF01010100CCFF00CCFF00CCFF00CCFF00CCFF00CCFF + 00CCFF00CCFF00CCFF01010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF + FF00FFFF00FFFF0101010101010000FF0000FF0000FF0000FF0000FF0000FF00 + 00FF0000FF0000FF000000000000000000000000000000000000000000000000 + 0000000000000000990000990000990000990000990000990000990000990000 + 9901010100339900339900339900339900339900339900339900339900339901 + 0101006699006699006699006699006699006699006699006699006699010101 + 00999900999900999900999900999900999900999900999900999901010100CC + 9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9901010100FF9900 + FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF990101010000CC0000CC + 0000CC0000CC0000CC0000CC0000CC0000CC0000CC0101010033CC0033CC0033 + CC0033CC0033CC0033CC0033CC0033CC0033CC0101010066CC0066CC0066CC00 + 66CC0066CC0066CC0066CC0066CC0066CC0101010099CC0099CC0099CC0099CC + 0099CC0099CC0099CC0099CC0099CC01010100CCCC00CCCC00CCCC00CCCC00CC + CC00CCCC00CCCC00CCCC00CCCC01010100FFCC00FFCC00FFCC00FFCC00FFCC00 + FFCC00FFCC00FFCC00FFCC0101010000FF0000FF0000FF0000FF0000FF0000FF + 0000FF0000FF0000FF0101010033FF0033FF0033FF0033FF0033FF0033FF0033 + FF0033FF0033FF0101010066FF0066FF0066FF0066FF0066FF0066FF0066FF00 + 66FF0066FF0101010099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF + 0099FF01010100CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CC + FF01010100FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF01 + 0101010101010101010101010101010101010101010101010101010101010101 + 0000000000000000000000000000000000000000000000000000000000000101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101FFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000 + 00000000000000000000000000000000000000000000FF0000FF0000FF0000FF + 0000FF0000FF0000FF0000FF0000FF0000010101FF3300FF3300FF3300FF3300 + FF3300FF3300FF3300FF3300FF3300010101FF6600FF6600FF6600FF6600FF66 + 00FF6600FF6600FF6600FF6600010101FF9900FF9900FF9900FF9900FF9900FF + 9900FF9900FF9900FF9900010101FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00 + FFCC00FFCC00FFCC00010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00010101FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF + 0033FF0033010101FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333 + FF3333010101FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF66 + 33010101FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF993301 + 0101FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33010101 + FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33010101FF00 + 66FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066010101FF3366FF + 3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366010101FF6666FF6666 + FF6666FF6666FF6666FF6666FF6666FF6666FF6666010101FF9966FF9966FF99 + 66FF9966FF9966FF9966FF9966FF9966FF9966010101FFCC66FFCC66FFCC66FF + CC66FFCC66FFCC66FFCC66FFCC66FFCC66010101FFFF66FFFF66FFFF66FFFF66 + FFFF66FFFF66FFFF66FFFF66FFFF66010101010101FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 + 0000000000000000000000000000FF0000FF0000FF0000FF0000FF0000FF0000 + FF0000FF0000FF0000010101FF3300FF3300FF3300FF3300FF3300FF3300FF33 + 00FF3300FF3300010101FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF + 6600FF6600010101FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900 + FF9900010101FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC + 00010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF0001 + 0101FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0033010101 + FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333010101FF66 + 33FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633010101FF9933FF + 9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933010101FFCC33FFCC33 + FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33010101FFFF33FFFF33FFFF + 33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33010101FF0066FF0066FF0066FF + 0066FF0066FF0066FF0066FF0066FF0066010101FF3366FF3366FF3366FF3366 + FF3366FF3366FF3366FF3366FF3366010101FF6666FF6666FF6666FF6666FF66 + 66FF6666FF6666FF6666FF6666010101FF9966FF9966FF9966FF9966FF9966FF + 9966FF9966FF9966FF9966010101FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66 + FFCC66FFCC66FFCC66010101FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF + 66FFFF66FFFF66010101010101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 + 000000000000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00 + 00010101FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF330001 + 0101FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600010101 + FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900010101FFCC + 00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00010101FFFF00FF + FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00010101FF0033FF0033 + FF0033FF0033FF0033FF0033FF0033FF0033FF0033010101FF3333FF3333FF33 + 33FF3333FF3333FF3333FF3333FF3333FF3333010101FF6633FF6633FF6633FF + 6633FF6633FF6633FF6633FF6633FF6633010101FF9933FF9933FF9933FF9933 + FF9933FF9933FF9933FF9933FF9933010101FFCC33FFCC33FFCC33FFCC33FFCC + 33FFCC33FFCC33FFCC33FFCC33010101FFFF33FFFF33FFFF33FFFF33FFFF33FF + FF33FFFF33FFFF33FFFF33010101FF0066FF0066FF0066FF0066FF0066FF0066 + FF0066FF0066FF0066010101FF3366FF3366FF3366FF3366FF3366FF3366FF33 + 66FF3366FF3366010101FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF + 6666FF6666010101FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966 + FF9966010101FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC + 66010101FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF6601 + 0101010101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 000000000000000000000000000000000000000000000000000000000000FF00 + 00FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000010101FF3300FF + 3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300010101FF6600FF6600 + FF6600FF6600FF6600FF6600FF6600FF6600FF6600010101FF9900FF9900FF99 + 00FF9900FF9900FF9900FF9900FF9900FF9900010101FFCC00FFCC00FFCC00FF + CC00FFCC00FFCC00FFCC00FFCC00FFCC00010101FFFF00FFFF00FFFF00FFFF00 + FFFF00FFFF00FFFF00FFFF00FFFF00010101FF0033FF0033FF0033FF0033FF00 + 33FF0033FF0033FF0033FF0033010101FF3333FF3333FF3333FF3333FF3333FF + 3333FF3333FF3333FF3333010101FF6633FF6633FF6633FF6633FF6633FF6633 + FF6633FF6633FF6633010101FF9933FF9933FF9933FF9933FF9933FF9933FF99 + 33FF9933FF9933010101FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FF + CC33FFCC33010101FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33 + FFFF33010101FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF00 + 66010101FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF336601 + 0101FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666010101 + FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966010101FFCC + 66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66010101FFFF66FF + FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66010101010101FFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000 + 00000000000000000000000000000000000000000000FF0000FF0000FF0000FF + 0000FF0000FF0000FF0000FF0000FF0000010101FF3300FF3300FF3300FF3300 + FF3300FF3300FF3300FF3300FF3300010101FF6600FF6600FF6600FF6600FF66 + 00FF6600FF6600FF6600FF6600010101FF9900FF9900FF9900FF9900FF9900FF + 9900FF9900FF9900FF9900010101FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00 + FFCC00FFCC00FFCC00010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00010101FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF + 0033FF0033010101FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333 + FF3333010101FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF66 + 33010101FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF993301 + 0101FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33010101 + FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33010101FF00 + 66FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066010101FF3366FF + 3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366010101FF6666FF6666 + FF6666FF6666FF6666FF6666FF6666FF6666FF6666010101FF9966FF9966FF99 + 66FF9966FF9966FF9966FF9966FF9966FF9966010101FFCC66FFCC66FFCC66FF + CC66FFCC66FFCC66FFCC66FFCC66FFCC66010101FFFF66FFFF66FFFF66FFFF66 + FFFF66FFFF66FFFF66FFFF66FFFF66010101010101FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 + 0000000000000000000000000000FF0000FF0000FF0000FF0000FF0000FF0000 + FF0000FF0000FF0000010101FF3300FF3300FF3300FF3300FF3300FF3300FF33 + 00FF3300FF3300010101FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF + 6600FF6600010101FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900 + FF9900010101FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC + 00010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF0001 + 0101FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0033010101 + FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333010101FF66 + 33FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633010101FF9933FF + 9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933010101FFCC33FFCC33 + FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33010101FFFF33FFFF33FFFF + 33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33010101FF0066FF0066FF0066FF + 0066FF0066FF0066FF0066FF0066FF0066010101FF3366FF3366FF3366FF3366 + FF3366FF3366FF3366FF3366FF3366010101FF6666FF6666FF6666FF6666FF66 + 66FF6666FF6666FF6666FF6666010101FF9966FF9966FF9966FF9966FF9966FF + 9966FF9966FF9966FF9966010101FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66 + FFCC66FFCC66FFCC66010101FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF + 66FFFF66FFFF66010101010101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 + 000000000000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00 + 00010101FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF330001 + 0101FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600010101 + FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900FF9900010101FFCC + 00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00010101FFFF00FF + FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00010101FF0033FF0033 + FF0033FF0033FF0033FF0033FF0033FF0033FF0033010101FF3333FF3333FF33 + 33FF3333FF3333FF3333FF3333FF3333FF3333010101FF6633FF6633FF6633FF + 6633FF6633FF6633FF6633FF6633FF6633010101FF9933FF9933FF9933FF9933 + FF9933FF9933FF9933FF9933FF9933010101FFCC33FFCC33FFCC33FFCC33FFCC + 33FFCC33FFCC33FFCC33FFCC33010101FFFF33FFFF33FFFF33FFFF33FFFF33FF + FF33FFFF33FFFF33FFFF33010101FF0066FF0066FF0066FF0066FF0066FF0066 + FF0066FF0066FF0066010101FF3366FF3366FF3366FF3366FF3366FF3366FF33 + 66FF3366FF3366010101FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF + 6666FF6666010101FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966 + FF9966010101FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC + 66010101FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF6601 + 0101010101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 000000000000000000000000000000000000000000000000000000000000FF00 + 00FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000010101FF3300FF + 3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300010101FF6600FF6600 + FF6600FF6600FF6600FF6600FF6600FF6600FF6600010101FF9900FF9900FF99 + 00FF9900FF9900FF9900FF9900FF9900FF9900010101FFCC00FFCC00FFCC00FF + CC00FFCC00FFCC00FFCC00FFCC00FFCC00010101FFFF00FFFF00FFFF00FFFF00 + FFFF00FFFF00FFFF00FFFF00FFFF00010101FF0033FF0033FF0033FF0033FF00 + 33FF0033FF0033FF0033FF0033010101FF3333FF3333FF3333FF3333FF3333FF + 3333FF3333FF3333FF3333010101FF6633FF6633FF6633FF6633FF6633FF6633 + FF6633FF6633FF6633010101FF9933FF9933FF9933FF9933FF9933FF9933FF99 + 33FF9933FF9933010101FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FF + CC33FFCC33010101FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33 + FFFF33010101FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF00 + 66010101FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF336601 + 0101FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666010101 + FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966FF9966010101FFCC + 66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66FFCC66010101FFFF66FF + FF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66FFFF66010101010101FFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000 + 00000000000000000000000000000000000000000000FF0000FF0000FF0000FF + 0000FF0000FF0000FF0000FF0000FF0000010101FF3300FF3300FF3300FF3300 + FF3300FF3300FF3300FF3300FF3300010101FF6600FF6600FF6600FF6600FF66 + 00FF6600FF6600FF6600FF6600010101FF9900FF9900FF9900FF9900FF9900FF + 9900FF9900FF9900FF9900010101FFCC00FFCC00FFCC00FFCC00FFCC00FFCC00 + FFCC00FFCC00FFCC00010101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF + 00FFFF00FFFF00010101FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF + 0033FF0033010101FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333 + FF3333010101FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF66 + 33010101FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF9933FF993301 + 0101FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33FFCC33010101 + FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33FFFF33010101FF00 + 66FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066010101FF3366FF + 3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366010101FF6666FF6666 + FF6666FF6666FF6666FF6666FF6666FF6666FF6666010101FF9966FF9966FF99 + 66FF9966FF9966FF9966FF9966FF9966FF9966010101FFCC66FFCC66FFCC66FF + CC66FFCC66FFCC66FFCC66FFCC66FFCC66010101FFFF66FFFF66FFFF66FFFF66 + FFFF66FFFF66FFFF66FFFF66FFFF660101010101010101010101010101010101 + 0101010101010101010101010101010100000000000000000000000000000000 + 0000000000000000000000000000010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 01010101010101010101010101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCC000000000000000000000000000000000000000000000000 + 000000000000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC00 + 00010101CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC330001 + 0101CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600010101 + CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900010101CCCC + 00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00010101CCFF00CC + FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00010101CC0033CC0033 + CC0033CC0033CC0033CC0033CC0033CC0033CC0033010101CC3333CC3333CC33 + 33CC3333CC3333CC3333CC3333CC3333CC3333010101CC6633CC6633CC6633CC + 6633CC6633CC6633CC6633CC6633CC6633010101CC9933CC9933CC9933CC9933 + CC9933CC9933CC9933CC9933CC9933010101CCCC33CCCC33CCCC33CCCC33CCCC + 33CCCC33CCCC33CCCC33CCCC33010101CCFF33CCFF33CCFF33CCFF33CCFF33CC + FF33CCFF33CCFF33CCFF33010101CC0066CC0066CC0066CC0066CC0066CC0066 + CC0066CC0066CC0066010101CC3366CC3366CC3366CC3366CC3366CC3366CC33 + 66CC3366CC3366010101CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC + 6666CC6666010101CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966 + CC9966010101CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC + 66010101CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF6601 + 0101010101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + 000000000000000000000000000000000000000000000000000000000000CC00 + 00CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000010101CC3300CC + 3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300010101CC6600CC6600 + CC6600CC6600CC6600CC6600CC6600CC6600CC6600010101CC9900CC9900CC99 + 00CC9900CC9900CC9900CC9900CC9900CC9900010101CCCC00CCCC00CCCC00CC + CC00CCCC00CCCC00CCCC00CCCC00CCCC00010101CCFF00CCFF00CCFF00CCFF00 + CCFF00CCFF00CCFF00CCFF00CCFF00010101CC0033CC0033CC0033CC0033CC00 + 33CC0033CC0033CC0033CC0033010101CC3333CC3333CC3333CC3333CC3333CC + 3333CC3333CC3333CC3333010101CC6633CC6633CC6633CC6633CC6633CC6633 + CC6633CC6633CC6633010101CC9933CC9933CC9933CC9933CC9933CC9933CC99 + 33CC9933CC9933010101CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC + CC33CCCC33010101CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33 + CCFF33010101CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC00 + 66010101CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC336601 + 0101CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666010101 + CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966010101CCCC + 66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66010101CCFF66CC + FF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66010101010101CCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC0000000000000000 + 00000000000000000000000000000000000000000000CC0000CC0000CC0000CC + 0000CC0000CC0000CC0000CC0000CC0000010101CC3300CC3300CC3300CC3300 + CC3300CC3300CC3300CC3300CC3300010101CC6600CC6600CC6600CC6600CC66 + 00CC6600CC6600CC6600CC6600010101CC9900CC9900CC9900CC9900CC9900CC + 9900CC9900CC9900CC9900010101CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00 + CCCC00CCCC00CCCC00010101CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF + 00CCFF00CCFF00010101CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC + 0033CC0033010101CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333 + CC3333010101CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC66 + 33010101CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC993301 + 0101CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33010101 + CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33010101CC00 + 66CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066010101CC3366CC + 3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366010101CC6666CC6666 + CC6666CC6666CC6666CC6666CC6666CC6666CC6666010101CC9966CC9966CC99 + 66CC9966CC9966CC9966CC9966CC9966CC9966010101CCCC66CCCC66CCCC66CC + CC66CCCC66CCCC66CCCC66CCCC66CCCC66010101CCFF66CCFF66CCFF66CCFF66 + CCFF66CCFF66CCFF66CCFF66CCFF66010101010101CCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC00000000000000000000000000000000 + 0000000000000000000000000000CC0000CC0000CC0000CC0000CC0000CC0000 + CC0000CC0000CC0000010101CC3300CC3300CC3300CC3300CC3300CC3300CC33 + 00CC3300CC3300010101CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC + 6600CC6600010101CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900 + CC9900010101CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC + 00010101CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF0001 + 0101CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033010101 + CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333010101CC66 + 33CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633010101CC9933CC + 9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933010101CCCC33CCCC33 + CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33010101CCFF33CCFF33CCFF + 33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33010101CC0066CC0066CC0066CC + 0066CC0066CC0066CC0066CC0066CC0066010101CC3366CC3366CC3366CC3366 + CC3366CC3366CC3366CC3366CC3366010101CC6666CC6666CC6666CC6666CC66 + 66CC6666CC6666CC6666CC6666010101CC9966CC9966CC9966CC9966CC9966CC + 9966CC9966CC9966CC9966010101CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66 + CCCC66CCCC66CCCC66010101CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF + 66CCFF66CCFF66010101010101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCC000000000000000000000000000000000000000000000000 + 000000000000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC00 + 00010101CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC330001 + 0101CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600010101 + CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900010101CCCC + 00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00010101CCFF00CC + FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00010101CC0033CC0033 + CC0033CC0033CC0033CC0033CC0033CC0033CC0033010101CC3333CC3333CC33 + 33CC3333CC3333CC3333CC3333CC3333CC3333010101CC6633CC6633CC6633CC + 6633CC6633CC6633CC6633CC6633CC6633010101CC9933CC9933CC9933CC9933 + CC9933CC9933CC9933CC9933CC9933010101CCCC33CCCC33CCCC33CCCC33CCCC + 33CCCC33CCCC33CCCC33CCCC33010101CCFF33CCFF33CCFF33CCFF33CCFF33CC + FF33CCFF33CCFF33CCFF33010101CC0066CC0066CC0066CC0066CC0066CC0066 + CC0066CC0066CC0066010101CC3366CC3366CC3366CC3366CC3366CC3366CC33 + 66CC3366CC3366010101CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC + 6666CC6666010101CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966 + CC9966010101CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC + 66010101CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF6601 + 0101010101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + 000000000000000000000000000000000000000000000000000000000000CC00 + 00CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000010101CC3300CC + 3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300010101CC6600CC6600 + CC6600CC6600CC6600CC6600CC6600CC6600CC6600010101CC9900CC9900CC99 + 00CC9900CC9900CC9900CC9900CC9900CC9900010101CCCC00CCCC00CCCC00CC + CC00CCCC00CCCC00CCCC00CCCC00CCCC00010101CCFF00CCFF00CCFF00CCFF00 + CCFF00CCFF00CCFF00CCFF00CCFF00010101CC0033CC0033CC0033CC0033CC00 + 33CC0033CC0033CC0033CC0033010101CC3333CC3333CC3333CC3333CC3333CC + 3333CC3333CC3333CC3333010101CC6633CC6633CC6633CC6633CC6633CC6633 + CC6633CC6633CC6633010101CC9933CC9933CC9933CC9933CC9933CC9933CC99 + 33CC9933CC9933010101CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CC + CC33CCCC33010101CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33 + CCFF33010101CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC00 + 66010101CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC336601 + 0101CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666010101 + CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966010101CCCC + 66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66010101CCFF66CC + FF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66010101010101CCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC0000000000000000 + 00000000000000000000000000000000000000000000CC0000CC0000CC0000CC + 0000CC0000CC0000CC0000CC0000CC0000010101CC3300CC3300CC3300CC3300 + CC3300CC3300CC3300CC3300CC3300010101CC6600CC6600CC6600CC6600CC66 + 00CC6600CC6600CC6600CC6600010101CC9900CC9900CC9900CC9900CC9900CC + 9900CC9900CC9900CC9900010101CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00 + CCCC00CCCC00CCCC00010101CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF + 00CCFF00CCFF00010101CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC + 0033CC0033010101CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333 + CC3333010101CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC66 + 33010101CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933CC993301 + 0101CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33010101 + CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33010101CC00 + 66CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066010101CC3366CC + 3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366010101CC6666CC6666 + CC6666CC6666CC6666CC6666CC6666CC6666CC6666010101CC9966CC9966CC99 + 66CC9966CC9966CC9966CC9966CC9966CC9966010101CCCC66CCCC66CCCC66CC + CC66CCCC66CCCC66CCCC66CCCC66CCCC66010101CCFF66CCFF66CCFF66CCFF66 + CCFF66CCFF66CCFF66CCFF66CCFF66010101010101CCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC00000000000000000000000000000000 + 0000000000000000000000000000CC0000CC0000CC0000CC0000CC0000CC0000 + CC0000CC0000CC0000010101CC3300CC3300CC3300CC3300CC3300CC3300CC33 + 00CC3300CC3300010101CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC + 6600CC6600010101CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900 + CC9900010101CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC + 00010101CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF0001 + 0101CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033010101 + CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333010101CC66 + 33CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633010101CC9933CC + 9933CC9933CC9933CC9933CC9933CC9933CC9933CC9933010101CCCC33CCCC33 + CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33CCCC33010101CCFF33CCFF33CCFF + 33CCFF33CCFF33CCFF33CCFF33CCFF33CCFF33010101CC0066CC0066CC0066CC + 0066CC0066CC0066CC0066CC0066CC0066010101CC3366CC3366CC3366CC3366 + CC3366CC3366CC3366CC3366CC3366010101CC6666CC6666CC6666CC6666CC66 + 66CC6666CC6666CC6666CC6666010101CC9966CC9966CC9966CC9966CC9966CC + 9966CC9966CC9966CC9966010101CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66 + CCCC66CCCC66CCCC66010101CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF + 66CCFF66CCFF66010101010101CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCC000000000000000000000000000000000000000000000000 + 000000000000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC00 + 00010101CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC330001 + 0101CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600010101 + CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900CC9900010101CCCC + 00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00CCCC00010101CCFF00CC + FF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00CCFF00010101CC0033CC0033 + CC0033CC0033CC0033CC0033CC0033CC0033CC0033010101CC3333CC3333CC33 + 33CC3333CC3333CC3333CC3333CC3333CC3333010101CC6633CC6633CC6633CC + 6633CC6633CC6633CC6633CC6633CC6633010101CC9933CC9933CC9933CC9933 + CC9933CC9933CC9933CC9933CC9933010101CCCC33CCCC33CCCC33CCCC33CCCC + 33CCCC33CCCC33CCCC33CCCC33010101CCFF33CCFF33CCFF33CCFF33CCFF33CC + FF33CCFF33CCFF33CCFF33010101CC0066CC0066CC0066CC0066CC0066CC0066 + CC0066CC0066CC0066010101CC3366CC3366CC3366CC3366CC3366CC3366CC33 + 66CC3366CC3366010101CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC + 6666CC6666010101CC9966CC9966CC9966CC9966CC9966CC9966CC9966CC9966 + CC9966010101CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC66CCCC + 66010101CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF66CCFF6601 + 0101010101010101010101010101010101010101010101010101010101010101 + 0000000000000000000000000000000000000000000000000000000000000101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101999999 + 9999999999999999999999999999999999999999999999990000000000000000 + 0000000000000000000000000000000000000000000099000099000099000099 + 0000990000990000990000990000990000010101993300993300993300993300 + 9933009933009933009933009933000101019966009966009966009966009966 + 0099660099660099660099660001010199990099990099990099990099990099 + 990099990099990099990001010199CC0099CC0099CC0099CC0099CC0099CC00 + 99CC0099CC0099CC0001010199FF0099FF0099FF0099FF0099FF0099FF0099FF + 0099FF0099FF0001010199003399003399003399003399003399003399003399 + 0033990033010101993333993333993333993333993333993333993333993333 + 9933330101019966339966339966339966339966339966339966339966339966 + 3301010199993399993399993399993399993399993399993399993399993301 + 010199CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC33010101 + 99FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF330101019900 + 6699006699006699006699006699006699006699006699006601010199336699 + 3366993366993366993366993366993366993366993366010101996666996666 + 9966669966669966669966669966669966669966660101019999669999669999 + 6699996699996699996699996699996699996601010199CC6699CC6699CC6699 + CC6699CC6699CC6699CC6699CC6699CC6601010199FF6699FF6699FF6699FF66 + 99FF6699FF6699FF6699FF6699FF660101010101019999999999999999999999 + 9999999999999999999999999999999900000000000000000000000000000000 + 0000000000000000000000000000990000990000990000990000990000990000 + 9900009900009900000101019933009933009933009933009933009933009933 + 0099330099330001010199660099660099660099660099660099660099660099 + 6600996600010101999900999900999900999900999900999900999900999900 + 99990001010199CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC + 0001010199FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0001 + 0101990033990033990033990033990033990033990033990033990033010101 + 9933339933339933339933339933339933339933339933339933330101019966 + 3399663399663399663399663399663399663399663399663301010199993399 + 993399993399993399993399993399993399993399993301010199CC3399CC33 + 99CC3399CC3399CC3399CC3399CC3399CC3399CC3301010199FF3399FF3399FF + 3399FF3399FF3399FF3399FF3399FF3399FF3301010199006699006699006699 + 0066990066990066990066990066990066010101993366993366993366993366 + 9933669933669933669933669933660101019966669966669966669966669966 + 6699666699666699666699666601010199996699996699996699996699996699 + 996699996699996699996601010199CC6699CC6699CC6699CC6699CC6699CC66 + 99CC6699CC6699CC6601010199FF6699FF6699FF6699FF6699FF6699FF6699FF + 6699FF6699FF6601010101010199999999999999999999999999999999999999 + 9999999999999999000000000000000000000000000000000000000000000000 + 0000000000009900009900009900009900009900009900009900009900009900 + 0001010199330099330099330099330099330099330099330099330099330001 + 0101996600996600996600996600996600996600996600996600996600010101 + 99990099990099990099990099990099990099990099990099990001010199CC + 0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0001010199FF0099 + FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF00010101990033990033 + 9900339900339900339900339900339900339900330101019933339933339933 + 3399333399333399333399333399333399333301010199663399663399663399 + 6633996633996633996633996633996633010101999933999933999933999933 + 99993399993399993399993399993301010199CC3399CC3399CC3399CC3399CC + 3399CC3399CC3399CC3399CC3301010199FF3399FF3399FF3399FF3399FF3399 + FF3399FF3399FF3399FF33010101990066990066990066990066990066990066 + 9900669900669900660101019933669933669933669933669933669933669933 + 6699336699336601010199666699666699666699666699666699666699666699 + 6666996666010101999966999966999966999966999966999966999966999966 + 99996601010199CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC + 6601010199FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6601 + 0101010101999999999999999999999999999999999999999999999999999999 + 0000000000000000000000000000000000000000000000000000000000009900 + 0099000099000099000099000099000099000099000099000001010199330099 + 3300993300993300993300993300993300993300993300010101996600996600 + 9966009966009966009966009966009966009966000101019999009999009999 + 0099990099990099990099990099990099990001010199CC0099CC0099CC0099 + CC0099CC0099CC0099CC0099CC0099CC0001010199FF0099FF0099FF0099FF00 + 99FF0099FF0099FF0099FF0099FF000101019900339900339900339900339900 + 3399003399003399003399003301010199333399333399333399333399333399 + 3333993333993333993333010101996633996633996633996633996633996633 + 9966339966339966330101019999339999339999339999339999339999339999 + 3399993399993301010199CC3399CC3399CC3399CC3399CC3399CC3399CC3399 + CC3399CC3301010199FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF33 + 99FF330101019900669900669900669900669900669900669900669900669900 + 6601010199336699336699336699336699336699336699336699336699336601 + 0101996666996666996666996666996666996666996666996666996666010101 + 99996699996699996699996699996699996699996699996699996601010199CC + 6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6601010199FF6699 + FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF66010101010101999999 + 9999999999999999999999999999999999999999999999990000000000000000 + 0000000000000000000000000000000000000000000099000099000099000099 + 0000990000990000990000990000990000010101993300993300993300993300 + 9933009933009933009933009933000101019966009966009966009966009966 + 0099660099660099660099660001010199990099990099990099990099990099 + 990099990099990099990001010199CC0099CC0099CC0099CC0099CC0099CC00 + 99CC0099CC0099CC0001010199FF0099FF0099FF0099FF0099FF0099FF0099FF + 0099FF0099FF0001010199003399003399003399003399003399003399003399 + 0033990033010101993333993333993333993333993333993333993333993333 + 9933330101019966339966339966339966339966339966339966339966339966 + 3301010199993399993399993399993399993399993399993399993399993301 + 010199CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC33010101 + 99FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF330101019900 + 6699006699006699006699006699006699006699006699006601010199336699 + 3366993366993366993366993366993366993366993366010101996666996666 + 9966669966669966669966669966669966669966660101019999669999669999 + 6699996699996699996699996699996699996601010199CC6699CC6699CC6699 + CC6699CC6699CC6699CC6699CC6699CC6601010199FF6699FF6699FF6699FF66 + 99FF6699FF6699FF6699FF6699FF660101010101019999999999999999999999 + 9999999999999999999999999999999900000000000000000000000000000000 + 0000000000000000000000000000990000990000990000990000990000990000 + 9900009900009900000101019933009933009933009933009933009933009933 + 0099330099330001010199660099660099660099660099660099660099660099 + 6600996600010101999900999900999900999900999900999900999900999900 + 99990001010199CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC + 0001010199FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF0001 + 0101990033990033990033990033990033990033990033990033990033010101 + 9933339933339933339933339933339933339933339933339933330101019966 + 3399663399663399663399663399663399663399663399663301010199993399 + 993399993399993399993399993399993399993399993301010199CC3399CC33 + 99CC3399CC3399CC3399CC3399CC3399CC3399CC3301010199FF3399FF3399FF + 3399FF3399FF3399FF3399FF3399FF3399FF3301010199006699006699006699 + 0066990066990066990066990066990066010101993366993366993366993366 + 9933669933669933669933669933660101019966669966669966669966669966 + 6699666699666699666699666601010199996699996699996699996699996699 + 996699996699996699996601010199CC6699CC6699CC6699CC6699CC6699CC66 + 99CC6699CC6699CC6601010199FF6699FF6699FF6699FF6699FF6699FF6699FF + 6699FF6699FF6601010101010199999999999999999999999999999999999999 + 9999999999999999000000000000000000000000000000000000000000000000 + 0000000000009900009900009900009900009900009900009900009900009900 + 0001010199330099330099330099330099330099330099330099330099330001 + 0101996600996600996600996600996600996600996600996600996600010101 + 99990099990099990099990099990099990099990099990099990001010199CC + 0099CC0099CC0099CC0099CC0099CC0099CC0099CC0099CC0001010199FF0099 + FF0099FF0099FF0099FF0099FF0099FF0099FF0099FF00010101990033990033 + 9900339900339900339900339900339900339900330101019933339933339933 + 3399333399333399333399333399333399333301010199663399663399663399 + 6633996633996633996633996633996633010101999933999933999933999933 + 99993399993399993399993399993301010199CC3399CC3399CC3399CC3399CC + 3399CC3399CC3399CC3399CC3301010199FF3399FF3399FF3399FF3399FF3399 + FF3399FF3399FF3399FF33010101990066990066990066990066990066990066 + 9900669900669900660101019933669933669933669933669933669933669933 + 6699336699336601010199666699666699666699666699666699666699666699 + 6666996666010101999966999966999966999966999966999966999966999966 + 99996601010199CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC + 6601010199FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF6601 + 0101010101999999999999999999999999999999999999999999999999999999 + 0000000000000000000000000000000000000000000000000000000000009900 + 0099000099000099000099000099000099000099000099000001010199330099 + 3300993300993300993300993300993300993300993300010101996600996600 + 9966009966009966009966009966009966009966000101019999009999009999 + 0099990099990099990099990099990099990001010199CC0099CC0099CC0099 + CC0099CC0099CC0099CC0099CC0099CC0001010199FF0099FF0099FF0099FF00 + 99FF0099FF0099FF0099FF0099FF000101019900339900339900339900339900 + 3399003399003399003399003301010199333399333399333399333399333399 + 3333993333993333993333010101996633996633996633996633996633996633 + 9966339966339966330101019999339999339999339999339999339999339999 + 3399993399993301010199CC3399CC3399CC3399CC3399CC3399CC3399CC3399 + CC3399CC3301010199FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF33 + 99FF330101019900669900669900669900669900669900669900669900669900 + 6601010199336699336699336699336699336699336699336699336699336601 + 0101996666996666996666996666996666996666996666996666996666010101 + 99996699996699996699996699996699996699996699996699996601010199CC + 6699CC6699CC6699CC6699CC6699CC6699CC6699CC6699CC6601010199FF6699 + FF6699FF6699FF6699FF6699FF6699FF6699FF6699FF66010101010101999999 + 9999999999999999999999999999999999999999999999990000000000000000 + 0000000000000000000000000000000000000000000099000099000099000099 + 0000990000990000990000990000990000010101993300993300993300993300 + 9933009933009933009933009933000101019966009966009966009966009966 + 0099660099660099660099660001010199990099990099990099990099990099 + 990099990099990099990001010199CC0099CC0099CC0099CC0099CC0099CC00 + 99CC0099CC0099CC0001010199FF0099FF0099FF0099FF0099FF0099FF0099FF + 0099FF0099FF0001010199003399003399003399003399003399003399003399 + 0033990033010101993333993333993333993333993333993333993333993333 + 9933330101019966339966339966339966339966339966339966339966339966 + 3301010199993399993399993399993399993399993399993399993399993301 + 010199CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC3399CC33010101 + 99FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF3399FF330101019900 + 6699006699006699006699006699006699006699006699006601010199336699 + 3366993366993366993366993366993366993366993366010101996666996666 + 9966669966669966669966669966669966669966660101019999669999669999 + 6699996699996699996699996699996699996601010199CC6699CC6699CC6699 + CC6699CC6699CC6699CC6699CC6699CC6601010199FF6699FF6699FF6699FF66 + 99FF6699FF6699FF6699FF6699FF660101010101010101010101010101010101 + 0101010101010101010101010101010100000000000000000000000000000000 + 0000000000000000000000000000010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010166666666666666666666666666666666666666 + 6666666666666666000000000000000000000000000000000000000000000000 + 0000000000006600006600006600006600006600006600006600006600006600 + 0001010166330066330066330066330066330066330066330066330066330001 + 0101666600666600666600666600666600666600666600666600666600010101 + 66990066990066990066990066990066990066990066990066990001010166CC + 0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0001010166FF0066 + FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF00010101660033660033 + 6600336600336600336600336600336600336600330101016633336633336633 + 3366333366333366333366333366333366333301010166663366663366663366 + 6633666633666633666633666633666633010101669933669933669933669933 + 66993366993366993366993366993301010166CC3366CC3366CC3366CC3366CC + 3366CC3366CC3366CC3366CC3301010166FF3366FF3366FF3366FF3366FF3366 + FF3366FF3366FF3366FF33010101660066660066660066660066660066660066 + 6600666600666600660101016633666633666633666633666633666633666633 + 6666336666336601010166666666666666666666666666666666666666666666 + 6666666666010101669966669966669966669966669966669966669966669966 + 66996601010166CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC + 6601010166FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6601 + 0101010101666666666666666666666666666666666666666666666666666666 + 0000000000000000000000000000000000000000000000000000000000006600 + 0066000066000066000066000066000066000066000066000001010166330066 + 3300663300663300663300663300663300663300663300010101666600666600 + 6666006666006666006666006666006666006666000101016699006699006699 + 0066990066990066990066990066990066990001010166CC0066CC0066CC0066 + CC0066CC0066CC0066CC0066CC0066CC0001010166FF0066FF0066FF0066FF00 + 66FF0066FF0066FF0066FF0066FF000101016600336600336600336600336600 + 3366003366003366003366003301010166333366333366333366333366333366 + 3333663333663333663333010101666633666633666633666633666633666633 + 6666336666336666330101016699336699336699336699336699336699336699 + 3366993366993301010166CC3366CC3366CC3366CC3366CC3366CC3366CC3366 + CC3366CC3301010166FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF33 + 66FF330101016600666600666600666600666600666600666600666600666600 + 6601010166336666336666336666336666336666336666336666336666336601 + 0101666666666666666666666666666666666666666666666666666666010101 + 66996666996666996666996666996666996666996666996666996601010166CC + 6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6601010166FF6666 + FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF66010101010101666666 + 6666666666666666666666666666666666666666666666660000000000000000 + 0000000000000000000000000000000000000000000066000066000066000066 + 0000660000660000660000660000660000010101663300663300663300663300 + 6633006633006633006633006633000101016666006666006666006666006666 + 0066660066660066660066660001010166990066990066990066990066990066 + 990066990066990066990001010166CC0066CC0066CC0066CC0066CC0066CC00 + 66CC0066CC0066CC0001010166FF0066FF0066FF0066FF0066FF0066FF0066FF + 0066FF0066FF0001010166003366003366003366003366003366003366003366 + 0033660033010101663333663333663333663333663333663333663333663333 + 6633330101016666336666336666336666336666336666336666336666336666 + 3301010166993366993366993366993366993366993366993366993366993301 + 010166CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC33010101 + 66FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF330101016600 + 6666006666006666006666006666006666006666006666006601010166336666 + 3366663366663366663366663366663366663366663366010101666666666666 + 6666666666666666666666666666666666666666660101016699666699666699 + 6666996666996666996666996666996666996601010166CC6666CC6666CC6666 + CC6666CC6666CC6666CC6666CC6666CC6601010166FF6666FF6666FF6666FF66 + 66FF6666FF6666FF6666FF6666FF660101010101016666666666666666666666 + 6666666666666666666666666666666600000000000000000000000000000000 + 0000000000000000000000000000660000660000660000660000660000660000 + 6600006600006600000101016633006633006633006633006633006633006633 + 0066330066330001010166660066660066660066660066660066660066660066 + 6600666600010101669900669900669900669900669900669900669900669900 + 66990001010166CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC + 0001010166FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0001 + 0101660033660033660033660033660033660033660033660033660033010101 + 6633336633336633336633336633336633336633336633336633330101016666 + 3366663366663366663366663366663366663366663366663301010166993366 + 993366993366993366993366993366993366993366993301010166CC3366CC33 + 66CC3366CC3366CC3366CC3366CC3366CC3366CC3301010166FF3366FF3366FF + 3366FF3366FF3366FF3366FF3366FF3366FF3301010166006666006666006666 + 0066660066660066660066660066660066010101663366663366663366663366 + 6633666633666633666633666633660101016666666666666666666666666666 + 6666666666666666666666666601010166996666996666996666996666996666 + 996666996666996666996601010166CC6666CC6666CC6666CC6666CC6666CC66 + 66CC6666CC6666CC6601010166FF6666FF6666FF6666FF6666FF6666FF6666FF + 6666FF6666FF6601010101010166666666666666666666666666666666666666 + 6666666666666666000000000000000000000000000000000000000000000000 + 0000000000006600006600006600006600006600006600006600006600006600 + 0001010166330066330066330066330066330066330066330066330066330001 + 0101666600666600666600666600666600666600666600666600666600010101 + 66990066990066990066990066990066990066990066990066990001010166CC + 0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0001010166FF0066 + FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF00010101660033660033 + 6600336600336600336600336600336600336600330101016633336633336633 + 3366333366333366333366333366333366333301010166663366663366663366 + 6633666633666633666633666633666633010101669933669933669933669933 + 66993366993366993366993366993301010166CC3366CC3366CC3366CC3366CC + 3366CC3366CC3366CC3366CC3301010166FF3366FF3366FF3366FF3366FF3366 + FF3366FF3366FF3366FF33010101660066660066660066660066660066660066 + 6600666600666600660101016633666633666633666633666633666633666633 + 6666336666336601010166666666666666666666666666666666666666666666 + 6666666666010101669966669966669966669966669966669966669966669966 + 66996601010166CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC + 6601010166FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6601 + 0101010101666666666666666666666666666666666666666666666666666666 + 0000000000000000000000000000000000000000000000000000000000006600 + 0066000066000066000066000066000066000066000066000001010166330066 + 3300663300663300663300663300663300663300663300010101666600666600 + 6666006666006666006666006666006666006666000101016699006699006699 + 0066990066990066990066990066990066990001010166CC0066CC0066CC0066 + CC0066CC0066CC0066CC0066CC0066CC0001010166FF0066FF0066FF0066FF00 + 66FF0066FF0066FF0066FF0066FF000101016600336600336600336600336600 + 3366003366003366003366003301010166333366333366333366333366333366 + 3333663333663333663333010101666633666633666633666633666633666633 + 6666336666336666330101016699336699336699336699336699336699336699 + 3366993366993301010166CC3366CC3366CC3366CC3366CC3366CC3366CC3366 + CC3366CC3301010166FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF33 + 66FF330101016600666600666600666600666600666600666600666600666600 + 6601010166336666336666336666336666336666336666336666336666336601 + 0101666666666666666666666666666666666666666666666666666666010101 + 66996666996666996666996666996666996666996666996666996601010166CC + 6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6601010166FF6666 + FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF66010101010101666666 + 6666666666666666666666666666666666666666666666660000000000000000 + 0000000000000000000000000000000000000000000066000066000066000066 + 0000660000660000660000660000660000010101663300663300663300663300 + 6633006633006633006633006633000101016666006666006666006666006666 + 0066660066660066660066660001010166990066990066990066990066990066 + 990066990066990066990001010166CC0066CC0066CC0066CC0066CC0066CC00 + 66CC0066CC0066CC0001010166FF0066FF0066FF0066FF0066FF0066FF0066FF + 0066FF0066FF0001010166003366003366003366003366003366003366003366 + 0033660033010101663333663333663333663333663333663333663333663333 + 6633330101016666336666336666336666336666336666336666336666336666 + 3301010166993366993366993366993366993366993366993366993366993301 + 010166CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC3366CC33010101 + 66FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF3366FF330101016600 + 6666006666006666006666006666006666006666006666006601010166336666 + 3366663366663366663366663366663366663366663366010101666666666666 + 6666666666666666666666666666666666666666660101016699666699666699 + 6666996666996666996666996666996666996601010166CC6666CC6666CC6666 + CC6666CC6666CC6666CC6666CC6666CC6601010166FF6666FF6666FF6666FF66 + 66FF6666FF6666FF6666FF6666FF660101010101016666666666666666666666 + 6666666666666666666666666666666600000000000000000000000000000000 + 0000000000000000000000000000660000660000660000660000660000660000 + 6600006600006600000101016633006633006633006633006633006633006633 + 0066330066330001010166660066660066660066660066660066660066660066 + 6600666600010101669900669900669900669900669900669900669900669900 + 66990001010166CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC + 0001010166FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF0001 + 0101660033660033660033660033660033660033660033660033660033010101 + 6633336633336633336633336633336633336633336633336633330101016666 + 3366663366663366663366663366663366663366663366663301010166993366 + 993366993366993366993366993366993366993366993301010166CC3366CC33 + 66CC3366CC3366CC3366CC3366CC3366CC3366CC3301010166FF3366FF3366FF + 3366FF3366FF3366FF3366FF3366FF3366FF3301010166006666006666006666 + 0066660066660066660066660066660066010101663366663366663366663366 + 6633666633666633666633666633660101016666666666666666666666666666 + 6666666666666666666666666601010166996666996666996666996666996666 + 996666996666996666996601010166CC6666CC6666CC6666CC6666CC6666CC66 + 66CC6666CC6666CC6601010166FF6666FF6666FF6666FF6666FF6666FF6666FF + 6666FF6666FF6601010101010166666666666666666666666666666666666666 + 6666666666666666000000000000000000000000000000000000000000000000 + 0000000000006600006600006600006600006600006600006600006600006600 + 0001010166330066330066330066330066330066330066330066330066330001 + 0101666600666600666600666600666600666600666600666600666600010101 + 66990066990066990066990066990066990066990066990066990001010166CC + 0066CC0066CC0066CC0066CC0066CC0066CC0066CC0066CC0001010166FF0066 + FF0066FF0066FF0066FF0066FF0066FF0066FF0066FF00010101660033660033 + 6600336600336600336600336600336600336600330101016633336633336633 + 3366333366333366333366333366333366333301010166663366663366663366 + 6633666633666633666633666633666633010101669933669933669933669933 + 66993366993366993366993366993301010166CC3366CC3366CC3366CC3366CC + 3366CC3366CC3366CC3366CC3301010166FF3366FF3366FF3366FF3366FF3366 + FF3366FF3366FF3366FF33010101660066660066660066660066660066660066 + 6600666600666600660101016633666633666633666633666633666633666633 + 6666336666336601010166666666666666666666666666666666666666666666 + 6666666666010101669966669966669966669966669966669966669966669966 + 66996601010166CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC6666CC + 6601010166FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6666FF6601 + 0101010101010101010101010101010101010101010101010101010101010101 + 0000000000000000000000000000000000000000000000000000000000000101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101333333 + 3333333333333333333333333333333333333333333333330000000000000000 + 0000000000000000000000000000000000000000000033000033000033000033 + 0000330000330000330000330000330000010101333300333300333300333300 + 3333003333003333003333003333000101013366003366003366003366003366 + 0033660033660033660033660001010133990033990033990033990033990033 + 990033990033990033990001010133CC0033CC0033CC0033CC0033CC0033CC00 + 33CC0033CC0033CC0001010133FF0033FF0033FF0033FF0033FF0033FF0033FF + 0033FF0033FF0001010133003333003333003333003333003333003333003333 + 0033330033010101333333333333333333333333333333333333333333333333 + 3333330101013366333366333366333366333366333366333366333366333366 + 3301010133993333993333993333993333993333993333993333993333993301 + 010133CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC33010101 + 33FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF330101013300 + 6633006633006633006633006633006633006633006633006601010133336633 + 3366333366333366333366333366333366333366333366010101336666336666 + 3366663366663366663366663366663366663366660101013399663399663399 + 6633996633996633996633996633996633996601010133CC6633CC6633CC6633 + CC6633CC6633CC6633CC6633CC6633CC6601010133FF6633FF6633FF6633FF66 + 33FF6633FF6633FF6633FF6633FF660101010101013333333333333333333333 + 3333333333333333333333333333333300000000000000000000000000000000 + 0000000000000000000000000000330000330000330000330000330000330000 + 3300003300003300000101013333003333003333003333003333003333003333 + 0033330033330001010133660033660033660033660033660033660033660033 + 6600336600010101339900339900339900339900339900339900339900339900 + 33990001010133CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC + 0001010133FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0001 + 0101330033330033330033330033330033330033330033330033330033010101 + 3333333333333333333333333333333333333333333333333333330101013366 + 3333663333663333663333663333663333663333663333663301010133993333 + 993333993333993333993333993333993333993333993301010133CC3333CC33 + 33CC3333CC3333CC3333CC3333CC3333CC3333CC3301010133FF3333FF3333FF + 3333FF3333FF3333FF3333FF3333FF3333FF3301010133006633006633006633 + 0066330066330066330066330066330066010101333366333366333366333366 + 3333663333663333663333663333660101013366663366663366663366663366 + 6633666633666633666633666601010133996633996633996633996633996633 + 996633996633996633996601010133CC6633CC6633CC6633CC6633CC6633CC66 + 33CC6633CC6633CC6601010133FF6633FF6633FF6633FF6633FF6633FF6633FF + 6633FF6633FF6601010101010133333333333333333333333333333333333333 + 3333333333333333000000000000000000000000000000000000000000000000 + 0000000000003300003300003300003300003300003300003300003300003300 + 0001010133330033330033330033330033330033330033330033330033330001 + 0101336600336600336600336600336600336600336600336600336600010101 + 33990033990033990033990033990033990033990033990033990001010133CC + 0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0001010133FF0033 + FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF00010101330033330033 + 3300333300333300333300333300333300333300330101013333333333333333 + 3333333333333333333333333333333333333301010133663333663333663333 + 6633336633336633336633336633336633010101339933339933339933339933 + 33993333993333993333993333993301010133CC3333CC3333CC3333CC3333CC + 3333CC3333CC3333CC3333CC3301010133FF3333FF3333FF3333FF3333FF3333 + FF3333FF3333FF3333FF33010101330066330066330066330066330066330066 + 3300663300663300660101013333663333663333663333663333663333663333 + 6633336633336601010133666633666633666633666633666633666633666633 + 6666336666010101339966339966339966339966339966339966339966339966 + 33996601010133CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC + 6601010133FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6601 + 0101010101333333333333333333333333333333333333333333333333333333 + 0000000000000000000000000000000000000000000000000000000000003300 + 0033000033000033000033000033000033000033000033000001010133330033 + 3300333300333300333300333300333300333300333300010101336600336600 + 3366003366003366003366003366003366003366000101013399003399003399 + 0033990033990033990033990033990033990001010133CC0033CC0033CC0033 + CC0033CC0033CC0033CC0033CC0033CC0001010133FF0033FF0033FF0033FF00 + 33FF0033FF0033FF0033FF0033FF000101013300333300333300333300333300 + 3333003333003333003333003301010133333333333333333333333333333333 + 3333333333333333333333010101336633336633336633336633336633336633 + 3366333366333366330101013399333399333399333399333399333399333399 + 3333993333993301010133CC3333CC3333CC3333CC3333CC3333CC3333CC3333 + CC3333CC3301010133FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF33 + 33FF330101013300663300663300663300663300663300663300663300663300 + 6601010133336633336633336633336633336633336633336633336633336601 + 0101336666336666336666336666336666336666336666336666336666010101 + 33996633996633996633996633996633996633996633996633996601010133CC + 6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6601010133FF6633 + FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF66010101010101333333 + 3333333333333333333333333333333333333333333333330000000000000000 + 0000000000000000000000000000000000000000000033000033000033000033 + 0000330000330000330000330000330000010101333300333300333300333300 + 3333003333003333003333003333000101013366003366003366003366003366 + 0033660033660033660033660001010133990033990033990033990033990033 + 990033990033990033990001010133CC0033CC0033CC0033CC0033CC0033CC00 + 33CC0033CC0033CC0001010133FF0033FF0033FF0033FF0033FF0033FF0033FF + 0033FF0033FF0001010133003333003333003333003333003333003333003333 + 0033330033010101333333333333333333333333333333333333333333333333 + 3333330101013366333366333366333366333366333366333366333366333366 + 3301010133993333993333993333993333993333993333993333993333993301 + 010133CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC33010101 + 33FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF330101013300 + 6633006633006633006633006633006633006633006633006601010133336633 + 3366333366333366333366333366333366333366333366010101336666336666 + 3366663366663366663366663366663366663366660101013399663399663399 + 6633996633996633996633996633996633996601010133CC6633CC6633CC6633 + CC6633CC6633CC6633CC6633CC6633CC6601010133FF6633FF6633FF6633FF66 + 33FF6633FF6633FF6633FF6633FF660101010101013333333333333333333333 + 3333333333333333333333333333333300000000000000000000000000000000 + 0000000000000000000000000000330000330000330000330000330000330000 + 3300003300003300000101013333003333003333003333003333003333003333 + 0033330033330001010133660033660033660033660033660033660033660033 + 6600336600010101339900339900339900339900339900339900339900339900 + 33990001010133CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC + 0001010133FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF0001 + 0101330033330033330033330033330033330033330033330033330033010101 + 3333333333333333333333333333333333333333333333333333330101013366 + 3333663333663333663333663333663333663333663333663301010133993333 + 993333993333993333993333993333993333993333993301010133CC3333CC33 + 33CC3333CC3333CC3333CC3333CC3333CC3333CC3301010133FF3333FF3333FF + 3333FF3333FF3333FF3333FF3333FF3333FF3301010133006633006633006633 + 0066330066330066330066330066330066010101333366333366333366333366 + 3333663333663333663333663333660101013366663366663366663366663366 + 6633666633666633666633666601010133996633996633996633996633996633 + 996633996633996633996601010133CC6633CC6633CC6633CC6633CC6633CC66 + 33CC6633CC6633CC6601010133FF6633FF6633FF6633FF6633FF6633FF6633FF + 6633FF6633FF6601010101010133333333333333333333333333333333333333 + 3333333333333333000000000000000000000000000000000000000000000000 + 0000000000003300003300003300003300003300003300003300003300003300 + 0001010133330033330033330033330033330033330033330033330033330001 + 0101336600336600336600336600336600336600336600336600336600010101 + 33990033990033990033990033990033990033990033990033990001010133CC + 0033CC0033CC0033CC0033CC0033CC0033CC0033CC0033CC0001010133FF0033 + FF0033FF0033FF0033FF0033FF0033FF0033FF0033FF00010101330033330033 + 3300333300333300333300333300333300333300330101013333333333333333 + 3333333333333333333333333333333333333301010133663333663333663333 + 6633336633336633336633336633336633010101339933339933339933339933 + 33993333993333993333993333993301010133CC3333CC3333CC3333CC3333CC + 3333CC3333CC3333CC3333CC3301010133FF3333FF3333FF3333FF3333FF3333 + FF3333FF3333FF3333FF33010101330066330066330066330066330066330066 + 3300663300663300660101013333663333663333663333663333663333663333 + 6633336633336601010133666633666633666633666633666633666633666633 + 6666336666010101339966339966339966339966339966339966339966339966 + 33996601010133CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC + 6601010133FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF6601 + 0101010101333333333333333333333333333333333333333333333333333333 + 0000000000000000000000000000000000000000000000000000000000003300 + 0033000033000033000033000033000033000033000033000001010133330033 + 3300333300333300333300333300333300333300333300010101336600336600 + 3366003366003366003366003366003366003366000101013399003399003399 + 0033990033990033990033990033990033990001010133CC0033CC0033CC0033 + CC0033CC0033CC0033CC0033CC0033CC0001010133FF0033FF0033FF0033FF00 + 33FF0033FF0033FF0033FF0033FF000101013300333300333300333300333300 + 3333003333003333003333003301010133333333333333333333333333333333 + 3333333333333333333333010101336633336633336633336633336633336633 + 3366333366333366330101013399333399333399333399333399333399333399 + 3333993333993301010133CC3333CC3333CC3333CC3333CC3333CC3333CC3333 + CC3333CC3301010133FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF33 + 33FF330101013300663300663300663300663300663300663300663300663300 + 6601010133336633336633336633336633336633336633336633336633336601 + 0101336666336666336666336666336666336666336666336666336666010101 + 33996633996633996633996633996633996633996633996633996601010133CC + 6633CC6633CC6633CC6633CC6633CC6633CC6633CC6633CC6601010133FF6633 + FF6633FF6633FF6633FF6633FF6633FF6633FF6633FF66010101010101333333 + 3333333333333333333333333333333333333333333333330000000000000000 + 0000000000000000000000000000000000000000000033000033000033000033 + 0000330000330000330000330000330000010101333300333300333300333300 + 3333003333003333003333003333000101013366003366003366003366003366 + 0033660033660033660033660001010133990033990033990033990033990033 + 990033990033990033990001010133CC0033CC0033CC0033CC0033CC0033CC00 + 33CC0033CC0033CC0001010133FF0033FF0033FF0033FF0033FF0033FF0033FF + 0033FF0033FF0001010133003333003333003333003333003333003333003333 + 0033330033010101333333333333333333333333333333333333333333333333 + 3333330101013366333366333366333366333366333366333366333366333366 + 3301010133993333993333993333993333993333993333993333993333993301 + 010133CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC3333CC33010101 + 33FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF3333FF330101013300 + 6633006633006633006633006633006633006633006633006601010133336633 + 3366333366333366333366333366333366333366333366010101336666336666 + 3366663366663366663366663366663366663366660101013399663399663399 + 6633996633996633996633996633996633996601010133CC6633CC6633CC6633 + CC6633CC6633CC6633CC6633CC6633CC6601010133FF6633FF6633FF6633FF66 + 33FF6633FF6633FF6633FF6633FF660101010000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010100000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000330000330000330000330000330000330000330000330000330001 + 0101006600006600006600006600006600006600006600006600006600010101 + 00990000990000990000990000990000990000990000990000990001010100CC + 0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0001010100FF0000 + FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00010101000033000033 + 0000330000330000330000330000330000330000330101010033330033330033 + 3300333300333300333300333300333300333301010100663300663300663300 + 6633006633006633006633006633006633010101009933009933009933009933 + 00993300993300993300993300993301010100CC3300CC3300CC3300CC3300CC + 3300CC3300CC3300CC3300CC3301010100FF3300FF3300FF3300FF3300FF3300 + FF3300FF3300FF3300FF33010101000066000066000066000066000066000066 + 0000660000660000660101010033660033660033660033660033660033660033 + 6600336600336601010100666600666600666600666600666600666600666600 + 6666006666010101009966009966009966009966009966009966009966009966 + 00996601010100CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC + 6601010100FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6601 + 0101000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000330000 + 3300003300003300003300003300003300003300003300010101006600006600 + 0066000066000066000066000066000066000066000101010099000099000099 + 0000990000990000990000990000990000990001010100CC0000CC0000CC0000 + CC0000CC0000CC0000CC0000CC0000CC0001010100FF0000FF0000FF0000FF00 + 00FF0000FF0000FF0000FF0000FF000101010000330000330000330000330000 + 3300003300003300003300003301010100333300333300333300333300333300 + 3333003333003333003333010101006633006633006633006633006633006633 + 0066330066330066330101010099330099330099330099330099330099330099 + 3300993300993301010100CC3300CC3300CC3300CC3300CC3300CC3300CC3300 + CC3300CC3301010100FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF33 + 00FF330101010000660000660000660000660000660000660000660000660000 + 6601010100336600336600336600336600336600336600336600336600336601 + 0101006666006666006666006666006666006666006666006666006666010101 + 00996600996600996600996600996600996600996600996600996601010100CC + 6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6601010100FF6600 + FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF66010101000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000003300003300003300003300 + 0033000033000033000033000033000101010066000066000066000066000066 + 0000660000660000660000660001010100990000990000990000990000990000 + 990000990000990000990001010100CC0000CC0000CC0000CC0000CC0000CC00 + 00CC0000CC0000CC0001010100FF0000FF0000FF0000FF0000FF0000FF0000FF + 0000FF0000FF0001010100003300003300003300003300003300003300003300 + 0033000033010101003333003333003333003333003333003333003333003333 + 0033330101010066330066330066330066330066330066330066330066330066 + 3301010100993300993300993300993300993300993300993300993300993301 + 010100CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC33010101 + 00FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF330101010000 + 6600006600006600006600006600006600006600006600006601010100336600 + 3366003366003366003366003366003366003366003366010101006666006666 + 0066660066660066660066660066660066660066660101010099660099660099 + 6600996600996600996600996600996600996601010100CC6600CC6600CC6600 + CC6600CC6600CC6600CC6600CC6600CC6601010100FF6600FF6600FF6600FF66 + 00FF6600FF6600FF6600FF6600FF660101010000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000033000033000033000033000033000033000033 + 0000330000330001010100660000660000660000660000660000660000660000 + 6600006600010101009900009900009900009900009900009900009900009900 + 00990001010100CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC + 0001010100FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0001 + 0101000033000033000033000033000033000033000033000033000033010101 + 0033330033330033330033330033330033330033330033330033330101010066 + 3300663300663300663300663300663300663300663300663301010100993300 + 993300993300993300993300993300993300993300993301010100CC3300CC33 + 00CC3300CC3300CC3300CC3300CC3300CC3300CC3301010100FF3300FF3300FF + 3300FF3300FF3300FF3300FF3300FF3300FF3301010100006600006600006600 + 0066000066000066000066000066000066010101003366003366003366003366 + 0033660033660033660033660033660101010066660066660066660066660066 + 6600666600666600666600666601010100996600996600996600996600996600 + 996600996600996600996601010100CC6600CC6600CC6600CC6600CC6600CC66 + 00CC6600CC6600CC6601010100FF6600FF6600FF6600FF6600FF6600FF6600FF + 6600FF6600FF6601010100000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000330000330000330000330000330000330000330000330000330001 + 0101006600006600006600006600006600006600006600006600006600010101 + 00990000990000990000990000990000990000990000990000990001010100CC + 0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0001010100FF0000 + FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00010101000033000033 + 0000330000330000330000330000330000330000330101010033330033330033 + 3300333300333300333300333300333300333301010100663300663300663300 + 6633006633006633006633006633006633010101009933009933009933009933 + 00993300993300993300993300993301010100CC3300CC3300CC3300CC3300CC + 3300CC3300CC3300CC3300CC3301010100FF3300FF3300FF3300FF3300FF3300 + FF3300FF3300FF3300FF33010101000066000066000066000066000066000066 + 0000660000660000660101010033660033660033660033660033660033660033 + 6600336600336601010100666600666600666600666600666600666600666600 + 6666006666010101009966009966009966009966009966009966009966009966 + 00996601010100CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC + 6601010100FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6601 + 0101000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000330000 + 3300003300003300003300003300003300003300003300010101006600006600 + 0066000066000066000066000066000066000066000101010099000099000099 + 0000990000990000990000990000990000990001010100CC0000CC0000CC0000 + CC0000CC0000CC0000CC0000CC0000CC0001010100FF0000FF0000FF0000FF00 + 00FF0000FF0000FF0000FF0000FF000101010000330000330000330000330000 + 3300003300003300003300003301010100333300333300333300333300333300 + 3333003333003333003333010101006633006633006633006633006633006633 + 0066330066330066330101010099330099330099330099330099330099330099 + 3300993300993301010100CC3300CC3300CC3300CC3300CC3300CC3300CC3300 + CC3300CC3301010100FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF33 + 00FF330101010000660000660000660000660000660000660000660000660000 + 6601010100336600336600336600336600336600336600336600336600336601 + 0101006666006666006666006666006666006666006666006666006666010101 + 00996600996600996600996600996600996600996600996600996601010100CC + 6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6601010100FF6600 + FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF66010101000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000003300003300003300003300 + 0033000033000033000033000033000101010066000066000066000066000066 + 0000660000660000660000660001010100990000990000990000990000990000 + 990000990000990000990001010100CC0000CC0000CC0000CC0000CC0000CC00 + 00CC0000CC0000CC0001010100FF0000FF0000FF0000FF0000FF0000FF0000FF + 0000FF0000FF0001010100003300003300003300003300003300003300003300 + 0033000033010101003333003333003333003333003333003333003333003333 + 0033330101010066330066330066330066330066330066330066330066330066 + 3301010100993300993300993300993300993300993300993300993300993301 + 010100CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC3300CC33010101 + 00FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF3300FF330101010000 + 6600006600006600006600006600006600006600006600006601010100336600 + 3366003366003366003366003366003366003366003366010101006666006666 + 0066660066660066660066660066660066660066660101010099660099660099 + 6600996600996600996600996600996600996601010100CC6600CC6600CC6600 + CC6600CC6600CC6600CC6600CC6600CC6601010100FF6600FF6600FF6600FF66 + 00FF6600FF6600FF6600FF6600FF660101010000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000033000033000033000033000033000033000033 + 0000330000330001010100660000660000660000660000660000660000660000 + 6600006600010101009900009900009900009900009900009900009900009900 + 00990001010100CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC + 0001010100FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0001 + 0101000033000033000033000033000033000033000033000033000033010101 + 0033330033330033330033330033330033330033330033330033330101010066 + 3300663300663300663300663300663300663300663300663301010100993300 + 993300993300993300993300993300993300993300993301010100CC3300CC33 + 00CC3300CC3300CC3300CC3300CC3300CC3300CC3301010100FF3300FF3300FF + 3300FF3300FF3300FF3300FF3300FF3300FF3301010100006600006600006600 + 0066000066000066000066000066000066010101003366003366003366003366 + 0033660033660033660033660033660101010066660066660066660066660066 + 6600666600666600666600666601010100996600996600996600996600996600 + 996600996600996600996601010100CC6600CC6600CC6600CC6600CC6600CC66 + 00CC6600CC6600CC6601010100FF6600FF6600FF6600FF6600FF6600FF6600FF + 6600FF6600FF6601010100000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000330000330000330000330000330000330000330000330000330001 + 0101006600006600006600006600006600006600006600006600006600010101 + 00990000990000990000990000990000990000990000990000990001010100CC + 0000CC0000CC0000CC0000CC0000CC0000CC0000CC0000CC0001010100FF0000 + FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF00010101000033000033 + 0000330000330000330000330000330000330000330101010033330033330033 + 3300333300333300333300333300333300333301010100663300663300663300 + 6633006633006633006633006633006633010101009933009933009933009933 + 00993300993300993300993300993301010100CC3300CC3300CC3300CC3300CC + 3300CC3300CC3300CC3300CC3301010100FF3300FF3300FF3300FF3300FF3300 + FF3300FF3300FF3300FF33010101000066000066000066000066000066000066 + 0000660000660000660101010033660033660033660033660033660033660033 + 6600336600336601010100666600666600666600666600666600666600666600 + 6666006666010101009966009966009966009966009966009966009966009966 + 00996601010100CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC6600CC + 6601010100FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6600FF6601 + 0101000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000001010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101010101010101 + 0101010101010101010101010101010101010101010101010101} + OnMouseDown = imgPaletteMouseDown + OnMouseMove = imgPaletteMouseMove + end + end + end + object SpTBXPanel1: TSpTBXPanel + Left = 0 + Top = 0 + Width = 213 + Height = 26 + Caption = 'SpTBXPanel1' + Align = alTop + TabOrder = 1 + OnDrawBackground = SpTBXPanel1DrawBackground + DesignSize = ( + 213 + 26) + object btnColorNone: TSpTBXSpeedButton + Left = 170 + Top = 3 + Width = 20 + Height = 20 + Anchors = [akTop, akRight] + OnClick = btnColorNoneClick + OnMouseEnter = btnColorNoneMouseEnter + OnMouseLeave = btnColorNoneMouseLeave + Images = ImageList1 + ImageIndex = 1 + OnDraw = btnColorDialogDraw + end + object btnColorDialog: TSpTBXSpeedButton + Left = 190 + Top = 3 + Width = 20 + Height = 20 + Anchors = [akTop, akRight] + OnClick = btnColorDialogClick + OnMouseEnter = btnColorDialogMouseEnter + OnMouseLeave = btnColorDialogMouseLeave + Images = ImageList1 + ImageIndex = 0 + OnDraw = btnColorDialogDraw + end + object btnColor: TSpTBXSpeedButton + Left = 2 + Top = 2 + Width = 50 + Height = 22 + OnDraw = btnColorDraw + end + object btnLabel: TSpTBXLabel + Left = 58 + Top = 3 + Width = 47 + Height = 19 + Caption = 'btnLabel' + end + end + object Timer1: TTimer + Interval = 25 + OnTimer = Timer1Timer + Left = 112 + Top = 152 + end + object ImageList1: TImageList + Left = 72 + Top = 152 + Bitmap = { + 494C010102000500040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000001000000001002000000000000010 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000040404000404 + 0400040404000404040004040400040404000404040004040400040404000404 + 0400040404000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000161616001616 + 1600222222001616160016161600222222001616160016161600161616001616 + 160016161600000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000033000033 + 3300003333000033330033330000333300003333000033000000330033003300 + 330033003300000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000066000033 + 6600006666000066330033660000666600006633000066000000660033006600 + 660033006600000000000000000000000000000000000000000000000000C0C0 + C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0 + C000C0C0C0000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000003399000066 + 9900009999000099660066990000999900009933000099000000990066009900 + 990033009900000000000000000000000000000000000000000000000000C0C0 + C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0 + C000C0C0C0000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000033CC000066 + CC0000CCCC0000CC660066CC0000CCCC0000CC660000CC000000CC006600CC00 + CC006600CC00000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000033FF000066 + FF0000FFFF0000FF660099FF0000FFFF0000FF660000FF000000FF009900CC00 + FF006600FF00000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000033FF003399 + FF0033FFFF0033FF990099FF3300FFFF3300FF993300FF333300FF339900FF33 + FF006633FF00000000000000000000000000000000000000000000000000C0C0 + C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0 + C000C0C0C0000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000003366FF006699 + FF0066FFFF0066FF9900CCFF6600FFFF6600FF996600FF666600FF66CC00FF66 + FF009966FF00000000000000000000000000000000000000000000000000C0C0 + C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0 + C000C0C0C0000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000807CFF0099CC + FF0099FFFF0099FFCC00CCFF9900FFFF9900FFCC9900FF999900FF99CC00FF99 + FF009999FF00000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000009999FF0099CC + FF0099FFFF0099FFCC00CCFF9900FFFF9900FFCCCC00FFCCCC00FF99CC00FF99 + FF00CC99FF00000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00C0C0C000C0C0C000FFFFFF00FFFFFF00C0C0C000C0C0C000FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000CCCCFF00CCCC + FF00CCFFFF00CCFFCC00CCFFCC00FFFFCC00FFCCCC00FFCCCC00FFCCCC00FFCC + FF00CCCCFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000040000000100000000100010000000000800000000000000000000000 + 000000000000000000000000FFFFFF00FFFFFFFF00000000FFFFFFFF00000000 + C007C00300000000C007C00300000000C007C00300000000C007C00300000000 + C007C00300000000C007C00300000000C007C00300000000C007C00300000000 + C007C00300000000C007C00300000000C007C00300000000C007C00300000000 + FFFFFFFF00000000FFFFFFFF00000000} + end + object ColorDialog1: TColorDialog + Options = [cdFullOpen] + Left = 144 + Top = 152 + end +end diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.hpp new file mode 100644 index 0000000..9e79a40 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.hpp @@ -0,0 +1,164 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxcolorpickerform.pas' rev: 20.00 + +#ifndef SptbxcolorpickerformHPP +#define SptbxcolorpickerformHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxcolorpickerform +{ +//-- type declarations ------------------------------------------------------- +class DELPHICLASS TSpTBXColorPickerDragObject; +class PASCALIMPLEMENTATION TSpTBXColorPickerDragObject : public Controls::TDragControlObject +{ + typedef Controls::TDragControlObject inherited; + +protected: + virtual Controls::TCursor __fastcall GetDragCursor(bool Accepted, int X, int Y); +public: + /* TBaseDragControlObject.Create */ inline __fastcall virtual TSpTBXColorPickerDragObject(Controls::TControl* AControl) : Controls::TDragControlObject(AControl) { } + +public: + /* TObject.Destroy */ inline __fastcall virtual ~TSpTBXColorPickerDragObject(void) { } + +}; + + +class DELPHICLASS TSpTBXColorEditPopupMenu; +class PASCALIMPLEMENTATION TSpTBXColorEditPopupMenu : public Sptbxformpopupmenu::TSpTBXFormPopupMenu +{ + typedef Sptbxformpopupmenu::TSpTBXFormPopupMenu inherited; + +protected: + virtual void __fastcall DoGetPopupFormClass(Forms::TCustomFormClass &AFormClass); + virtual bool __fastcall InternalPopup(int X, int Y, bool ForceFocus, Controls::TControl* PopupControl = (Controls::TControl*)(0x0)); + +public: + __fastcall virtual TSpTBXColorEditPopupMenu(Classes::TComponent* AOwner); +public: + /* TSpTBXFormPopupMenu.Destroy */ inline __fastcall virtual ~TSpTBXColorEditPopupMenu(void) { } + +}; + + +class DELPHICLASS TSpTBXColorPickerForm; +class PASCALIMPLEMENTATION TSpTBXColorPickerForm : public Forms::TForm +{ + typedef Forms::TForm inherited; + +__published: + Extctrls::TTimer* Timer1; + Extctrls::TImage* imgColorPicker; + Sptbxtabs::TSpTBXTabControl* SpTBXTabControl1; + Sptbxtabs::TSpTBXTabItem* SpTBXTabItem1; + Sptbxtabs::TSpTBXTabSheet* SpTBXTabSheet1; + Sptbxtabs::TSpTBXTabItem* SpTBXTabItem2; + Sptbxtabs::TSpTBXTabSheet* SpTBXTabSheet2; + Extctrls::TImage* imgPalette; + Sptbxcontrols::TSpTBXSpeedButton* btnColorPicker; + Sptbxtabs::TSpTBXTabItem* SpTBXTabItem3; + Sptbxtabs::TSpTBXTabSheet* SpTBXTabSheet3; + Controls::TImageList* ImageList1; + Sptbxexteditors::TSpTBXColorListBox* SpTBXColorListBox1; + Dialogs::TColorDialog* ColorDialog1; + Sptbxcontrols::TSpTBXPanel* SpTBXPanel1; + Sptbxcontrols::TSpTBXSpeedButton* btnColorNone; + Sptbxcontrols::TSpTBXSpeedButton* btnColorDialog; + Sptbxcontrols::TSpTBXSpeedButton* btnColor; + Sptbxcontrols::TSpTBXLabel* btnLabel; + void __fastcall Timer1Timer(System::TObject* Sender); + void __fastcall imgPaletteMouseMove(System::TObject* Sender, Classes::TShiftState Shift, int X, int Y); + void __fastcall btnColorPickerStartDrag(System::TObject* Sender, Controls::TDragObject* &DragObject); + void __fastcall FormCreate(System::TObject* Sender); + void __fastcall btnColorPickerEndDrag(System::TObject* Sender, System::TObject* Target, int X, int Y); + void __fastcall FormResize(System::TObject* Sender); + void __fastcall SpTBXTabControl1ActiveTabChange(System::TObject* Sender, int TabIndex); + void __fastcall SpTBXColorListBox1Click(System::TObject* Sender); + void __fastcall FormShow(System::TObject* Sender); + void __fastcall FormDestroy(System::TObject* Sender); + void __fastcall btnColorDraw(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + void __fastcall btnColorNoneClick(System::TObject* Sender); + void __fastcall btnColorNoneMouseEnter(System::TObject* Sender); + void __fastcall btnColorDialogClick(System::TObject* Sender); + void __fastcall btnColorDialogMouseEnter(System::TObject* Sender); + void __fastcall btnColorDialogDraw(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + void __fastcall SpTBXPanel1DrawBackground(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + void __fastcall btnColorDialogMouseLeave(System::TObject* Sender); + void __fastcall btnColorNoneMouseLeave(System::TObject* Sender); + void __fastcall imgPaletteMouseDown(System::TObject* Sender, Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + +protected: + Graphics::TColor FSelectedColor; + Graphics::TColor FPrevLabelColor; + TSpTBXColorPickerDragObject* FColorPickerDragObject; + void __fastcall CenterImages(void); + +public: + Graphics::TColor __fastcall GetSelectedColor(void); + void __fastcall SetSelectedColor(Graphics::TColor AColor); + void __fastcall UpdateColorLabel(Graphics::TColor AColor, int AButtonType = 0xffffffff); + __property Graphics::TColor SelectedColor = {read=FSelectedColor, write=FSelectedColor, nodefault}; +public: + /* TCustomForm.Create */ inline __fastcall virtual TSpTBXColorPickerForm(Classes::TComponent* AOwner) : Forms::TForm(AOwner) { } + /* TCustomForm.CreateNew */ inline __fastcall virtual TSpTBXColorPickerForm(Classes::TComponent* AOwner, int Dummy) : Forms::TForm(AOwner, Dummy) { } + /* TCustomForm.Destroy */ inline __fastcall virtual ~TSpTBXColorPickerForm(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXColorPickerForm(HWND ParentWindow) : Forms::TForm(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +static const ShortInt crSpTBXEyeDropper = 0x67; +extern PACKAGE System::ResourceString _SSpTBXTransparentColor; +#define Sptbxcolorpickerform_SSpTBXTransparentColor System::LoadResourceString(&Sptbxcolorpickerform::_SSpTBXTransparentColor) +extern PACKAGE System::ResourceString _SSpTBXColorPicker; +#define Sptbxcolorpickerform_SSpTBXColorPicker System::LoadResourceString(&Sptbxcolorpickerform::_SSpTBXColorPicker) +extern PACKAGE void __fastcall SpScreenShot(const Types::TRect &SourceR, Graphics::TCanvas* DestCanvas, const Types::TRect &DestR); +extern PACKAGE void __fastcall SpScreenShotMagnify(Graphics::TCanvas* DestCanvas, const Types::TRect &DestR, bool DrawCrosshair, /* out */ Graphics::TColor &CenterColor, double ZoomFactor = 2.000000E+02); + +} /* namespace Sptbxcolorpickerform */ +using namespace Sptbxcolorpickerform; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxcolorpickerformHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.pas new file mode 100644 index 0000000..fce712b --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXColorPickerForm.pas @@ -0,0 +1,522 @@ +unit SpTBXColorPickerForm; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development notes: + - All the Windows and Delphi bugs fixes are marked with '[Bugfix]'. + - All the theme changes and adjustments are marked with '[Theme-Change]'. + +To Do: + - Rotated caption painting. + +Known Issues: + - + +History: + - + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, Classes, SysUtils, Controls, Graphics, ImgList, Forms, + Menus, StdCtrls, ExtCtrls, ActnList, Dialogs, + TB2Dock, TB2Toolbar, TB2Item, TB2ExtItems, + SpTBXSkins, SpTBXItem, SpTBXControls, SpTBXEditors, SpTBXFormPopupMenu, + SpTBXExtEditors, SpTBXTabs; + +type + { TSpTBXColorPickerDragObject } + + TSpTBXColorPickerDragObject = class(TDragControlObject) + protected + function GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor; override; + end; + + { TSpTBXColorEditPopupMenu } + + TSpTBXColorEditPopupMenu = class(TSpTBXFormPopupMenu) + protected + procedure DoGetPopupFormClass(var AFormClass: TCustomFormClass); override; + function InternalPopup(X, Y: Integer; ForceFocus: Boolean; PopupControl: TControl = nil): Boolean; override; + public + constructor Create(AOwner: TComponent); override; + end; + + { TSpTBXColorPickerForm } + + TSpTBXColorPickerForm = class(TForm) + Timer1: TTimer; + imgColorPicker: TImage; + SpTBXTabControl1: TSpTBXTabControl; + SpTBXTabItem1: TSpTBXTabItem; + SpTBXTabSheet1: TSpTBXTabSheet; + SpTBXTabItem2: TSpTBXTabItem; + SpTBXTabSheet2: TSpTBXTabSheet; + imgPalette: TImage; + btnColorPicker: TSpTBXSpeedButton; + SpTBXTabItem3: TSpTBXTabItem; + SpTBXTabSheet3: TSpTBXTabSheet; + ImageList1: TImageList; + SpTBXColorListBox1: TSpTBXColorListBox; + ColorDialog1: TColorDialog; + SpTBXPanel1: TSpTBXPanel; + btnColorNone: TSpTBXSpeedButton; + btnColorDialog: TSpTBXSpeedButton; + btnColor: TSpTBXSpeedButton; + btnLabel: TSpTBXLabel; + procedure Timer1Timer(Sender: TObject); + procedure imgPaletteMouseMove(Sender: TObject; Shift: TShiftState; X, + Y: Integer); + procedure btnColorPickerStartDrag(Sender: TObject; + var DragObject: TDragObject); + procedure FormCreate(Sender: TObject); + procedure btnColorPickerEndDrag(Sender, Target: TObject; X, Y: Integer); + procedure FormResize(Sender: TObject); + procedure SpTBXTabControl1ActiveTabChange(Sender: TObject; + TabIndex: Integer); + procedure SpTBXColorListBox1Click(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure btnColorDraw(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); + procedure btnColorNoneClick(Sender: TObject); + procedure btnColorNoneMouseEnter(Sender: TObject); + procedure btnColorDialogClick(Sender: TObject); + procedure btnColorDialogMouseEnter(Sender: TObject); + procedure btnColorDialogDraw(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); + procedure SpTBXPanel1DrawBackground(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); + procedure btnColorDialogMouseLeave(Sender: TObject); + procedure btnColorNoneMouseLeave(Sender: TObject); + procedure imgPaletteMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + protected + FSelectedColor: TColor; + FPrevLabelColor: TColor; + FColorPickerDragObject: TSpTBXColorPickerDragObject; + procedure CenterImages; + public + function GetSelectedColor: TColor; + procedure SetSelectedColor(AColor: TColor); + procedure UpdateColorLabel(AColor: TColor; AButtonType: Integer = -1); + property SelectedColor: TColor read FSelectedColor write FSelectedColor; + end; + +{ Helpers } +procedure SpScreenShot(SourceR: TRect; DestCanvas: TCanvas; DestR: TRect); +procedure SpScreenShotMagnify(DestCanvas: TCanvas; DestR: TRect; DrawCrosshair: Boolean; out CenterColor: TColor; ZoomFactor: Double = 200); + +const + crSpTBXEyeDropper = 103; // Cursor ID used for Eye Dropper cursor + +resourcestring + SSpTBXTransparentColor = 'Transparent Color'; + SSpTBXColorPicker = 'Color Picker'; + +implementation + +{$R *.dfm} + +uses + Themes, UxTheme; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +procedure SpScreenShot(SourceR: TRect; DestCanvas: TCanvas; DestR: TRect); +var + DesktopDC: HDC; +begin + DesktopDC := GetDC(0); + try + Windows.StretchBlt( + DestCanvas.Handle, DestR.Left, DestR.Top, DestR.Right - DestR.Left, DestR.Bottom - DestR.Top, + DesktopDC, SourceR.Left, SourceR.Top, SourceR.Right - SourceR.Left, SourceR.Bottom - SourceR.Top, + SRCCOPY); + finally + ReleaseDC(0, DesktopDC); + end; +end; + +procedure SpScreenShotMagnify(DestCanvas: TCanvas; DestR: TRect; DrawCrosshair: Boolean; out CenterColor: TColor; ZoomFactor: Double = 200); +var + W, H, zoomW, zoomH: integer; + CursorP, CenterP: TPoint; + SourceR: TRect; + Multiplier: Double; +begin + GetCursorPos(CursorP); + + W := DestR.Right - DestR.Left; + H := DestR.Bottom - DestR.Top; + + // Get the zoom width and height + if ZoomFactor < 0 then ZoomFactor := 100; + Multiplier := ZoomFactor / 100; + zoomW := Round(W * Multiplier); + zoomH := Round(H * Multiplier); + + // Get the zoomed Rect + SourceR.Left := CursorP.X - (zoomW div 2); + SourceR.Top := CursorP.Y - (zoomH div 2); + SourceR.Right := SourceR.Left + zoomW; + SourceR.Bottom := SourceR.Top + zoomH; + + DestCanvas.Lock; + try + // Draw the screenshot + DestCanvas.FillRect(DestR); + SpScreenShot(SourceR, DestCanvas, DestR); + CenterP := Point(W div 2, H div 2); + CenterColor := DestCanvas.Pixels[CenterP.X, CenterP.Y]; + + // Draw the crosshair + if DrawCrosshair then begin + DestCanvas.MoveTo(CenterP.X - (CenterP.X div 2), CenterP.Y); + DestCanvas.LineTo(CenterP.X + (CenterP.X div 2), CenterP.Y); + DestCanvas.MoveTo(CenterP.X, CenterP.Y - (CenterP.Y div 2)); + DestCanvas.LineTo(CenterP.X, CenterP.Y + (CenterP.Y div 2)); + end; + finally + DestCanvas.Unlock; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorPickerDragObject } + +function TSpTBXColorPickerDragObject.GetDragCursor(Accepted: Boolean; X, + Y: Integer): TCursor; +begin + // Make sure we always use crSpTBXEyeDropper + Result := crSpTBXEyeDropper; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorEditPopupMenu } + +constructor TSpTBXColorEditPopupMenu.Create(AOwner: TComponent); +begin + inherited; + BorderStyle := pbsSizeableRightBottom; +end; + +procedure TSpTBXColorEditPopupMenu.DoGetPopupFormClass(var AFormClass: TCustomFormClass); +begin + AFormClass := TSpTBXColorPickerForm; + inherited DoGetPopupFormClass(AFormClass); +end; + +function TSpTBXColorEditPopupMenu.InternalPopup(X, Y: Integer; + ForceFocus: Boolean; PopupControl: TControl): Boolean; +begin + if Assigned(PopupControl) and (PopupControl is TSpTBXColorEdit) then + SkinType := TSpTBXColorEdit(PopupControl).SkinType; + Result := inherited InternalPopup(X, Y, ForceFocus, PopupControl); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorPickerForm } + +procedure TSpTBXColorPickerForm.FormCreate(Sender: TObject); +begin + SpTBXTabControl1.DoubleBuffered := True; + imgPalette.Cursor := crSpTBXEyeDropper; +end; + +procedure TSpTBXColorPickerForm.FormDestroy(Sender: TObject); +begin + FreeAndNil(FColorPickerDragObject); +end; + +procedure TSpTBXColorPickerForm.FormResize(Sender: TObject); +begin + CenterImages; +end; + +procedure TSpTBXColorPickerForm.FormShow(Sender: TObject); +var + T: TSpTBXSkinType; +begin + if Assigned(ActiveFormPopupMenu) then begin + T := ActiveFormPopupMenu.SkinType; + SkinManager.ChangeControlSkinType(Self, T); + if T <> sknSkin then + SpTBXTabControl1.TabBackgroundColor := clBtnFace; + end; + + UpdateColorLabel(GetSelectedColor); + CenterImages; +end; + +procedure TSpTBXColorPickerForm.CenterImages; +begin + // Center the images + case SpTBXTabControl1.ActiveTabIndex of + 0: begin + imgPalette.Left := (imgPalette.Parent.Width - imgPalette.Width) div 2; + imgPalette.Top := (imgPalette.Parent.Height - imgPalette.Height) div 2; + end; + 2: begin + imgColorPicker.Picture := nil; + end; + end; +end; + +procedure TSpTBXColorPickerForm.btnColorDraw(Sender: TObject; + ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + if PaintStage = pstPrePaint then begin + PaintDefault := False; + InflateRect(ARect, -3, -3); + if btnColor.CaptionGlowColor = clNone then + SpDrawCheckeredBackground(ACanvas, ARect) + else begin + ACanvas.Brush.Color := btnColor.CaptionGlowColor; + ACanvas.FillRect(ARect); + end; + SpDrawRectangle(ACanvas, ARect, 0, clBtnShadow, clBtnHighlight); + end; +end; + +procedure TSpTBXColorPickerForm.btnColorDialogClick(Sender: TObject); +var + EditButton: TSpTBXColorEditButton; + P: TSpTBXFormPopupMenu; +begin + P := ActiveFormPopupMenu; + if Assigned(P) and Assigned(P.PopupComponent) and (P.PopupComponent is TSpTBXColorEditButton) then begin + EditButton := TSpTBXColorEditButton(P.PopupComponent); + Parent.Visible := False; + ColorDialog1.Color := btnColor.CaptionGlowColor; + if ColorDialog1.Execute then + EditButton.SelectedColor := ColorDialog1.Color; + P.ClosePopup(False); + end; +end; + +procedure TSpTBXColorPickerForm.btnColorDialogDraw(Sender: TObject; + ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +// Used by btnColorDialog and btnColorNone +var + B: TSpTBXSpeedButton; + Flags: Integer; + State: TSpTBXSkinStatesType; +begin + if (PaintStage = pstPrePaint) and (Sender is TSpTBXSpeedButton) then begin + PaintDefault := False; + B := Sender as TSpTBXSpeedButton; + if B.MouseInControl then begin + case SpTBXSkinType(SpTBXPanel1.SkinType) of + sknNone: + PaintDefault := True; + sknWindows: + begin + if B.Pushed then Flags := TS_PRESSED + else Flags := TS_HOT; + DrawThemeBackground(ThemeServices.Theme[teToolBar], ACanvas.Handle, TP_BUTTON, Flags, ARect, nil); + end; + sknSkin: + begin + if B.Pushed then State := sknsPushed + else State := sknsHotTrack; + CurrentSkin.PaintBackground(ACanvas, ARect, skncToolbarItem, State, True, True); + end; + end; + end; + end; +end; + +procedure TSpTBXColorPickerForm.btnColorDialogMouseEnter(Sender: TObject); +begin + FPrevLabelColor := btnColor.CaptionGlowColor; + btnLabel.Caption := SSpTBXColorPicker; +end; + +procedure TSpTBXColorPickerForm.btnColorDialogMouseLeave(Sender: TObject); +begin + UpdateColorLabel(FPrevLabelColor); +end; + +procedure TSpTBXColorPickerForm.btnColorNoneClick(Sender: TObject); +begin + SetSelectedColor(clNone); +end; + +procedure TSpTBXColorPickerForm.btnColorNoneMouseEnter(Sender: TObject); +begin + FPrevLabelColor := btnColor.CaptionGlowColor; + UpdateColorLabel(clNone); +end; + +procedure TSpTBXColorPickerForm.btnColorNoneMouseLeave(Sender: TObject); +begin + UpdateColorLabel(FPrevLabelColor); +end; + +procedure TSpTBXColorPickerForm.btnColorPickerStartDrag(Sender: TObject; + var DragObject: TDragObject); +begin + FColorPickerDragObject := TSpTBXColorPickerDragObject.Create(btnColorPicker); + DragObject := FColorPickerDragObject; +end; + +procedure TSpTBXColorPickerForm.btnColorPickerEndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if Assigned(FColorPickerDragObject) then + if FColorPickerDragObject.Dropped then + SetSelectedColor(btnColor.CaptionGlowColor); + FreeAndNil(FColorPickerDragObject); +end; + +procedure TSpTBXColorPickerForm.imgPaletteMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + SetSelectedColor(btnColor.CaptionGlowColor); +end; + +procedure TSpTBXColorPickerForm.imgPaletteMouseMove(Sender: TObject; Shift: TShiftState; + X, Y: Integer); +var + C: TColor; +begin + C := imgPalette.Picture.Bitmap.Canvas.Pixels[X, Y]; + if C <> $00010101 then + UpdateColorLabel(C); +end; + +procedure TSpTBXColorPickerForm.SpTBXTabControl1ActiveTabChange(Sender: TObject; + TabIndex: Integer); +begin + CenterImages; +end; + +procedure TSpTBXColorPickerForm.SpTBXColorListBox1Click(Sender: TObject); +begin + SetSelectedColor(SpTBXColorListBox1.Selected); +end; + +procedure TSpTBXColorPickerForm.SpTBXPanel1DrawBackground(Sender: TObject; + ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + if PaintStage = pstPrePaint then begin + PaintDefault := False; + SpDrawXPDock(ACanvas, ARect, SpTBXPanel1.SkinType); + SpDrawXPToolbar(ACanvas, ARect, SpTBXPanel1.SkinType, True, False, False, True, False); + end; +end; + +procedure TSpTBXColorPickerForm.Timer1Timer(Sender: TObject); +var + CursorP: TPoint; + Zoom: Double; + C: TColor; +begin + if not IsIconic(Application.Handle) then begin + GetCursorPos(CursorP); + CursorP := ScreenToClient(CursorP); + if btnColorPicker.Dragging and not PtInRect(ClientRect, CursorP) then begin + if not imgColorPicker.Visible then begin + imgColorPicker.Visible := True; + btnColorPicker.Visible := False; + SpTBXTabControl1.InvalidateBackground; + end; + Zoom := 100 / 5; // x5 factor + SpScreenShotMagnify(imgColorPicker.Canvas, Rect(0, 0, imgColorPicker.Width, imgColorPicker.Height), True, C, Zoom); + UpdateColorLabel(C); + end + else + if imgColorPicker.Visible then begin + imgColorPicker.Visible := False; + btnColorPicker.Visible := True; + SpTBXTabControl1.InvalidateBackground; + end; + end; +end; + +function TSpTBXColorPickerForm.GetSelectedColor: TColor; +var + B: TSpTBXColorEditButton; +begin + Result := clNone; + if Assigned(ActiveFormPopupMenu) then + if Assigned(ActiveFormPopupMenu.PopupComponent) and (ActiveFormPopupMenu.PopupComponent is TSpTBXColorEditButton) then begin + B := TSpTBXColorEditButton(ActiveFormPopupMenu.PopupComponent); + Result := B.SelectedColor; + end; +end; + +procedure TSpTBXColorPickerForm.SetSelectedColor(AColor: TColor); +var + B: TSpTBXColorEditButton; +begin + // Inform the ActiveFormPopupMenu that a selection was made. + UpdateColorLabel(AColor); + FSelectedColor := AColor; + if Assigned(ActiveFormPopupMenu) then begin + if Assigned(ActiveFormPopupMenu.PopupComponent) and (ActiveFormPopupMenu.PopupComponent is TSpTBXColorEditButton) then begin + B := TSpTBXColorEditButton(ActiveFormPopupMenu.PopupComponent); + B.SelectedColor := AColor; + end; + ActiveFormPopupMenu.ClosePopup(True); + end; +end; + +procedure TSpTBXColorPickerForm.UpdateColorLabel(AColor: TColor; AButtonType: Integer = -1); +begin + btnColor.CaptionGlowColor := AColor; + if AColor = clNone then + btnLabel.Caption := SSpTBXTransparentColor + else + btnLabel.Caption := SpColorToHTML(AColor); +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.dcu new file mode 100644 index 0000000..fe618be Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.hpp new file mode 100644 index 0000000..8a06ffd --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.hpp @@ -0,0 +1,1306 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxcontrols.pas' rev: 20.00 + +#ifndef SptbxcontrolsHPP +#define SptbxcontrolsHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxcontrols +{ +//-- type declarations ------------------------------------------------------- +typedef Classes::TStrings* TTntStrings; + +#pragma option push -b- +enum TSpTBXPanelBorder { pbrRaised, pbrDoubleRaised, pbrSunken, pbrDoubleSunken, pbrBumped, pbrEtched, pbrFramed }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXProgressCaption { pctNone, pctDefault, pctPercentage, pctProgress }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXTickMark { tmxBottomRight, tmxTopLeft, tmxBoth, tmxCenter }; +#pragma option pop + +typedef void __fastcall (__closure *TSpTBXCanResizeEvent)(System::TObject* Sender, int &NewSize, bool &Accept); + +class DELPHICLASS TSpTBXCustomPanel; +class PASCALIMPLEMENTATION TSpTBXCustomPanel : public Sptbxitem::TSpTBXCustomControl +{ + typedef Sptbxitem::TSpTBXCustomControl inherited; + +private: + bool FBorders; + TSpTBXPanelBorder FBorderType; + bool FTBXStyleBackground; + Sptbxskins::TSpTBXSkinType FSkinType; + Sptbxitem::TSpTBXDrawEvent FOnDrawBackground; + void __fastcall SetBorders(const bool Value); + void __fastcall SetBorderType(const TSpTBXPanelBorder Value); + void __fastcall SetTBXStyleBackground(const bool Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message); + MESSAGE void __fastcall CMSpTBXControlsInvalidate(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TMessage &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMWindowPosChanged(Messages::TWMWindowPosMsg &Message); + +protected: + Graphics::TBitmap* FBackground; + virtual void __fastcall AdjustClientRect(Types::TRect &Rect); + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual void __fastcall DrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + virtual void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + __property bool Borders = {read=FBorders, write=SetBorders, default=1}; + __property TSpTBXPanelBorder BorderType = {read=FBorderType, write=SetBorderType, default=5}; + __property ParentColor = {default=0}; + __property bool TBXStyleBackground = {read=FTBXStyleBackground, write=SetTBXStyleBackground, default=0}; + __property Sptbxitem::TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; + +public: + __fastcall virtual TSpTBXCustomPanel(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomPanel(void); + virtual void __fastcall InvalidateBackground(bool InvalidateChildren = true); + +__published: + __property Caption; + __property Hint; + __property Color = {default=536870911}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomPanel(HWND ParentWindow) : Sptbxitem::TSpTBXCustomControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXPanel; +class PASCALIMPLEMENTATION TSpTBXPanel : public TSpTBXCustomPanel +{ + typedef TSpTBXCustomPanel inherited; + +private: + bool FHotTracking; + bool FHotTrack; + bool FChildFocused; + void __fastcall SetHotTrack(const bool Value); + void __fastcall SetHotTracking(const bool Value); + HIDESBASE MESSAGE void __fastcall CMMouseEnter(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMMouseLeave(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMFocusChanged(Controls::TCMFocusChanged &Message); + +protected: + virtual void __fastcall DrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + +public: + __property bool HotTracking = {read=FHotTracking, nodefault}; + +__published: + __property Align = {default=0}; + __property Anchors = {default=3}; + __property AutoSize = {default=0}; + __property BiDiMode; + __property Constraints; + __property UseDockManager = {default=0}; + __property DockSite = {default=0}; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentBiDiMode = {default=1}; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowHint; + __property TabOrder = {default=-1}; + __property TabStop = {default=0}; + __property Visible = {default=1}; + __property OnCanResize; + __property OnClick; + __property OnConstrainedResize; + __property OnContextPopup; + __property OnDockDrop; + __property OnDockOver; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnEnter; + __property OnExit; + __property OnGetSiteInfo; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnResize; + __property OnStartDock; + __property OnStartDrag; + __property OnUnDock; + __property Borders = {default=1}; + __property BorderType = {default=5}; + __property bool HotTrack = {read=FHotTrack, write=SetHotTrack, default=0}; + __property TBXStyleBackground = {default=0}; + __property OnDrawBackground; +public: + /* TSpTBXCustomPanel.Create */ inline __fastcall virtual TSpTBXPanel(Classes::TComponent* AOwner) : TSpTBXCustomPanel(AOwner) { } + /* TSpTBXCustomPanel.Destroy */ inline __fastcall virtual ~TSpTBXPanel(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXPanel(HWND ParentWindow) : TSpTBXCustomPanel(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomGroupBox; +class PASCALIMPLEMENTATION TSpTBXCustomGroupBox : public TSpTBXCustomPanel +{ + typedef TSpTBXCustomPanel inherited; + +private: + HIDESBASE MESSAGE void __fastcall CMDialogChar(Messages::TWMKey &Message); + HIDESBASE MESSAGE void __fastcall CMTextChanged(Messages::TMessage &Message); + +protected: + virtual void __fastcall AdjustClientRect(Types::TRect &Rect); + virtual void __fastcall DrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + +public: + __fastcall virtual TSpTBXCustomGroupBox(Classes::TComponent* AOwner); +public: + /* TSpTBXCustomPanel.Destroy */ inline __fastcall virtual ~TSpTBXCustomGroupBox(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomGroupBox(HWND ParentWindow) : TSpTBXCustomPanel(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXGroupBox; +class PASCALIMPLEMENTATION TSpTBXGroupBox : public TSpTBXCustomGroupBox +{ + typedef TSpTBXCustomGroupBox inherited; + +__published: + __property Align = {default=0}; + __property Anchors = {default=3}; + __property BiDiMode; + __property Color = {default=536870911}; + __property Constraints; + __property UseDockManager = {default=0}; + __property DockSite = {default=0}; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentBiDiMode = {default=1}; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowHint; + __property TabOrder = {default=-1}; + __property TabStop = {default=0}; + __property Visible = {default=1}; + __property OnCanResize; + __property OnClick; + __property OnConstrainedResize; + __property OnContextPopup; + __property OnDockDrop; + __property OnDockOver; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnEnter; + __property OnExit; + __property OnGetSiteInfo; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnResize; + __property OnStartDock; + __property OnStartDrag; + __property OnUnDock; + __property Borders = {default=1}; + __property BorderType = {default=5}; + __property TBXStyleBackground = {default=0}; + __property OnDrawBackground; +public: + /* TSpTBXCustomGroupBox.Create */ inline __fastcall virtual TSpTBXGroupBox(Classes::TComponent* AOwner) : TSpTBXCustomGroupBox(AOwner) { } + +public: + /* TSpTBXCustomPanel.Destroy */ inline __fastcall virtual ~TSpTBXGroupBox(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXGroupBox(HWND ParentWindow) : TSpTBXCustomGroupBox(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXTextObjectActionLink; +class PASCALIMPLEMENTATION TSpTBXTextObjectActionLink : public Controls::TControlActionLink +{ + typedef Controls::TControlActionLink inherited; + +public: + /* TBasicActionLink.Create */ inline __fastcall virtual TSpTBXTextObjectActionLink(System::TObject* AClient) : Controls::TControlActionLink(AClient) { } + /* TBasicActionLink.Destroy */ inline __fastcall virtual ~TSpTBXTextObjectActionLink(void) { } + +}; + + +class DELPHICLASS TSpTBXTextObject; +class PASCALIMPLEMENTATION TSpTBXTextObject : public Sptbxitem::TSpTBXCustomControl +{ + typedef Sptbxitem::TSpTBXCustomControl inherited; + +private: + Classes::TAlignment FAlignment; + Sptbxskins::TSpGlowDirection FCaptionGlow; + Graphics::TColor FCaptionGlowColor; + Sptbxskins::TSpTextRotationAngle FCaptionRoatationAngle; + bool FChecked; + bool FDisabledIconCorrection; + bool FDrawPushedCaption; + Sptbxskins::TSpGlyphLayout FGlyphLayout; + Imglist::TCustomImageList* FImages; + Imglist::TChangeLink* FImageChangeLink; + Imglist::TImageIndex FImageIndex; + System::WideString FLinkText; + System::WideString FLinkTextParams; + bool FMouseInControl; + bool FPushed; + Sptbxskins::TSpTBXSkinType FSkinType; + bool FSpaceAsClick; + bool FShowAccelChar; + bool FUpdating; + Sptbxitem::TTextWrapping FWrapping; + Sptbxitem::TSpTBXDrawEvent FOnDraw; + Sptbxitem::TSpTBXDrawTextEvent FOnDrawCaption; + Sptbxitem::TSpTBXDrawHintEvent FOnDrawHint; + Sptbxitem::TSpTBXGetImageIndexEvent FOnGetImageIndex; + Classes::TNotifyEvent FOnMouseEnter; + Classes::TNotifyEvent FOnMouseLeave; + void __fastcall ReadLinkFont(Classes::TReader* Reader); + void __fastcall ImageListChange(System::TObject* Sender); + void __fastcall UpdateTracking(bool ForceMouseLeave = false); + void __fastcall SetAlignment(const Classes::TAlignment Value); + void __fastcall SetCaptionGlow(const Sptbxskins::TSpGlowDirection Value); + void __fastcall SetCaptionGlowColor(const Graphics::TColor Value); + void __fastcall SetCaptionRoatationAngle(const Sptbxskins::TSpTextRotationAngle Value); + void __fastcall SetGlyphLayout(const Sptbxskins::TSpGlyphLayout Value); + void __fastcall SetImageIndex(const Imglist::TImageIndex Value); + void __fastcall SetImages(const Imglist::TCustomImageList* Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + void __fastcall SetShowAccelChar(bool Value); + void __fastcall SetWrapping(Sptbxitem::TTextWrapping Value); + HIDESBASE MESSAGE void __fastcall CMEnabledChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMHintShow(Controls::TCMHintShow &Message); + HIDESBASE MESSAGE void __fastcall CMMouseEnter(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMMouseLeave(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMTextChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMKillFocus(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMSetFocus(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + virtual void __fastcall AdjustFont(Graphics::TFont* AFont); + void __fastcall AdjustBounds(void); + virtual void __fastcall DoDrawHint(Graphics::TBitmap* AHintBitmap, System::WideString &AHint, bool &PaintDefault); + virtual bool __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + virtual int __fastcall DoDrawText(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Flags); + virtual void __fastcall DoGetImageIndex(Imglist::TCustomImageList* &AImageList, int &AImageIndex); + virtual void __fastcall DoInternalGlyphDraw(Graphics::TCanvas* ACanvas, const Types::TRect &AGlyphRect); + virtual Types::TRect __fastcall GetFocusRect(const Types::TRect &R, const Types::TRect &TextR, const Types::TRect &GlyphR); + virtual Types::TRect __fastcall GetTextMargins(); + bool __fastcall IsImageIndexValid(void); + virtual void __fastcall Paint(void); + virtual bool __fastcall CanAutoSize(int &NewWidth, int &NewHeight); + virtual void __fastcall DoAdjustBounds(int &NewWidth, int &NewHeight); + virtual bool __fastcall GetFocused(void); + virtual bool __fastcall GetPushed(void); + virtual void __fastcall DoMouseEnter(void); + virtual void __fastcall DoMouseLeave(void); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall KeyDown(System::Word &Key, Classes::TShiftState Shift); + DYNAMIC void __fastcall KeyUp(System::Word &Key, Classes::TShiftState Shift); + DYNAMIC void __fastcall ActionChange(System::TObject* Sender, bool CheckDefaults); + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual void __fastcall DefineProperties(Classes::TFiler* Filer); + virtual void __fastcall ExecuteLink(void); + DYNAMIC Controls::TControlActionLinkClass __fastcall GetActionLinkClass(void); + virtual bool __fastcall GetChecked(void); + virtual void __fastcall SetChecked(bool Value); + virtual void __fastcall Loaded(void); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + __property Classes::TAlignment Alignment = {read=FAlignment, write=SetAlignment, default=0}; + __property AutoSize = {default=1}; + __property bool Checked = {read=GetChecked, write=SetChecked, default=0}; + __property Sptbxskins::TSpGlowDirection CaptionGlow = {read=FCaptionGlow, write=SetCaptionGlow, default=0}; + __property Graphics::TColor CaptionGlowColor = {read=FCaptionGlowColor, write=SetCaptionGlowColor, default=65535}; + __property Sptbxskins::TSpTextRotationAngle CaptionRoatationAngle = {read=FCaptionRoatationAngle, write=SetCaptionRoatationAngle, default=0}; + __property bool DrawPushedCaption = {read=FDrawPushedCaption, write=FDrawPushedCaption, default=0}; + __property bool DisabledIconCorrection = {read=FDisabledIconCorrection, write=FDisabledIconCorrection, default=1}; + __property Sptbxskins::TSpGlyphLayout GlyphLayout = {read=FGlyphLayout, write=SetGlyphLayout, default=0}; + __property Imglist::TCustomImageList* Images = {read=FImages, write=SetImages}; + __property Imglist::TImageIndex ImageIndex = {read=FImageIndex, write=SetImageIndex, default=-1}; + __property System::WideString LinkText = {read=FLinkText, write=FLinkText}; + __property System::WideString LinkTextParams = {read=FLinkTextParams, write=FLinkTextParams}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; + __property bool ShowAccelChar = {read=FShowAccelChar, write=SetShowAccelChar, default=1}; + __property bool SpaceAsClick = {read=FSpaceAsClick, write=FSpaceAsClick, default=0}; + __property Sptbxitem::TTextWrapping Wrapping = {read=FWrapping, write=SetWrapping, default=0}; + __property Sptbxitem::TSpTBXDrawEvent OnDraw = {read=FOnDraw, write=FOnDraw}; + __property Sptbxitem::TSpTBXDrawTextEvent OnDrawCaption = {read=FOnDrawCaption, write=FOnDrawCaption}; + __property Sptbxitem::TSpTBXDrawHintEvent OnDrawHint = {read=FOnDrawHint, write=FOnDrawHint}; + __property Sptbxitem::TSpTBXGetImageIndexEvent OnGetImageIndex = {read=FOnGetImageIndex, write=FOnGetImageIndex}; + __property Classes::TNotifyEvent OnMouseEnter = {read=FOnMouseEnter, write=FOnMouseEnter}; + __property Classes::TNotifyEvent OnMouseLeave = {read=FOnMouseLeave, write=FOnMouseLeave}; + __property TabStop = {default=1}; + __property ParentColor = {default=0}; + +public: + __fastcall virtual TSpTBXTextObject(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXTextObject(void); + DYNAMIC bool __fastcall CanFocus(void); + DYNAMIC void __fastcall Click(void); + DYNAMIC Classes::TAlignment __fastcall GetControlsAlignment(void); + virtual void __fastcall GetSize(/* out */ Types::TRect &TotalR, /* out */ Types::TRect &TextR, /* out */ Types::TRect &GlyphR); + unsigned __fastcall GetTextFlags(void); + virtual tagSIZE __fastcall GetGlyphSize(); + __property Canvas; + __property bool MouseInControl = {read=FMouseInControl, nodefault}; + __property bool Pushed = {read=GetPushed, nodefault}; + +__published: + __property Caption; + __property Hint; + __property Color = {default=536870911}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXTextObject(HWND ParentWindow) : Sptbxitem::TSpTBXCustomControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomLabel; +class PASCALIMPLEMENTATION TSpTBXCustomLabel : public TSpTBXTextObject +{ + typedef TSpTBXTextObject inherited; + +private: + Controls::TWinControl* FFocusControl; + bool FUnderline; + Graphics::TColor FUnderlineColor; + void __fastcall SetFocusControl(const Controls::TWinControl* Value); + void __fastcall SetUnderline(const bool Value); + void __fastcall SetUnderlineColor(const Graphics::TColor Value); + HIDESBASE MESSAGE void __fastcall CMDialogChar(Messages::TWMKey &Message); + +protected: + virtual void __fastcall AdjustFont(Graphics::TFont* AFont); + virtual bool __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + __property Controls::TWinControl* FocusControl = {read=FFocusControl, write=SetFocusControl}; + __property bool Underline = {read=FUnderline, write=SetUnderline, default=0}; + __property Graphics::TColor UnderlineColor = {read=FUnderlineColor, write=SetUnderlineColor, default=-16777200}; + +public: + __fastcall virtual TSpTBXCustomLabel(Classes::TComponent* AOwner); + virtual void __fastcall GetSize(/* out */ Types::TRect &TotalR, /* out */ Types::TRect &TextR, /* out */ Types::TRect &GlyphR); +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXCustomLabel(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomLabel(HWND ParentWindow) : TSpTBXTextObject(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXLabel; +class PASCALIMPLEMENTATION TSpTBXLabel : public TSpTBXCustomLabel +{ + typedef TSpTBXCustomLabel inherited; + +__published: + __property Action; + __property Align = {default=0}; + __property Anchors = {default=3}; + __property AutoSize = {default=1}; + __property BiDiMode; + __property Color = {default=536870911}; + __property Constraints; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentBiDiMode = {default=1}; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowAccelChar = {default=1}; + __property ShowHint; + __property Visible = {default=1}; + __property Wrapping = {default=0}; + __property OnClick; + __property OnContextPopup; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnMouseDown; + __property OnMouseEnter; + __property OnMouseLeave; + __property OnMouseMove; + __property OnMouseUp; + __property OnStartDock; + __property OnStartDrag; + __property Alignment = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property FocusControl; + __property GlyphLayout = {default=0}; + __property Images; + __property ImageIndex = {default=-1}; + __property LinkText; + __property LinkTextParams; + __property SkinType = {default=2}; + __property Underline = {default=0}; + __property UnderlineColor = {default=-16777200}; + __property OnDraw; + __property OnDrawCaption; + __property OnDrawHint; + __property OnGetImageIndex; +public: + /* TSpTBXCustomLabel.Create */ inline __fastcall virtual TSpTBXLabel(Classes::TComponent* AOwner) : TSpTBXCustomLabel(AOwner) { } + +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXLabel(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXLabel(HWND ParentWindow) : TSpTBXCustomLabel(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXButtonControl; +class PASCALIMPLEMENTATION TSpTBXButtonControl : public TSpTBXTextObject +{ + typedef TSpTBXTextObject inherited; + +private: + bool FAllowAllUp; + int FGroupIndex; + bool FStateChanged; + void __fastcall SetAllowAllUp(const bool Value); + void __fastcall SetGroupIndex(const int Value); + HIDESBASE MESSAGE void __fastcall CMDialogChar(Messages::TWMKey &Message); + MESSAGE void __fastcall CMSPGroupIndexUpdate(Messages::TMessage &Message); + +protected: + virtual bool __fastcall CanUpdateExclusive(void); + virtual void __fastcall SetChecked(bool Value); + void __fastcall UpdateExclusive(void); + __property bool AllowAllUp = {read=FAllowAllUp, write=SetAllowAllUp, default=0}; + __property int GroupIndex = {read=FGroupIndex, write=SetGroupIndex, default=0}; + __property bool StateChanged = {read=FStateChanged, write=FStateChanged, nodefault}; + +public: + __fastcall virtual TSpTBXButtonControl(Classes::TComponent* AOwner); + DYNAMIC bool __fastcall CanFocus(void); +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXButtonControl(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXButtonControl(HWND ParentWindow) : TSpTBXTextObject(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomCheckButton; +class PASCALIMPLEMENTATION TSpTBXCustomCheckButton : public TSpTBXButtonControl +{ + typedef TSpTBXButtonControl inherited; + +protected: + virtual void __fastcall Toggle(void); + +public: + virtual tagSIZE __fastcall GetGlyphSize(); + virtual void __fastcall GetSize(/* out */ Types::TRect &TotalR, /* out */ Types::TRect &TextR, /* out */ Types::TRect &GlyphR); +public: + /* TSpTBXButtonControl.Create */ inline __fastcall virtual TSpTBXCustomCheckButton(Classes::TComponent* AOwner) : TSpTBXButtonControl(AOwner) { } + +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXCustomCheckButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomCheckButton(HWND ParentWindow) : TSpTBXButtonControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomCheckBox; +class PASCALIMPLEMENTATION TSpTBXCustomCheckBox : public TSpTBXCustomCheckButton +{ + typedef TSpTBXCustomCheckButton inherited; + +private: + bool FAllowGrayed; + Stdctrls::TCheckBoxState FState; + void __fastcall SetState(const Stdctrls::TCheckBoxState Value); + +protected: + virtual void __fastcall AdjustFont(Graphics::TFont* AFont); + virtual void __fastcall DoInternalGlyphDraw(Graphics::TCanvas* ACanvas, const Types::TRect &AGlyphRect); + virtual bool __fastcall GetChecked(void); + virtual void __fastcall SetChecked(bool Value); + virtual void __fastcall Toggle(void); + __property bool AllowGrayed = {read=FAllowGrayed, write=FAllowGrayed, default=0}; + __property Stdctrls::TCheckBoxState State = {read=FState, write=SetState, default=0}; + +public: + __fastcall virtual TSpTBXCustomCheckBox(Classes::TComponent* AOwner); + DYNAMIC void __fastcall Click(void); +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXCustomCheckBox(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomCheckBox(HWND ParentWindow) : TSpTBXCustomCheckButton(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCheckBox; +class PASCALIMPLEMENTATION TSpTBXCheckBox : public TSpTBXCustomCheckBox +{ + typedef TSpTBXCustomCheckBox inherited; + +__published: + __property Action; + __property Align = {default=0}; + __property Anchors = {default=3}; + __property AutoSize = {default=1}; + __property BiDiMode; + __property Color = {default=536870911}; + __property Constraints; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentBiDiMode = {default=1}; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowAccelChar = {default=1}; + __property ShowHint; + __property TabOrder = {default=-1}; + __property TabStop = {default=1}; + __property Visible = {default=1}; + __property Wrapping = {default=0}; + __property OnClick; + __property OnContextPopup; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnMouseDown; + __property OnMouseEnter; + __property OnMouseLeave; + __property OnMouseMove; + __property OnMouseUp; + __property OnStartDock; + __property OnStartDrag; + __property Alignment = {default=0}; + __property AllowGrayed = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property Checked = {default=0}; + __property State = {default=0}; + __property SkinType = {default=2}; + __property OnDraw; + __property OnDrawCaption; + __property OnDrawHint; + __property OnGetImageIndex; +public: + /* TSpTBXCustomCheckBox.Create */ inline __fastcall virtual TSpTBXCheckBox(Classes::TComponent* AOwner) : TSpTBXCustomCheckBox(AOwner) { } + +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXCheckBox(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCheckBox(HWND ParentWindow) : TSpTBXCustomCheckBox(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomRadioButton; +class PASCALIMPLEMENTATION TSpTBXCustomRadioButton : public TSpTBXCustomCheckButton +{ + typedef TSpTBXCustomCheckButton inherited; + +private: + HIDESBASE MESSAGE void __fastcall CMFocusChanged(Controls::TCMFocusChanged &Message); + +protected: + virtual void __fastcall AdjustFont(Graphics::TFont* AFont); + virtual bool __fastcall CanUpdateExclusive(void); + virtual void __fastcall DoInternalGlyphDraw(Graphics::TCanvas* ACanvas, const Types::TRect &AGlyphRect); + virtual void __fastcall SetChecked(bool Value); + virtual void __fastcall Toggle(void); + __property TabStop = {default=0}; + +public: + __fastcall virtual TSpTBXCustomRadioButton(Classes::TComponent* AOwner); + DYNAMIC void __fastcall Click(void); +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXCustomRadioButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomRadioButton(HWND ParentWindow) : TSpTBXCustomCheckButton(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXRadioButton; +class PASCALIMPLEMENTATION TSpTBXRadioButton : public TSpTBXCustomRadioButton +{ + typedef TSpTBXCustomRadioButton inherited; + +__published: + __property Action; + __property Align = {default=0}; + __property Anchors = {default=3}; + __property AutoSize = {default=1}; + __property BiDiMode; + __property Color = {default=536870911}; + __property Constraints; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentBiDiMode = {default=1}; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowAccelChar = {default=1}; + __property ShowHint; + __property TabOrder = {default=-1}; + __property TabStop = {default=0}; + __property Visible = {default=1}; + __property Wrapping = {default=0}; + __property OnClick; + __property OnContextPopup; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnMouseDown; + __property OnMouseEnter; + __property OnMouseLeave; + __property OnMouseMove; + __property OnMouseUp; + __property OnStartDock; + __property OnStartDrag; + __property Alignment = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property Checked = {default=0}; + __property GroupIndex = {default=0}; + __property SkinType = {default=2}; + __property OnDraw; + __property OnDrawCaption; + __property OnDrawHint; + __property OnGetImageIndex; +public: + /* TSpTBXCustomRadioButton.Create */ inline __fastcall virtual TSpTBXRadioButton(Classes::TComponent* AOwner) : TSpTBXCustomRadioButton(AOwner) { } + +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXRadioButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXRadioButton(HWND ParentWindow) : TSpTBXCustomRadioButton(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomRadioGroup; +class PASCALIMPLEMENTATION TSpTBXCustomRadioGroup : public TSpTBXCustomGroupBox +{ + typedef TSpTBXCustomGroupBox inherited; + +private: + Classes::TList* FButtons; + Classes::TStrings* FItems; + int FItemIndex; + int FColumns; + bool FReading; + bool FUpdating; + TSpTBXRadioButton* __fastcall GetButtons(int Index); + void __fastcall ArrangeButtons(void); + void __fastcall ButtonClick(System::TObject* Sender); + void __fastcall ItemsChange(System::TObject* Sender); + void __fastcall SetButtonCount(int Value); + void __fastcall SetColumns(int Value); + void __fastcall SetItemIndex(int Value); + void __fastcall SetItems(Classes::TStrings* Value); + void __fastcall UpdateButtons(void); + HIDESBASE MESSAGE void __fastcall CMEnabledChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message); + +protected: + virtual void __fastcall Loaded(void); + virtual void __fastcall ReadState(Classes::TReader* Reader); + __property int Columns = {read=FColumns, write=SetColumns, default=1}; + __property int ItemIndex = {read=FItemIndex, write=SetItemIndex, default=-1}; + __property Classes::TStrings* Items = {read=FItems, write=SetItems}; + +public: + __fastcall virtual TSpTBXCustomRadioGroup(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomRadioGroup(void); + DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root); + DYNAMIC void __fastcall FlipChildren(bool AllLevels); + virtual void __fastcall InvalidateBackground(bool InvalidateChildren = true); + virtual void __fastcall SetFocus(void); + __property TSpTBXRadioButton* Buttons[int Index] = {read=GetButtons}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomRadioGroup(HWND ParentWindow) : TSpTBXCustomGroupBox(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXRadioGroup; +class PASCALIMPLEMENTATION TSpTBXRadioGroup : public TSpTBXCustomRadioGroup +{ + typedef TSpTBXCustomRadioGroup inherited; + +__published: + __property Align = {default=0}; + __property Anchors = {default=3}; + __property BiDiMode; + __property Color = {default=536870911}; + __property Constraints; + __property UseDockManager = {default=0}; + __property DockSite = {default=0}; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentBiDiMode = {default=1}; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowHint; + __property TabOrder = {default=-1}; + __property TabStop = {default=0}; + __property Visible = {default=1}; + __property OnCanResize; + __property OnClick; + __property OnConstrainedResize; + __property OnContextPopup; + __property OnDockDrop; + __property OnDockOver; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnEnter; + __property OnExit; + __property OnGetSiteInfo; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnResize; + __property OnStartDock; + __property OnStartDrag; + __property OnUnDock; + __property Borders = {default=1}; + __property BorderType = {default=5}; + __property TBXStyleBackground = {default=0}; + __property OnDrawBackground; + __property Columns = {default=1}; + __property ItemIndex = {default=-1}; + __property Items; +public: + /* TSpTBXCustomRadioGroup.Create */ inline __fastcall virtual TSpTBXRadioGroup(Classes::TComponent* AOwner) : TSpTBXCustomRadioGroup(AOwner) { } + /* TSpTBXCustomRadioGroup.Destroy */ inline __fastcall virtual ~TSpTBXRadioGroup(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXRadioGroup(HWND ParentWindow) : TSpTBXCustomRadioGroup(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomButton; +class PASCALIMPLEMENTATION TSpTBXCustomButton : public TSpTBXButtonControl +{ + typedef TSpTBXButtonControl inherited; + +private: + Graphics::TBitmap* FBitmap; + bool FBitmapTransparent; + bool FActive; + bool FCancel; + bool FDefault; + bool FDropDownArrow; + Menus::TPopupMenu* FDropDownMenu; + bool FDropDownMenuVisible; + bool FFlat; + Controls::TModalResult FModalResult; + bool FRepeating; + Extctrls::TTimer* FRepeatTimer; + void __fastcall BitmapChanged(System::TObject* Sender); + void __fastcall RepeatTimerHandler(System::TObject* Sender); + void __fastcall SetBitmap(const Graphics::TBitmap* Value); + void __fastcall SetDefault(const bool Value); + void __fastcall SetDropDownArrow(const bool Value); + void __fastcall SetDropdownMenu(Menus::TPopupMenu* Value); + void __fastcall SetFlat(const bool Value); + HIDESBASE MESSAGE void __fastcall CMDialogKey(Messages::TWMKey &Message); + HIDESBASE MESSAGE void __fastcall CMFocusChanged(Controls::TCMFocusChanged &Message); + MESSAGE void __fastcall CMSPPopupClose(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMCancelMode(Messages::TWMNoParams &Message); + +protected: + Controls::TControl* FPopupControl; + virtual void __fastcall CreateWnd(void); + virtual void __fastcall AdjustFont(Graphics::TFont* AFont); + bool __fastcall BitmapValid(void); + virtual bool __fastcall DoDrawDropDownArrow(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + virtual bool __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + virtual bool __fastcall GetFocused(void); + virtual Types::TRect __fastcall GetFocusRect(const Types::TRect &R, const Types::TRect &TextR, const Types::TRect &GlyphR); + virtual Menus::TPopupMenu* __fastcall GetInternalDropDownMenu(void); + virtual bool __fastcall GetPushed(void); + virtual Types::TRect __fastcall GetTextMargins(); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + __property Alignment = {default=2}; + __property Graphics::TBitmap* Bitmap = {read=FBitmap, write=SetBitmap}; + __property bool BitmapTransparent = {read=FBitmapTransparent, write=FBitmapTransparent, default=1}; + __property DrawPushedCaption = {default=1}; + __property bool Cancel = {read=FCancel, write=FCancel, default=0}; + __property bool Default = {read=FDefault, write=SetDefault, default=0}; + __property bool DropDownArrow = {read=FDropDownArrow, write=SetDropDownArrow, default=1}; + __property Menus::TPopupMenu* DropDownMenu = {read=FDropDownMenu, write=SetDropdownMenu}; + __property bool Flat = {read=FFlat, write=SetFlat, default=0}; + __property Controls::TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=0}; + __property bool Repeating = {read=FRepeating, write=FRepeating, default=0}; + +public: + __fastcall virtual TSpTBXCustomButton(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomButton(void); + DYNAMIC void __fastcall Click(void); + Types::TRect __fastcall GetSkinStateRect(); + bool __fastcall IsDroppedDown(void); + virtual void __fastcall StopRepeat(void); +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomButton(HWND ParentWindow) : TSpTBXButtonControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXButton; +class PASCALIMPLEMENTATION TSpTBXButton : public TSpTBXCustomButton +{ + typedef TSpTBXCustomButton inherited; + +__published: + __property Action; + __property Align = {default=0}; + __property Anchors = {default=3}; + __property BiDiMode; + __property Color = {default=536870911}; + __property Constraints; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentBiDiMode = {default=1}; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowAccelChar = {default=1}; + __property ShowHint; + __property TabOrder = {default=-1}; + __property TabStop = {default=1}; + __property Visible = {default=1}; + __property Wrapping = {default=0}; + __property OnClick; + __property OnContextPopup; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnMouseDown; + __property OnMouseEnter; + __property OnMouseLeave; + __property OnMouseMove; + __property OnMouseUp; + __property OnStartDock; + __property OnStartDrag; + __property Alignment = {default=2}; + __property Bitmap; + __property BitmapTransparent = {default=1}; + __property Cancel = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property Checked = {default=0}; + __property Default = {default=0}; + __property DrawPushedCaption = {default=1}; + __property DropDownArrow = {default=1}; + __property DropDownMenu; + __property Flat = {default=0}; + __property GlyphLayout = {default=0}; + __property GroupIndex = {default=0}; + __property Images; + __property ImageIndex = {default=-1}; + __property LinkText; + __property LinkTextParams; + __property ModalResult = {default=0}; + __property SkinType = {default=2}; + __property Repeating = {default=0}; + __property OnDraw; + __property OnDrawCaption; + __property OnDrawHint; + __property OnGetImageIndex; +public: + /* TSpTBXCustomButton.Create */ inline __fastcall virtual TSpTBXButton(Classes::TComponent* AOwner) : TSpTBXCustomButton(AOwner) { } + /* TSpTBXCustomButton.Destroy */ inline __fastcall virtual ~TSpTBXButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXButton(HWND ParentWindow) : TSpTBXCustomButton(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomSpeedButton; +class PASCALIMPLEMENTATION TSpTBXCustomSpeedButton : public TSpTBXCustomButton +{ + typedef TSpTBXCustomButton inherited; + +public: + __fastcall virtual TSpTBXCustomSpeedButton(Classes::TComponent* AOwner); + DYNAMIC bool __fastcall CanFocus(void); + DYNAMIC void __fastcall Click(void); +public: + /* TSpTBXCustomButton.Destroy */ inline __fastcall virtual ~TSpTBXCustomSpeedButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomSpeedButton(HWND ParentWindow) : TSpTBXCustomButton(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXSpeedButton; +class PASCALIMPLEMENTATION TSpTBXSpeedButton : public TSpTBXCustomSpeedButton +{ + typedef TSpTBXCustomSpeedButton inherited; + +__published: + __property Action; + __property Align = {default=0}; + __property Anchors = {default=3}; + __property BiDiMode; + __property Color = {default=536870911}; + __property Constraints; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentBiDiMode = {default=1}; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowAccelChar = {default=1}; + __property ShowHint; + __property Visible = {default=1}; + __property Wrapping = {default=0}; + __property OnClick; + __property OnContextPopup; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnMouseDown; + __property OnMouseEnter; + __property OnMouseLeave; + __property OnMouseMove; + __property OnMouseUp; + __property OnStartDock; + __property OnStartDrag; + __property Alignment = {default=2}; + __property AllowAllUp = {default=0}; + __property Bitmap; + __property BitmapTransparent = {default=1}; + __property Cancel = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property Checked = {default=0}; + __property Default = {default=0}; + __property DrawPushedCaption = {default=1}; + __property DropDownArrow = {default=1}; + __property DropDownMenu; + __property Flat = {default=0}; + __property GlyphLayout = {default=0}; + __property GroupIndex = {default=0}; + __property Images; + __property ImageIndex = {default=-1}; + __property LinkText; + __property LinkTextParams; + __property SkinType = {default=2}; + __property Repeating = {default=0}; + __property OnDraw; + __property OnDrawCaption; + __property OnDrawHint; + __property OnGetImageIndex; +public: + /* TSpTBXCustomSpeedButton.Create */ inline __fastcall virtual TSpTBXSpeedButton(Classes::TComponent* AOwner) : TSpTBXCustomSpeedButton(AOwner) { } + +public: + /* TSpTBXCustomButton.Destroy */ inline __fastcall virtual ~TSpTBXSpeedButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXSpeedButton(HWND ParentWindow) : TSpTBXCustomSpeedButton(ParentWindow) { } + +}; + + +typedef void __fastcall (__closure *TSpTBXProgressBarChangeEvent)(System::TObject* Sender, int NewPosition); + +class DELPHICLASS TSpTBXCustomProgressBar; +class PASCALIMPLEMENTATION TSpTBXCustomProgressBar : public TSpTBXTextObject +{ + typedef TSpTBXTextObject inherited; + +private: + int FMin; + int FMax; + int FPosition; + bool FProgressVisible; + bool FSmooth; + bool FVertical; + TSpTBXProgressCaption FCaptionType; + TSpTBXProgressBarChangeEvent FOnProgressChange; + void __fastcall SetMax(const int Value); + void __fastcall SetMin(const int Value); + void __fastcall SetPosition(int Value); + void __fastcall SetSmooth(const bool Value); + void __fastcall SetVertical(const bool Value); + void __fastcall SetCaptionType(const TSpTBXProgressCaption Value); + void __fastcall SetProgressVisible(const bool Value); + +protected: + virtual void __fastcall AdjustFont(Graphics::TFont* AFont); + virtual bool __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + virtual void __fastcall DoProgressChange(void); + virtual Types::TRect __fastcall GetTextMargins(); + __property Alignment = {default=2}; + __property CaptionGlow = {default=1}; + __property TSpTBXProgressCaption CaptionType = {read=FCaptionType, write=SetCaptionType, default=2}; + __property int Max = {read=FMax, write=SetMax, default=100}; + __property int Min = {read=FMin, write=SetMin, default=0}; + __property int Position = {read=FPosition, write=SetPosition, default=0}; + __property bool ProgressVisible = {read=FProgressVisible, write=SetProgressVisible, default=1}; + __property bool Smooth = {read=FSmooth, write=SetSmooth, default=0}; + __property bool Vertical = {read=FVertical, write=SetVertical, default=0}; + __property TSpTBXProgressBarChangeEvent OnProgressChange = {read=FOnProgressChange, write=FOnProgressChange}; + +public: + __fastcall virtual TSpTBXCustomProgressBar(Classes::TComponent* AOwner); + void __fastcall StepIt(int Delta = 0x1); +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXCustomProgressBar(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomProgressBar(HWND ParentWindow) : TSpTBXTextObject(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXProgressBar; +class PASCALIMPLEMENTATION TSpTBXProgressBar : public TSpTBXCustomProgressBar +{ + typedef TSpTBXCustomProgressBar inherited; + +__published: + __property Align = {default=0}; + __property Anchors = {default=3}; + __property Color = {default=536870911}; + __property Constraints; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentColor = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowHint; + __property Visible = {default=1}; + __property OnClick; + __property OnContextPopup; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnMouseDown; + __property OnMouseEnter; + __property OnMouseLeave; + __property OnMouseMove; + __property OnMouseUp; + __property OnStartDock; + __property OnStartDrag; + __property Alignment = {default=2}; + __property CaptionGlow = {default=1}; + __property CaptionGlowColor = {default=65535}; + __property CaptionType = {default=2}; + __property Max = {default=100}; + __property Min = {default=0}; + __property Position = {default=0}; + __property Smooth = {default=0}; + __property Vertical = {default=0}; + __property SkinType = {default=2}; + __property OnDraw; + __property OnDrawCaption; + __property OnDrawHint; + __property OnProgressChange; +public: + /* TSpTBXCustomProgressBar.Create */ inline __fastcall virtual TSpTBXProgressBar(Classes::TComponent* AOwner) : TSpTBXCustomProgressBar(AOwner) { } + +public: + /* TSpTBXTextObject.Destroy */ inline __fastcall virtual ~TSpTBXProgressBar(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXProgressBar(HWND ParentWindow) : TSpTBXCustomProgressBar(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXTrackBar; +class PASCALIMPLEMENTATION TSpTBXTrackBar : public Comctrls::TTrackBar +{ + typedef Comctrls::TTrackBar inherited; + +private: + Sptbxskins::TSpTBXSkinType FSkinType; + TSpTBXTickMark FTickMarks; + Sptbxitem::TSpTBXDrawEvent FOnDrawChannel; + Sptbxitem::TSpTBXDrawPosEvent FOnDrawChannelTicks; + Sptbxitem::TSpTBXDrawEvent FOnDrawThumb; + bool FCanDrawChannelSelection; + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + HIDESBASE void __fastcall SetTickMarks(const TSpTBXTickMark Value); + MESSAGE void __fastcall CMSpTBXControlsInvalidate(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CNNotify(Messages::TWMNotify &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkGnd(Messages::TMessage &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual bool __fastcall DoDrawChannel(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + virtual bool __fastcall DoDrawChannelTicks(Graphics::TCanvas* ACanvas, int X, int Y); + virtual bool __fastcall DoDrawThumb(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + virtual void __fastcall DrawTicks(Graphics::TCanvas* ACanvas); + +public: + __fastcall virtual TSpTBXTrackBar(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXTrackBar(void); + Types::TRect __fastcall ChannelRect(); + bool __fastcall MouseInThumb(void); + void __fastcall InvalidateBackground(void); + +__published: + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; + __property TSpTBXTickMark TickMarks = {read=FTickMarks, write=SetTickMarks, default=0}; + __property Sptbxitem::TSpTBXDrawEvent OnDrawChannel = {read=FOnDrawChannel, write=FOnDrawChannel}; + __property Sptbxitem::TSpTBXDrawPosEvent OnDrawChannelTicks = {read=FOnDrawChannelTicks, write=FOnDrawChannelTicks}; + __property Sptbxitem::TSpTBXDrawEvent OnDrawThumb = {read=FOnDrawThumb, write=FOnDrawThumb}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXTrackBar(HWND ParentWindow) : Comctrls::TTrackBar(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +static const ShortInt ConstStatesCount = 0x4; +static const Word ConstInitRepeatPause = 0x190; +static const ShortInt ConstRepeatPause = 0x64; +static const Word CM_SPGROUPINDEXUPDATE = 0xb8ae; +static const Word CM_SPTBXCONTROLSINVALIDATE = 0xbd05; +extern PACKAGE void __fastcall SpDrawXPPanel(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, bool TBXStyleBackground, Sptbxskins::TSpTBXSkinType SkinType, TSpTBXPanelBorder Border); +extern PACKAGE void __fastcall SpDrawXPPanelBorder(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, TSpTBXPanelBorder Border); +extern PACKAGE void __fastcall SpDrawXPGroupBox(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, System::WideString ACaption, unsigned TextFlags, bool Enabled, bool TBXStyleBackground, Sptbxskins::TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPProgressBar(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int Min, int Max, int Position, Graphics::TBitmap* Back, Graphics::TBitmap* Fore)/* overload */; +extern PACKAGE int __fastcall SpDrawXPProgressBar(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Vertical, bool Smooth, bool DrawProgress, int Min, int Max, int Position, Sptbxskins::TSpTBXSkinType SkinType)/* overload */; +extern PACKAGE void __fastcall SpDrawXPTrackBar(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, unsigned Part, bool Vertical, bool Pushed, bool ChannelSelection, TSpTBXTickMark TickMark, int Min, int Max, int SelStart, int SelEnd, Sptbxskins::TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpInvalidateSpTBXControl(Controls::TWinControl* AControl, bool InvalidateChildren, bool OnlySpTBXControls); + +} /* namespace Sptbxcontrols */ +using namespace Sptbxcontrols; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxcontrolsHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.pas new file mode 100644 index 0000000..03f5973 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXControls.pas @@ -0,0 +1,4259 @@ +unit SpTBXControls; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development notes: + - All the theme changes and adjustments are marked with '[Theme-Change]'. + - All the compatibility changes are marked with '[Backward-Compatibility]'. + +History: +8 May 2009 - version 2.4.2 + - Added AllowAllUp property to TSpTBXSpeedButton. + +15 March 2009 - version 2.4.1 + - Added GlyphLayout property to TSpTBXButton/TSpTBXSpeedButton. + - Added Flat property to TSpTBXButton/TSpTBXSpeedButton. + - Fixed TSpTBXTrackBar bug, the Frequency property didn't work, + thanks to Alfred Vink for reporting this. + +17 January 2009 - version 2.4 + - No changes. + +28 September 2008 - version 2.3.1 + - Fixed incorrect TSpTBXGroupBox painting, the control was not + repainted when the font was changed, thanks to Yury Plashenkov + for reporting this. + +26 September 2008 - version 2.3 + - Removed LinkFont property from TSpTBXTextObject, having 2 font + properties to control the text state was a bad idea. + +29 July 2008 - version 2.2 + - Fixed incorrect ProgressBar painting on Windows Vista, + thanks to Arvid for reporting this. + +22 June 2008 - version 2.1 + - No changes. + +3 May 2008 - version 2.0 + - No changes. + +2 April 2008 - version 1.9.5 + - Improved the background painting of TSpTBXPanel. + +3 February 2008 - version 1.9.4 + - No changes. + +19 January 2008 - version 1.9.3 + - Fixed incorrect Autosizing of TSpTBXTextControl, thanks + to Alexey Naumov for reporting this. + +26 December 2007 - version 1.9.2 + - Added State parameter to TSpTBXTextControl.OnDrawCaption + - Fixed incorrect Default property handling of TSpTBXButton, + thanks to Karpushin Matvey and Beta Xiong for reporting this. + +1 December 2007 - version 1.9.1 + - Added various painting enhancements made by Jim. + - Fixed incorrect caption color on the controls when + the Font is changed, thanks to Arvid and Zunyite for + reporting this. + - Fixed incorrect nested panel painting (canvas was not locked), + thanks to Jim for reporting this. + +20 November 2007 - version 1.9 + - Removed TBX dependency. + +8 February 2007 - version 1.8.3 + - Added GripHotTrack property to TSpTBXSplitter. + +17 December 2006 - version 1.8.2 + - Added AutoSize property to TSpTBXPanel. + - Fixed incorrect resizing behavior on TSpTBXSplitter when a + DockablePanel was adjacent. + +24 November 2006 - version 1.8.1 + - Improved TSpTBXPanel painting, thanks to Jim Kueneman for + his code donation. + - Fixed incorrect focus behavior on TSpTBXRadioButton when used + on a groupbox, thanks to Andrew for reporting this. + +27 August 2006 - version 1.8 + - Added DropDownArrow property to TSpTBXButton and TSpTBXSpeedButton. + - Fixed incorrect TSpTBXGroupBox painting when changing the + Enabled property, thanks to Tomaz Kunaver for reporting this. + +15 June 2006 - version 1.7 + - Fixed incorrect TSpTBXButton painting when using a bitmap + skin and the DropDownMenu is shown, thanks to Boris Yankov + for reporting this. + +4 May 2006 - version 1.6 + - New component added, TSpTBXRadioGroup. + +12 April 2006 - version 1.5 + - No changes. + +27 February 2006 - version 1.4 + - Added GroupIndex property to TSpTBXButton and TSpTBXSpeedButton. + +10 February 2006 - version 1.3 + - New component added, TSpTBXSpeedButton. + - New component added, TSpTBXSplitter. + - Fixed incorrect TSpTBXButton behavior when trying to close the + DropDownMenu clicking the button, thanks to Alexey Naumov for + reporting this. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, Classes, SysUtils, Forms, Controls, Graphics, ImgList, + Menus, StdCtrls, ExtCtrls, ComCtrls, ActnList, + {$IFNDEF UNICODE} + TntClasses, TntControls, + {$ENDIF} + TB2Dock, TB2Toolbar, TB2Item, SpTBXItem, SpTBXSkins; + +{$IFDEF UNICODE} +type + TTntStrings = TStrings; +{$ENDIF} + +const + ConstStatesCount = 4; // Buttons have 4 states (normal, hottrack, pushed, disabled) + ConstInitRepeatPause = 400; // Delay of the first repeated click (ms) + ConstRepeatPause = 100; // Interval of the repeated clicks (ms) + CM_SPGROUPINDEXUPDATE = CM_BASE + 2222; // Message sent to the controls to update its state based on the GroupIndex + CM_SPTBXCONTROLSINVALIDATE = CM_BASE + 3333; // Message sent to SpTBX controls to invalidate the background + +type + TSpTBXTextObject = class; + + TSpTBXPanelBorder = ( + pbrRaised, + pbrDoubleRaised, + pbrSunken, + pbrDoubleSunken, + pbrBumped, + pbrEtched, + pbrFramed + ); + + TSpTBXProgressCaption = ( + pctNone, + pctDefault, + pctPercentage, + pctProgress + ); + + TSpTBXTickMark = ( + tmxBottomRight, + tmxTopLeft, + tmxBoth, + tmxCenter + ); + + TSpTBXCanResizeEvent = procedure(Sender: TObject; var NewSize: Integer; var Accept: Boolean) of object; + + { TSpTBXPanel } + + TSpTBXCustomPanel = class(TSpTBXCustomControl) + private + FBorders: Boolean; + FBorderType: TSpTBXPanelBorder; + FTBXStyleBackground: Boolean; + FSkinType: TSpTBXSkinType; + FOnDrawBackground: TSpTBXDrawEvent; + procedure SetBorders(const Value: Boolean); + procedure SetBorderType(const Value: TSpTBXPanelBorder); + procedure SetTBXStyleBackground(const Value: Boolean); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED; + procedure CMSpTBXControlsInvalidate(var Message: TMessage); message CM_SPTBXCONTROLSINVALIDATE; + procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + procedure WMWindowPosChanged(var Message: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED; + protected + FBackground: TBitmap; + procedure AdjustClientRect(var Rect: TRect); override; + procedure CreateParams(var Params: TCreateParams); override; + procedure DrawBackground(ACanvas: TCanvas; ARect: TRect); virtual; + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + property Borders: Boolean read FBorders write SetBorders default True; + property BorderType: TSpTBXPanelBorder read FBorderType write SetBorderType default pbrEtched; + property ParentColor default False; + property TBXStyleBackground: Boolean read FTBXStyleBackground write SetTBXStyleBackground default False; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure InvalidateBackground(InvalidateChildren: Boolean = True); virtual; + published + property Caption; + property Hint; + property Color default clNone; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + end; + + TSpTBXPanel = class(TSpTBXCustomPanel) + private + FHotTracking: Boolean; + FHotTrack: Boolean; + FChildFocused: Boolean; + procedure SetHotTrack(const Value: Boolean); + procedure SetHotTracking(const Value: Boolean); + procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; + procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; + procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED; + protected + procedure DrawBackground(ACanvas: TCanvas; ARect: TRect); override; + public + property HotTracking: Boolean read FHotTracking; + published + property Align; + property Anchors; + property AutoSize; + property BiDiMode; + property Constraints; + property UseDockManager; + property DockSite; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentBiDiMode; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property TabOrder; + property TabStop; + property Visible; + property OnCanResize; + property OnClick; + property OnConstrainedResize; + property OnContextPopup; + property OnDockDrop; + property OnDockOver; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnEnter; + property OnExit; + property OnGetSiteInfo; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnResize; + property OnStartDock; + property OnStartDrag; + property OnUnDock; + // TSpTBXCustomPanel properties + property Borders; + property BorderType; + property HotTrack: Boolean read FHotTrack write SetHotTrack default False; + property TBXStyleBackground; + property OnDrawBackground; + end; + + { TSpTBXGroupBox } + + TSpTBXCustomGroupBox = class(TSpTBXCustomPanel) + private + procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR; + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + protected + procedure AdjustClientRect(var Rect: TRect); override; + procedure DrawBackground(ACanvas: TCanvas; ARect: TRect); override; + public + constructor Create(AOwner: TComponent); override; + end; + + TSpTBXGroupBox = class(TSpTBXCustomGroupBox) + published + property Align; + property Anchors; + property BiDiMode; + property Color; + property Constraints; + property UseDockManager; + property DockSite; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentBiDiMode; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property TabOrder; + property TabStop; + property Visible; + property OnCanResize; + property OnClick; + property OnConstrainedResize; + property OnContextPopup; + property OnDockDrop; + property OnDockOver; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnEnter; + property OnExit; + property OnGetSiteInfo; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnResize; + property OnStartDock; + property OnStartDrag; + property OnUnDock; + // TSpTBXCustomPanel properties + property Borders; + property BorderType; + property TBXStyleBackground; + property OnDrawBackground; + end; + + { TSpTBXTextObjectActionLink } + + {$IFNDEF UNICODE} + TSpTBXTextObjectActionLink = class(TControlActionLink) + protected + FUnicodeClient: TSpTBXTextObject; + procedure AssignClient(AClient: TObject); override; + function IsCaptionLinked: Boolean; override; + function IsCheckedLinked: Boolean; override; + function IsHintLinked: Boolean; override; + procedure SetCaption(const Value: String); override; + procedure SetChecked(Value: Boolean); override; + procedure SetHint(const Value: String); override; + procedure SetImageIndex(Value: Integer); override; + end; + {$ELSE} + TSpTBXTextObjectActionLink = class(TControlActionLink); + {$ENDIF} + + { TSpTBXTextObject } + + TSpTBXTextObject = class(TSpTBXCustomControl) + private + FAlignment: TAlignment; + FCaptionGlow: TSpGlowDirection; + FCaptionGlowColor: TColor; + FCaptionRoatationAngle: TSpTextRotationAngle; + FChecked: Boolean; + FDisabledIconCorrection: Boolean; + FDrawPushedCaption: Boolean; + FGlyphLayout: TSpGlyphLayout; + FImages: TCustomImageList; + FImageChangeLink: TChangeLink; + FImageIndex: TImageIndex; + FLinkText: WideString; + FLinkTextParams: WideString; + FMouseInControl: Boolean; + FPushed: Boolean; + FSkinType: TSpTBXSkinType; + FSpaceAsClick: Boolean; + FShowAccelChar: Boolean; + FUpdating: Boolean; + FWrapping: TTextWrapping; + FOnDraw: TSpTBXDrawEvent; + FOnDrawCaption: TSpTBXDrawTextEvent; + FOnDrawHint: TSpTBXDrawHintEvent; + FOnGetImageIndex: TSpTBXGetImageIndexEvent; + FOnMouseEnter: TNotifyEvent; + FOnMouseLeave: TNotifyEvent; + procedure ReadLinkFont(Reader: TReader); // [Backward-Compatibility] + procedure ImageListChange(Sender: TObject); + procedure UpdateTracking(ForceMouseLeave: Boolean = False); + procedure SetAlignment(const Value: TAlignment); + procedure SetCaptionGlow(const Value: TSpGlowDirection); + procedure SetCaptionGlowColor(const Value: TColor); + procedure SetCaptionRoatationAngle(const Value: TSpTextRotationAngle); + procedure SetGlyphLayout(const Value: TSpGlyphLayout); + procedure SetImageIndex(const Value: TImageIndex); + procedure SetImages(const Value: TCustomImageList); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure SetShowAccelChar(Value: Boolean); + procedure SetWrapping(Value: TTextWrapping); + procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED; + procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED; + procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW; + procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; + procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND; + procedure WMKillFocus(var Message: TMessage); message WM_KILLFOCUS; + procedure WMSetFocus(var Message: TMessage); message WM_SETFOCUS; + procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + // Painting + procedure AdjustFont(AFont: TFont); virtual; + procedure AdjustBounds; + procedure DoDrawHint(AHintBitmap: TBitmap; var AHint: Widestring; var PaintDefault: Boolean); virtual; + function DoDrawItem(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; virtual; + function DoDrawText(ACanvas: TCanvas; var ARect: TRect; Flags: Longint): Integer; virtual; + procedure DoGetImageIndex(var AImageList: TCustomImageList; var AImageIndex: Integer); virtual; + procedure DoInternalGlyphDraw(ACanvas: TCanvas; AGlyphRect: TRect); virtual; + function GetFocusRect(R, TextR, GlyphR: TRect): TRect; virtual; + function GetTextMargins: TRect; virtual; + function IsImageIndexValid: Boolean; + procedure Paint; override; + + // Sizing + function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override; + procedure DoAdjustBounds(var NewWidth, NewHeight: Integer); virtual; + + // Mouse + function GetFocused: Boolean; virtual; + function GetPushed: Boolean; virtual; + procedure DoMouseEnter; virtual; + procedure DoMouseLeave; virtual; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure KeyUp(var Key: Word; Shift: TShiftState); override; + + // Component + procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; + procedure CreateParams(var Params: TCreateParams); override; + procedure DefineProperties(Filer: TFiler); override; + procedure ExecuteLink; virtual; + function GetActionLinkClass: TControlActionLinkClass; override; + function GetChecked: Boolean; virtual; + procedure SetChecked(Value: Boolean); virtual; + procedure Loaded; override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + + property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; + property AutoSize default True; + property Checked: Boolean read GetChecked write SetChecked default False; + property CaptionGlow: TSpGlowDirection read FCaptionGlow write SetCaptionGlow default gldNone; + property CaptionGlowColor: TColor read FCaptionGlowColor write SetCaptionGlowColor default clYellow; + property CaptionRoatationAngle: TSpTextRotationAngle read FCaptionRoatationAngle write SetCaptionRoatationAngle default tra0; + property DrawPushedCaption: Boolean read FDrawPushedCaption write FDrawPushedCaption default False; + property DisabledIconCorrection: Boolean read FDisabledIconCorrection write FDisabledIconCorrection default True; + property GlyphLayout: TSpGlyphLayout read FGlyphLayout write SetGlyphLayout default ghlGlyphLeft; + property Images: TCustomImageList read FImages write SetImages; + property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1; + property LinkText: WideString read FLinkText write FLinkText; + property LinkTextParams: WideString read FLinkTextParams write FLinkTextParams; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + property ShowAccelChar: Boolean read FShowAccelChar write SetShowAccelChar default True; + property SpaceAsClick: Boolean read FSpaceAsClick write FSpaceAsClick default False; + property Wrapping: TTextWrapping read FWrapping write SetWrapping default twNone; + property OnDraw: TSpTBXDrawEvent read FOnDraw write FOnDraw; + property OnDrawCaption: TSpTBXDrawTextEvent read FOnDrawCaption write FOnDrawCaption; + property OnDrawHint: TSpTBXDrawHintEvent read FOnDrawHint write FOnDrawHint; + property OnGetImageIndex: TSpTBXGetImageIndexEvent read FOnGetImageIndex write FOnGetImageIndex; + property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter; + property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave; + property TabStop default True; + property ParentColor default False; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function CanFocus: Boolean; override; + procedure Click; override; + function GetControlsAlignment: TAlignment; override; + procedure GetSize(out TotalR, TextR, GlyphR: TRect); virtual; + function GetTextFlags: Cardinal; + function GetGlyphSize: TSize; virtual; + property Canvas; + property MouseInControl: Boolean read FMouseInControl; + property Pushed: Boolean read GetPushed; + published + property Caption; + property Hint; + property Color default clNone; + end; + + { TSpTBXLabel } + + TSpTBXCustomLabel = class(TSpTBXTextObject) + private + FFocusControl: TWinControl; + FUnderline: Boolean; + FUnderlineColor: TColor; + procedure SetFocusControl(const Value: TWinControl); + procedure SetUnderline(const Value: Boolean); + procedure SetUnderlineColor(const Value: TColor); + procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR; + protected + procedure AdjustFont(AFont: TFont); override; + function DoDrawItem(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + property FocusControl: TWinControl read FFocusControl write SetFocusControl; + property Underline: Boolean read FUnderline write SetUnderline default False; + property UnderlineColor: TColor read FUnderlineColor write SetUnderlineColor default clBtnShadow; + public + constructor Create(AOwner: TComponent); override; + procedure GetSize(out TotalR: TRect; out TextR: TRect; out GlyphR: TRect); override; + end; + + TSpTBXLabel = class(TSpTBXCustomLabel) + published + property Action; + property Align; + property Anchors; + property AutoSize; + property BiDiMode; + property Color; + property Constraints; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentBiDiMode; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowAccelChar; + property ShowHint; + property Visible; + property Wrapping; + property OnClick; + property OnContextPopup; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnMouseDown; + property OnMouseEnter; + property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; + property OnStartDock; + property OnStartDrag; + // TSpTBXCustomLabel properties + property Alignment; + property CaptionGlow; + property CaptionGlowColor; + property FocusControl; + property GlyphLayout; + property Images; + property ImageIndex; + property LinkText; + property LinkTextParams; + property SkinType; + property Underline; + property UnderlineColor; + property OnDraw; + property OnDrawCaption; + property OnDrawHint; + property OnGetImageIndex; + end; + + { TSpTBXButtonControl } + + TSpTBXButtonControl = class(TSpTBXTextObject) + private + FAllowAllUp: Boolean; + FGroupIndex: Integer; + FStateChanged: Boolean; + procedure SetAllowAllUp(const Value: Boolean); + procedure SetGroupIndex(const Value: Integer); + procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR; + procedure CMSPGroupIndexUpdate(var Message: TMessage); message CM_SPGROUPINDEXUPDATE; + protected + function CanUpdateExclusive: Boolean; virtual; + procedure SetChecked(Value: Boolean); override; + procedure UpdateExclusive; + property AllowAllUp: Boolean read FAllowAllUp write SetAllowAllUp default False; + property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0; + property StateChanged: Boolean read FStateChanged write FStateChanged; + public + constructor Create(AOwner: TComponent); override; + function CanFocus: Boolean; override; + end; + + { TSpTBXCheckBox } + + TSpTBXCustomCheckButton = class(TSpTBXButtonControl) + protected + procedure Toggle; virtual; + public + function GetGlyphSize: TSize; override; + procedure GetSize(out TotalR, TextR, GlyphR: TRect); override; + end; + + TSpTBXCustomCheckBox = class(TSpTBXCustomCheckButton) + private + FAllowGrayed: Boolean; + FState: TCheckBoxState; + procedure SetState(const Value: TCheckBoxState); + protected + procedure AdjustFont(AFont: TFont); override; + procedure DoInternalGlyphDraw(ACanvas: TCanvas; AGlyphRect: TRect); override; + function GetChecked: Boolean; override; + procedure SetChecked(Value: Boolean); override; + procedure Toggle; override; + property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed default False; + property State: TCheckBoxState read FState write SetState default cbUnchecked; + public + constructor Create(AOwner: TComponent); override; + procedure Click; override; + end; + + TSpTBXCheckBox = class(TSpTBXCustomCheckBox) + published + property Action; + property Align; + property Anchors; + property AutoSize; + property BiDiMode; + property Color; + property Constraints; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentBiDiMode; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowAccelChar; + property ShowHint; + property TabOrder; + property TabStop; + property Visible; + property Wrapping; + property OnClick; + property OnContextPopup; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnMouseDown; + property OnMouseEnter; + property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; + property OnStartDock; + property OnStartDrag; + // TSpTBXCustomCheckBox properties + property Alignment; + property AllowGrayed; + property CaptionGlow; + property CaptionGlowColor; + property Checked; + property State; + property SkinType; + property OnDraw; + property OnDrawCaption; + property OnDrawHint; + property OnGetImageIndex; + end; + + { TSpTBXRadioButton } + + TSpTBXCustomRadioButton = class(TSpTBXCustomCheckButton) + private + procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED; + protected + procedure AdjustFont(AFont: TFont); override; + function CanUpdateExclusive: Boolean; override; + procedure DoInternalGlyphDraw(ACanvas: TCanvas; AGlyphRect: TRect); override; + procedure SetChecked(Value: Boolean); override; + procedure Toggle; override; + property TabStop default False; + public + constructor Create(AOwner: TComponent); override; + procedure Click; override; + end; + + TSpTBXRadioButton = class(TSpTBXCustomRadioButton) + published + property Action; + property Align; + property Anchors; + property AutoSize; + property BiDiMode; + property Color; + property Constraints; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentBiDiMode; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowAccelChar; + property ShowHint; + property TabOrder; + property TabStop; + property Visible; + property Wrapping; + property OnClick; + property OnContextPopup; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnMouseDown; + property OnMouseEnter; + property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; + property OnStartDock; + property OnStartDrag; + // TSpTBXCustomRadioButton properties + property Alignment; + property CaptionGlow; + property CaptionGlowColor; + property Checked; + property GroupIndex; + property SkinType; + property OnDraw; + property OnDrawCaption; + property OnDrawHint; + property OnGetImageIndex; + end; + + { TSpTBXRadioGroup } + + TSpTBXCustomRadioGroup = class(TSpTBXCustomGroupBox) + private + FButtons: TList; + FItems: TTntStrings; + FItemIndex: Integer; + FColumns: Integer; + FReading: Boolean; + FUpdating: Boolean; + function GetButtons(Index: Integer): TSpTBXRadioButton; + procedure ArrangeButtons; + procedure ButtonClick(Sender: TObject); + procedure ItemsChange(Sender: TObject); + procedure SetButtonCount(Value: Integer); + procedure SetColumns(Value: Integer); + procedure SetItemIndex(Value: Integer); + procedure SetItems(Value: TTntStrings); + procedure UpdateButtons; + procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED; + procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED; + procedure WMSize(var Message: TWMSize); message WM_SIZE; + protected + procedure Loaded; override; + procedure ReadState(Reader: TReader); override; + property Columns: Integer read FColumns write SetColumns default 1; + property ItemIndex: Integer read FItemIndex write SetItemIndex default -1; + property Items: TTntStrings read FItems write SetItems; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; + procedure FlipChildren(AllLevels: Boolean); override; + procedure InvalidateBackground(InvalidateChildren: Boolean = True); override; + procedure SetFocus; override; + property Buttons[Index: Integer]: TSpTBXRadioButton read GetButtons; + end; + + TSpTBXRadioGroup = class(TSpTBXCustomRadioGroup) + published + property Align; + property Anchors; + property BiDiMode; + property Color; + property Constraints; + property UseDockManager; + property DockSite; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentBiDiMode; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property TabOrder; + property TabStop; + property Visible; + property OnCanResize; + property OnClick; + property OnConstrainedResize; + property OnContextPopup; + property OnDockDrop; + property OnDockOver; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnEnter; + property OnExit; + property OnGetSiteInfo; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnResize; + property OnStartDock; + property OnStartDrag; + property OnUnDock; + // TSpTBXCustomPanel properties + property Borders; + property BorderType; + property TBXStyleBackground; + property OnDrawBackground; + // TSpTBXCustomRadioGroup properties + property Columns; + property ItemIndex; + property Items; + end; + + { TSpTBXButton } + + TSpTBXCustomButton = class(TSpTBXButtonControl) + private + FBitmap: TBitmap; + FBitmapTransparent: Boolean; + FActive: Boolean; + FCancel: Boolean; + FDefault: Boolean; + FDropDownArrow: Boolean; + FDropDownMenu: TPopupMenu; + FDropDownMenuVisible: Boolean; + FFlat: Boolean; + FModalResult: TModalResult; + FRepeating: Boolean; + FRepeatTimer: TTimer; + procedure BitmapChanged(Sender: TObject); + procedure RepeatTimerHandler(Sender: TObject); + procedure SetBitmap(const Value: TBitmap); + procedure SetDefault(const Value: Boolean); + procedure SetDropDownArrow(const Value: Boolean); + procedure SetDropdownMenu(Value: TPopupMenu); + procedure SetFlat(const Value: Boolean); + procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY; + procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED; + procedure CMSPPopupClose(var Message: TMessage); message CM_SPPOPUPCLOSE; + procedure WMCancelMode(var Message: TWMCancelMode); message WM_CANCELMODE; + protected + FPopupControl: TControl; + procedure CreateWnd; override; + procedure AdjustFont(AFont: TFont); override; + function BitmapValid: boolean; + function DoDrawDropDownArrow(ACanvas: TCanvas; ARect: TRect): Boolean; virtual; + function DoDrawItem(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; override; + function GetFocused: Boolean; override; + function GetFocusRect(R, TextR, GlyphR: TRect): TRect; override; + function GetInternalDropDownMenu: TPopupMenu; virtual; + function GetPushed: Boolean; override; + function GetTextMargins: TRect; override; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + property Alignment default taCenter; + property Bitmap: TBitmap read FBitmap write SetBitmap; + property BitmapTransparent: Boolean read FBitmapTransparent write FBitmapTransparent default True; + property DrawPushedCaption default True; + property Cancel: Boolean read FCancel write FCancel default False; + property Default: Boolean read FDefault write SetDefault default False; + property DropDownArrow: Boolean read FDropDownArrow write SetDropDownArrow default True; + property DropDownMenu: TPopupMenu read FDropDownMenu write SetDropDownMenu; + property Flat: Boolean read FFlat write SetFlat default False; + property ModalResult: TModalResult read FModalResult write FModalResult default 0; + property Repeating: Boolean read FRepeating write FRepeating default False; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Click; override; + function GetSkinStateRect: TRect; + function IsDroppedDown: Boolean; + procedure StopRepeat; virtual; + end; + + TSpTBXButton = class(TSpTBXCustomButton) + published + property Action; + property Align; + property Anchors; + property BiDiMode; + property Color; + property Constraints; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentBiDiMode; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowAccelChar; + property ShowHint; + property TabOrder; + property TabStop; + property Visible; + property Wrapping; + property OnClick; + property OnContextPopup; + // property OnDblClick; Buttons don't have OnDblClick events + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnMouseDown; + property OnMouseEnter; + property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; + property OnStartDock; + property OnStartDrag; + // TSpTBXCustomButton properties + property Alignment; + property Bitmap; + property BitmapTransparent; + property Cancel; + property CaptionGlow; + property CaptionGlowColor; + property Checked; + property Default; + property DrawPushedCaption; + property DropDownArrow; + property DropDownMenu; + property Flat; + property GlyphLayout; + property GroupIndex; + property Images; + property ImageIndex; + property LinkText; + property LinkTextParams; + property ModalResult; + property SkinType; + property Repeating; + property OnDraw; + property OnDrawCaption; + property OnDrawHint; + property OnGetImageIndex; + end; + + { TSpTBXSpeedButton } + + TSpTBXCustomSpeedButton = class(TSpTBXCustomButton) + public + constructor Create(AOwner: TComponent); override; + function CanFocus: Boolean; override; + procedure Click; override; + end; + + TSpTBXSpeedButton = class(TSpTBXCustomSpeedButton) + published + property Action; + property Align; + property Anchors; + property BiDiMode; + property Color; + property Constraints; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentBiDiMode; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowAccelChar; + property ShowHint; + // property TabOrder; SpeedButtons don't have TabStops + // property TabStop; SpeedButtons don't have TabStops + property Visible; + property Wrapping; + property OnClick; + property OnContextPopup; + // property OnDblClick; SpeedButtons don't have OnDblClick events + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnMouseDown; + property OnMouseEnter; + property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; + property OnStartDock; + property OnStartDrag; + // TSpTBXCustomButton properties + property Alignment; + property AllowAllUp; + property Bitmap; + property BitmapTransparent; + property Cancel; + property CaptionGlow; + property CaptionGlowColor; + property Checked; + property Default; + property DrawPushedCaption; + property DropDownArrow; + property DropDownMenu; + property Flat; + property GlyphLayout; + property GroupIndex; + property Images; + property ImageIndex; + property LinkText; + property LinkTextParams; + property SkinType; + property Repeating; + property OnDraw; + property OnDrawCaption; + property OnDrawHint; + property OnGetImageIndex; + end; + + { TSpTBXProgressBar } + + TSpTBXProgressBarChangeEvent = procedure(Sender: TObject; NewPosition: Integer) of object; + + TSpTBXCustomProgressBar = class(TSpTBXTextObject) + private + FMin: Integer; + FMax: Integer; + FPosition: Integer; + FProgressVisible: Boolean; + FSmooth: Boolean; + FVertical: Boolean; + FCaptionType: TSpTBXProgressCaption; + FOnProgressChange: TSpTBXProgressBarChangeEvent; + procedure SetMax(const Value: integer); + procedure SetMin(const Value: integer); + procedure SetPosition(Value: integer); + procedure SetSmooth(const Value: Boolean); + procedure SetVertical(const Value: Boolean); + procedure SetCaptionType(const Value: TSpTBXProgressCaption); + procedure SetProgressVisible(const Value: Boolean); + protected + procedure AdjustFont(AFont: TFont); override; + function DoDrawItem(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; override; + procedure DoProgressChange; virtual; + function GetTextMargins: TRect; override; + property Alignment default taCenter; + property CaptionGlow default gldAll; + property CaptionType: TSpTBXProgressCaption read FCaptionType write SetCaptionType default pctPercentage; + property Max: Integer read FMax write SetMax default 100; + property Min: Integer read FMin write SetMin default 0; + property Position: Integer read FPosition write SetPosition default 0; + property ProgressVisible: Boolean read FProgressVisible write SetProgressVisible default True; + property Smooth: Boolean read FSmooth write SetSmooth default False; + property Vertical: Boolean read FVertical write SetVertical default False; + property OnProgressChange: TSpTBXProgressBarChangeEvent read FOnProgressChange write FOnProgressChange; + public + constructor Create(AOwner: TComponent); override; + procedure StepIt(Delta: Integer = 1); + end; + + TSpTBXProgressBar = class(TSpTBXCustomProgressBar) + published + property Align; + property Anchors; + property Color; + property Constraints; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentColor; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property Visible; + property OnClick; + property OnContextPopup; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnMouseDown; + property OnMouseEnter; + property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; + property OnStartDock; + property OnStartDrag; + // TSpTBXCustomProgressBar properties + property Alignment; + property CaptionGlow; + property CaptionGlowColor; + property CaptionType; + property Max; + property Min; + property Position; + property Smooth; + property Vertical; + property SkinType; + property OnDraw; + property OnDrawCaption; + property OnDrawHint; + property OnProgressChange; + end; + + { TSpTBXTrackBar } + + TSpTBXTrackBar = class(TTrackBar) + private + FSkinType: TSpTBXSkinType; + FTickMarks: TSpTBXTickMark; + FOnDrawChannel: TSpTBXDrawEvent; + FOnDrawChannelTicks: TSpTBXDrawPosEvent; + FOnDrawThumb: TSpTBXDrawEvent; + FCanDrawChannelSelection: Boolean; + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure SetTickMarks(const Value: TSpTBXTickMark); + procedure CMSpTBXControlsInvalidate(var Message: TMessage); message CM_SPTBXCONTROLSINVALIDATE; + procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY; + procedure WMEraseBkGnd(var Message: TMessage); message WM_ERASEBKGND; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + procedure CreateParams(var Params: TCreateParams); override; + function DoDrawChannel(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; virtual; + function DoDrawChannelTicks(ACanvas: TCanvas; X, Y: Integer): Boolean; virtual; + function DoDrawThumb(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; virtual; + procedure DrawTicks(ACanvas: TCanvas); virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function ChannelRect: TRect; + function MouseInThumb: Boolean; + procedure InvalidateBackground; + published + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + property TickMarks: TSpTBXTickMark read FTickMarks write SetTickMarks default tmxBottomRight; + property OnDrawChannel: TSpTBXDrawEvent read FOnDrawChannel write FOnDrawChannel; + property OnDrawChannelTicks: TSpTBXDrawPosEvent read FOnDrawChannelTicks write FOnDrawChannelTicks; + property OnDrawThumb: TSpTBXDrawEvent read FOnDrawThumb write FOnDrawThumb; + end; + +{ Painting helpers } +procedure SpDrawXPPanel(ACanvas: TCanvas; ARect: TRect; Enabled, TBXStyleBackground: Boolean; SkinType: TSpTBXSkinType; Border: TSpTBXPanelBorder); +procedure SpDrawXPPanelBorder(ACanvas: TCanvas; ARect: TRect; Border: TSpTBXPanelBorder); +procedure SpDrawXPGroupBox(ACanvas: TCanvas; ARect: TRect; ACaption: WideString; TextFlags: Cardinal; Enabled, TBXStyleBackground: Boolean; SkinType: TSpTBXSkinType); +procedure SpDrawXPProgressBar(ACanvas: TCanvas; ARect: TRect; Min, Max, Position: Integer; Back, Fore: TBitmap); overload; +function SpDrawXPProgressBar(ACanvas: TCanvas; ARect: TRect; Vertical, Smooth, DrawProgress: Boolean; Min, Max, Position: Integer; SkinType: TSpTBXSkinType): Integer; overload; +procedure SpDrawXPTrackBar(ACanvas: TCanvas; ARect: TRect; Part: Cardinal; Vertical, Pushed, ChannelSelection: Boolean; TickMark: TSpTBXTickMark; Min, Max, SelStart, SelEnd: Integer; SkinType: TSpTBXSkinType); +procedure SpInvalidateSpTBXControl(AControl: TWinControl; InvalidateChildren, OnlySpTBXControls: Boolean); + +implementation + +uses + Themes, UxTheme, + {$IFNDEF UNICODE} TntActnList, {$ENDIF} + CommCtrl, ShellAPI; +type + TWinControlAccess = class(TWinControl); + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +procedure SpDrawXPPanel(ACanvas: TCanvas; ARect: TRect; Enabled, TBXStyleBackground: Boolean; + SkinType: TSpTBXSkinType; Border: TSpTBXPanelBorder); +var + Flags: Integer; +begin + case SpTBXSkinType(SkinType) of + sknWindows: + begin + if Enabled then Flags := GBS_NORMAL + else Flags := GBS_DISABLED; + DrawThemeBackground(ThemeServices.Theme[teButton], ACanvas.Handle, BP_GROUPBOX, Flags, ARect, nil); + end; + sknNone: + SpDrawXPPanelBorder(ACanvas, ARect, Border); + sknSkin: + CurrentSkin.PaintBackground(ACanvas, ARect, skncPanel, sknsNormal, TBXStyleBackground, True); + end; +end; + +procedure SpDrawXPPanelBorder(ACanvas: TCanvas; ARect: TRect; Border: TSpTBXPanelBorder); +const + Edge: array [TSpTBXPanelBorder] of Cardinal = (BDR_RAISEDINNER, EDGE_RAISED, + BDR_SUNKENOUTER, EDGE_SUNKEN, EDGE_BUMP, EDGE_ETCHED, 0); +begin + if Border = pbrFramed then begin + ACanvas.Brush.Color := clBtnFace; + ACanvas.FrameRect(ARect); + end + else + DrawEdge(ACanvas.Handle, ARect, Edge[Border], BF_RECT); +end; + +procedure SpDrawXPGroupBox(ACanvas: TCanvas; ARect: TRect; ACaption: WideString; + TextFlags: Cardinal; Enabled, TBXStyleBackground: Boolean; SkinType: TSpTBXSkinType); +var + Width, Flags, SaveIndex: Integer; + R: TRect; + CaptionRect: TRect; +begin + Flags := 0; + SkinType := SpTBXSkinType(SkinType); + Width := ARect.Right - ARect.Left; + + if ACaption <> '' then begin + CaptionRect := Rect(0, 0, 1, 1); + + if Enabled then Flags := GBS_NORMAL + else Flags := GBS_DISABLED; + if SkinType = sknWindows then + GetThemeTextExtent(ThemeServices.Theme[teButton], ACanvas.Handle, BP_GROUPBOX, Flags, + PWideChar(ACaption), Length(ACaption), DT_LEFT, nil, CaptionRect) + else + SpDrawXPText(ACanvas, ACaption, CaptionRect, TextFlags or DT_CALCRECT); + + if (TextFlags and DT_RTLREADING) = 0 then + OffsetRect(CaptionRect, 8, 0) + else + OffsetRect(CaptionRect, Width - 8 - CaptionRect.Right, 0); + end + else + CaptionRect := Rect(0, 0, 0, 0); + + R := ARect; + R.Top := (CaptionRect.Bottom - CaptionRect.Top) div 2; + SaveIndex := SaveDC(ACanvas.Handle); + with CaptionRect do + ExcludeClipRect(ACanvas.Handle, Left, Top, Right, Bottom); + try + SpDrawXPPanel(ACanvas, R, Enabled, TBXStyleBackground, SkinType, pbrEtched); + finally + RestoreDC(ACanvas.Handle, SaveIndex); + end; + + if ACaption <> '' then begin + case SkinType of + sknNone: + SpDrawXPText(ACanvas, ACaption, CaptionRect, TextFlags); + sknWindows: + DrawThemeText(ThemeServices.Theme[teButton], ACanvas.Handle, BP_GROUPBOX, Flags, PWideChar(ACaption), -1, TextFlags, 0, CaptionRect); + sknSkin: + begin + if CurrentSkin.Options(skncPanel, sknsNormal).TextColor <> clNone then + ACanvas.Font.Color := CurrentSkin.Options(skncPanel, sknsNormal).TextColor; + SpDrawXPText(ACanvas, ACaption, CaptionRect, TextFlags); + end; + end; + end; +end; + +procedure SpDrawXPProgressBar(ACanvas: TCanvas; ARect: TRect; + Min, Max, Position: Integer; Back, Fore: TBitmap); +var + Percent, Delta: Integer; + DeltaR, R: TRect; +begin + if Position < Min then Position := Min + else if Position > Max then Position := Max; + + // Get the delta + if (Max > Min) and (Position > Min) then begin + Percent := (Position * 100) div (Max - Min); + DeltaR := ARect; + R := Rect(0, 0, Back.Width, Back.Height); + if Back.Height > Back.Width then begin + Delta := (Back.Height * Percent) div 100; + DeltaR.Bottom := DeltaR.Top + Delta; + R.Bottom := R.Top + Delta; + end + else begin + Delta := (Back.Width * Percent) div 100; + DeltaR.Right := DeltaR.Left + Delta; + R.Right := R.Left + Delta; + end; + end + else + Delta := 0; + + ACanvas.Draw(ARect.Left, ARect.Top, Back); + if Delta > 0 then + ACanvas.CopyRect(DeltaR, Fore.Canvas, R); +end; + +function SpDrawXPProgressBar(ACanvas: TCanvas; ARect: TRect; + Vertical, Smooth, DrawProgress: Boolean; Min, Max, Position: Integer; + SkinType: TSpTBXSkinType): Integer; +const + PartID: array [Boolean] of Integer = (PP_BAR, PP_BARVERT); + VistaPartID: array [Boolean] of Integer = (5, 6); // PP_FILL, PP_FILLVERT + ChunkID: array [Boolean] of Integer = (PP_CHUNK, PP_CHUNKVERT); +var + ChunkPaint: Boolean; + I: Integer; + DeltaR, R: TRect; + B: TBitmap; + Percentage: Double; +begin + Result := 0; + ChunkPaint := False; + if Position < Min then Position := Min + else if Position > Max then Position := Max; + SkinType := SpTBXSkinType(SkinType); + + // Get the delta + if (Max > Min) and (Position > Min) then begin + DeltaR := ARect; + case SkinType of + sknWindows: + if not SpIsWinVistaOrUp then + if Vertical then InflateRect(DeltaR, -3, -4) + else InflateRect(DeltaR, -4, -3); + sknNone: InflateRect(DeltaR, -2, -2); + end; + // Cast Position to a Double real type, otherwise Percentage * 100 + // returns a negative value, e.g. 30000000 * 100 + Percentage := Position; + Percentage := (Percentage * 100) / (Max - Min); + Result := Round(Percentage); + if Vertical then + DeltaR.Top := DeltaR.Bottom - (((DeltaR.Bottom - DeltaR.Top) * Result) div 100) + else + DeltaR.Right := DeltaR.Left + (((DeltaR.Right - DeltaR.Left) * Result) div 100); + end + else + DeltaR := Rect(0, 0, 0, 0); + + B := TBitmap.Create; + try + case SkinType of + sknWindows: + begin + DrawThemeBackground(ThemeServices.Theme[teProgress], ACanvas.Handle, PartID[Vertical], 0, ARect, nil); + if DrawProgress and not IsRectEmpty(DeltaR) then begin + if SpIsWinVistaOrUp then + DrawThemeBackground(ThemeServices.Theme[teProgress], ACanvas.Handle, VistaPartID[Vertical], 1, DeltaR, nil) + else begin + // [Theme-Change] + // Another Windows API bug, Windows XP progress bar chunks are 8 x 11, + // but DrawThemeBackground draws 10 x 11 chunks. We must draw the chunks manually. + if Vertical then begin + B.Width := DeltaR.Right - DeltaR.Left; + B.Height := 8; + R := Rect(0, 2, B.Width, B.Height); + end + else begin + B.Width := 8; + B.Height := DeltaR.Bottom - DeltaR.Top; + R := Rect(0, 0, B.Width - 2, B.Height); + end; + DrawThemeBackground(ThemeServices.Theme[teProgress], B.Canvas.Handle, ChunkID[Vertical], 0, R, nil); + ChunkPaint := True; + end; + end; + end; + sknNone: + begin + DrawEdge(ACanvas.Handle, ARect, BDR_SUNKENOUTER, BF_RECT); + if DrawProgress and not IsRectEmpty(DeltaR) then + if Smooth then begin + ACanvas.Brush.Color := clHighlight; + ACanvas.FillRect(DeltaR); + end + else begin + // Chunks are 10 x 13 + if Vertical then begin + B.Width := DeltaR.Right - DeltaR.Left; + B.Height := 10; + R := Rect(0, 2, B.Width, B.Height); + end + else begin + B.Width := 10; + B.Height := DeltaR.Bottom - DeltaR.Top; + R := Rect(0, 0, B.Width - 2, B.Height); + end; + B.Canvas.Brush.Color := clBtnFace; + B.Canvas.FillRect(Rect(0, 0, B.Width, B.Height)); + B.Canvas.Brush.Color := clHighlight; + B.Canvas.FillRect(R); + ChunkPaint := True; + end; + end; + sknSkin: + begin + CurrentSkin.PaintBackground(ACanvas, ARect, skncProgressBar, sknsNormal, True, True); + if DrawProgress and not IsRectEmpty(DeltaR) then begin + B.Width := ARect.Right - ARect.Left; + B.Height := ARect.Bottom - ARect.Top; + R := Rect(0, 0, B.Width, B.Height); + B.Canvas.CopyRect(R, ACanvas, ARect); // B is transparent + + CurrentSkin.PaintBackground(B.Canvas, R, skncProgressBar, sknsHotTrack, True, True); + + if Vertical then + R.Top := R.Bottom - (DeltaR.Bottom - DeltaR.Top) + else + R.Right := DeltaR.Right - DeltaR.Left; + ACanvas.CopyRect(DeltaR, B.Canvas, R); + end; + end; + end; + + if ChunkPaint then begin + if Vertical then begin + ExcludeClipRect(ACanvas.Handle, ARect.Left, ARect.Top, ARect.Right, ARect.Top + 2); + I := DeltaR.Bottom - B.Height; + while I > DeltaR.Top - B.Height do begin + ACanvas.Draw(DeltaR.Left, I, B); + Dec(I, B.Height); + end; + end + else begin + ExcludeClipRect(ACanvas.Handle, ARect.Right - 2, ARect.Top, ARect.Right, ARect.Bottom); + I := DeltaR.Left; + while I < DeltaR.Right do begin + ACanvas.Draw(I, DeltaR.Top, B); + Inc(I, B.Width); + end; + end; + SelectClipRgn(ACanvas.Handle, 0); + end; + finally + B.Free; + end; +end; + +procedure SpDrawXPTrackBar(ACanvas: TCanvas; ARect: TRect; Part: Cardinal; + Vertical, Pushed, ChannelSelection: Boolean; TickMark: TSpTBXTickMark; + Min, Max, SelStart, SelEnd: Integer; SkinType: TSpTBXSkinType); +var + Flags: Integer; + + procedure DrawChannelSelection(ChannelR: TRect); + var + I: Integer; + Step : Single; + begin + if not ChannelSelection then Exit; + I := Max - Min; + if (I > 0) and (SelEnd > SelStart) then begin + if SkinType = sknSkin then + InflateRect(ChannelR, -2, -2) + else + InflateRect(ChannelR, -1, -1); + Step := (ChannelR.Right - ChannelR.Left) / I; + ChannelR.Right := ChannelR.Left + Round(SelEnd * Step); + ChannelR.Left := ChannelR.Left + Round(SelStart * Step); + + if SkinType = sknSkin then + CurrentSkin.PaintBackground(ACanvas, ChannelR, skncTrackBar, sknsHotTrack, True, True) + else begin + ACanvas.Brush.Color := clHighlight; + ACanvas.FillRect(ChannelR); + end; + end; + end; + +begin + SkinType := SpTBXSkinType(SkinType); + case SkinType of + sknWindows: + if Part = TBCD_THUMB then begin + if Pushed then Flags := TUS_HOT + else Flags := TUS_NORMAL; + Case TickMark of + tmxBottomRight: + if Vertical then Part := TKP_THUMBRIGHT + else Part := TKP_THUMBBOTTOM; + tmxTopLeft: + if Vertical then Part := TKP_THUMBLEFT + else Part := TKP_THUMBTOP; + tmxBoth, tmxCenter: + if Vertical then Part := TKP_THUMBVERT + else Part := TKP_THUMB; + end; + DrawThemeBackground(ThemeServices.Theme[teTrackBar], ACanvas.Handle, Part, Flags, ARect, nil); + end + else if Part = TBCD_CHANNEL then begin + if Vertical then Part := TKP_TRACKVERT + else Part := TKP_TRACK; + DrawThemeBackground(ThemeServices.Theme[teTrackBar], ACanvas.Handle, Part, TKS_NORMAL, ARect, nil); + DrawChannelSelection(ARect); + end; + sknNone: + if Part = TBCD_THUMB then begin + ACanvas.Brush.Color := clBtnFace; + ACanvas.FillRect(ARect); + DrawFrameControl(ACanvas.Handle, ARect, DFC_BUTTON, DFCS_BUTTONPUSH); + end + else if Part = TBCD_CHANNEL then begin + ACanvas.Brush.Color := clWindow; + ACanvas.FillRect(ARect); + ExtCtrls.Frame3D(ACanvas, ARect, clBtnShadow, clBtnHighlight, 1); + ExtCtrls.Frame3D(ACanvas, ARect, cl3DDkShadow, clBtnFace, 1); + DrawChannelSelection(ARect); + end; + sknSkin: + if Part = TBCD_THUMB then begin + if Pushed then + CurrentSkin.PaintBackground(ACanvas, ARect, skncTrackBarButton, sknsPushed, True, True) + else + CurrentSkin.PaintBackground(ACanvas, ARect, skncTrackBarButton, sknsNormal, True, True); + end + else if Part = TBCD_CHANNEL then begin + CurrentSkin.PaintBackground(ACanvas, ARect, skncTrackBar, sknsNormal, True, True); + DrawChannelSelection(ARect); + end; + end; +end; + +procedure SpInvalidateSpTBXControl(AControl: TWinControl; InvalidateChildren, OnlySpTBXControls: Boolean); +var + I: Integer; + ChildW: TWinControl; +begin + // Invalidate will not fire WM_ERASEBKGND, because csOpaque is setted + if Assigned(AControl) and not (csDestroying in AControl.ComponentState) and AControl.HandleAllocated then + begin + if InvalidateChildren then begin + if OnlySpTBXControls then begin + RedrawWindow(AControl.Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE); + // Only invalidate SpTBXControls + for I := 0 to AControl.ControlCount - 1 do + if Assigned(AControl.Controls[I]) and (AControl.Controls[I] is TWinControl) then begin + ChildW := AControl.Controls[I] as TWinControl; + if ChildW is TSpTBXTextObject then + RedrawWindow(ChildW.Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE) + else + PostMessage(ChildW.Handle, CM_SPTBXCONTROLSINVALIDATE, ChildW.Width, ChildW.Height); + end; + end + else + RedrawWindow(AControl.Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN); + end + else + RedrawWindow(AControl.Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE); + end; +end; + +procedure ApplyMargins(var R: TRect; const Margins: TRect); overload; +begin + with Margins do begin + Inc(R.Left, Left); Inc(R.Top, Top); + Dec(R.Right, Right); Dec(R.Bottom, Bottom); + end; +end; + +function GetRealAlignment(Control: TControl): TAlignment; +const + ReverseAlignment: array [TAlignment] of TAlignment = (taRightJustify, taLeftJustify, taCenter); +begin + Result := Control.GetControlsAlignment; + if Control.UseRightToLeftAlignment then Result := ReverseAlignment[Result]; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomPanel } + +constructor TSpTBXCustomPanel.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle + [csAcceptsControls]; + + FBackground := TBitmap.Create; + + FBorders := True; + FBorderType := pbrEtched; + FSkinType := sknSkin; + Color := clNone; + ParentColor := False; + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXCustomPanel.Destroy; +begin + FreeAndNil(FBackground); + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +procedure TSpTBXCustomPanel.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + if not (csDesigning in ComponentState) then begin + with Params do + Style := Style or WS_CLIPCHILDREN; + with Params.WindowClass do + Style := Style and not (CS_HREDRAW or CS_VREDRAW); + end; +end; + +procedure TSpTBXCustomPanel.AdjustClientRect(var Rect: TRect); +begin + inherited AdjustClientRect(Rect); + InflateRect(Rect, -2, -2); +end; + +procedure TSpTBXCustomPanel.InvalidateBackground(InvalidateChildren: Boolean); +begin + // Force background repaint + if Assigned(FBackground) then + FBackground.Width := 1; + SpInvalidateSpTBXControl(Self, InvalidateChildren, True); +end; + +procedure TSpTBXCustomPanel.SetBorders(const Value: Boolean); +begin + if FBorders <> Value then begin + FBorders := Value; + InvalidateBackground; + end; +end; + +procedure TSpTBXCustomPanel.SetBorderType(const Value: TSpTBXPanelBorder); +begin + if FBorderType <> Value then begin + FBorderType := Value; + InvalidateBackground; + end; +end; + +procedure TSpTBXCustomPanel.SetSkinType(const Value: TSpTBXSkinType); +begin + if Value <> FSkinType then begin + FSkinType := Value; + InvalidateBackground(False); + end; +end; + +procedure TSpTBXCustomPanel.SetTBXStyleBackground(const Value: Boolean); +begin + if FTBXStyleBackground <> Value then begin + FTBXStyleBackground := Value; + InvalidateBackground; + end; +end; + +procedure TSpTBXCustomPanel.DoDrawBackground(ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, + PaintStage, PaintDefault); +end; + +procedure TSpTBXCustomPanel.DrawBackground(ACanvas: TCanvas; ARect: TRect); +begin + SpDrawXPPanel(ACanvas, ARect, True, FTBXStyleBackground, FSkinType, FBorderType); +end; + +procedure TSpTBXCustomPanel.CMFontChanged(var Message: TMessage); +begin + inherited; + InvalidateBackground(False); +end; + +procedure TSpTBXCustomPanel.CMSpTBXControlsInvalidate(var Message: TMessage); +begin + InvalidateBackground; + Message.Result := 1; +end; + +procedure TSpTBXCustomPanel.WMEraseBkgnd(var Message: TMessage); +var + R, R2: TRect; + PaintDefault: Boolean; + ACanvas: TCanvas; +begin + Message.Result := 1; + + if (not DoubleBuffered or (Message.wParam = Message.lParam)) and + not (csDestroying in ComponentState) and Assigned(FBackground) then + begin + ACanvas := TCanvas.Create; + try + ACanvas.Handle := TWMEraseBkgnd(Message).DC; + R := ClientRect; + + if (FBackground.Width = R.Right) and (FBackground.Height = R.Bottom) and not Assigned(FOnDrawBackground) then + ACanvas.Draw(R.Left, R.Top, FBackground) + else begin + FBackground.Width := R.Right; + FBackground.Height := R.Bottom; + + if (Color = clNone) and Assigned(Parent) then begin + // The Panel is a special component, it has the ability + // to paint the parent background on its children controls. + // For that it receives WM_ERASEBKGND messages from its children + // via SpDrawParentBackground. + SpDrawParentBackground(Self, FBackground.Canvas.Handle, R); + // PerformEraseBackground(Self, FBackground.Canvas.Handle); + end + else + Windows.FillRect(FBackground.Canvas.Handle, ClientRect, Brush.Handle); + + // Set the Font after SpDrawParentBackground, DrawThemeParentBackground, + // or PerformEraseBackground. + // The API messes the font, it seems it destroys it. + // For more info see: + // - TCustomActionControl.DrawBackground for more info. + // - Theme Explorer Main.pas TMainForm.ControlMessage + // (http://www.soft-gems.net:8080/browse/Demos) + FBackground.Canvas.Font.Handle := 0; // Reset the font, it gets destroyed + FBackground.Canvas.Font.Color := $010101; // Force a change + FBackground.Canvas.Font.Assign(Self.Font); + + PaintDefault := True; + DoDrawBackground(FBackground.Canvas, R, pstPrePaint, PaintDefault); + if PaintDefault then begin + if not FBorders then begin + R2 := R; + InflateRect(R2, 3, 3); + DrawBackground(FBackground.Canvas, R2); + end + else + DrawBackground(FBackground.Canvas, R); + end; + PaintDefault := True; + DoDrawBackground(FBackground.Canvas, R, pstPostPaint, PaintDefault); + + ACanvas.Draw(R.Left, R.Top, FBackground); + end; + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; + end; +end; + +procedure TSpTBXCustomPanel.WMWindowPosChanged(var Message: TWMWindowPosChanged); +begin + inherited; + InvalidateBackground; +end; + +procedure TSpTBXCustomPanel.WMSpSkinChange(var Message: TMessage); +begin + InvalidateBackground; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXPanel } + +procedure TSpTBXPanel.DrawBackground(ACanvas: TCanvas; ARect: TRect); +begin + if not TBXStyleBackground and FHotTrack then begin + if SpTBXSkinType(SkinType) = sknNone then + SpDrawXPPanelBorder(ACanvas, ARect, pbrDoubleSunken) + else + SpDrawXPEditFrame(ACanvas, ARect, Enabled, FHotTracking, SkinType, True, True); + end + else + inherited; +end; + +procedure TSpTBXPanel.CMFocusChanged(var Message: TCMFocusChanged); +begin + inherited; + if FHotTrack and Assigned(Message.Sender) then begin + FChildFocused := SpFindControl(Self, Message.Sender) > -1; + if FChildFocused <> FHotTracking then + SetHotTracking(FChildFocused); + end; +end; + +procedure TSpTBXPanel.CMMouseEnter(var Message: TMessage); +begin + inherited; + if FHotTrack and not FHotTracking then + SetHotTracking(True); +end; + +procedure TSpTBXPanel.CMMouseLeave(var Message: TMessage); +begin + inherited; + if FHotTrack and FHotTracking and not FChildFocused then + SetHotTracking(False); +end; + +procedure TSpTBXPanel.SetHotTrack(const Value: Boolean); +begin + if FHotTrack <> Value then begin + FHotTrack := Value; + InvalidateBackground(False); + end; +end; + +procedure TSpTBXPanel.SetHotTracking(const Value: Boolean); +begin + if SpTBXSkinType(SkinType) = sknSkin then begin + FHotTracking := Value; + InvalidateBackground(False); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomGroupBox } + +constructor TSpTBXCustomGroupBox.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + ControlStyle := ControlStyle + [csSetCaption]; + Width := 185; + Height := 105; +end; + +procedure TSpTBXCustomGroupBox.AdjustClientRect(var Rect: TRect); +var + R: TRect; + H: Integer; +begin + inherited AdjustClientRect(Rect); + Canvas.Font := Font; + R := Rect; + H := SpDrawXPText(Canvas, '0', R, DT_SINGLELINE or DT_CALCRECT); + Inc(Rect.Top, H); +end; + +procedure TSpTBXCustomGroupBox.CMDialogChar(var Message: TCMDialogChar); +begin + with Message do + if IsAccel(CharCode, Caption) and SpCanFocus(Self) then begin + SelectFirst; + Result := 1; + end + else + inherited; +end; + +procedure TSpTBXCustomGroupBox.CMTextChanged(var Message: TMessage); +begin + inherited; + InvalidateBackground(False); + Realign; +end; + +procedure TSpTBXCustomGroupBox.DrawBackground(ACanvas: TCanvas; ARect: TRect); +var + Flags: Cardinal; +begin + Flags := DT_SINGLELINE; + if UseRightToLeftAlignment then + Flags := Flags or DT_RTLREADING; + SpDrawXPGroupBox(ACanvas, ARect, Caption, Flags, True, TBXStyleBackground, SkinType); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTextObjectActionLink } + +{$IFNDEF UNICODE} +procedure TSpTBXTextObjectActionLink.AssignClient(AClient: TObject); +begin + inherited AssignClient(AClient); + FUnicodeClient := AClient as TSpTBXTextObject; +end; + +function TSpTBXTextObjectActionLink.IsCheckedLinked: Boolean; +begin + Result := inherited IsCheckedLinked and + (FUnicodeClient.Checked = (Action as TCustomAction).Checked); +end; + +function TSpTBXTextObjectActionLink.IsCaptionLinked: Boolean; +begin + if (Action is TCustomAction) and Supports(Action, ITntAction) then + Result := FUnicodeClient.Caption = TntActnList.TntAction_GetCaption(Action as TCustomAction) + else + Result := inherited IsCaptionLinked; +end; + +function TSpTBXTextObjectActionLink.IsHintLinked: Boolean; +begin + if (Action is TCustomAction) and Supports(Action, ITntAction) then + Result := FUnicodeClient.Hint = TntActnList.TntAction_GetHint(Action as TCustomAction) + else + Result := inherited IsHintLinked; +end; + +procedure TSpTBXTextObjectActionLink.SetCaption(const Value: String); +begin + if IsCaptionLinked then + if (Action is TCustomAction) and Supports(Action, ITntAction) then + FUnicodeClient.Caption := TntActnList.TntAction_GetNewCaption(Action as TCustomAction, Value) + else + FUnicodeClient.Caption := Value; +end; + +procedure TSpTBXTextObjectActionLink.SetChecked(Value: Boolean); +begin + if IsCheckedLinked then FUnicodeClient.Checked := Value; +end; + +procedure TSpTBXTextObjectActionLink.SetHint(const Value: String); +begin + if IsHintLinked then + if (Action is TCustomAction) and Supports(Action, ITntAction) then + FUnicodeClient.Hint := TntActnList.TntAction_GetNewHint(Action as TCustomAction, Value) + else + FUnicodeClient.Hint := Value; +end; + +procedure TSpTBXTextObjectActionLink.SetImageIndex(Value: Integer); +begin + if IsImageIndexLinked then FUnicodeClient.ImageIndex := Value; +end; +{$ENDIF} + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTextObject } + +constructor TSpTBXTextObject.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle + [csClickEvents, csDoubleClicks, csSetCaption] - [csAcceptsControls, csOpaque]; + + FImageIndex := -1; + FImageChangeLink := TChangeLink.Create; + FImageChangeLink.OnChange := ImageListChange; + + FAlignment := taLeftJustify; + FCaptionGlowColor := clYellow; + FDisabledIconCorrection := True; + FDrawPushedCaption := False; + FShowAccelChar := True; + FSkinType := sknSkin; + + Autosize := True; + Color := clNone; + DoubleBuffered := True; + ParentColor := False; + TabStop := True; + Width := 100; + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXTextObject.Destroy; +begin + FImageChangeLink.Free; + SkinManager.RemoveSkinNotification(Self); + + inherited; +end; + +procedure TSpTBXTextObject.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + { + if not (csDesigning in ComponentState) then + with Params.WindowClass do + Style := Style and not (CS_HREDRAW or CS_VREDRAW); + } +end; + +procedure TSpTBXTextObject.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if Operation = opRemove then + if AComponent = Images then SetImages(nil); +end; + +procedure TSpTBXTextObject.DefineProperties(Filer: TFiler); +begin + inherited; + + // [Backward-Compatibility]: Don't read/save LinkFont, it's not used anymore + Filer.DefineProperty('LinkFont.Charset', ReadLinkFont, nil, False); + Filer.DefineProperty('LinkFont.Color', ReadLinkFont, nil, False); + Filer.DefineProperty('LinkFont.Height', ReadLinkFont, nil, False); + Filer.DefineProperty('LinkFont.Name', ReadLinkFont, nil, False); + Filer.DefineProperty('LinkFont.Orientation', ReadLinkFont, nil, False); + Filer.DefineProperty('LinkFont.Pitch', ReadLinkFont, nil, False); + Filer.DefineProperty('LinkFont.Style', ReadLinkFont, nil, False); + + Filer.DefineProperty('EditButton.LinkFont.Charset', ReadLinkFont, nil, False); + Filer.DefineProperty('EditButton.LinkFont.Color', ReadLinkFont, nil, False); + Filer.DefineProperty('EditButton.LinkFont.Height', ReadLinkFont, nil, False); + Filer.DefineProperty('EditButton.LinkFont.Name', ReadLinkFont, nil, False); + Filer.DefineProperty('EditButton.LinkFont.Orientation', ReadLinkFont, nil, False); + Filer.DefineProperty('EditButton.LinkFont.Pitch', ReadLinkFont, nil, False); + Filer.DefineProperty('EditButton.LinkFont.Style', ReadLinkFont, nil, False); + + Filer.DefineProperty('SpinButton.LinkFont.Charset', ReadLinkFont, nil, False); + Filer.DefineProperty('SpinButton.LinkFont.Color', ReadLinkFont, nil, False); + Filer.DefineProperty('SpinButton.LinkFont.Height', ReadLinkFont, nil, False); + Filer.DefineProperty('SpinButton.LinkFont.Name', ReadLinkFont, nil, False); + Filer.DefineProperty('SpinButton.LinkFont.Orientation', ReadLinkFont, nil, False); + Filer.DefineProperty('SpinButton.LinkFont.Pitch', ReadLinkFont, nil, False); + Filer.DefineProperty('SpinButton.LinkFont.Style', ReadLinkFont, nil, False); +end; + +function TSpTBXTextObject.GetActionLinkClass: TControlActionLinkClass; +begin + Result := TSpTBXTextObjectActionLink; +end; + +procedure TSpTBXTextObject.ActionChange(Sender: TObject; CheckDefaults: Boolean); +begin + inherited; + + if Sender is TCustomAction then + with TCustomAction(Sender) do begin + if not CheckDefaults or (Self.Checked = False) then + Self.Checked := Checked; + if not CheckDefaults or (Self.ImageIndex = -1) then + Self.ImageIndex := ImageIndex; + end; +end; + +procedure TSpTBXTextObject.AdjustFont(AFont: TFont); +begin + if (FLinkText <> '') and MouseInControl then begin + AFont.Color := clBlue; + AFont.Style := AFont.Style + [fsUnderline]; + end; +end; + +procedure TSpTBXTextObject.AdjustBounds; +var + NewWidth, NewHeight: Integer; +begin + if HandleAllocated and not FUpdating and ([csReading, csLoading] * ComponentState = []) and AutoSize then + begin + FUpdating := True; + try + NewWidth := Width; + NewHeight := 0; + DoAdjustBounds(NewWidth, NewHeight); + SetBounds(Left, Top, NewWidth, NewHeight); + finally + FUpdating := False; + end; + end; +end; + +function TSpTBXTextObject.CanFocus: Boolean; +begin + Result := False; +end; + +procedure TSpTBXTextObject.Click; +begin + if not (csLoading in ComponentState) then begin + Invalidate; + inherited; + ExecuteLink; + end; +end; + +function TSpTBXTextObject.CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; +begin + if not FUpdating and ([csReading, csLoading] * ComponentState = []) and AutoSize then begin + FUpdating := True; + try + NewHeight := 0; + DoAdjustBounds(NewWidth, NewHeight); + Result := True; + finally + FUpdating := False; + end; + end + else + Result := False; +end; + +procedure TSpTBXTextObject.DoAdjustBounds(var NewWidth, NewHeight: Integer); +var + R, R1, R2: TRect; +begin + GetSize(R, R1, R2); + NewHeight := R.Bottom - R.Top; + if Wrapping = twNone then + NewWidth := R.Right - R.Left; +end; + +procedure TSpTBXTextObject.DoDrawHint(AHintBitmap: TBitmap; + var AHint: Widestring; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawHint) then FOnDrawHint(Self, AHintBitmap, AHint, PaintDefault); +end; + +function TSpTBXTextObject.DoDrawItem(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +begin + Result := True; + if Assigned(FOnDraw) then FOnDraw(Self, ACanvas, ARect, PaintStage, Result); +end; + +function TSpTBXTextObject.DoDrawText(ACanvas: TCanvas; var ARect: TRect; + Flags: Longint): Integer; +var + PaintDefault: Boolean; + GlyphSize, DummyRightGlyphSize: TSize; + DummyRightGlyphRect: TRect; + R, R1, R2: TRect; + WS: WideString; + TextFlags: Cardinal; + State: TSpTBXSkinStatesType; +begin + Result := 0; + WS := Caption; + TextFlags := Flags; + if TextFlags and DT_CALCRECT = 0 then begin + ACanvas.Brush.Style := bsClear; + State := CurrentSkin.GetState(Enabled, Pushed, MouseInControl, Checked); + + PaintDefault := True; + if Assigned(FOnDrawCaption) then + FOnDrawCaption(Self, ACanvas, ClientRect, State, WS, ARect, TextFlags, False, pstPrePaint, PaintDefault); + + if PaintDefault then begin + // Calc the rects + GlyphSize := GetGlyphSize; + DummyRightGlyphSize.cx := 0; + DummyRightGlyphSize.cy := 0; + DummyRightGlyphRect := Rect(0, 0, 0, 0); + SpCalcXPText(ACanvas, ARect, WS, GetRealAlignment(Self), TextFlags, GlyphSize, DummyRightGlyphSize, FGlyphLayout, DrawPushedCaption and Pushed, R1, R2, DummyRightGlyphRect, FCaptionRoatationAngle); + + // Paint the text + if not Enabled then + if SpTBXSkinType(FSkinType) = sknNone then begin + OffsetRect(R1, 1, 1); + ACanvas.Font.Color := clBtnHighlight; + SpDrawXPText(ACanvas, WS, R1, TextFlags, FCaptionGlow, FCaptionGlowColor, FCaptionRoatationAngle); + OffsetRect(R1, -1, -1); + ACanvas.Font.Color := clGrayText; + end; + SpDrawXPText(ACanvas, WS, R1, TextFlags, FCaptionGlow, FCaptionGlowColor, FCaptionRoatationAngle); + + // Paint the glyph + DoInternalGlyphDraw(ACanvas, R2); + end; + + PaintDefault := True; + if Assigned(FOnDrawCaption) then + FOnDrawCaption(Self, ACanvas, ClientRect, State, WS, ARect, TextFlags, False, pstPostPaint, PaintDefault); + if PaintDefault then + if GetFocused then begin + R := ClientRect; + SpDrawFocusRect(ACanvas, GetFocusRect(R, R1, R2)); + end; + end + else + Result := SpDrawXPText(ACanvas, WS, ARect, TextFlags); +end; + +procedure TSpTBXTextObject.DoGetImageIndex(var AImageList: TCustomImageList; var AImageIndex: Integer); +begin + if Assigned(FOnGetImageIndex) then FOnGetImageIndex(Self, AImageList, AImageIndex); +end; + +procedure TSpTBXTextObject.DoInternalGlyphDraw(ACanvas: TCanvas; + AGlyphRect: TRect); +var + I: Integer; + IL: TCustomImageList; +begin + IL := FImages; + I := FImageIndex; + DoGetImageIndex(IL, I); + if Assigned(IL) and (I > -1) and (I < IL.Count) then + SpDrawImageList(ACanvas, AGlyphRect, IL, I, Enabled, FDisabledIconCorrection) +end; + +procedure TSpTBXTextObject.DoMouseEnter; +begin + Invalidate; + if Assigned(FOnMouseEnter) then FOnMouseEnter(Self); +end; + +procedure TSpTBXTextObject.DoMouseLeave; +begin + Invalidate; + if Assigned(FOnMouseLeave) then FOnMouseLeave(Self); +end; + +procedure TSpTBXTextObject.ExecuteLink; +begin + if FLinkText <> '' then + if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then + ShellExecuteA(Application.Handle, 'open', PAnsiChar(AnsiString(FLinkText)), PAnsiChar(AnsiString(FLinkTextParams)), '', SW_SHOWNORMAL) + else + ShellExecuteW(Application.Handle, 'open', PWideChar(FLinkText), PWideChar(FLinkTextParams), '', SW_SHOWNORMAL); +end; + +function TSpTBXTextObject.GetControlsAlignment: TAlignment; +begin + Result := FAlignment; +end; + +function TSpTBXTextObject.GetTextFlags: Cardinal; +const + Alignments: array [TAlignment] of Integer = (DT_LEFT, DT_RIGHT, DT_CENTER); + WordWraps: array [TTextWrapping] of Integer = (DT_SINGLELINE, + DT_SINGLELINE or DT_END_ELLIPSIS, + DT_SINGLELINE or DT_PATH_ELLIPSIS, DT_WORDBREAK); + ShowAccelChars: array [Boolean] of Integer = (DT_NOPREFIX, 0); + SystemAccelChars: array [Boolean] of Integer = (DT_HIDEPREFIX, 0); +begin + // Note on SystemAccelChars: custom controls need to update the accel painting + // in response to WM_UPDATEUISTATE, call WM_QUERYUISTATE to get the accel + // painting state: + // http://blogs.msdn.com/oldnewthing/archive/2005/05/03/414317.aspx + // + // Another way of doing it is updating a flag in WM_UPDATEUISTATE, without + // calling WM_QUERYUISTATE everytime the control needs to be painted: + // begin + // if LoWord(Message.WParam) and UISF_HIDEACCEL = UISF_HIDEACCEL then begin + // if HiWord(Message.WParam) and UIS_CLEAR = UIS_CLEAR then + // FSystemShowAccelChar := True; + // if HiWord(Message.WParam) and UIS_SET = UIS_SET then + // FSystemShowAccelChar := False; + // end; + // inherited; + // end; + // + // To test this use the mouse to run the app on the IDE, don't use F9 + // otherwise the accel will always be visible + + Result := DT_EXPANDTABS or WordWraps[Wrapping] or + Alignments[GetRealAlignment(Self)] or + ShowAccelChars[ShowAccelChar] or SystemAccelChars[SendMessage(Handle, WM_QUERYUISTATE, 0, 0) and UISF_HIDEACCEL = 0]; + Result := DrawTextBiDiModeFlags(Result); +end; + +function TSpTBXTextObject.GetFocusRect(R, TextR, GlyphR: TRect): TRect; +begin + if Caption = '' then + Result := Rect(0, 0, 0, 0) + else begin + InflateRect(TextR, 1, 1); + Result := TextR; + end; +end; + +function TSpTBXTextObject.GetGlyphSize: TSize; +var + I: Integer; + IL: TCustomImageList; +begin + IL := FImages; + I := FImageIndex; + DoGetImageIndex(IL, I); + if Assigned(IL) and (I > -1) and (I < IL.Count) then begin + Result.cx := IL.Width; + Result.cy := IL.Height; + end + else begin + Result.cx := 0; + Result.cy := 0; + end; +end; + +function TSpTBXTextObject.GetFocused: Boolean; +begin + Result := Focused; +end; + +function TSpTBXTextObject.GetPushed: Boolean; +begin + Result := FPushed and MouseInControl; +end; + +procedure TSpTBXTextObject.GetSize(out TotalR, TextR, GlyphR: TRect); +// Size of Text + Glyph + TextMargin + Margins +var + GlyphSize, DummyRightGlyphSize: TSize; + DummyRightGlyphRect: TRect; + R: TRect; +begin + GlyphSize := GetGlyphSize; + DummyRightGlyphSize.cx := 0; + DummyRightGlyphSize.cy := 0; + DummyRightGlyphRect := Rect(0, 0, 0, 0); + R := ClientRect; + ApplyMargins(R, GetTextMargins); + + Canvas.Font.Assign(Font); + AdjustFont(Canvas.Font); + SpCalcXPText(Canvas, R, Caption, GetRealAlignment(Self), GetTextFlags, GlyphSize, DummyRightGlyphSize, + FGlyphLayout, DrawPushedCaption and Pushed, TextR, GlyphR, DummyRightGlyphRect); + + UnionRect(TotalR, TextR, GlyphR); + + {$IF CompilerVersion > 17} + if Autosize then + with Margins do begin + Inc(TotalR.Right, Left + Right); + Inc(TotalR.Bottom, Top + Bottom); + end; + {$IFEND} +end; + +function TSpTBXTextObject.GetTextMargins: TRect; +begin + Result := Rect(0, 0, 0, 0); +end; + +procedure TSpTBXTextObject.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + if (Button = mbLeft) and Enabled and not FPushed then begin + FPushed := True; + if not Focused and CanFocus then + SetFocus // Invalidates the canvas + else + Invalidate; + end; + inherited; +end; + +procedure TSpTBXTextObject.MouseMove(Shift: TShiftState; X, Y: Integer); +begin + if FPushed then + UpdateTracking; + inherited; +end; + +procedure TSpTBXTextObject.MouseUp(Button: TMouseButton; Shift: TShiftState; X, + Y: Integer); +begin + FPushed := False; + Invalidate; + inherited; +end; + +procedure TSpTBXTextObject.KeyDown(var Key: Word; Shift: TShiftState); +begin + inherited; + if (Key = VK_SPACE) and FSpaceAsClick then begin + FPushed := True; + FMouseInControl := True; + Invalidate; + end; +end; + +procedure TSpTBXTextObject.KeyUp(var Key: Word; Shift: TShiftState); +begin + if (Key = VK_SPACE) and FSpaceAsClick and FPushed then begin + FPushed := False; + FMouseInControl := False; + Click; + Invalidate; + end; + inherited; +end; + +procedure TSpTBXTextObject.Paint; +var + R, TextR: TRect; +begin + R := ClientRect; + Canvas.Font.Assign(Font); + AdjustFont(Canvas.Font); + // Draw the background + DoDrawItem(Canvas, R, pstPrePaint); + // Draw the text + TextR := R; + ApplyMargins(TextR, GetTextMargins); + DoDrawText(Canvas, TextR, GetTextFlags); + // Draw the Focus, Icon and Text + DoDrawItem(Canvas, R, pstPostPaint); +end; + +procedure TSpTBXTextObject.ReadLinkFont(Reader: TReader); +begin + // [Backward-Compatibility] + Reader.SkipValue; +end; + +procedure TSpTBXTextObject.SetAlignment(const Value: TAlignment); +begin + if FAlignment <> Value then begin + FAlignment := Value; + Invalidate; + end; +end; + +procedure TSpTBXTextObject.Loaded; +begin + inherited; + AdjustBounds; +end; + +procedure TSpTBXTextObject.SetCaptionGlow(const Value: TSpGlowDirection); +begin + if FCaptionGlow <> Value then begin + FCaptionGlow := Value; + Invalidate; + end; +end; + +procedure TSpTBXTextObject.SetCaptionGlowColor(const Value: TColor); +begin + if FCaptionGlowColor <> Value then begin + FCaptionGlowColor := Value; + Invalidate; + end; +end; + +procedure TSpTBXTextObject.SetCaptionRoatationAngle(const Value: TSpTextRotationAngle); +begin + if FCaptionRoatationAngle <> Value then begin + FCaptionRoatationAngle := Value; + Invalidate; + end; +end; + +function TSpTBXTextObject.GetChecked: Boolean; +begin + Result := FChecked; +end; + +procedure TSpTBXTextObject.SetChecked(Value: Boolean); +begin + if Value <> FChecked then begin + FChecked := Value; + Invalidate; + end; +end; + +procedure TSpTBXTextObject.SetGlyphLayout(const Value: TSpGlyphLayout); +begin + if FGlyphLayout <> Value then begin + FGlyphLayout := Value; + Invalidate; + end; +end; + +function TSpTBXTextObject.IsImageIndexValid: Boolean; +var + I: Integer; + IL: TCustomImageList; +begin + IL := FImages; + I := FImageIndex; + DoGetImageIndex(IL, I); + Result := Assigned(IL) and (I > -1) and (I < IL.Count); +end; + +procedure TSpTBXTextObject.ImageListChange(Sender: TObject); +begin + if Sender = Images then begin + Invalidate; + AdjustBounds; + end; +end; + +procedure TSpTBXTextObject.SetImageIndex(const Value: TImageIndex); +begin + if FImageIndex <> Value then begin + FImageIndex := Value; + if Assigned(Images) then Invalidate; + AdjustBounds; + end; +end; + +procedure TSpTBXTextObject.SetImages(const Value: TCustomImageList); +begin + if FImages <> nil then FImages.UnRegisterChanges(FImageChangeLink); + FImages := Value; + if FImages <> nil then begin + FImages.RegisterChanges(FImageChangeLink); + FImages.FreeNotification(Self); + end; + Invalidate; + AdjustBounds; +end; + +procedure TSpTBXTextObject.SetShowAccelChar(Value: Boolean); +begin + if FShowAccelChar <> Value then begin + FShowAccelChar := Value; + AdjustBounds; + Invalidate; + end; +end; + +procedure TSpTBXTextObject.SetSkinType(const Value: TSpTBXSkinType); +begin + if FSkinType <> Value then begin + FSkinType := Value; + Invalidate; + end; +end; + +procedure TSpTBXTextObject.SetWrapping(Value: TTextWrapping); +begin + if FWrapping <> Value then begin + FWrapping := Value; + AdjustBounds; + Invalidate; + end; +end; + +procedure TSpTBXTextObject.UpdateTracking(ForceMouseLeave: Boolean = False); +var + P: TPoint; + IsInControl: Boolean; +begin + if ForceMouseLeave then begin + FMouseInControl := True; + Perform(CM_MOUSELEAVE, 0, 0) + end + else + if Enabled then begin + GetCursorPos(P); + IsInControl := FindDragTarget(P, True) = Self; + + if FMouseInControl <> IsInControl then begin + FMouseInControl := not IsInControl; + if FMouseInControl then + Perform(CM_MOUSELEAVE, 0, 0) + else + Perform(CM_MOUSEENTER, 0, 0); + end; + end; +end; + +procedure TSpTBXTextObject.CMEnabledChanged(var Message: TMessage); +begin + inherited; + if not Enabled and FMouseInControl then begin + FMouseInControl := False; + DoMouseLeave; + Perform(WM_CANCELMODE, 0, 0); + end + else + Invalidate; +end; + +procedure TSpTBXTextObject.CMFontChanged(var Message: TMessage); +begin + inherited; + Invalidate; + AdjustBounds; +end; + +procedure TSpTBXTextObject.CMHintShow(var Message: TCMHintShow); +// Handle the CM_HINTSHOW message to show unicode hints using +// a custom THintWindow. +var + HintInfo: PHintInfo; + WideHint, PrevWideHint: Widestring; + R, TextR: TRect; + PaintDefault: Boolean; +begin + WideHint := Hint; + + // Prepare the HintBitmap + SpStockHintBitmap.Canvas.Font.Assign(Screen.HintFont); + SpStockHintBitmap.Canvas.Font.Color := clInfoText; + SpStockHintBitmap.Canvas.Pen.Color := clBlack; + SpStockHintBitmap.Canvas.Brush.Color := clInfoBk; + TextR := Rect(0, 0, 1, 1); + SpDrawXPText(SpStockHintBitmap.Canvas, WideHint, TextR, DT_NOPREFIX or DT_CALCRECT); + SpStockHintBitmap.Width := TextR.Right + 8; + SpStockHintBitmap.Height := TextR.Bottom + 4; + R := Rect(0, 0, SpStockHintBitmap.Width, SpStockHintBitmap.Height); + SpDrawXPTooltipBackground(SpStockHintBitmap.Canvas, R); + + // Draw the hint in the HintBitmap + PrevWideHint := WideHint; + PaintDefault := True; + DoDrawHint(SpStockHintBitmap, WideHint, PaintDefault); + if PaintDefault then begin + // Prepare the HintInfo + HintInfo := Message.HintInfo; + HintInfo.HintStr := WideHint; + HintInfo.CursorRect := ClientRect; + HintInfo.HintWindowClass := SpTBXHintWindowClass; // Custom HintWindow class + HintInfo.HintData := SpStockHintBitmap; // TApplication.ActivateHint will pass the data to the HintWindow + HintInfo.HideTimeout := 60000; // 1 minute + + // Adjust the bounds and repaint the background if it's needed + if WideHint <> PrevWideHint then begin + TextR := Rect(0, 0, 1, 1); + SpDrawXPText(SpStockHintBitmap.Canvas, WideHint, TextR, DT_NOPREFIX or DT_CALCRECT); + SpStockHintBitmap.Width := TextR.Right + 8; + SpStockHintBitmap.Height := TextR.Bottom + 4; + R := Rect(0, 0, SpStockHintBitmap.Width, SpStockHintBitmap.Height); + SpDrawXPTooltipBackground(SpStockHintBitmap.Canvas, R); + end + else + R := Rect(0, 0, SpStockHintBitmap.Width, SpStockHintBitmap.Height); + + // Draw the hint + OffsetRect(TextR, ((R.Right - TextR.Right) div 2) - 2, (R.Bottom - TextR.Bottom) div 2); + SpDrawXPText(SpStockHintBitmap.Canvas, WideHint, TextR, DT_NOPREFIX); + end; +end; + +procedure TSpTBXTextObject.CMMouseEnter(var Message: TMessage); +begin + inherited; + if not FMouseInControl then begin + FMouseInControl := True; + DoMouseEnter; + end; +end; + +procedure TSpTBXTextObject.CMMouseLeave(var Message: TMessage); +begin + inherited; + if FMouseInControl then begin + FMouseInControl := False; + DoMouseLeave; + end; +end; + +procedure TSpTBXTextObject.CMTextChanged(var Message: TMessage); +begin + inherited; + Invalidate; + AdjustBounds; +end; + +procedure TSpTBXTextObject.WMEraseBkgnd(var Message: TMessage); +begin + if not DoubleBuffered or (Message.wParam = Message.lParam) then + begin + if (Color = clNone) and Assigned(Parent) then + SpDrawParentBackground(Self, TWMEraseBkgnd(Message).DC, ClientRect) + else + Windows.FillRect(TWMEraseBkgnd(Message).DC, ClientRect, Brush.Handle); + end; + Message.Result := 1; +end; + +procedure TSpTBXTextObject.WMKillFocus(var Message: TMessage); +begin + inherited; + FPushed := False; + Invalidate; +end; + +procedure TSpTBXTextObject.WMSetFocus(var Message: TMessage); +begin + inherited; + Invalidate; +end; + +procedure TSpTBXTextObject.WMSetCursor(var Message: TWMSetCursor); +begin + if not (csDesigning in ComponentState) and (Message.CursorWnd = Handle) and + (FLinkText <> '') and MouseInControl and (Screen.Cursor = crDefault) then + begin + // Replace the Delphi hand cursor for the one used by Windows only if + // there is no other cursor assigned. + Windows.SetCursor(Screen.Cursors[crSpTBXNewHandPoint]); + Message.Result := 1; + end + else + inherited; +end; + +procedure TSpTBXTextObject.WMSpSkinChange(var Message: TMessage); +var + R: TRect; +begin + if HandleAllocated then begin + R := ClientRect; + InvalidateRect(Handle, @R, True); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomLabel } + +constructor TSpTBXCustomLabel.Create(AOwner: TComponent); +begin + inherited; + FUnderlineColor := clBtnShadow; + TabStop := False; +end; + +procedure TSpTBXCustomLabel.AdjustFont(AFont: TFont); +var + State: TSpTBXSkinStatesType; +begin + if (LinkText <> '') and MouseInControl then + inherited + else + if (SkinType = sknSkin) and ((AFont.Color = clWindowText) or (AFont.Color = clNone)) then begin + State := CurrentSkin.GetState(Enabled, Pushed, MouseInControl, Checked); + AFont.Color := CurrentSkin.GetTextColor(skncLabel, State); + end; +end; + +function TSpTBXCustomLabel.DoDrawItem(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +var + C: TColor; +begin + Result := inherited DoDrawItem(ACanvas, ARect, PaintStage); + if Result and (PaintStage = pstPrePaint) and FUnderline then begin + C := ACanvas.Pen.Color; + try + ACanvas.Pen.Color := UnderlineColor; + ACanvas.MoveTo(ARect.Left, ARect.Bottom - 1); + ACanvas.LineTo(ARect.Right, ARect.Bottom - 1); + finally + ACanvas.Pen.Color := C; + end; + end; +end; + +procedure TSpTBXCustomLabel.GetSize(out TotalR, TextR, GlyphR: TRect); +begin + inherited GetSize(TotalR, TextR, GlyphR); + if FUnderline then + Inc(TotalR.Bottom); +end; + +procedure TSpTBXCustomLabel.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if Operation = opRemove then + if AComponent = FocusControl then SetFocusControl(nil); +end; + +procedure TSpTBXCustomLabel.SetFocusControl(const Value: TWinControl); +begin + if FFocusControl <> Value then + begin + FFocusControl := Value; + if FFocusControl <> nil then FFocusControl.FreeNotification(Self); + end; +end; + +procedure TSpTBXCustomLabel.SetUnderline(const Value: Boolean); +begin + if Value <> FUnderline then begin + FUnderline := Value; + Invalidate; + AdjustBounds; + end; +end; + +procedure TSpTBXCustomLabel.SetUnderlineColor(const Value: TColor); +begin + FUnderlineColor := Value; + Invalidate; +end; + +procedure TSpTBXCustomLabel.CMDialogChar(var Message: TCMDialogChar); +begin + if Assigned(FFocusControl) and IsAccel(Message.CharCode, Caption) and SpCanFocus(FFocusControl) then begin + FFocusControl.SetFocus; + Message.Result := 1; + end + else + inherited; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXButtonControl } + +constructor TSpTBXButtonControl.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle - [csDoubleClicks]; + FGroupIndex := 0; +end; + +function TSpTBXButtonControl.CanFocus: Boolean; +var + Control: TWinControl; + Form: TCustomForm; +begin + Result := False; + Form := GetParentForm(Self); + if (Form <> nil) and Form.Visible and Form.Enabled then begin + Control := Self; + while Control <> Form do + begin + if not (Control.Visible and Control.Enabled) then Exit; + Control := Control.Parent; + end; + Result := True; + end; +end; + +function TSpTBXButtonControl.CanUpdateExclusive: Boolean; +begin + Result := FGroupIndex <> 0; +end; + +procedure TSpTBXButtonControl.UpdateExclusive; +var + Msg: TMessage; +begin + if Assigned(Parent) and CanUpdateExclusive then begin + Msg.Msg := CM_SPGROUPINDEXUPDATE; + Msg.WParam := FGroupIndex; + Msg.LParam := Longint(Self); + Msg.Result := 0; + Parent.Broadcast(Msg); + end; +end; + +procedure TSpTBXButtonControl.SetGroupIndex(const Value: Integer); +begin + if FGroupIndex <> Value then begin + FGroupIndex := Value; + UpdateExclusive; + end; +end; + +procedure TSpTBXButtonControl.SetAllowAllUp(const Value: Boolean); +begin + if FAllowAllUp <> Value then begin + FAllowAllUp := Value; + UpdateExclusive; + end; +end; + +procedure TSpTBXButtonControl.SetChecked(Value: Boolean); +begin + inherited; + if Value then UpdateExclusive; +end; + +procedure TSpTBXButtonControl.CMDialogChar(var Message: TCMDialogChar); +begin + if Enabled and ShowAccelChar and IsAccel(Message.CharCode, Caption) and + CanFocus and Visible then + begin + SetFocus; + Click; + Message.Result := 1; + end + else + inherited; +end; + +procedure TSpTBXButtonControl.CMSPGroupIndexUpdate(var Message: TMessage); +var + Sender: TComponent; + SenderButton: TSpTBXButtonControl; +begin + if Message.WParam = FGroupIndex then begin + Sender := TComponent(Message.LParam); + if (Sender <> Self) and (Sender is TSpTBXButtonControl) and (Sender.ClassType = Self.ClassType) then begin + SenderButton := Sender as TSpTBXButtonControl; + FAllowAllUp := SenderButton.AllowAllUp; + if SenderButton.Checked and Checked then + Checked := False; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomCheckButton } + +function TSpTBXCustomCheckButton.GetGlyphSize: TSize; +begin + Result := inherited GetGlyphSize; + if (Result.cx = 0) or (Result.cy = 0) then begin + Result.cx := 13; + Result.cy := 13; + end; +end; + +procedure TSpTBXCustomCheckButton.GetSize(out TotalR, TextR, GlyphR: TRect); +begin + inherited GetSize(TotalR, TextR, GlyphR); + // Inc TotalR for the FocusRect + if Autosize then begin + Inc(TotalR.Right); + Inc(TotalR.Bottom, 2); + end; +end; + +procedure TSpTBXCustomCheckButton.Toggle; +begin + // Toggle the check state +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomCheckBox } + +constructor TSpTBXCustomCheckBox.Create(AOwner: TComponent); +begin + inherited; + FAllowGrayed := False; + FState := cbUnchecked; + SpaceAsClick := True; +end; + +procedure TSpTBXCustomCheckBox.DoInternalGlyphDraw(ACanvas: TCanvas; + AGlyphRect: TRect); +begin + if IsImageIndexValid then + inherited + else + SpDrawXPCheckBoxGlyph(ACanvas, AGlyphRect, Enabled, State, MouseInControl, Pushed, SkinType); +end; + +procedure TSpTBXCustomCheckBox.AdjustFont(AFont: TFont); +var + State: TSpTBXSkinStatesType; +begin + if (LinkText <> '') and MouseInControl then + inherited + else + if (SkinType = sknSkin) and ((AFont.Color = clWindowText) or (AFont.Color = clNone)) then begin + State := CurrentSkin.GetState(Enabled, Pushed, MouseInControl, Checked); + AFont.Color := CurrentSkin.GetTextColor(skncCheckBox, State); + end; +end; + +procedure TSpTBXCustomCheckBox.Click; +begin + if StateChanged then + inherited + else + Toggle; // Toggle calls OnClick +end; + +function TSpTBXCustomCheckBox.GetChecked: Boolean; +begin + Result := FState = cbChecked; +end; + +procedure TSpTBXCustomCheckBox.SetChecked(Value: Boolean); +begin + if Checked <> Value then begin + inherited; + if Value then SetState(cbChecked) + else SetState(cbUnchecked); + end; +end; + +procedure TSpTBXCustomCheckBox.SetState(const Value: TCheckBoxState); +begin + if (FState <> Value) then begin + FState := Value; + + // When State is changed OnClick must be fired + StateChanged := True; + try + Click; + finally + StateChanged := False; + end; + end; +end; + +procedure TSpTBXCustomCheckBox.Toggle; +begin + case State of + cbUnchecked: if AllowGrayed then SetState(cbGrayed) else SetState(cbChecked); + cbChecked: SetState(cbUnchecked); + cbGrayed: SetState(cbChecked); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomRadioButton } + +constructor TSpTBXCustomRadioButton.Create(AOwner: TComponent); +begin + inherited; + TabStop := False; +end; + +procedure TSpTBXCustomRadioButton.DoInternalGlyphDraw(ACanvas: TCanvas; + AGlyphRect: TRect); +begin + if IsImageIndexValid then + inherited + else + SpDrawXPRadioButtonGlyph(ACanvas, AGlyphRect, Enabled, Checked, MouseInControl, Pushed, SkinType); +end; + +procedure TSpTBXCustomRadioButton.AdjustFont(AFont: TFont); +var + State: TSpTBXSkinStatesType; +begin + if (LinkText <> '') and MouseInControl then + inherited + else + if (SkinType = sknSkin) and ((AFont.Color = clWindowText) or (AFont.Color = clNone)) then begin + State := CurrentSkin.GetState(Enabled, Pushed, MouseInControl, Checked); + AFont.Color := CurrentSkin.GetTextColor(skncRadioButton, State); + end; +end; + +function TSpTBXCustomRadioButton.CanUpdateExclusive: Boolean; +begin + // Special case on RadioButtons, UpdateExclusive on all + // the radiobuttons regardless of the GroupIndex + Result := True; +end; + +procedure TSpTBXCustomRadioButton.Click; +begin + if StateChanged then + inherited + else + if not Checked then Toggle; // Toggle calls OnClick +end; + +procedure TSpTBXCustomRadioButton.CMFocusChanged(var Message: TCMFocusChanged); +begin + inherited; + if Focused then + Toggle; +end; + +procedure TSpTBXCustomRadioButton.SetChecked(Value: Boolean); +var + WasChecked: Boolean; +begin + WasChecked := Checked; + inherited; + TabStop := Value; + // When Checked is true OnClick must be fired + if not WasChecked and Value then begin + StateChanged := True; + try + Click; + finally + StateChanged := False; + end; + end; +end; + +procedure TSpTBXCustomRadioButton.Toggle; +begin + if not Checked then Checked := True; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXRadioGroupButton } + +type + TSpTBXRadioGroupButton = class(TSpTBXRadioButton) + public + constructor InternalCreate(RadioGroup: TSpTBXCustomRadioGroup); + destructor Destroy; override; + end; + +constructor TSpTBXRadioGroupButton.InternalCreate(RadioGroup: TSpTBXCustomRadioGroup); +begin + inherited Create(RadioGroup); + RadioGroup.FButtons.Add(Self); + Parent := RadioGroup; + AutoSize := False; + Visible := False; + Enabled := RadioGroup.Enabled; + ParentShowHint := False; + TabStop := False; + OnClick := RadioGroup.ButtonClick; +end; + +destructor TSpTBXRadioGroupButton.Destroy; +begin + TSpTBXCustomRadioGroup(Owner).FButtons.Remove(Self); + inherited Destroy; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomRadioGroup } + +constructor TSpTBXCustomRadioGroup.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + ControlStyle := ControlStyle - [csAcceptsControls]; + FButtons := TList.Create; + FItems := TTntStringList.Create; + TTntStringList(FItems).OnChange := ItemsChange; + FItemIndex := -1; + FColumns := 1; +end; + +destructor TSpTBXCustomRadioGroup.Destroy; +begin + SetButtonCount(0); + TTntStringList(FItems).OnChange := nil; + FItems.Free; + FButtons.Free; + inherited Destroy; +end; + +procedure TSpTBXCustomRadioGroup.FlipChildren(AllLevels: Boolean); +begin + { The radio buttons are flipped using BiDiMode } +end; + +procedure TSpTBXCustomRadioGroup.ArrangeButtons; +var + ButtonsPerCol, ButtonWidth, ButtonHeight, TopMargin, I: Integer; + DC: HDC; + SaveFont: HFont; + Metrics: TTextMetric; + DeferHandle: THandle; + ALeft: Integer; +begin + if (FButtons.Count <> 0) and not FReading then + begin + DC := GetDC(0); + SaveFont := SelectObject(DC, Font.Handle); + GetTextMetrics(DC, Metrics); + SelectObject(DC, SaveFont); + ReleaseDC(0, DC); + ButtonsPerCol := (FButtons.Count + FColumns - 1) div FColumns; + ButtonWidth := (Width - 10) div FColumns; + I := Height - Metrics.tmHeight - 5; + ButtonHeight := I div ButtonsPerCol; + TopMargin := Metrics.tmHeight + 1 + (I mod ButtonsPerCol) div 2; + DeferHandle := BeginDeferWindowPos(FButtons.Count); + try + for I := 0 to FButtons.Count - 1 do + with TSpTBXRadioGroupButton(FButtons[I]) do + begin + BiDiMode := Self.BiDiMode; + ALeft := (I div ButtonsPerCol) * ButtonWidth + 8; + if UseRightToLeftAlignment then + ALeft := Self.ClientWidth - ALeft - ButtonWidth; + DeferHandle := DeferWindowPos(DeferHandle, Handle, 0, + ALeft, + (I mod ButtonsPerCol) * ButtonHeight + TopMargin, + ButtonWidth, ButtonHeight, + SWP_NOZORDER or SWP_NOACTIVATE); + Visible := True; + end; + finally + EndDeferWindowPos(DeferHandle); + end; + end; +end; + +procedure TSpTBXCustomRadioGroup.ButtonClick(Sender: TObject); +begin + if not FUpdating then begin + FItemIndex := FButtons.IndexOf(Sender); + Changed; + Click; + end; +end; + +procedure TSpTBXCustomRadioGroup.InvalidateBackground(InvalidateChildren: Boolean); +var + I: Integer; + T: TSpTBXSkinType; +begin + inherited; + + if not InvalidateChildren and not (csDestroying in ComponentState) then + if HandleAllocated then begin + T := SkinType; + for I := 0 to FButtons.Count - 1 do + Buttons[I].SkinType := T; + end; +end; + +procedure TSpTBXCustomRadioGroup.ItemsChange(Sender: TObject); +begin + if not FReading then begin + if FItemIndex >= FItems.Count then FItemIndex := FItems.Count - 1; + UpdateButtons; + end; +end; + +procedure TSpTBXCustomRadioGroup.Loaded; +begin + inherited Loaded; + ArrangeButtons; +end; + +procedure TSpTBXCustomRadioGroup.ReadState(Reader: TReader); +begin + FReading := True; + try + inherited ReadState(Reader); + finally + FReading := False; + end; + UpdateButtons; +end; + +procedure TSpTBXCustomRadioGroup.SetButtonCount(Value: Integer); +begin + while FButtons.Count < Value do + TSpTBXRadioGroupButton.InternalCreate(Self); + while FButtons.Count > Value do + TSpTBXRadioGroupButton(FButtons.Last).Free; +end; + +procedure TSpTBXCustomRadioGroup.SetColumns(Value: Integer); +begin + if Value < 1 then Value := 1; + if Value > 16 then Value := 16; + if FColumns <> Value then begin + FColumns := Value; + ArrangeButtons; + Invalidate; + end; +end; + +procedure TSpTBXCustomRadioGroup.SetFocus; +begin + inherited; + if Enabled and (FItemIndex > -1) then + GetButtons(FItemIndex).SetFocus; +end; + +procedure TSpTBXCustomRadioGroup.SetItemIndex(Value: Integer); +begin + if FReading then + FItemIndex := Value + else begin + if Value < -1 then Value := -1; + if Value >= FButtons.Count then Value := FButtons.Count - 1; + if FItemIndex <> Value then + begin + if FItemIndex >= 0 then + GetButtons(FItemIndex).Checked := False; + FItemIndex := Value; + if FItemIndex >= 0 then + GetButtons(FItemIndex).Checked := True; + end; + end; +end; + +procedure TSpTBXCustomRadioGroup.SetItems(Value: TTntStrings); +begin + FItems.Assign(Value); +end; + +procedure TSpTBXCustomRadioGroup.UpdateButtons; +var + I: Integer; +begin + SetButtonCount(FItems.Count); + for I := 0 to FButtons.Count - 1 do + Buttons[I].Caption := FItems[I]; + if FItemIndex >= 0 then begin + FUpdating := True; + try + GetButtons(FItemIndex).Checked := True; + finally + FUpdating := False; + end; + end; + ArrangeButtons; + Invalidate; +end; + +procedure TSpTBXCustomRadioGroup.CMEnabledChanged(var Message: TMessage); +var + I: Integer; +begin + inherited; + for I := 0 to FButtons.Count - 1 do + GetButtons(I).Enabled := Enabled; +end; + +procedure TSpTBXCustomRadioGroup.CMFontChanged(var Message: TMessage); +begin + inherited; + ArrangeButtons; +end; + +procedure TSpTBXCustomRadioGroup.WMSize(var Message: TWMSize); +begin + inherited; + ArrangeButtons; +end; + +procedure TSpTBXCustomRadioGroup.GetChildren(Proc: TGetChildProc; Root: TComponent); +begin + // Do nothing +end; + +function TSpTBXCustomRadioGroup.GetButtons(Index: Integer): TSpTBXRadioButton; +begin + Result := TSpTBXRadioButton(FButtons[Index]); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomButton } + +constructor TSpTBXCustomButton.Create(AOwner: TComponent); +begin + inherited; + + FBitmapTransparent := True; + FBitmap := TBitmap.Create; + FBitmap.OnChange := BitmapChanged; + + FPopupControl := Self; + FDropDownArrow := True; + Alignment := taCenter; + Autosize := False; + DrawPushedCaption := True; + SpaceAsClick := True; + Width := 75; + Height := 25; +end; + +destructor TSpTBXCustomButton.Destroy; +begin + StopRepeat; + FBitmap.Free; + inherited; +end; + +procedure TSpTBXCustomButton.CreateWnd; +begin + inherited; + FActive := FDefault; +end; + +procedure TSpTBXCustomButton.AdjustFont(AFont: TFont); +var + State: TSpTBXSkinStatesType; +begin + if (LinkText <> '') and MouseInControl then + inherited + else + if (SkinType = sknSkin) and ((AFont.Color = clWindowText) or (AFont.Color = clNone)) then begin + State := CurrentSkin.GetState(Enabled, Pushed, MouseInControl, Checked); + AFont.Color := CurrentSkin.GetTextColor(skncButton, State); + end; +end; + +procedure TSpTBXCustomButton.BitmapChanged(Sender: TObject); +begin + Invalidate; +end; + +function TSpTBXCustomButton.BitmapValid: boolean; +begin + Result := (Bitmap <> nil) and (not Bitmap.Empty) and (Bitmap.Height mod ConstStatesCount = 0); +end; + +procedure TSpTBXCustomButton.Click; +var + P: TPoint; + Form: TCustomForm; + M: TPopupMenu; + SpTBXPopup: ISpTBXPopupMenu; + + procedure RemoveClicks; + var + RepostList: TList; + Repost: Boolean; + I: Integer; + Msg: TMsg; + P: TPoint; + begin + RepostList := TList.Create; + try + while PeekMessage(Msg, 0, WM_LBUTTONDOWN, WM_MBUTTONDBLCLK, PM_REMOVE) do + with Msg do + begin + Repost := True; + case Message of + WM_QUIT: begin + { Throw back any WM_QUIT messages } + PostQuitMessage(wParam); + Break; + end; + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, + WM_RBUTTONDOWN, WM_RBUTTONDBLCLK, + WM_MBUTTONDOWN, WM_MBUTTONDBLCLK: begin + P := SmallPointToPoint(TSmallPoint(lParam)); + Windows.ClientToScreen(hwnd, P); + if FindDragTarget(P, True) = Self then Repost := False; + end; + end; + if Repost then + begin + RepostList.Add(AllocMem(SizeOf(TMsg))); + PMsg(RepostList.Last)^ := Msg; + end; + end; + + for I := 0 to RepostList.Count-1 do + begin + with PMsg(RepostList[I])^ do PostMessage(hwnd, message, wParam, lParam); + FreeMem(RepostList[I]); + end; + finally + RepostList.Free; + end; + end; + +begin + if not FRepeating then begin + M := GetInternalDropDownMenu; + if Assigned(M) then begin + FDropDownMenuVisible := True; + try + UpdateTracking(True); + MouseCapture := False; + M.PopupComponent := Self; + + if M.GetInterface(ISpTBXPopupMenu, SpTBXPopup) then begin + if not SpTBXPopup.InternalPopup(0, 0, False, FPopupControl) then + FDropDownMenuVisible := False; + end + else begin + P := ClientToScreen(Point(0, Height)); + M.Popup(P.X, P.Y); + FDropDownMenuVisible := False; + end; + finally + Invalidate; + RemoveClicks; + end; + Exit; // don't call the Click handler if the DropDownMenu is shown + end; + + Form := GetParentForm(Self); + if Assigned(Form) then Form.ModalResult := FModalResult; + end; + + inherited; +end; + +function TSpTBXCustomButton.DoDrawDropDownArrow(ACanvas: TCanvas; + ARect: TRect): Boolean; +var + R: TRect; + P: TPoint; +begin + Result := True; + if FDropDownArrow and Assigned(FDropDownMenu) then begin + R := ARect; + R.Left := R.Right - GetTextMargins.Right; + + P.X := (R.Left + R.Right) div 2 - 1; + P.Y := (R.Top + R.Bottom) div 2 - 1; + SpDrawArrow(ACanvas, P.X, P.Y, ACanvas.Font.Color, True, False, 2); + end; +end; + +function TSpTBXCustomButton.DoDrawItem(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +var + B: TBitmap; + T: TSpTBXSkinType; +begin + Result := inherited DoDrawItem(ACanvas, ARect, PaintStage); + + if Result and (PaintStage = pstPrePaint) then + // When Flat is true draw the button only when it's needed + if not Flat or (MouseInControl or Focused or FPushed or Checked) then begin + if BitmapValid then begin + B := TBitmap.Create; + try + B.Width := ARect.Right - ARect.Left; + B.Height := ARect.Bottom - ARect.Top; + SetStretchBltMode(B.Canvas.Handle, COLORONCOLOR); + B.Canvas.CopyRect(ARect, Bitmap.Canvas, GetSkinStateRect); + if FBitmapTransparent then + B.Transparent := True; + ACanvas.Draw(0, 0, B); + finally + B.Free; + end; + end + else begin + T := SpTBXSkinType(SkinType); + case T of + sknNone, sknWindows: + SpDrawXPButton(ACanvas, ARect, Enabled, Pushed, MouseInControl, Checked, False, FActive, T); + sknSkin: + SpDrawXPButton(ACanvas, ARect, Enabled, Pushed, MouseInControl, Checked, False, False, T); + end; + end; + end; + + // Draw the button arrow + if Result and (PaintStage = pstPostPaint) then + DoDrawDropDownArrow(ACanvas, ARect); +end; + +function TSpTBXCustomButton.GetFocused: Boolean; +begin + Result := Focused and (IsDroppedDown or (inherited GetFocused)); +end; + +function TSpTBXCustomButton.GetFocusRect(R, TextR, GlyphR: TRect): TRect; +begin + Result := R; + if SpTBXSkinType(SkinType) = sknNone then + InflateRect(Result, -4, -4) + else + InflateRect(Result, -3, -3); +end; + +function TSpTBXCustomButton.GetInternalDropDownMenu: TPopupMenu; +begin + Result := FDropDownMenu; +end; + +function TSpTBXCustomButton.GetPushed: Boolean; +begin + Result := IsDroppedDown or (inherited GetPushed); +end; + +function TSpTBXCustomButton.GetTextMargins: TRect; +const + ArrowWidth = 5; +begin + Result := Rect(8, 2, 8, 2); + if FDropDownArrow and Assigned(FDropdownMenu) then + Inc(Result.Right, ArrowWidth + 4); +end; + +function TSpTBXCustomButton.IsDroppedDown: Boolean; +begin + Result := FDropDownMenuVisible; +end; + +function TSpTBXCustomButton.GetSkinStateRect: TRect; +var + W, H: integer; +begin + // Finds the skin rect based on the button state + Result := Rect(0, 0, 0, 0); + + if BitmapValid then begin + W := Bitmap.Width; + H := (Bitmap.Height div ConstStatesCount); // 4 states + if not Enabled then + Result := Bounds(0, H * 3, W, H) // 4th state (disabled) + else begin + if Checked or Pushed then + Result := Bounds(0, H * 2, W, H) // 3rd state (down) + else + if MouseInControl then + Result := Bounds(0, H * 1, W, H) // 2nd state (hottrack) + else + Result := Bounds(0, H * 0, W, H); // 1st state (up) + end; + end; +end; + +procedure TSpTBXCustomButton.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + inherited; + if Enabled and (Button = mbLeft) then begin + if Repeating then begin + Click; + ControlState := ControlState - [csClicked]; + if not Assigned(FRepeatTimer) then FRepeatTimer := TTimer.Create(Self); + FRepeatTimer.Interval := ConstInitRepeatPause; + FRepeatTimer.OnTimer := RepeatTimerHandler; + FRepeatTimer.Enabled := True; + end; + end; +end; + +procedure TSpTBXCustomButton.MouseUp(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + inherited; + if Button = mbLeft then StopRepeat; +end; + +procedure TSpTBXCustomButton.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if Operation = opRemove then + if AComponent = DropdownMenu then DropdownMenu := nil; +end; + +procedure TSpTBXCustomButton.RepeatTimerHandler(Sender: TObject); +begin + FRepeatTimer.Interval := ConstRepeatPause; + if Repeating then begin + if Pushed then + Click; + end + else + StopRepeat; +end; + +procedure TSpTBXCustomButton.StopRepeat; +begin + if Assigned(FRepeatTimer) then begin + FRepeatTimer.Free; + FRepeatTimer := nil; + end; +end; + +procedure TSpTBXCustomButton.SetBitmap(const Value: TBitmap); +begin + FBitmap.Assign(Value); + Invalidate; +end; + +procedure TSpTBXCustomButton.SetDefault(const Value: Boolean); +var + Form: TCustomForm; +begin + FDefault := Value; + if HandleAllocated then begin + Form := GetParentForm(Self); + if Assigned(Form) then + Form.Perform(CM_FOCUSCHANGED, 0, Longint(Form.ActiveControl)); + end; +end; + +procedure TSpTBXCustomButton.SetDropDownArrow(const Value: Boolean); +begin + if FDropDownArrow <> Value then begin + FDropDownArrow := Value; + Invalidate; + end; +end; + +procedure TSpTBXCustomButton.SetDropDownMenu(Value: TPopupMenu); +begin + if FDropDownMenu <> Value then begin + if Assigned(FDropDownMenu) then RemoveFreeNotification(FDropDownMenu); + FDropDownMenu := Value; + if Assigned(FDropDownMenu) then FreeNotification(FDropDownMenu); + Invalidate; + end; +end; + +procedure TSpTBXCustomButton.SetFlat(const Value: Boolean); +begin + if FFlat <> Value then begin + FFlat := Value; + Invalidate; + end; +end; + +procedure TSpTBXCustomButton.CMDialogKey(var Message: TCMDialogKey); +begin + with Message do + if (((CharCode = VK_RETURN) and FActive) or + ((CharCode = VK_ESCAPE) and FCancel)) and + (KeyDataToShiftState(Message.KeyData) = []) and CanFocus then + begin + Click; + Result := 1; + end + else + inherited; +end; + +procedure TSpTBXCustomButton.CMFocusChanged(var Message: TCMFocusChanged); +begin + with Message do + if Sender is TSpTBXCustomButton then + FActive := Sender = Self + else + FActive := FDefault; + inherited; +end; + +procedure TSpTBXCustomButton.CMSPPopupClose(var Message: TMessage); +begin + FDropDownMenuVisible := False; + Invalidate; + inherited; +end; + +procedure TSpTBXCustomButton.WMCancelMode(var Message: TWMCancelMode); +begin + inherited; + StopRepeat; + UpdateTracking(True); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomSpeedButton } + +constructor TSpTBXCustomSpeedButton.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle - [csSetCaption]; + SetBounds(0, 0, 23, 22); +end; + +function TSpTBXCustomSpeedButton.CanFocus: Boolean; +begin + Result := False; +end; + +procedure TSpTBXCustomSpeedButton.Click; +begin + if FGroupIndex <> 0 then + if AllowAllUp then + Checked := not Checked + else + Checked := True; + inherited +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomProgressBar } + +constructor TSpTBXCustomProgressBar.Create(AOwner: TComponent); +begin + inherited; + FMax := 100; + FMin := 0; + FPosition := 0; + FProgressVisible := True; + FCaptionGlow := gldAll; + FCaptionType := pctPercentage; + + Alignment := taCenter; + Autosize := False; + Width := 150; + Height := 17; + Font.Style := Font.Style + [fsBold]; + TabStop := False; +end; + +procedure TSpTBXCustomProgressBar.AdjustFont(AFont: TFont); +var + State: TSpTBXSkinStatesType; +begin + if (LinkText <> '') and MouseInControl then + inherited + else + if (SkinType = sknSkin) and ((AFont.Color = clWindowText) or (AFont.Color = clNone)) then begin + State := CurrentSkin.GetState(Enabled, Pushed, MouseInControl, Checked); + AFont.Color := CurrentSkin.GetTextColor(skncProgressBar, State); + end; +end; + +function TSpTBXCustomProgressBar.DoDrawItem(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +var + I: Integer; + T: TSpTBXSkinType; +begin + Result := inherited DoDrawItem(ACanvas, ARect, PaintStage); + if Result and (PaintStage = pstPrePaint) then begin + T := SpTBXSkinType(SkinType); + I := SpDrawXPProgressBar(ACanvas, ARect, FVertical, FSmooth, FProgressVisible, FMin, FMax, FPosition, T); + case FCaptionType of + pctNone: Caption := ''; + pctPercentage: Caption := IntToStr(I) + '%'; + pctProgress: Caption := IntToStr(FPosition); + end; + end; +end; + +procedure TSpTBXCustomProgressBar.DoProgressChange; +begin + if Assigned(FOnProgressChange) then FOnProgressChange(Self, Position); +end; + +function TSpTBXCustomProgressBar.GetTextMargins: TRect; +begin + Result := Rect(8, 2, 8, 2); +end; + +procedure TSpTBXCustomProgressBar.SetCaptionType(const Value: TSpTBXProgressCaption); +begin + if FCaptionType <> Value then begin + FCaptionType := Value; + if Value <> pctDefault then Caption := ''; + Invalidate; + end; +end; + +procedure TSpTBXCustomProgressBar.SetMax(const Value: integer); +begin + if FMax <> Value then begin + FMax := Value; + Invalidate; + end; +end; + +procedure TSpTBXCustomProgressBar.SetMin(const Value: integer); +begin + if FMin <> Value then begin + FMin := Value; + Invalidate; + end; +end; + +procedure TSpTBXCustomProgressBar.SetPosition(Value: integer); +begin + if Value > FMax then Value := FMax + else if Value < FMin then Value := FMin; + if FPosition <> Value then begin + FPosition := Value; + Invalidate; + DoProgressChange; + end; +end; + +procedure TSpTBXCustomProgressBar.SetProgressVisible(const Value: Boolean); +begin + if FProgressVisible <> Value then begin + FProgressVisible := Value; + Invalidate; + end; +end; + +procedure TSpTBXCustomProgressBar.SetSmooth(const Value: Boolean); +begin + if FSmooth <> Value then begin + FSmooth := Value; + Invalidate; + end; +end; + +procedure TSpTBXCustomProgressBar.SetVertical(const Value: Boolean); +begin + if FVertical <> Value then begin + FVertical := Value; + if FVertical then + FCaptionRoatationAngle := tra90 + else + FCaptionRoatationAngle := tra0; + if Width > Height then + SetBounds(Left, Top, Height, Width); + Invalidate; + end; +end; + +procedure TSpTBXCustomProgressBar.StepIt(Delta: Integer = 1); +begin + SetPosition(FPosition + Delta); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTrackBar } + +constructor TSpTBXTrackBar.Create(AOwner: TComponent); +begin + inherited; + FSkinType := sknSkin; + FTickMarks := tmxBottomRight; + SkinManager.AddSkinNotification(Self); +end; + +procedure TSpTBXTrackBar.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + FCanDrawChannelSelection := (Params.Style and TBS_ENABLESELRANGE) <> 0; +end; + +destructor TSpTBXTrackBar.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +function TSpTBXTrackBar.ChannelRect: TRect; +var + R: TRect; +begin + // TBM_GETCHANNELRECT allways returns the horizontal channel rect, even + // when the Orientation is vertical. + SendMessage(Handle, TBM_GETCHANNELRECT, 0, Integer(@Result)); + if Orientation = trVertical then begin + R := Result; + Result := Rect(R.Top, R.Left, R.Bottom, R.Right); + end; +end; + +function TSpTBXTrackBar.DoDrawChannel(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +begin + Result := True; + if Assigned(FOnDrawChannel) then FOnDrawChannel(Self, ACanvas, ARect, PaintStage, Result); +end; + +function TSpTBXTrackBar.DoDrawChannelTicks(ACanvas: TCanvas; X, Y: Integer): Boolean; +begin + Result := True; + if Assigned(FOnDrawChannelTicks) then FOnDrawChannelTicks(Self, ACanvas, X, Y, Result); +end; + +function TSpTBXTrackBar.DoDrawThumb(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +begin + Result := True; + if Assigned(FOnDrawThumb) then FOnDrawThumb(Self, ACanvas, ARect, PaintStage, Result); +end; + +procedure TSpTBXTrackBar.DrawTicks(ACanvas: TCanvas); +var + PosArray: array of Integer; + I, Count, Y, iStart, iEnd: Integer; + ChannelR, ThumbR: TRect; + FirstTickSize, TickSize, TickDelta: Integer; + LastPenColor: TColor; +begin + if TickStyle = tsNone then Exit; + + // Returns the position of the ticks on the client area + // Check if Max - Min > 2 to see if the ticks array is valid. + Count := Max - Min; + if Count < 2 then + Count := 2 + else + Count := Count + 1; + SetLength(PosArray, Count); + + // Fill the array, the first and last ticks are not included in the ticks array: + // http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/trackbar/messages/tbm_getticpos.asp?frame=true + // First we need to get the middle ticks + // 0 1 2 3 4 5 6 7 8 9 // Tick positions seen on the trackbar. + // 1 2 3 4 5 6 7 8 // Tick positions whose position can be identified. + // 0 1 2 3 4 5 6 7 // Index numbers for the identifiable positions. + if Count >= 2 then begin + iStart := 1; + iEnd := Count - 1 - 1; + for I := iStart to iEnd do + PosArray[I] := SendMessage(Self.Handle, TBM_GETTICPOS, I - 1, 0); + end; + + LastPenColor := ACanvas.Pen.Color; + + case SpTBXSkinType(FSkinType) of + sknNone: + ACanvas.Pen.Color := clBlack; + sknWindows: + ACanvas.Pen.Color := clBtnShadow; + sknSkin: + if CurrentSkin.Options(skncTrackBar, sknsNormal).TextColor <> clNone then + ACanvas.Pen.Color := CurrentSkin.Options(skncTrackBar, sknsNormal).TextColor + else + ACanvas.Pen.Color := clBtnShadow; + end; + + SendMessage(Self.Handle, TBM_GETTHUMBRECT, 0, Integer(@ThumbR)); + ChannelR := ChannelRect; + FirstTickSize := 4; + TickSize := 3; + Y := 0; + + if Orientation = trHorizontal then begin + I := (ThumbR.Right - ThumbR.Left) div 2; + PosArray[0] := ChannelR.Left + I; + PosArray[Count - 1] := ChannelR.Right - I - 1; + case TickMarks of + tmxBottomRight: + begin + Y := ThumbR.Bottom + 1; + FirstTickSize := 4; + TickSize := 3; + end; + tmxTopLeft: + begin + Y := ThumbR.Top - 2; + FirstTickSize := -4; + TickSize := -3; + end; + tmxBoth: + begin + Y := ThumbR.Top - 2; + FirstTickSize := -4; + TickSize := -3; + end; + tmxCenter: + begin + Y := ChannelR.Top + (ChannelR.Bottom - ChannelR.Top) div 2; + FirstTickSize := 1; + TickSize := 1; + end; + end; + for I := 0 to Count - 1 do + if DoDrawChannelTicks(ACanvas, PosArray[I], Y) then begin + TickDelta := 0; + if (I = 0) or (I = Count - 1) then + TickDelta := FirstTickSize + else + if TickStyle = tsManual then TickDelta := TickSize + else if I mod Frequency = 0 then TickDelta := TickSize; + if TickDelta <> 0 then begin + ACanvas.MoveTo(PosArray[I], Y); + ACanvas.LineTo(PosArray[I], Y + TickDelta); + if TickMarks = tmxBoth then begin + ACanvas.MoveTo(PosArray[I], ThumbR.Bottom + 1); + ACanvas.LineTo(PosArray[I], ThumbR.Bottom + 1 - TickDelta); + end; + end; + end; + end + else begin + I := (ThumbR.Bottom - ThumbR.Top) div 2; + PosArray[0] := ChannelR.Top + I; + PosArray[Count - 1] := ChannelR.Bottom - I - 1; + case TickMarks of + tmxBottomRight: + begin + Y := ThumbR.Right + 1; + FirstTickSize := 4; + TickSize := 3; + end; + tmxTopLeft: + begin + Y := ThumbR.Left - 2; + FirstTickSize := -4; + TickSize := -3; + end; + tmxBoth: + begin + Y := ThumbR.Left - 2; + FirstTickSize := -4; + TickSize := -3; + end; + tmxCenter: + begin + Y := ChannelR.Left + (ChannelR.Right - ChannelR.Left) div 2; + FirstTickSize := 1; + TickSize := 1; + end; + end; + for I := 0 to Count - 1 do + if DoDrawChannelTicks(ACanvas, Y, PosArray[I]) then begin + TickDelta := 0; + if (I = 0) or (I = Count - 1) then + TickDelta := FirstTickSize + else + if TickStyle = tsManual then TickDelta := TickSize + else if I mod Frequency = 0 then TickDelta := TickSize; + if TickDelta <> 0 then begin + ACanvas.MoveTo(Y, PosArray[I]); + ACanvas.LineTo(Y + TickDelta, PosArray[I]); + if TickMarks = tmxBoth then begin + ACanvas.MoveTo(ThumbR.Right + 1, PosArray[I]); + ACanvas.LineTo(ThumbR.Right + 1 - TickDelta, PosArray[I]); + end; + end; + end; + end; + + ACanvas.Pen.Color := LastPenColor; +end; + +function TSpTBXTrackBar.MouseInThumb: Boolean; +var + P: TPoint; + R: TRect; +begin + if csDesigning in ComponentState then + Result := False + else begin + SendMessage(Handle, TBM_GETTHUMBRECT, 0, Integer(@R)); + GetCursorPos(P); + P := ScreenToClient(P); + Result := PtInRect(R, P) + end; + + if SpTBXSkinType(SkinType) = sknWindows then begin + if Focused then Result := not (GetCaptureControl = Self); + end + else + Result := GetCaptureControl = Self; +end; + +procedure TSpTBXTrackBar.InvalidateBackground; +begin + // Invalidate, Repaint, Update, SetWindowPos and RedrawWindow doesn't work + // on Trackbars (CN_NOTIFY messages are not sent), we have to send a + // WM_SIZE message in order to invalidate the control. + if HandleAllocated then + SendMessage(Handle, WM_SIZE, SIZE_RESTORED, MakeLParam(Width, Height)); +end; + +procedure TSpTBXTrackBar.SetSkinType(const Value: TSpTBXSkinType); +begin + if Value <> FSkinType then begin + FSkinType := Value; + InvalidateBackground; + end; +end; + +procedure TSpTBXTrackBar.SetTickMarks(const Value: TSpTBXTickMark); +const + A: array [TSpTBXTickMark] of TTickMark = (tmBottomRight, tmTopLeft, tmBoth, tmBoth); +begin + if Value <> FTickMarks then begin + if A[FTickMarks] = A[Value] then begin + FTickMarks := Value; + inherited TickMarks := A[Value]; + RecreateWnd; + end + else begin + FTickMarks := Value; + inherited TickMarks := A[Value]; + end; + end; +end; + +procedure TSpTBXTrackBar.CMSpTBXControlsInvalidate(var Message: TMessage); +begin + InvalidateBackground; + Message.Result := 1; +end; + +procedure TSpTBXTrackBar.CNNotify(var Message: TWMNotify); +var + Info: PNMCustomDraw; + ACanvas: TCanvas; + R: TRect; + Rgn: HRGN; + Offset: Integer; +begin + if Message.NMHdr.code = NM_CUSTOMDRAW then begin + Message.Result := CDRF_DODEFAULT; + Info := Pointer(Message.NMHdr); + case Info.dwDrawStage of + CDDS_PREPAINT: + Message.Result := CDRF_NOTIFYITEMDRAW; + CDDS_ITEMPREPAINT: + begin + ACanvas := TCanvas.Create; + ACanvas.Lock; + try + ACanvas.Handle := Info.hdc; + case Info.dwItemSpec of + TBCD_TICS: + begin + R := ClientRect; + SpDrawParentBackground(Self, ACanvas.Handle, R); + if Focused then + SpDrawFocusRect(ACanvas, R); + if FTickMarks <> tmxCenter then + DrawTicks(ACanvas); + Message.Result := CDRF_SKIPDEFAULT; + end; + TBCD_THUMB: + begin + if SliderVisible then begin + SendMessage(Handle, TBM_GETTHUMBRECT, 0, Integer(@R)); + if DoDrawThumb(ACanvas, R, pstPrePaint) then + SpDrawXPTrackBar(ACanvas, R, TBCD_THUMB, Orientation = trVertical, MouseInThumb, False, FTickMarks, Min, Max, SelStart, SelEnd, FSkinType); + DoDrawThumb(ACanvas, R, pstPostPaint); + Message.Result := CDRF_SKIPDEFAULT; + end; + end; + TBCD_CHANNEL: + begin + SendMessage(Handle, TBM_GETTHUMBRECT, 0, Integer(@R)); + Offset := 0; + if Focused then + Inc(Offset); + if Orientation = trHorizontal then begin + R.Left := ClientRect.Left + Offset; + R.Right := ClientRect.Right - Offset; + end + else begin + R.Top := ClientRect.Top + Offset; + R.Bottom := ClientRect.Bottom - Offset; + end; + with R do + Rgn := CreateRectRgn(Left, Top, Right, Bottom); + SelectClipRgn(ACanvas.Handle, Rgn); + try + SpDrawParentBackground(Self, ACanvas.Handle, ClientRect); + R := ChannelRect; + + if DoDrawChannel(ACanvas, R, pstPrePaint) then + SpDrawXPTrackBar(ACanvas, R, TBCD_CHANNEL, Orientation = trVertical, False, FCanDrawChannelSelection, FTickMarks, Min, Max, SelStart, SelEnd, FSkinType); + DoDrawChannel(ACanvas, R, pstPostPaint); + + // Draw channel tics + if FTickMarks = tmxCenter then + DrawTicks(ACanvas); + finally + DeleteObject(Rgn); + SelectClipRgn(ACanvas.Handle, 0); + end; + Message.Result := CDRF_SKIPDEFAULT; + end; + end; + finally + ACanvas.Unlock; + ACanvas.Handle := 0; + ACanvas.Free; + end; + end; + end; + end; +end; + +procedure TSpTBXTrackBar.WMEraseBkGnd(var Message: TMessage); +begin + if SpTBXSkinType(SkinType) <> sknNone then + Message.Result := 1 + else + inherited; +end; + +procedure TSpTBXTrackBar.WMSpSkinChange(var Message: TMessage); +begin + InvalidateBackground; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.dcu new file mode 100644 index 0000000..02fce61 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.hpp new file mode 100644 index 0000000..1cdef24 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.hpp @@ -0,0 +1,260 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxcustomizer.pas' rev: 20.00 + +#ifndef SptbxcustomizerHPP +#define SptbxcustomizerHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxcustomizer +{ +//-- type declarations ------------------------------------------------------- +typedef Classes::TStringList* TTntStringList; + +class DELPHICLASS TShortCutsProcessor; +class PASCALIMPLEMENTATION TShortCutsProcessor : public System::TObject +{ + typedef System::TObject inherited; + +private: + bool FActive; + +public: + __fastcall virtual TShortCutsProcessor(void); + __fastcall virtual ~TShortCutsProcessor(void); + bool __fastcall MainWindowHook(Messages::TMessage &Message); + __property bool Active = {read=FActive, write=FActive, nodefault}; +}; + + +class DELPHICLASS TSpTBXMenuBarShortcuts; +class PASCALIMPLEMENTATION TSpTBXMenuBarShortcuts : public Classes::TStringList +{ + typedef Classes::TStringList inherited; + +private: + System::UnicodeString FMenuBarName; + +public: + __property System::UnicodeString MenuBarName = {read=FMenuBarName, write=FMenuBarName}; +public: + /* TStringList.Create */ inline __fastcall TSpTBXMenuBarShortcuts(void)/* overload */ : Classes::TStringList() { } + /* TStringList.Destroy */ inline __fastcall virtual ~TSpTBXMenuBarShortcuts(void) { } + +}; + + +class DELPHICLASS TSpTBXCustomCustomizeForm; +class DELPHICLASS TSpTBXCustomizer; +class PASCALIMPLEMENTATION TSpTBXCustomCustomizeForm : public Forms::TForm +{ + typedef Forms::TForm inherited; + +private: + bool FEmbedded; + +protected: + TSpTBXCustomizer* FCustomizer; + Classes::TStringList* FToolbarList; + Classes::TStringList* FItemList; + Classes::TStringList* FShortcutList; + Classes::TStringList* FSeparatorList; + Classes::TStringList* FBlankSeparatorList; + virtual void __fastcall DoFillCommands(Classes::TStringList* ToolbarList, Classes::TStringList* ItemList, Classes::TStringList* ShortcutsList) = 0 ; + DYNAMIC void __fastcall DoShow(void); + DYNAMIC void __fastcall DoClose(Forms::TCloseAction &Action); + virtual void __fastcall DoIconOptionsChange(bool UseSmallImages); + virtual void __fastcall DoSkinChange(void); + void __fastcall FillCommands(void); + DYNAMIC void __fastcall KeyDown(System::Word &Key, Classes::TShiftState Shift); + +public: + __fastcall TSpTBXCustomCustomizeForm(TSpTBXCustomizer* AOwner, Controls::TWinControl* EmbeddedParent); + __fastcall virtual ~TSpTBXCustomCustomizeForm(void); + __property TSpTBXCustomizer* Customizer = {read=FCustomizer}; + __property bool Embedded = {read=FEmbedded, nodefault}; +public: + /* TCustomForm.CreateNew */ inline __fastcall virtual TSpTBXCustomCustomizeForm(Classes::TComponent* AOwner, int Dummy) : Forms::TForm(AOwner, Dummy) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomCustomizeForm(HWND ParentWindow) : Forms::TForm(ParentWindow) { } + +}; + + +typedef TMetaClass* TSpTBXCustomizeFormClass; + +typedef void __fastcall (__closure *TSpTBXGetCustomizeFormClassEvent)(System::TObject* Sender, TSpTBXCustomizeFormClass &CustomizeFormClass); + +typedef void __fastcall (__closure *TSpTBXExtraOptionsEvent)(System::TObject* Sender, Classes::TStringList* ExtraOptions); + +typedef void __fastcall (__closure *TSpTBXLayoutExtraOptionsEvent)(System::TObject* Sender, System::UnicodeString LayoutName, Classes::TStringList* ExtraOptions); + +typedef void __fastcall (__closure *TSpTBXIconOptionsChangeEvent)(System::TObject* Sender, Tb2toolbar::TTBCustomToolbar* Toolbar, bool UseSmallImages); + +typedef void __fastcall (__closure *TSpTBXAcceptItemEvent)(System::TObject* Sender, Tb2item::TTBCustomItem* AItem, bool &Accept); + +class PASCALIMPLEMENTATION TSpTBXCustomizer : public Classes::TComponent +{ + typedef Classes::TComponent inherited; + +private: + Classes::TStringList* FLayouts; + Classes::TStringList* FResetState; + bool FBlankSeparators; + Tb2item::TTBRootItem* FItems; + TSpTBXCustomCustomizeForm* FCustomizeForm; + Tb2toolbar::TTBCustomToolbar* FMenuBar; + bool FShowing; + bool FSaveFormState; + Classes::TNotifyEvent FOnShow; + Classes::TNotifyEvent FOnClose; + TSpTBXGetCustomizeFormClassEvent FOnGetCustomizeForm; + TSpTBXExtraOptionsEvent FOnLoad; + TSpTBXExtraOptionsEvent FOnSave; + TSpTBXLayoutExtraOptionsEvent FOnLayoutLoad; + TSpTBXLayoutExtraOptionsEvent FOnLayoutSave; + TSpTBXAcceptItemEvent FOnGetShortcutsList; + TSpTBXIconOptionsChangeEvent FOnIconOptionsChange; + Classes::TNotifyEvent FOnSkinChange; + Tb2item::TTBCustomItem* __fastcall GetItems(void); + Imglist::TCustomImageList* __fastcall GetImages(void); + void __fastcall SetImages(Imglist::TCustomImageList* Value); + void __fastcall SetMenuBar(const Tb2toolbar::TTBCustomToolbar* Value); + void __fastcall SaveResetState(TSpTBXMenuBarShortcuts* ShortcutsList); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + virtual bool __fastcall DoGetShortcutsList(Tb2item::TTBCustomItem* AItem); + virtual void __fastcall DoIconOptionsChange(Tb2toolbar::TTBCustomToolbar* Toolbar, bool UseSmallImages); + virtual void __fastcall DoLoad(Classes::TStringList* ExtraOptions); + virtual void __fastcall DoSave(Classes::TStringList* ExtraOptions); + virtual void __fastcall DoLayoutLoad(System::UnicodeString LayoutName, Classes::TStringList* ExtraOptions); + virtual void __fastcall DoLayoutSave(System::UnicodeString LayoutName, Classes::TStringList* ExtraOptions); + virtual void __fastcall DoSkinChange(void); + DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root); + virtual TSpTBXCustomizeFormClass __fastcall GetCustomizeFormClass(void); + void __fastcall GetShortcutList(Classes::TStringList* ShortcutsList); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + virtual void __fastcall SetupForm(void); + DYNAMIC void __fastcall ValidateContainer(Classes::TComponent* AComponent); + +public: + __fastcall virtual TSpTBXCustomizer(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomizer(void); + void __fastcall Show(void); + void __fastcall ShowEmbedded(Controls::TWinControl* AParent = (Controls::TWinControl*)(0x0)); + void __fastcall Close(void); + void __fastcall Load(Inifiles::TCustomIniFile* IniFile, bool LoadLastLayout = true)/* overload */; + void __fastcall Load(Classes::TStrings* OptionsList, bool LoadLastLayout = true)/* overload */; + void __fastcall Load(const System::UnicodeString Filename, bool LoadLastLayout = true)/* overload */; + void __fastcall Load(const unsigned RootKey, System::UnicodeString BaseRegistryKey, bool LoadLastLayout = true)/* overload */; + void __fastcall Save(Inifiles::TCustomIniFile* IniFile)/* overload */; + void __fastcall Save(Classes::TStrings* OptionsList)/* overload */; + void __fastcall Save(const System::UnicodeString Filename)/* overload */; + void __fastcall Save(const unsigned RootKey, System::UnicodeString BaseRegistryKey)/* overload */; + void __fastcall Reset(void); + void __fastcall LoadLayout(Inifiles::TCustomIniFile* IniFile, System::UnicodeString LayoutName)/* overload */; + void __fastcall LoadLayout(Classes::TStrings* OptionsList, System::UnicodeString LayoutName)/* overload */; + void __fastcall LoadLayout(const System::UnicodeString Filename, const System::UnicodeString LayoutName)/* overload */; + void __fastcall LoadLayout(const unsigned RootKey, System::UnicodeString BaseRegistryKey, System::UnicodeString LayoutName)/* overload */; + void __fastcall SaveLayout(Inifiles::TCustomIniFile* IniFile, System::UnicodeString LayoutName)/* overload */; + void __fastcall SaveLayout(Classes::TStrings* OptionsList, System::UnicodeString LayoutName)/* overload */; + void __fastcall SaveLayout(const System::UnicodeString Filename, const System::UnicodeString LayoutName)/* overload */; + void __fastcall SaveLayout(const unsigned RootKey, System::UnicodeString BaseRegistryKey, System::UnicodeString LayoutName)/* overload */; + bool __fastcall DeleteLayout(Inifiles::TCustomIniFile* IniFile, System::UnicodeString LayoutName)/* overload */; + bool __fastcall DeleteLayout(Classes::TStrings* OptionsList, System::UnicodeString LayoutName)/* overload */; + bool __fastcall DeleteLayout(const System::UnicodeString Filename, const System::UnicodeString LayoutName)/* overload */; + bool __fastcall DeleteLayout(const unsigned RootKey, System::UnicodeString BaseRegistryKey, System::UnicodeString LayoutName)/* overload */; + __property TSpTBXCustomCustomizeForm* CustomizeForm = {read=FCustomizeForm}; + __property Classes::TStringList* Layouts = {read=FLayouts}; + __property bool Showing = {read=FShowing, nodefault}; + +__published: + __property bool BlankSeparators = {read=FBlankSeparators, write=FBlankSeparators, default=0}; + __property Imglist::TCustomImageList* Images = {read=GetImages, write=SetImages}; + __property Tb2item::TTBRootItem* Items = {read=FItems}; + __property Tb2toolbar::TTBCustomToolbar* MenuBar = {read=FMenuBar, write=SetMenuBar}; + __property bool SaveFormState = {read=FSaveFormState, write=FSaveFormState, default=1}; + __property Classes::TNotifyEvent OnShow = {read=FOnShow, write=FOnShow}; + __property Classes::TNotifyEvent OnClose = {read=FOnClose, write=FOnClose}; + __property TSpTBXGetCustomizeFormClassEvent OnGetCustomizeForm = {read=FOnGetCustomizeForm, write=FOnGetCustomizeForm}; + __property TSpTBXAcceptItemEvent OnGetShortcutsList = {read=FOnGetShortcutsList, write=FOnGetShortcutsList}; + __property TSpTBXExtraOptionsEvent OnLoad = {read=FOnLoad, write=FOnLoad}; + __property TSpTBXExtraOptionsEvent OnSave = {read=FOnSave, write=FOnSave}; + __property TSpTBXLayoutExtraOptionsEvent OnLayoutLoad = {read=FOnLayoutLoad, write=FOnLayoutLoad}; + __property TSpTBXLayoutExtraOptionsEvent OnLayoutSave = {read=FOnLayoutSave, write=FOnLayoutSave}; + __property TSpTBXIconOptionsChangeEvent OnIconOptionsChange = {read=FOnIconOptionsChange, write=FOnIconOptionsChange}; + __property Classes::TNotifyEvent OnSkinChange = {read=FOnSkinChange, write=FOnSkinChange}; +private: + void *__ITBItems; /* Tb2item::ITBItems */ + +public: + #if defined(MANAGED_INTERFACE_OPERATORS) + operator Tb2item::_di_ITBItems() + { + Tb2item::_di_ITBItems intf; + GetInterface(intf); + return intf; + } + #else + operator ITBItems*(void) { return (ITBItems*)&__ITBItems; } + #endif + +}; + + +//-- var, const, procedure --------------------------------------------------- +extern PACKAGE void __fastcall SpIniEraseSection(Inifiles::TCustomIniFile* IniFile, System::UnicodeString Section, bool EraseKeysOnly); +extern PACKAGE void __fastcall SpIniSaveStringList(Inifiles::TCustomIniFile* IniFile, System::UnicodeString Section, Classes::TStringList* L); +extern PACKAGE void __fastcall SpIniLoadStringList(Inifiles::TCustomIniFile* IniFile, System::UnicodeString Section, Classes::TStringList* L); +extern PACKAGE void __fastcall SpRegSaveStringList(Classes::TStringList* L, const unsigned RootKey, const System::UnicodeString BaseRegistryKey); +extern PACKAGE void __fastcall SpRegLoadStringList(Classes::TStringList* L, const unsigned RootKey, const System::UnicodeString BaseRegistryKey); +extern PACKAGE void __fastcall SpLoadFormState(Forms::TCustomForm* Form, Classes::TStrings* OptionsList); +extern PACKAGE void __fastcall SpSaveFormState(Forms::TCustomForm* Form, Classes::TStrings* OptionsList); +extern PACKAGE void __fastcall SpLoadLayoutList(Inifiles::TCustomIniFile* IniFile, Classes::TStringList* L)/* overload */; +extern PACKAGE void __fastcall SpSaveLayout(const Classes::TComponent* OwnerComponent, Inifiles::TCustomIniFile* IniFile, System::UnicodeString LayoutName, Classes::TStringList* ExtraOptions = (Classes::TStringList*)(0x0)); +extern PACKAGE void __fastcall SpLoadLayout(const Classes::TComponent* OwnerComponent, Inifiles::TCustomIniFile* IniFile, System::UnicodeString LayoutName, Classes::TStringList* ExtraOptions = (Classes::TStringList*)(0x0)); +extern PACKAGE void __fastcall SpSaveItems(const Classes::TComponent* OwnerComponent, Inifiles::TCustomIniFile* IniFile, TSpTBXMenuBarShortcuts* ShortcutsList = (TSpTBXMenuBarShortcuts*)(0x0), Classes::TStringList* ExtraOptions = (Classes::TStringList*)(0x0))/* overload */; +extern PACKAGE void __fastcall SpLoadItems(const Classes::TComponent* OwnerComponent, Inifiles::TCustomIniFile* IniFile, TSpTBXMenuBarShortcuts* ShortcutsList = (TSpTBXMenuBarShortcuts*)(0x0), Classes::TStringList* ExtraOptions = (Classes::TStringList*)(0x0))/* overload */; +extern PACKAGE System::WideString __fastcall SpCustomizerGetWideCaption(Tb2item::TTBCustomItem* Item); +extern PACKAGE Sptbxitem::TSpTBXSeparatorItem* __fastcall SpCreateUniqueSeparator(bool Blank); + +} /* namespace Sptbxcustomizer */ +using namespace Sptbxcustomizer; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxcustomizerHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.pas new file mode 100644 index 0000000..01b160a --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizer.pas @@ -0,0 +1,1620 @@ +unit SpTBXCustomizer; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +History: +8 May 2009 - version 2.4.2 + - No changes. + +15 March 2009 - version 2.4.1 + - Fixed incorrect Customizer loading and saving when Frames + were used, thanks to Eduardo Mauro for reporting this. + +17 January 2009 - version 2.4 + - No changes. + +26 September 2008 - version 2.3 + - No changes. + +29 July 2008 - version 2.2 + - No changes. + +26 June 2008 - version 2.1 + - No changes. + +3 May 2008 - version 2.0 + - No changes. + +2 April 2008 - version 1.9.5 + - No changes. + +3 February 2008 - version 1.9.4 + - No changes. + +19 January 2008 - version 1.9.3 + - Added BlankSeparators property to TSpTBXCustomizer. + - Fixed AV on TSpTBXCustomizer when ShorcutsList was nil + when calling ApplyItemOptions, thanks to PyScripter for + reporting this. + +26 December 2007 - version 1.9.2 + - No changes. + +1 December 2007 - version 1.9.1 + - No changes. + +20 November 2007 - version 1.9 + - Removed TBX dependency. + - Added Reset method to TSpTBXCustomizer, used to reinitialize + the toolbars. + +8 February 2007 - version 1.8.3 + - Added DeleteLayout method to TSpTBXCustomizer. + - The customizer now closes when ESC is pressed, thanks to + Jim Kueneman for reporting this. + - The customizer now saves the Toolbar's DisplayMode, thanks to + Jim Kueneman for reporting this. + +17 December 2006 - version 1.8.2 + - No changes. + +24 November 2006 - version 1.8.1 + - No changes. + +27 August 2006 - version 1.8 + - Fixed TSpTBXCustomizer items saving when the MenuBar items are + nested in more than 3 subitems levels, thanks to Jim Kueneman + for reporting this. + +15 June 2006 - version 1.7 + - Added SaveFormState property to TSpTBXCustomizer, when SaveFormState + is true the main form position and WindowState are saved. + - Added Load and Save methods to TSpTBXCustomizer that loads/saves + the customizer options to a StringList, thanks to Philipp Hechter + for reporting this. + +4 May 2006 - version 1.6 + - No changes. + +12 April 2006 - version 1.5 + - No changes. + +27 February 2006 - version 1.4 + - No changes. + +10 February 2006 - version 1.3 + - No changes. + +28 December 2005 - version 1.2 + - Fixed incorrect ShortCut processing. + +18 October 2005 - version 1.1 + - Fixed TSpTBXCustomizer ShortCut processing method when + loading from file or registry. + - Fixed TSpTBXCustomizer support for separators items. + - Fixed TSpTBXCustomizer support for anchored items. + - Added OnGetShortcutsList event to the TSpTBXCustomizer to + allow the shortcuts list filtering. + - Added separator cloning support to the TSpTBXCustomizer. + +10 August 2005 - version 1.0 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ExtCtrls, ImgList, IniFiles, + {$IFNDEF UNICODE} + TntClasses, + {$ENDIF} + TB2Dock, TB2Toolbar, TB2Item, + SpTBXSkins, SpTBXItem, SpTBXEditors; + + +type + +{$IFDEF UNICODE} + TTntStringList = TStringList; +{$ENDIF} + + TSpTBXCustomizer = class; + + TShortCutsProcessor = class + private + FActive: Boolean; + public + constructor Create; virtual; + destructor Destroy; override; + function MainWindowHook(var Message: TMessage): Boolean; + property Active: Boolean read FActive write FActive; + end; + + TSpTBXMenuBarShortcuts = class(TTntStringList) + private + FMenuBarName: string; + public + property MenuBarName: string read FMenuBarName write FMenuBarName; + end; + + TSpTBXCustomCustomizeForm = class(TForm) + private + FEmbedded: Boolean; + protected + FCustomizer: TSpTBXCustomizer; + FToolbarList: TTntStringList; + FItemList: TTntStringList; + FShortcutList: TTntStringList; + FSeparatorList: TTntStringList; + FBlankSeparatorList: TTntStringList; + procedure DoFillCommands(ToolbarList, ItemList, ShortcutsList: TTntStringList); virtual; abstract; + procedure DoShow; override; + procedure DoClose(var Action: TCloseAction); override; + procedure DoIconOptionsChange(UseSmallImages: Boolean); virtual; + procedure DoSkinChange; virtual; + procedure FillCommands; + procedure KeyDown(var Key: Word; Shift: TShiftState); override; + public + constructor Create(AOwner: TSpTBXCustomizer; EmbeddedParent: TWinControl); reintroduce; + destructor Destroy; override; + property Customizer: TSpTBXCustomizer read FCustomizer; + property Embedded: Boolean read FEmbedded; + end; + + TSpTBXCustomizeFormClass = class of TSpTBXCustomCustomizeForm; + + TSpTBXGetCustomizeFormClassEvent = procedure(Sender: TObject; var CustomizeFormClass: TSpTBXCustomizeFormClass) of object; + TSpTBXExtraOptionsEvent = procedure(Sender: TObject; ExtraOptions: TStringList) of object; + TSpTBXLayoutExtraOptionsEvent = procedure(Sender: TObject; LayoutName: string; ExtraOptions: TStringList) of object; + + TSpTBXIconOptionsChangeEvent = procedure(Sender: TObject; Toolbar: TTBCustomToolbar; UseSmallImages: Boolean) of object; + TSpTBXAcceptItemEvent = procedure(Sender: TObject; AItem: TTBCustomItem; var Accept: Boolean) of object; + + TSpTBXCustomizer = class(TComponent, ITBItems) + private + FLayouts: TStringList; + FResetState: TStringList; + FBlankSeparators: Boolean; + FItems: TTBRootItem; + FCustomizeForm: TSpTBXCustomCustomizeForm; + FMenuBar: TTBCustomToolbar; + FShowing: Boolean; + FSaveFormState: Boolean; + FOnShow: TNotifyEvent; + FOnClose: TNotifyEvent; + FOnGetCustomizeForm: TSpTBXGetCustomizeFormClassEvent; + FOnLoad: TSpTBXExtraOptionsEvent; + FOnSave: TSpTBXExtraOptionsEvent; + FOnLayoutLoad: TSpTBXLayoutExtraOptionsEvent; + FOnLayoutSave: TSpTBXLayoutExtraOptionsEvent; + FOnGetShortcutsList: TSpTBXAcceptItemEvent; + FOnIconOptionsChange: TSpTBXIconOptionsChangeEvent; + FOnSkinChange: TNotifyEvent; + function GetItems: TTBCustomItem; // For ITBItems interface + function GetImages: TCustomImageList; + procedure SetImages(Value: TCustomImageList); + procedure SetMenuBar(const Value: TTBCustomToolbar); + procedure SaveResetState(ShortcutsList: TSpTBXMenuBarShortcuts); + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + function DoGetShortcutsList(AItem: TTBCustomItem): Boolean; virtual; + procedure DoIconOptionsChange(Toolbar: TTBCustomToolbar; UseSmallImages: Boolean); virtual; + procedure DoLoad(ExtraOptions: TStringList); virtual; + procedure DoSave(ExtraOptions: TStringList); virtual; + procedure DoLayoutLoad(LayoutName: string; ExtraOptions: TStringList); virtual; + procedure DoLayoutSave(LayoutName: string; ExtraOptions: TStringList); virtual; + procedure DoSkinChange; virtual; + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; // For ITBItems interface + function GetCustomizeFormClass: TSpTBXCustomizeFormClass; virtual; + procedure GetShortcutList(ShortcutsList: TTntStringList); + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure SetupForm; virtual; + procedure ValidateContainer(AComponent: TComponent); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Show; + procedure ShowEmbedded(AParent: TWinControl = nil); + procedure Close; + procedure Load(IniFile: TCustomIniFile; LoadLastLayout: Boolean = True); overload; + procedure Load(OptionsList: TStrings; LoadLastLayout: Boolean = True); overload; + procedure Load(const Filename: string; LoadLastLayout: Boolean = True); overload; + procedure Load(const RootKey: DWORD; BaseRegistryKey: string; LoadLastLayout: Boolean = True); overload; + procedure Save(IniFile: TCustomIniFile); overload; + procedure Save(OptionsList: TStrings); overload; + procedure Save(const Filename: string); overload; + procedure Save(const RootKey: DWORD; BaseRegistryKey: string); overload; + procedure Reset; + procedure LoadLayout(IniFile: TCustomIniFile; LayoutName: string); overload; + procedure LoadLayout(OptionsList: TStrings; LayoutName: string); overload; + procedure LoadLayout(const Filename, LayoutName: string); overload; + procedure LoadLayout(const RootKey: DWORD; BaseRegistryKey, LayoutName: string); overload; + procedure SaveLayout(IniFile: TCustomIniFile; LayoutName: string); overload; + procedure SaveLayout(OptionsList: TStrings; LayoutName: string); overload; + procedure SaveLayout(const Filename, LayoutName: string); overload; + procedure SaveLayout(const RootKey: DWORD; BaseRegistryKey, LayoutName: string); overload; + function DeleteLayout(IniFile: TCustomIniFile; LayoutName: string): Boolean; overload; + function DeleteLayout(OptionsList: TStrings; LayoutName: string): Boolean; overload; + function DeleteLayout(const Filename, LayoutName: string): Boolean; overload; + function DeleteLayout(const RootKey: DWORD; BaseRegistryKey, LayoutName: string): Boolean; overload; + property CustomizeForm: TSpTBXCustomCustomizeForm read FCustomizeForm; + property Layouts: TStringList read FLayouts; + property Showing: Boolean read FShowing; + published + property BlankSeparators: Boolean read FBlankSeparators write FBlankSeparators default False; + property Images: TCustomImageList read GetImages write SetImages; + property Items: TTBRootItem read FItems; + property MenuBar: TTBCustomToolbar read FMenuBar write SetMenuBar; + property SaveFormState: Boolean read FSaveFormState write FSaveFormState default True; + property OnShow: TNotifyEvent read FOnShow write FOnShow; + property OnClose: TNotifyEvent read FOnClose write FOnClose; + property OnGetCustomizeForm: TSpTBXGetCustomizeFormClassEvent read FOnGetCustomizeForm write FOnGetCustomizeForm; + property OnGetShortcutsList: TSpTBXAcceptItemEvent read FOnGetShortcutsList write FOnGetShortcutsList; + property OnLoad: TSpTBXExtraOptionsEvent read FOnLoad write FOnLoad; + property OnSave: TSpTBXExtraOptionsEvent read FOnSave write FOnSave; + property OnLayoutLoad: TSpTBXLayoutExtraOptionsEvent read FOnLayoutLoad write FOnLayoutLoad; + property OnLayoutSave: TSpTBXLayoutExtraOptionsEvent read FOnLayoutSave write FOnLayoutSave; + property OnIconOptionsChange: TSpTBXIconOptionsChangeEvent read FOnIconOptionsChange write FOnIconOptionsChange; + property OnSkinChange: TNotifyEvent read FOnSkinChange write FOnSkinChange; + end; + +{ Ini/Reg } +procedure SpIniEraseSection(IniFile: TCustomIniFile; Section: string; EraseKeysOnly: Boolean); +procedure SpIniSaveStringList(IniFile: TCustomIniFile; Section: string; L: TStringList); +procedure SpIniLoadStringList(IniFile: TCustomIniFile; Section: string; L: TStringList); +procedure SpRegSaveStringList(L: TStringList; const RootKey: DWORD; const BaseRegistryKey: string); +procedure SpRegLoadStringList(L: TStringList; const RootKey: DWORD; const BaseRegistryKey: string); + +{ Layouts } +procedure SpLoadFormState(Form: TCustomForm; OptionsList: TStrings); +procedure SpSaveFormState(Form: TCustomForm; OptionsList: TStrings); +procedure SpLoadLayoutList(IniFile: TCustomIniFile; L: TStringList); overload; +procedure SpLoadLayout(const OwnerComponent: TComponent; IniFile: TCustomIniFile; LayoutName: string; ExtraOptions: TStringList = nil); +procedure SpSaveLayout(const OwnerComponent: TComponent; IniFile: TCustomIniFile; LayoutName: string; ExtraOptions: TStringList = nil); + +{ Items } +procedure SpLoadItems(const OwnerComponent: TComponent; IniFile: TCustomIniFile; ShortcutsList: TSpTBXMenuBarShortcuts = nil; ExtraOptions: TStringList = nil); +procedure SpSaveItems(const OwnerComponent: TComponent; IniFile: TCustomIniFile; ShortcutsList: TSpTBXMenuBarShortcuts = nil; ExtraOptions: TStringList = nil); + +{ Misc } +function SpCustomizerGetWideCaption(Item: TTBCustomItem): WideString; +function SpCreateUniqueSeparator(Blank: Boolean): TSpTBXSeparatorItem; + +implementation + +uses + TypInfo, Registry, Menus, ActnList, TB2ExtItems, + SpTBXTabs, SpTBXDkPanels, SpTBXCustomizerForm; + +type + TTBRootItemAccess = class(TTBRootItem); + TTBCustomItemAccess = class(TTBCustomItem); + TTBDockAccess = class(TTBDock); + TSpTBXTabToolbarAccess = class(TSpTBXTabToolbar); + +{ Constants for SpTBXCustomizer-specific registry values. Do not localize! } +const + SSpTBXCustomizerRepeatedInstance = 'There''s already another instance of TSpTBXCustomizer'; + SSpTBXCustomizerInvalidParent = 'TSpTBXCustomizer must be dropped only on a Form or on a Frame'; + rvLastLayout = 'LastLayout'; + rvExtraOptions = 'ExtraOptions'; + rvLayoutRegList = 'LayoutsList'; + rvLayoutList = 'Layouts'; + rvItemsList = 'Items'; + rvCount = 'Count'; + rvSkin = 'Skin'; + rvMainFormWindowState = 'MainForm.WindowState'; + rvMainFormBounds = 'MainForm.Bounds'; + rvMainFormRestoreBounds = 'MainForm.RestoreBounds'; + rvSeparator = '--[Separator]--'; + rvBlankSeparator = '--[Blank Separator]--'; + rvUniqueSeparatorPrefix = 'CustomizerUniqueSeparator'; + rvUniqueBlankSeparatorPrefix = 'CustomizerUniqueBlankSeparator'; + +var + FShortcutsProcessor: TShortCutsProcessor; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +function IncludeTrailingRegKeyDelimiter(const S: string): string; +var + C: integer; +begin + Result := S; + C := Length(Result); + if (C > 0) and (Result[C] <> '\') then + Result := Result + '\'; +end; + +function ParseItemEntry(RootItemsList, ItemsList: TStringList; const ItemEntry: string; + out ParentItem: TTBCustomItem; out ItemName: string; out ShortCut: TShortCut): TTBCustomItem; +var + L: TStringList; + I: Integer; + TBName: string; +begin + Result := nil; + ParentItem := nil; + ShortCut := 0; + + L := TStringList.Create; + try + L.CommaText := ItemEntry; + TBName := L[0]; + ItemName := L[1]; + if L.Count > 2 then + if L[2] = '0' then + ShortCut := 0 + else + ShortCut := TextToShortCut(L[2]); + I := RootItemsList.IndexOf(TBName); + if I > -1 then begin + ParentItem := RootItemsList.Objects[I] as TTBCustomItem; + if Pos(rvUniqueSeparatorPrefix, ItemName) > 0 then begin // If it's a cloned separator create it + Result := TSpTBXSeparatorItem.Create(nil); + Result.Name := ItemName; + end + else + if Pos(rvUniqueBlankSeparatorPrefix, ItemName) > 0 then begin // If it's a cloned blank separator create it + Result := TSpTBXSeparatorItem.Create(nil); + Result.Name := ItemName; + TSpTBXSeparatorItem(Result).Blank := True; + end + else begin + I := ItemsList.IndexOf(ItemName); + if I > -1 then + Result := ItemsList.Objects[I] as TTBCustomItem; + end; + end; + finally + L.Free; + end; +end; + +procedure GetRootItemsList(OwnerComponent: TComponent; RootItemsList: TStringList); +// Creates a list with all the toolbar's root items +// It excludes Frames toolbars (name collision problems) +var + I: Integer; + C: TComponent; +begin + for I := 0 to OwnerComponent.ComponentCount - 1 do begin + C := OwnerComponent.Components[I]; + if C is TFrame then + Continue + else + if C is TSpTBXToolbar then begin + if TSpTBXToolbar(C).Customizable then + RootItemsList.AddObject(C.Name, TSpTBXToolbar(C).Items); + end + else + if C is TSpTBXCustomizer then + RootItemsList.AddObject(C.Name, TSpTBXCustomizer(C).Items) + else + if (C is TWinControl) and not (C is TFrame) and not (C is TForm) then + GetRootItemsList(C, RootItemsList); + end; +end; + +procedure SaveItemOptions(OwnerComponent: TComponent; + ShortcutsList: TSpTBXMenuBarShortcuts; OptionsList: TStringList); + + procedure SaveOption(ComponentName: string; AItem: TTBCustomItem); + var + ShortCut: string; + begin + ShortCut := ShortCutToText(AItem.ShortCut); + if ShortCut = '' then ShortCut := '0'; + OptionsList.Add(ComponentName + ', ' + AItem.Name + ', ' + ShortCut); + end; + +var + I, J: Integer; + ParentItem: TTBCustomItem; + RootItemsList: TStringList; +begin + OptionsList.Clear; + + RootItemsList := TStringList.Create; + try + GetRootItemsList(OwnerComponent, RootItemsList); + for I := 0 to RootItemsList.Count - 1 do begin + ParentItem := TTBCustomItem(RootItemsList.Objects[I]); + for J := 0 to ParentItem.Count - 1 do + SaveOption(RootItemsList.Strings[I], ParentItem[J]); + end; + finally + RootItemsList.Free; + end; + + // Save the MenuBar shortcuts + if Assigned(ShortcutsList) then begin + for J := 0 to ShortcutsList.Count - 1 do + SaveOption(ShortcutsList.MenuBarName, ShortcutsList.Objects[J] as TTBCustomItem); + end; +end; + +procedure ApplyItemOptions(OwnerComponent: TComponent; + ShortcutsList: TSpTBXMenuBarShortcuts; OptionsList: TStringList); +var + RootItemsList, ItemsList: TStringList; + I, J, OrigPos, InsertPoint: Integer; + Item, ParentItem, AuxParentItem: TTBCustomItem; + ParentToolbar: TSpTBXTabToolbarAccess; + ItemName: string; + ShortCut: TShortCut; +begin + RootItemsList := TStringList.Create; + ItemsList := TStringList.Create; + try + GetRootItemsList(OwnerComponent, RootItemsList); + for I := 0 to RootItemsList.Count - 1 do begin + ParentItem := TTBCustomItem(RootItemsList.Objects[I]); + for J := 0 to ParentItem.Count - 1 do + ItemsList.AddObject(ParentItem[J].Name, ParentItem[J]); + end; + + InsertPoint := 0; + AuxParentItem := nil; + for I := 0 to OptionsList.Count - 1 do begin + Item := ParseItemEntry(RootItemsList, ItemsList, OptionsList[I], ParentItem, ItemName, ShortCut); + if Assigned(Item) then begin + if AuxParentItem <> ParentItem then begin + AuxParentItem := ParentItem; + InsertPoint := 0; + end; + // Move the item if the parent or index are different + if not Assigned(Item.Parent) then + ParentItem.Insert(InsertPoint, Item) + else + if Item.Parent <> ParentItem then begin + Item.Parent.Remove(Item); + ParentItem.Insert(InsertPoint, Item); + end + else begin + OrigPos := Item.Parent.IndexOf(Item); + if OrigPos <> InsertPoint then begin + if Item.Parent.ParentComponent is TSpTBXTabToolbar then begin + ParentToolbar := TSpTBXTabToolbarAccess(Item.Parent.ParentComponent); + ParentToolbar.BeginItemMove; + ParentToolbar.View.BeginUpdate; + try + // The item is the active tab, we need to update the ActiveTabIndex + // Just set the internal value because the page didn't change + if ParentToolbar.FActiveTabIndex = OrigPos then + ParentToolbar.FActiveTabIndex := InsertPoint; + Item.Parent.Move(OrigPos, InsertPoint); + finally + ParentToolbar.View.EndUpdate; + ParentToolbar.EndItemMove; + end; + end + else + Item.Parent.Move(OrigPos, InsertPoint); + end; + end; + + if Assigned(Item.Action) and (Item.Action is TAction) then + TAction(Item.Action).ShortCut := ShortCut + else + Item.ShortCut := ShortCut; + Inc(InsertPoint); + end + else begin + // Item not found try to change the Shortcut + if Assigned(ShortcutsList) then + for J := 0 to ShortcutsList.Count - 1 do begin + Item := ShortcutsList.Objects[J] as TTBCustomItem; + if Item.Name = ItemName then begin + if Assigned(Item.Action) and (Item.Action is TAction) then + TAction(Item.Action).ShortCut := ShortCut + else + Item.ShortCut := ShortCut; + Break; + end; + end; + end; + end; + + finally + RootItemsList.Free; + ItemsList.Free; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Ini/Reg } + +procedure SpIniEraseSection(IniFile: TCustomIniFile; Section: string; EraseKeysOnly: Boolean); +var + I: Integer; + Keys: TStringList; +begin + if EraseKeysOnly then begin + Keys := TStringList.Create; + try + IniFile.ReadSection(Section, Keys); + for I := 0 to Keys.Count - 1 do + IniFile.DeleteKey(Section, Keys[I]); + finally + Keys.Free; + end; + end + else + IniFile.EraseSection(Section); +end; + +procedure SpIniSaveStringList(IniFile: TCustomIniFile; Section: string; L: TStringList); +var + I: Integer; +begin + if not Assigned(L) then Exit; + SpIniEraseSection(IniFile, Section, True); + if L.Count > 0 then begin + IniFile.WriteInteger(Section, rvCount, L.Count); + for I := 0 to L.Count - 1 do + IniFile.WriteString(Section, IntToStr(I), L[I]); + end; +end; + +procedure SpIniLoadStringList(IniFile: TCustomIniFile; Section: string; L: TStringList); +var + I, C: integer; +begin + if not Assigned(L) then Exit; + L.Clear; + C := IniFile.ReadInteger(Section, rvCount, -1); + for I := 0 to C - 1 do + L.Add(IniFile.ReadString(Section, IntToStr(I), '')); +end; + +procedure SpRegSaveStringList(L: TStringList; const RootKey: DWORD; const BaseRegistryKey: string); +var + Reg: TRegistry; + I: integer; +begin + if not Assigned(L) then Exit; + Reg := TRegistry.Create; + try + Reg.RootKey := RootKey; + Reg.DeleteKey(BaseRegistryKey); + if Reg.OpenKey(BaseRegistryKey, True) and (L.Count > 0) then begin + Reg.WriteInteger(rvCount, L.Count); + for I := 0 to L.Count - 1 do + Reg.WriteString(IntToStr(I), L[I]); + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +procedure SpRegLoadStringList(L: TStringList; const RootKey: DWORD; const BaseRegistryKey: string); +var + Reg: TRegistry; + I, C: integer; +begin + if not Assigned(L) then Exit; + Reg := TRegistry.Create; + try + L.Clear; + Reg.RootKey := RootKey; + if Reg.OpenKey(BaseRegistryKey, True) then begin + if Reg.ValueExists(rvCount) then begin + C := Reg.ReadInteger(rvCount); + for I := 0 to C - 1 do + if Reg.ValueExists(inttostr(I)) then + L.Add(Reg.ReadString(inttostr(I))); + end; + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Layouts } + +procedure SpLoadFormState(Form: TCustomForm; OptionsList: TStrings); +var + WState: TWindowState; + R: TRect; +begin + if Assigned(Form) then begin + WState := TWindowState(GetEnumValue(TypeInfo(TWindowState), OptionsList.Values[rvMainFormWindowState])); + if (WState < Low(WState)) or (WState > High(WState)) then + WState := Form.WindowState; // Failed reading from string, leave the default value + + if SpStringToRect(OptionsList.Values[rvMainFormBounds], R) then + Form.SetBounds(R.Left, R.Top, R.Right, R.Bottom); + + if not SpStringToRect(OptionsList.Values[rvMainFormRestoreBounds], R) then + R := Rect(Form.Left, Form.Top, Form.Width, Form.Height); // Failed reading from string, leave the default value + + SpSetFormWindowState(Form, WState, R); + end; +end; + +procedure SpSaveFormState(Form: TCustomForm; OptionsList: TStrings); +var + WState: TWindowState; + RestoreBounds: TRect; +begin + if Assigned(Form) then begin + WState := SpGetFormWindowState(Form, RestoreBounds); + OptionsList.Values[rvMainFormWindowState] := GetEnumName(TypeInfo(TWindowState), Ord(WState)); + OptionsList.Values[rvMainFormBounds] := SpRectToString(Rect(Form.Left, Form.Top, Form.Width, Form.Height)); + OptionsList.Values[rvMainFormRestoreBounds] := SpRectToString(RestoreBounds); + end; +end; + +procedure SpLoadLayoutList(IniFile: TCustomIniFile; L: TStringList); overload; +begin + SpIniLoadStringList(IniFile, rvLayoutList, L); +end; + +procedure SpSaveLayout(const OwnerComponent: TComponent; IniFile: TCustomIniFile; + LayoutName: string; ExtraOptions: TStringList = nil); +var + L: TStringList; + Prefix, RegPrevPath: string; +begin + // Add the Layout to the LayoutList + L := TStringList.Create; + try + SpIniLoadStringList(IniFile, rvLayoutList, L); + if L.IndexOf(LayoutName) = -1 then + L.Add(LayoutName); + SpIniSaveStringList(IniFile, rvLayoutList, L); + finally + L.Free; + end; + + Prefix := LayoutName + ' @ '; + // Open the new key and save the previous key if it's a TRegistryIniFile + if IniFile is TRegistryIniFile then begin + RegPrevPath := TRegistryIniFile(IniFile).RegIniFile.CurrentPath; + Prefix := ''; + if not TRegistryIniFile(IniFile).RegIniFile.OpenKey(RegPrevPath + '\' + rvLayoutRegList + '\' + LayoutName, True) then + Exit; + end; + // Save the Layout and ExtraOptions + SpTBIniSavePositions(OwnerComponent, IniFile, Prefix); + if Assigned(ExtraOptions) then + SpIniSaveStringList(IniFile, Prefix + rvExtraOptions, ExtraOptions); + // Open the previous key if it's a TRegistryIniFile + if IniFile is TRegistryIniFile then + TRegistryIniFile(IniFile).RegIniFile.OpenKey(RegPrevPath, False); +end; + +procedure SpLoadLayout(const OwnerComponent: TComponent; IniFile: TCustomIniFile; + LayoutName: string; ExtraOptions: TStringList = nil); +var + L: TStringList; + Prefix, RegPrevPath: string; +begin + // Check if the layout exists on the layout list + L := TStringList.Create; + try + SpIniLoadStringList(IniFile, rvLayoutList, L); + if L.IndexOf(LayoutName) < 0 then + Exit; + finally + L.Free; + end; + + Prefix := LayoutName + ' @ '; + // Open the new key and save the previous key if it's a TRegistryIniFile + if IniFile is TRegistryIniFile then begin + RegPrevPath := TRegistryIniFile(IniFile).RegIniFile.CurrentPath; + Prefix := ''; + if not TRegistryIniFile(IniFile).RegIniFile.OpenKey(RegPrevPath + '\' + rvLayoutRegList + '\' + LayoutName, False) then + Exit; + end; + // Load the Layout and ExtraOptions + SpTBIniLoadPositions(OwnerComponent, IniFile, Prefix); + if Assigned(ExtraOptions) then + SpIniLoadStringList(IniFile, Prefix + rvExtraOptions, ExtraOptions); + // Open the previous key if it's a TRegistryIniFile + if IniFile is TRegistryIniFile then + TRegistryIniFile(IniFile).RegIniFile.OpenKey(RegPrevPath, False); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Items } + +procedure SpSaveItems(const OwnerComponent: TComponent; IniFile: TCustomIniFile; + ShortcutsList: TSpTBXMenuBarShortcuts = nil; ExtraOptions: TStringList = nil); overload; +var + L: TStringList; +begin + L := TStringList.Create; + try + SaveItemOptions(OwnerComponent, ShortcutsList, L); + SpIniSaveStringList(IniFile, rvItemsList, L); + SpIniSaveStringList(IniFile, rvExtraOptions, ExtraOptions); + finally + L.Free; + end; +end; + +procedure SpLoadItems(const OwnerComponent: TComponent; IniFile: TCustomIniFile; + ShortcutsList: TSpTBXMenuBarShortcuts = nil; ExtraOptions: TStringList = nil); overload; +var + L: TStringList; +begin + L := TStringList.Create; + try + SpIniLoadStringList(IniFile, rvItemsList, L); + ApplyItemOptions(OwnerComponent, ShortcutsList, L); + SpIniLoadStringList(IniFile, rvExtraOptions, ExtraOptions); + finally + L.Free; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Misc } + +function SpCustomizerGetWideCaption(Item: TTBCustomItem): WideString; +begin + if Item is TSpTBXCustomItem then Result := TSpTBXCustomItem(Item).Caption + else if Item is TSpTBXEditItem then Result := TSpTBXEditItem(Item).Caption + else if Item is TTBSeparatorItem then Result := Item.Name + else if Item is TTBGroupItem then Result := Item.Name + else Result := Item.Caption; + Result := SpStripShortcut(Result); + Result := SpStripAccelChars(Result); +end; + +function SpCreateUniqueSeparator(Blank: Boolean): TSpTBXSeparatorItem; +var + S: string; +begin + S := IntToStr(DateTimeToFileDate(Now)); + Result := TSpTBXSeparatorItem.Create(nil); + if Blank then begin + Result.Name := rvUniqueBlankSeparatorPrefix + S; + TSpTBXSeparatorItem(Result).Blank := True; + end + else + Result.Name := rvUniqueSeparatorPrefix + S; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TShortCutsProcessor } + +constructor TShortCutsProcessor.Create; +begin + inherited; + if Assigned(Application) then + Application.HookMainWindow(MainWindowHook); +end; + +destructor TShortCutsProcessor.Destroy; +begin + if Assigned(Application) then + Application.UnhookMainWindow(MainWindowHook); + inherited; +end; + +function TShortCutsProcessor.MainWindowHook(var Message: TMessage): Boolean; +begin + // Hook to the Application's message loop to disable ShortCut messages processing. + // If the Form is non-modal and a key is pressed it tries to find a shortcut + // handler in the main form, we need to disable this. + // We have to hook in the initialization section so the hook is prior the + // TTBCustomToolbar hook in the Application's hooklist. + + // Shortcut messages: + // Whenever a keystroke is pressed and is not handled by the active control + // or a suitable popup menu item, it is passed to the underlying form's + // IsShortCut method. The form tries to handle the keystroke through its + // OnShortCut event or, failing that, through its main menu. If nothing wants + // it, all action lists owned by the form are checked for a matching shortcut. + // The action list checks each of its actions and if a match is found, + // the action's Execute method is called. + // If no suitable action is found on the current form a CM_APPKEYDOWN message + // is sent to the Application object which calls its own IsShortCut method. + // This tries to handle the keystroke in its own OnShortCut event and if + // that fails it calls the main form's IsShortCut method. + + // Key press -> Active Control -> Popup Menu -> TCustomForm.IsShortCut -> + // TCustomForm.MainMenu -> TActionList -> TApplication CM_APPKEYDOWN and CM_APPSYSCOMMAND -> + // TApplication.IsShortCut + + Result := False; + if FActive then + if (Message.Msg = CM_APPKEYDOWN) or (Message.Msg = CM_APPSYSCOMMAND) then begin + Message.Result := 0; + Result := true; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomizer } + +constructor TSpTBXCustomizer.Create(AOwner: TComponent); +begin + inherited; + FItems := TTBRootItem.Create(Self); + FItems.ParentComponent := Self; + FLayouts := TStringList.Create; + FResetState := TStringList.Create; + FSaveFormState := True; + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXCustomizer.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + FItems.Free; + FLayouts.Free; + FResetState.Free; + inherited; +end; + +procedure TSpTBXCustomizer.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if (Operation = opRemove) then begin + if AComponent = FCustomizeForm then FCustomizeForm := nil; + if AComponent = FMenuBar then FMenuBar := nil; + end; +end; + +procedure TSpTBXCustomizer.GetChildren(Proc: TGetChildProc; + Root: TComponent); +begin + TTBRootItemAccess(FItems).GetChildren(Proc, Root); +end; + +function TSpTBXCustomizer.GetCustomizeFormClass: TSpTBXCustomizeFormClass; +begin + Result := TSpTBXCustomizeForm; + if Assigned(FOnGetCustomizeForm) then FOnGetCustomizeForm(Self, Result); + if not Assigned(Result) then + Result := TSpTBXCustomizeForm; +end; + +procedure TSpTBXCustomizer.GetShortcutList(ShortcutsList: TTntStringList); +var + I: Integer; + Item: TTBCustomItem; + ItemStyle: TTBItemStyle; + L: TTntStringList; +begin + ShortcutsList.Clear; + + if Assigned(MenuBar) then begin + if ShortcutsList is TSpTBXMenuBarShortcuts then + TSpTBXMenuBarShortcuts(ShortcutsList).MenuBarName := MenuBar.Name; + + L := TTntStringList.Create; + try + SpGetAllItems(MenuBar.Items, L); + for I := 0 to L.Count - 1 do begin + Item := L.Objects[I] as TTBCustomItem; + ItemStyle := TTBCustomItemAccess(Item).ItemStyle; + // Exclude the submenus, separators, labels, groups and edit items + if (ItemStyle * [tbisSubMenu, tbisSeparator, tbisEmbeddedGroup, tbisClicksTransparent] = []) and + not (Item is TTBEditItem) then + begin + if DoGetShortcutsList(Item) then + ShortcutsList.AddObject(SpCustomizerGetWideCaption(Item), Item); + end; + end; + finally + L.Free; + end; + end; +end; + +function TSpTBXCustomizer.GetImages: TCustomImageList; +begin + Result := FItems.SubMenuImages; +end; + +function TSpTBXCustomizer.GetItems: TTBCustomItem; +begin + Result := FItems; +end; + +procedure TSpTBXCustomizer.SetImages(Value: TCustomImageList); +begin + FItems.SubMenuImages := Value; +end; + +procedure TSpTBXCustomizer.SetMenuBar(const Value: TTBCustomToolbar); +begin + if FMenuBar <> Value then begin + FMenuBar := Value; + if Assigned(Value) then + Value.FreeNotification(Self); + end; +end; + +procedure TSpTBXCustomizer.SetupForm; +begin + FCustomizeForm.FormStyle := fsStayOnTop; + FCustomizeForm.BorderIcons := [biSystemMenu]; + FCustomizeForm.Position := poMainFormCenter; + SpCustomizeAllToolbars(Owner as TWinControl, False); + SpCustomizeAllToolbars(FCustomizeForm, False); +end; + +procedure TSpTBXCustomizer.Close; +begin + if FShowing and Assigned(FCustomizeForm) then begin + FCustomizeForm.Close; + SpCustomizeAllToolbars(Owner as TWinControl, True); + SpCustomizeAllToolbars(FCustomizeForm, True); + FShowing := False; + if Assigned(FOnClose) then FOnClose(Self); + end; +end; + +procedure TSpTBXCustomizer.Show; +begin + ShowEmbedded; +end; + +procedure TSpTBXCustomizer.ShowEmbedded(AParent: TWinControl = nil); +begin + if not Assigned(FCustomizeForm) then + FCustomizeForm := GetCustomizeFormClass.Create(Self, AParent); + + if not FShowing and Assigned(FCustomizeForm) then begin + FShowing := True; + SetupForm; + FCustomizeForm.Show; + FCustomizeForm.DoSkinChange; + if Assigned(FOnShow) then FOnShow(Self); + end; +end; + +procedure TSpTBXCustomizer.ValidateContainer(AComponent: TComponent); +var + I: Integer; +begin + if Assigned(AComponent) then begin + if not (AComponent is TCustomForm) and not (AComponent is TCustomFrame) then + raise EInvalidOperation.Create(SSpTBXCustomizerInvalidParent); + for I := 0 to AComponent.ComponentCount - 1 do + if AComponent.Components[I] is TSpTBXCustomizer then + raise EInvalidOperation.Create(SSpTBXCustomizerRepeatedInstance); + end + else + raise EInvalidOperation.Create(SSpTBXCustomizerInvalidParent); + + inherited; +end; + +procedure TSpTBXCustomizer.Load(IniFile: TCustomIniFile; LoadLastLayout: Boolean = True); +var + ExtraL: TStringList; + ShortcutsL: TSpTBXMenuBarShortcuts; +begin + ExtraL := TStringList.Create; + ShortcutsL := TSpTBXMenuBarShortcuts.Create; + try + // Load Shortcuts + if Assigned(MenuBar) then + GetShortcutList(ShortcutsL); + + // Save the ResetState, save only the Items and Toolbar state + SaveResetState(ShortcutsL); + + // Load Items + SpLoadItems(Owner, IniFile, ShortcutsL, ExtraL); + + // Fill Extra Options + DoLoad(ExtraL); + if FSaveFormState then + SpLoadFormState(Application.MainForm, ExtraL); + SkinManager.SetSkin(ExtraL.Values[rvSkin]); + + // Load Layouts + SpLoadLayoutList(IniFile, FLayouts); + if LoadLastLayout then + LoadLayout(IniFile, rvLastLayout); + finally + ExtraL.Free; + ShortcutsL.Free; + end; +end; + +procedure TSpTBXCustomizer.Load(OptionsList: TStrings; LoadLastLayout: Boolean = True); +var + MemIni: TMemIniFile; +begin + MemIni := TMemIniFile.Create(''); + try + MemIni.SetStrings(OptionsList); // Transfer OptionsList contents to MemIni + Load(MemIni, LoadLastLayout); + finally + MemIni.Free; + end; +end; + +procedure TSpTBXCustomizer.Load(const Filename: string; LoadLastLayout: Boolean = True); +var + MemIni: TMemIniFile; +begin + MemIni := TMemIniFile.Create(Filename); + try + Load(MemIni, LoadLastLayout); + finally + MemIni.Free; + end; +end; + +procedure TSpTBXCustomizer.Load(const RootKey: DWORD; BaseRegistryKey: string; LoadLastLayout: Boolean = True); +var + Reg: TRegistryIniFile; +begin + // Use TRegistryIniFile to call Load + Reg := TRegistryIniFile.Create('', KEY_QUERY_VALUE); + try + Reg.RegIniFile.RootKey := RootKey; + if Reg.RegIniFile.OpenKey(BaseRegistryKey, False) then + Load(Reg, LoadLastLayout); + finally + Reg.Free; + end; +end; + +procedure TSpTBXCustomizer.Save(IniFile: TCustomIniFile); +var + ExtraL: TStringList; + ShortcutsL: TSpTBXMenuBarShortcuts; +begin + ExtraL := TStringList.Create; + ShortcutsL := TSpTBXMenuBarShortcuts.Create; + try + // Fill Extra Options, SpSaveItems will save it + ExtraL.Values[rvSkin] := SkinManager.CurrentSkinName; + if FSaveFormState then + SpSaveFormState(Application.MainForm, ExtraL); + DoSave(ExtraL); + + // Save Items + if Assigned(MenuBar) then + GetShortcutList(ShortcutsL); + SpSaveItems(Owner, IniFile, ShortcutsL, ExtraL); + + // Save Layouts + SaveLayout(IniFile, rvLastLayout); + finally + ExtraL.Free; + ShortcutsL.Free; + end; +end; + +procedure TSpTBXCustomizer.Save(OptionsList: TStrings); +var + MemIni: TMemIniFile; +begin + MemIni := TMemIniFile.Create(''); + try + MemIni.SetStrings(OptionsList); // Transfer OptionsList contents to MemIni + Save(MemIni); + OptionsList.Clear; + MemIni.GetStrings(OptionsList); // Transfer MemIni contents to OptionsList + finally + MemIni.Free; + end; +end; + +procedure TSpTBXCustomizer.Save(const Filename: string); +var + MemIni: TMemIniFile; +begin + MemIni := TMemIniFile.Create(Filename); + try + Save(MemIni); + MemIni.UpdateFile; + finally + MemIni.Free; + end; +end; + +procedure TSpTBXCustomizer.Save(const RootKey: DWORD; BaseRegistryKey: string); +var + Reg: TRegistryIniFile; +begin + // Use TRegistryIniFile to call Save + Reg := TRegistryIniFile.Create(''); + try + Reg.RegIniFile.RootKey := RootKey; + Reg.RegIniFile.CreateKey(BaseRegistryKey); + if Reg.RegIniFile.OpenKey(BaseRegistryKey, True) then + Save(Reg); + finally + Reg.Free; + end; +end; + +procedure TSpTBXCustomizer.Reset; +var + MemIni: TMemIniFile; + ShortcutsL: TSpTBXMenuBarShortcuts; +begin + // Load ResetState + if FResetState.Count > 0 then begin + MemIni := TMemIniFile.Create(''); + ShortcutsL := TSpTBXMenuBarShortcuts.Create; + try + MemIni.SetStrings(FResetState); // Transfer FResetState contents to MemIni + // Load Shortcuts + if Assigned(MenuBar) then + GetShortcutList(ShortcutsL); + // Load Items + SpLoadItems(Owner, MemIni, ShortcutsL, nil); + // Load last layout + SpLoadLayout(Owner, MemIni, rvLastLayout, nil); + finally + MemIni.Free; + ShortcutsL.Free; + end; + end; +end; + +procedure TSpTBXCustomizer.LoadLayout(IniFile: TCustomIniFile; LayoutName: string); +var + ExtraL: TStringList; +begin + ExtraL := TStringList.Create; + try + SpLoadLayout(Owner, IniFile, LayoutName, ExtraL); + DoLayoutLoad(LayoutName, ExtraL); + finally + ExtraL.Free; + end; +end; + +procedure TSpTBXCustomizer.LoadLayout(OptionsList: TStrings; LayoutName: string); +var + MemIni: TMemIniFile; +begin + MemIni := TMemIniFile.Create(''); + try + MemIni.SetStrings(OptionsList); // Transfer OptionsList contents to MemIni + LoadLayout(MemIni, LayoutName); + finally + MemIni.Free; + end; +end; + +procedure TSpTBXCustomizer.LoadLayout(const Filename, LayoutName: string); +var + MemIni: TMemIniFile; +begin + MemIni := TMemIniFile.Create(Filename); + try + LoadLayout(MemIni, LayoutName); + finally + MemIni.Free; + end; +end; + +procedure TSpTBXCustomizer.LoadLayout(const RootKey: DWORD; + BaseRegistryKey, LayoutName: string); +var + Reg: TRegistryIniFile; +begin + // Use TRegistryIniFile to call LoadLayout + Reg := TRegistryIniFile.Create('', KEY_QUERY_VALUE); + try + Reg.RegIniFile.RootKey := RootKey; + if Reg.RegIniFile.OpenKey(BaseRegistryKey, False) then + LoadLayout(Reg, LayoutName); + finally + Reg.Free; + end; +end; + +procedure TSpTBXCustomizer.SaveLayout(IniFile: TCustomIniFile; LayoutName: string); +var + ExtraL: TStringList; +begin + if LayoutName = '' then Exit; + ExtraL := TStringList.Create; + try + DoLayoutSave(LayoutName, ExtraL); + SpSaveLayout(Owner, IniFile, LayoutName, ExtraL); + SpLoadLayoutList(IniFile, FLayouts); + finally + ExtraL.Free; + end; +end; + +procedure TSpTBXCustomizer.SaveLayout(OptionsList: TStrings; LayoutName: string); +var + MemIni: TMemIniFile; +begin + if LayoutName = '' then Exit; + MemIni := TMemIniFile.Create(''); + try + MemIni.SetStrings(OptionsList); // Transfer OptionsList contents to MemIni + SaveLayout(MemIni, LayoutName); + + // Reload OptionsList + OptionsList.Clear; + MemIni.GetStrings(OptionsList); // Transfer MemIni contents to OptionsList + finally + MemIni.Free; + end; +end; + +procedure TSpTBXCustomizer.SaveLayout(const Filename, LayoutName: string); +var + MemIni: TMemIniFile; +begin + if LayoutName = '' then Exit; + MemIni := TMemIniFile.Create(Filename); + try + SaveLayout(MemIni, LayoutName); + MemIni.UpdateFile; + finally + MemIni.Free; + end; +end; + +procedure TSpTBXCustomizer.SaveLayout(const RootKey: DWORD; + BaseRegistryKey, LayoutName: string); +var + Reg: TRegistryIniFile; +begin + if LayoutName = '' then Exit; + // Use TRegistryIniFile to call SaveLayout + Reg := TRegistryIniFile.Create(''); + try + Reg.RegIniFile.RootKey := RootKey; + Reg.RegIniFile.CreateKey(BaseRegistryKey); + if Reg.RegIniFile.OpenKey(BaseRegistryKey, True) then + SaveLayout(Reg, LayoutName); + finally + Reg.Free; + end; +end; + +procedure TSpTBXCustomizer.SaveResetState(ShortcutsList: TSpTBXMenuBarShortcuts); +var + TempIni: TMemIniFile; +begin + // Save the ResetState, save only the Items and Toolbar state + if FResetState.Count = 0 then begin + TempIni := TMemIniFile.Create(''); + try + SaveItemOptions(Owner, ShortcutsList, FResetState); + SpIniSaveStringList(TempIni, rvItemsList, FResetState); + SpSaveLayout(Owner, TempIni, rvLastLayout, nil); + FResetState.Clear; + TempIni.GetStrings(FResetState); // Transfer MemIni contents to OptionsList + finally + TempIni.Free; + end; + end; +end; + +function TSpTBXCustomizer.DeleteLayout(IniFile: TCustomIniFile; LayoutName: string): Boolean; +var + L: TStringList; + I, P: Integer; + S: string; +begin + Result := False; + L := TStringList.Create; + try + SpIniLoadStringList(IniFile, rvLayoutList, L); + I := L.IndexOf(LayoutName); + if I > -1 then begin + Result := True; + L.Delete(I); + SpIniSaveStringList(IniFile, rvLayoutList, L); + + if IniFile is TRegistryIniFile then + TRegistryIniFile(IniFile).EraseSection(rvLayoutRegList + '\' + LayoutName) + else begin + // Delete all the Layout sections + IniFile.ReadSections(L); + for I := 0 to L.Count - 1 do begin + P := Pos(' @ ', L[I]); + if P > 0 then begin + S := Copy(L[I], 1, P - 1); + if SameText(LayoutName, S) then + IniFile.EraseSection(L[I]); + end; + end; + end; + + SpLoadLayoutList(IniFile, FLayouts); + end; + finally + L.Free; + end; +end; + +function TSpTBXCustomizer.DeleteLayout(OptionsList: TStrings; LayoutName: string): Boolean; +var + MemIni: TMemIniFile; +begin + Result := False; + MemIni := TMemIniFile.Create(''); + try + MemIni.SetStrings(OptionsList); // Transfer OptionsList contents to MemIni + if DeleteLayout(MemIni, LayoutName) then begin + Result := True; + // Reload OptionsList + OptionsList.Clear; + MemIni.GetStrings(OptionsList); // Transfer MemIni contents to OptionsList + end; + finally + MemIni.Free; + end; +end; + +function TSpTBXCustomizer.DeleteLayout(const Filename, LayoutName: string): Boolean; +var + MemIni: TMemIniFile; +begin + Result := False; + MemIni := TMemIniFile.Create(Filename); + try + if DeleteLayout(MemIni, LayoutName) then begin + Result := True; + MemIni.UpdateFile; + end; + finally + MemIni.Free; + end; +end; + +function TSpTBXCustomizer.DeleteLayout(const RootKey: DWORD; BaseRegistryKey, + LayoutName: string): Boolean; +var + Reg: TRegistryIniFile; +begin + // Use TRegistryIniFile to call DeleteLayout + Result := False; + Reg := TRegistryIniFile.Create(''); + try + Reg.RegIniFile.RootKey := RootKey; + Reg.RegIniFile.CreateKey(BaseRegistryKey); + if Reg.RegIniFile.OpenKey(BaseRegistryKey, True) then + Result := DeleteLayout(Reg, LayoutName); + finally + Reg.Free; + end; +end; + +function TSpTBXCustomizer.DoGetShortcutsList(AItem: TTBCustomItem): Boolean; +begin + if AItem.Parent is TSpTBXSkinGroupItem then + Result := False + else + Result := True; + if Assigned(FOnGetShortcutsList) then FOnGetShortcutsList(Self, AItem, Result); +end; + +procedure TSpTBXCustomizer.DoIconOptionsChange(Toolbar: TTBCustomToolbar; + UseSmallImages: Boolean); +begin + if Assigned(FOnIconOptionsChange) then FOnIconOptionsChange(Self, Toolbar, UseSmallImages); +end; + +procedure TSpTBXCustomizer.DoLoad(ExtraOptions: TStringList); +begin + if Assigned(FOnLoad) then FOnLoad(Self, ExtraOptions); +end; + +procedure TSpTBXCustomizer.DoSave(ExtraOptions: TStringList); +begin + if Assigned(FOnSave) then FOnSave(Self, ExtraOptions); +end; + +procedure TSpTBXCustomizer.DoLayoutLoad(LayoutName: string; + ExtraOptions: TStringList); +begin + if Assigned(FOnLayoutLoad) then FOnLayoutLoad(Self, LayoutName, ExtraOptions); +end; + +procedure TSpTBXCustomizer.DoLayoutSave(LayoutName: string; + ExtraOptions: TStringList); +begin + if Assigned(FOnLayoutSave) then FOnLayoutSave(Self, LayoutName, ExtraOptions); +end; + +procedure TSpTBXCustomizer.DoSkinChange; +begin + if FShowing and Assigned(FCustomizeForm) then + FCustomizeForm.DoSkinChange; + if Assigned(FOnSkinChange) then FOnSkinChange(Self); +end; + +procedure TSpTBXCustomizer.WMSpSkinChange(var Message: TMessage); +begin + DoSkinChange; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomCustomizeForm } + +constructor TSpTBXCustomCustomizeForm.Create(AOwner: TSpTBXCustomizer; EmbeddedParent: TWinControl); +begin + FCustomizer := AOwner; + FEmbedded := Assigned(EmbeddedParent); + + inherited Create(AOwner); + + FToolbarList := TTntStringList.Create; + FItemList := TTntStringList.Create; + FShortcutList := TTntStringList.Create; + FSeparatorList := TTntStringList.Create; + FBlankSeparatorList := TTntStringList.Create; + + // Hook to the Application's message loop to disable ShortCut messages processing. + // Otherwise the TApplication.MainForm Actions are executed. + if Assigned(FShortcutsProcessor) then + FShortcutsProcessor.Active := True; + + if Assigned(EmbeddedParent) then begin + Parent := EmbeddedParent; + BorderStyle := bsNone; + Align := alClient; + end; +end; + +destructor TSpTBXCustomCustomizeForm.Destroy; +begin + Customizer.Close; + if Assigned(FShortcutsProcessor) then + FShortcutsProcessor.Active := False; + FreeAndNil(FToolbarList); + FreeAndNil(FItemList); + FreeAndNil(FShortcutList); + FreeAndNil(FSeparatorList); + FreeAndNil(FBlankSeparatorList); + inherited; +end; + +procedure TSpTBXCustomCustomizeForm.FillCommands; +var + I: Integer; + W: TWinControl; + TB: TSpTBXToolbar; + Item: TTBCustomItem; + WS: WideString; + UseBlankSeparators: Boolean; +begin + // Get the main form + W := Customizer.Owner as TWinControl; + + FToolbarList.Clear; + FSeparatorList.Clear; + FBlankSeparatorList.Clear; + FItemList.Clear; + + // Fill the Toolbars + for I := 0 to W.ComponentCount - 1 do + if W.Components[I] is TSpTBXToolbar then begin + TB := W.Components[I] as TSpTBXToolbar; + if TB.Customizable then + FToolbarList.AddObject(TB.Caption, TB); + end; + + // Add the Separator item + FItemList.Add(rvSeparator); + UseBlankSeparators := Customizer.BlankSeparators; + if UseBlankSeparators then + FItemList.Add(rvBlankSeparator); + + // Add the Customizer items + for I := 0 to Customizer.Items.Count - 1 do begin + Item := Customizer.Items[I]; + WS := SpCustomizerGetWideCaption(Item); + if Item is TTBSeparatorItem then begin + if UseBlankSeparators and TTBSeparatorItem(Item).Blank then + FBlankSeparatorList.AddObject(WS, Item) + else + FSeparatorList.AddObject(WS, Item); + end + else + FItemList.AddObject(WS, Item); + end; + + // Add the Shortcuts items + Customizer.GetShortcutList(FShortcutList); + + DoFillCommands(FToolbarList, FItemList, FShortcutList); +end; + +procedure TSpTBXCustomCustomizeForm.KeyDown(var Key: Word; Shift: TShiftState); +begin + inherited KeyUp(Key, Shift); + if Key = VK_ESCAPE then Close; +end; + +procedure TSpTBXCustomCustomizeForm.DoClose(var Action: TCloseAction); +begin + Action := caFree; + inherited DoClose(Action); +end; + +procedure TSpTBXCustomCustomizeForm.DoShow; +begin + if Assigned(Customizer) then + FillCommands; + inherited; +end; + +procedure TSpTBXCustomCustomizeForm.DoIconOptionsChange(UseSmallImages: Boolean); +var + I: integer; + TB: TTBCustomToolbar; +begin + if Assigned(Customizer) then + for I := 0 to FToolbarList.Count - 1 do + if FToolbarList.Objects[I] is TTBCustomToolbar then begin + TB := FToolbarList.Objects[I] as TTBCustomToolbar; + Customizer.DoIconOptionsChange(TB, UseSmallImages); + end; +end; + +procedure TSpTBXCustomCustomizeForm.DoSkinChange; +begin + // The skin has changed +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM + +initialization + FShortcutsProcessor := TShortCutsProcessor.Create; +finalization + FreeAndNil(FShortcutsProcessor); + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.dcu new file mode 100644 index 0000000..de87e95 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.dfm b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.dfm new file mode 100644 index 0000000..a451e91 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.dfm @@ -0,0 +1,299 @@ +object SpTBXCustomizeForm: TSpTBXCustomizeForm + Left = 219 + Top = 115 + Caption = 'Customizer' + ClientHeight = 321 + ClientWidth = 347 + Color = clBtnFace + Constraints.MinHeight = 355 + Constraints.MinWidth = 355 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [] + FormStyle = fsStayOnTop + KeyPreview = True + OldCreateOrder = False + Position = poDesigned + OnCreate = FormCreate + OnKeyDown = FormKeyDown + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object SpTBXTabControl1: TSpTBXTabControl + Left = 0 + Top = 0 + Width = 347 + Height = 286 + Align = alClient + ActiveTabIndex = 0 + HiddenItems = <> + object tabToolbars: TSpTBXTabItem + Caption = 'Toolbars' + Checked = True + end + object tabCommands: TSpTBXTabItem + Caption = 'Commands' + end + object tabShortcuts: TSpTBXTabItem + Caption = 'Shortcuts' + end + object SpTBXTabSheet3: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 347 + Height = 263 + Caption = 'Commands' + ImageIndex = -1 + DesignSize = ( + 347 + 263) + TabItem = 'tabCommands' + object SpTBXLabel3: TSpTBXLabel + Left = 8 + Top = 213 + Width = 330 + Height = 44 + Caption = + 'To add command buttons, drag and drop commands onto a toolbar. T' + + 'o remove command buttons, drag them off the toolbar and drop the' + + 'm on the commands list.' + Anchors = [akLeft, akRight, akBottom] + AutoSize = False + Wrapping = twWrap + end + object lbCommands: TSpTBXListBox + Left = 8 + Top = 7 + Width = 330 + Height = 205 + Anchors = [akLeft, akTop, akRight, akBottom] + DragMode = dmAutomatic + ItemHeight = 16 + TabOrder = 0 + OnDragDrop = lbCommandsDragDrop + OnDragOver = lbCommandsDragOver + OnDrawItem = lbCommandsDrawItem + OnEndDrag = lbCommandsEndDrag + OnStartDrag = lbCommandsStartDrag + end + end + object SpTBXTabSheet2: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 347 + Height = 263 + Caption = 'Shortcuts' + ImageIndex = -1 + DesignSize = ( + 347 + 263) + TabItem = 'tabShortcuts' + object SpTBXPanel5: TSpTBXPanel + Left = 65 + Top = 228 + Width = 191 + Height = 22 + Anchors = [akLeft, akRight, akBottom] + TabOrder = 1 + HotTrack = True + object Panel1: TPanel + Left = 2 + Top = 2 + Width = 187 + Height = 18 + Align = alClient + BevelOuter = bvNone + TabOrder = 0 + DesignSize = ( + 187 + 18) + object HotKey1: THotKey + Left = -2 + Top = -2 + Width = 193 + Height = 23 + Anchors = [akLeft, akTop, akRight, akBottom] + HotKey = 0 + Modifiers = [] + TabOrder = 0 + end + end + end + object SpTBXLabel4: TSpTBXLabel + Left = 11 + Top = 229 + Width = 47 + Height = 19 + Caption = '&Shortcut' + Anchors = [akLeft, akBottom] + FocusControl = HotKey1 + end + object ChangeShortcut: TSpTBXButton + Left = 261 + Top = 227 + Width = 75 + Height = 25 + Caption = 'C&hange' + Anchors = [akRight, akBottom] + TabOrder = 2 + OnClick = ChangeShortcutClick + end + object lbShortcuts: TSpTBXListBox + Left = 8 + Top = 7 + Width = 330 + Height = 210 + Anchors = [akLeft, akTop, akRight, akBottom] + ItemHeight = 16 + TabOrder = 0 + OnClick = lbShortcutsClick + OnDrawItem = lbShortcutsDrawItem + end + end + object SpTBXTabSheet1: TSpTBXTabSheet + Left = 0 + Top = 23 + Width = 347 + Height = 263 + Caption = 'Toolbars' + ImageIndex = -1 + DesignSize = ( + 347 + 263) + TabItem = 'tabToolbars' + object SpTBXLabel1: TSpTBXLabel + Left = 10 + Top = 4 + Width = 47 + Height = 19 + Caption = '&Toolbars' + FocusControl = lbToolbars + end + object SpTBXGroupBox1: TSpTBXGroupBox + Left = 173 + Top = 18 + Width = 161 + Height = 177 + Caption = 'Options' + Anchors = [akTop, akRight] + TabOrder = 1 + object cbText: TSpTBXComboBox + Left = 8 + Top = 64 + Width = 145 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 1 + OnClick = cbTextClick + Items.Strings = ( + 'Selective text on right' + 'No text labels' + 'Show text labels' + 'Text only') + end + object cbIcon: TSpTBXComboBox + Left = 8 + Top = 112 + Width = 145 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 2 + Items.Strings = ( + 'Large images' + 'Small images') + end + object cbTextLabel: TSpTBXLabel + Left = 8 + Top = 43 + Width = 68 + Height = 19 + Caption = 'T&ext Options' + FocusControl = cbText + end + object cbIconLabel: TSpTBXLabel + Left = 8 + Top = 93 + Width = 67 + Height = 19 + Caption = '&Icon Options' + FocusControl = cbIcon + end + object checkVisible: TSpTBXCheckBox + Left = 8 + Top = 21 + Width = 53 + Height = 21 + Caption = '&Visible' + TabOrder = 0 + OnClick = checkVisibleClick + end + end + object SpTBXGroupBox2: TSpTBXGroupBox + Left = 173 + Top = 200 + Width = 161 + Height = 49 + Caption = '&Skins' + Anchors = [akTop, akRight, akBottom] + TabOrder = 2 + object cbSkins: TSpTBXComboBox + Left = 8 + Top = 20 + Width = 145 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 0 + OnClick = cbSkinsClick + end + end + object lbToolbars: TSpTBXCheckListBox + Left = 8 + Top = 24 + Width = 158 + Height = 225 + OnClickCheck = lbToolbarsClickCheck + Anchors = [akLeft, akTop, akRight, akBottom] + ItemHeight = 20 + TabOrder = 0 + OnClick = lbToolbarsClick + end + end + end + object ClosePanel: TSpTBXPanel + Left = 0 + Top = 286 + Width = 347 + Height = 35 + Align = alBottom + TabOrder = 1 + Borders = False + TBXStyleBackground = True + DesignSize = ( + 347 + 35) + object CloseButton: TSpTBXButton + Left = 267 + Top = 4 + Width = 75 + Height = 25 + Caption = 'Close' + Anchors = [akRight, akBottom] + TabOrder = 0 + OnClick = CloseButtonClick + end + object ResetButton: TSpTBXButton + Left = 7 + Top = 4 + Width = 105 + Height = 25 + Caption = '&Reset to default' + TabOrder = 1 + OnClick = ResetButtonClick + end + end +end diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.hpp new file mode 100644 index 0000000..276a6bc --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.hpp @@ -0,0 +1,131 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxcustomizerform.pas' rev: 20.00 + +#ifndef SptbxcustomizerformHPP +#define SptbxcustomizerformHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxcustomizerform +{ +//-- type declarations ------------------------------------------------------- +class DELPHICLASS TSpTBXCustomizeForm; +class PASCALIMPLEMENTATION TSpTBXCustomizeForm : public Sptbxcustomizer::TSpTBXCustomCustomizeForm +{ + typedef Sptbxcustomizer::TSpTBXCustomCustomizeForm inherited; + +__published: + Sptbxtabs::TSpTBXTabControl* SpTBXTabControl1; + Sptbxtabs::TSpTBXTabItem* tabCommands; + Sptbxtabs::TSpTBXTabSheet* SpTBXTabSheet1; + Sptbxtabs::TSpTBXTabItem* tabToolbars; + Sptbxtabs::TSpTBXTabSheet* SpTBXTabSheet2; + Sptbxtabs::TSpTBXTabItem* tabShortcuts; + Sptbxtabs::TSpTBXTabSheet* SpTBXTabSheet3; + Sptbxcontrols::TSpTBXButton* CloseButton; + Sptbxcontrols::TSpTBXLabel* SpTBXLabel1; + Sptbxcontrols::TSpTBXLabel* SpTBXLabel3; + Comctrls::THotKey* HotKey1; + Sptbxcontrols::TSpTBXButton* ChangeShortcut; + Sptbxcontrols::TSpTBXLabel* SpTBXLabel4; + Sptbxcontrols::TSpTBXPanel* SpTBXPanel5; + Extctrls::TPanel* Panel1; + Sptbxeditors::TSpTBXComboBox* cbSkins; + Sptbxcontrols::TSpTBXLabel* cbIconLabel; + Sptbxeditors::TSpTBXComboBox* cbText; + Sptbxeditors::TSpTBXComboBox* cbIcon; + Sptbxcontrols::TSpTBXLabel* cbTextLabel; + Sptbxcontrols::TSpTBXGroupBox* SpTBXGroupBox1; + Sptbxcontrols::TSpTBXButton* ResetButton; + Sptbxcontrols::TSpTBXCheckBox* checkVisible; + Sptbxcontrols::TSpTBXGroupBox* SpTBXGroupBox2; + Sptbxeditors::TSpTBXCheckListBox* lbToolbars; + Sptbxeditors::TSpTBXListBox* lbCommands; + Sptbxeditors::TSpTBXListBox* lbShortcuts; + Sptbxcontrols::TSpTBXPanel* ClosePanel; + void __fastcall lbCommandsStartDrag(System::TObject* Sender, Controls::TDragObject* &DragObject); + void __fastcall lbCommandsDragOver(System::TObject* Sender, System::TObject* Source, int X, int Y, Controls::TDragState State, bool &Accept); + void __fastcall lbCommandsDragDrop(System::TObject* Sender, System::TObject* Source, int X, int Y); + void __fastcall lbToolbarsClickCheck(System::TObject* Sender); + void __fastcall CloseButtonClick(System::TObject* Sender); + void __fastcall FormKeyDown(System::TObject* Sender, System::Word &Key, Classes::TShiftState Shift); + void __fastcall lbCommandsEndDrag(System::TObject* Sender, System::TObject* Target, int X, int Y); + void __fastcall lbShortcutsClick(System::TObject* Sender); + void __fastcall FormCreate(System::TObject* Sender); + void __fastcall cbSkinsClick(System::TObject* Sender); + void __fastcall checkVisibleClick(System::TObject* Sender); + void __fastcall cbTextClick(System::TObject* Sender); + void __fastcall lbToolbarsClick(System::TObject* Sender); + void __fastcall ChangeShortcutClick(System::TObject* Sender); + void __fastcall FormShow(System::TObject* Sender); + void __fastcall ResetButtonClick(System::TObject* Sender); + void __fastcall lbCommandsDrawItem(System::TObject* Sender, Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + void __fastcall lbShortcutsDrawItem(System::TObject* Sender, Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + +protected: + virtual void __fastcall DoFillCommands(Classes::TStringList* ToolbarList, Classes::TStringList* ItemList, Classes::TStringList* ShortcutsList); + virtual void __fastcall DoSkinChange(void); +public: + /* TSpTBXCustomCustomizeForm.Create */ inline __fastcall TSpTBXCustomizeForm(Sptbxcustomizer::TSpTBXCustomizer* AOwner, Controls::TWinControl* EmbeddedParent) : Sptbxcustomizer::TSpTBXCustomCustomizeForm(AOwner, EmbeddedParent) { } + /* TSpTBXCustomCustomizeForm.Destroy */ inline __fastcall virtual ~TSpTBXCustomizeForm(void) { } + +public: + /* TCustomForm.CreateNew */ inline __fastcall virtual TSpTBXCustomizeForm(Classes::TComponent* AOwner, int Dummy) : Sptbxcustomizer::TSpTBXCustomCustomizeForm(AOwner, Dummy) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomizeForm(HWND ParentWindow) : Sptbxcustomizer::TSpTBXCustomCustomizeForm(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +extern PACKAGE System::ResourceString _SSpTBXCustomizerFormChangeShortcut; +#define Sptbxcustomizerform_SSpTBXCustomizerFormChangeShortcut System::LoadResourceString(&Sptbxcustomizerform::_SSpTBXCustomizerFormChangeShortcut) +extern PACKAGE System::ResourceString _SSpTBXCustomizerFormChangeShortcutTitle; +#define Sptbxcustomizerform_SSpTBXCustomizerFormChangeShortcutTitle System::LoadResourceString(&Sptbxcustomizerform::_SSpTBXCustomizerFormChangeShortcutTitle) +extern PACKAGE System::ResourceString _SSpTBXCustomizerFormSeparator; +#define Sptbxcustomizerform_SSpTBXCustomizerFormSeparator System::LoadResourceString(&Sptbxcustomizerform::_SSpTBXCustomizerFormSeparator) +extern PACKAGE System::ResourceString _SSpTBXCustomizerFormBlankSeparator; +#define Sptbxcustomizerform_SSpTBXCustomizerFormBlankSeparator System::LoadResourceString(&Sptbxcustomizerform::_SSpTBXCustomizerFormBlankSeparator) + +} /* namespace Sptbxcustomizerform */ +using namespace Sptbxcustomizerform; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxcustomizerformHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.pas new file mode 100644 index 0000000..aa3e3c2 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXCustomizerForm.pas @@ -0,0 +1,531 @@ +unit SpTBXCustomizerForm; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development notes: + - All the TBX theme changes and adjustments are marked with '[TBXTheme-Change]'. + +History: + - + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ExtCtrls, ComCtrls, ImgList, CheckLst, + {$IFNDEF UNICODE} + TntClasses, TntStdCtrls, TntCheckLst, + {$ENDIF} + TB2Toolbar, TB2Item, + SpTBXSkins, SpTBXItem, SpTBXControls, SpTBXEditors, SpTBXTabs, SpTBXCustomizer; + +resourcestring + SSpTBXCustomizerFormChangeShortcut = 'The shortcut is already being used by the "%s" command. Do you want to reassign it to the "%s" command?'; + SSpTBXCustomizerFormChangeShortcutTitle = 'Change Shortcut'; + SSpTBXCustomizerFormSeparator = '[ Separator ]'; + SSpTBXCustomizerFormBlankSeparator = '[ Blank Separator ]'; + +type + TSpTBXCustomizeForm = class(TSpTBXCustomCustomizeForm) + SpTBXTabControl1: TSpTBXTabControl; + tabCommands: TSpTBXTabItem; + SpTBXTabSheet1: TSpTBXTabSheet; + tabToolbars: TSpTBXTabItem; + SpTBXTabSheet2: TSpTBXTabSheet; + tabShortcuts: TSpTBXTabItem; + SpTBXTabSheet3: TSpTBXTabSheet; + CloseButton: TSpTBXButton; + SpTBXLabel1: TSpTBXLabel; + SpTBXLabel3: TSpTBXLabel; + HotKey1: THotKey; + ChangeShortcut: TSpTBXButton; + SpTBXLabel4: TSpTBXLabel; + SpTBXPanel5: TSpTBXPanel; + Panel1: TPanel; + cbSkins: TSpTBXComboBox; + cbIconLabel: TSpTBXLabel; + cbText: TSpTBXComboBox; + cbIcon: TSpTBXComboBox; + cbTextLabel: TSpTBXLabel; + SpTBXGroupBox1: TSpTBXGroupBox; + ResetButton: TSpTBXButton; + checkVisible: TSpTBXCheckBox; + SpTBXGroupBox2: TSpTBXGroupBox; + lbToolbars: TSpTBXCheckListBox; + lbCommands: TSpTBXListBox; + lbShortcuts: TSpTBXListBox; + ClosePanel: TSpTBXPanel; + procedure lbCommandsStartDrag(Sender: TObject; + var DragObject: TDragObject); + procedure lbCommandsDragOver(Sender, Source: TObject; X, + Y: Integer; State: TDragState; var Accept: Boolean); + procedure lbCommandsDragDrop(Sender, Source: TObject; X, + Y: Integer); + procedure lbToolbarsClickCheck(Sender: TObject); + procedure CloseButtonClick(Sender: TObject); + procedure FormKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure lbCommandsEndDrag(Sender, Target: TObject; X, Y: Integer); + procedure lbShortcutsClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure cbSkinsClick(Sender: TObject); + procedure checkVisibleClick(Sender: TObject); + procedure cbTextClick(Sender: TObject); + procedure lbToolbarsClick(Sender: TObject); + procedure ChangeShortcutClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure ResetButtonClick(Sender: TObject); + procedure lbCommandsDrawItem(Sender: TObject; ACanvas: TCanvas; + var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); + procedure lbShortcutsDrawItem(Sender: TObject; ACanvas: TCanvas; + var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); + protected + procedure DoFillCommands(ToolbarList, ItemList, ShortcutsList: TTntStringList); override; + procedure DoSkinChange; override; + end; + +implementation + +uses + ActnList; + +{$R *.dfm} + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +procedure SpDrawListboxItem(L: TSpTBXListBox; Index: Integer; ARect: TRect; + State: TOwnerDrawState; DrawShortcut: Boolean; DefaultImageList: TCustomImageList); +var + Item: TTBCustomItem; + IL: TCustomImageList; + WS: WideString; + TextR, ILRect: TRect; + Y: Integer; + ACanvas: TCanvas; +begin + if (Index < 0) or (Index > L.Count - 1) or not (L.Items.Objects[Index] is TTBCustomItem) then Exit; + Item := L.Items.Objects[Index] as TTBCustomItem; + ACanvas := L.Canvas; + + // Draw the icon image + Inc(ARect.Left, 2); // Apply margins + if Item.ImageIndex > -1 then begin + IL := Item.Images; + if not Assigned(IL) then + IL := DefaultImageList; + if Assigned(IL) then begin + ILRect := Bounds(ARect.Left, ARect.Top + ((L.ItemHeight - IL.Height) div 2), IL.Width, IL.Height); + // Draw icon shadow + if odSelected in State then begin + OffsetRect(ILRect, 1, 1); + SpDrawIconShadow(ACanvas, ILRect, IL, Item.ImageIndex); + OffsetRect(ILRect, -2, -2); + end; + SpDrawImageList(ACanvas, ILRect, IL, Item.ImageIndex, True, True); + end; + end; + + // Draw the caption + Inc(ARect.Left, L.ItemHeight); // Apply margins + WS := L.Items[Index]; + TextR := ARect; + Y := SpDrawXPText(ACanvas, WS, TextR, DT_CALCRECT); + ARect.Top := ARect.Top + ((L.ItemHeight - Y) div 2); + SpDrawXPText(ACanvas, WS, ARect, 0); + + // Draw the shortcut + if DrawShortcut then begin + WS := Item.GetShortCutText; + if (WS <> '0') and (WS <> '') then begin + ARect.Left := L.Width - 120; + SpDrawXPText(ACanvas, WS, ARect, 0) + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomizeForm } + +procedure TSpTBXCustomizeForm.FormCreate(Sender: TObject); +var + L: TStringList; +begin + ClosePanel.Visible := not Embedded; + + // Setup the listboxes + if Assigned(Customizer.Images) then begin + lbCommands.ItemHeight := Customizer.Images.Height + 4; + lbShortcuts.ItemHeight := Customizer.Images.Height + 4; + end; + // Hide the Icon Options combobox if necessary + if not Assigned(Customizer.OnIconOptionsChange) then begin + cbIconLabel.Visible := False; + cbIcon.Visible := False; + end; + // Fill the Skins combobox + L := TStringList.Create; + try + SkinManager.SkinsList.GetSkinNames(L); + L.Sort; + cbSkins.Items.Assign(L); + cbSkins.ItemIndex := L.IndexOf(SkinManager.CurrentSkinName); + finally + L.Free; + end; +end; + +procedure TSpTBXCustomizeForm.FormShow(Sender: TObject); +begin + SpTBXTabControl1.ActiveTabIndex := 0; +end; + +procedure TSpTBXCustomizeForm.FormKeyDown(Sender: TObject; + var Key: Word; Shift: TShiftState); +var + I: Integer; +begin + // Allow to change the tab index using Ctrl+Tab and Shift+Ctrl+Tab + if Key = VK_TAB then + if Shift = [ssCtrl] then begin + I := SpTBXTabControl1.ActiveTabIndex; + if I + 1 < SpTBXTabControl1.PagesCount then + SpTBXTabControl1.ActiveTabIndex := I + 1 + else + SpTBXTabControl1.ActiveTabIndex := I - 1 + end + else + if Shift = [ssCtrl, ssShift] then begin + I := SpTBXTabControl1.ActiveTabIndex; + if I - 1 > -1 then + SpTBXTabControl1.ActiveTabIndex := I - 1 + else + SpTBXTabControl1.ActiveTabIndex := I + 1; + end; +end; + +procedure TSpTBXCustomizeForm.CloseButtonClick(Sender: TObject); +begin + Close; +end; + +procedure TSpTBXCustomizeForm.DoFillCommands(ToolbarList, ItemList, ShortcutsList: TTntStringList); +var + I: Integer; + TB: TSpTBXToolbar; +begin + lbToolbars.Items.Assign(ToolbarList); + lbCommands.Items.Assign(ItemList); + lbShortcuts.Items.Assign(ShortcutsList); + // Setup the Toolbars check list + for I := 0 to lbToolbars.Count - 1 do begin + TB := lbToolbars.Items.Objects[I] as TSpTBXToolbar; + if TB.Visible then + lbToolbars.State[I] := cbChecked; + end; + if lbToolbars.Count > 0 then begin + lbToolbars.ItemIndex := 0; + lbToolbarsClick(nil); + end; +end; + +procedure TSpTBXCustomizeForm.DoSkinChange; +begin + inherited; + ClosePanel.Color := SkinManager.CurrentSkin.ColorBtnFace; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Toolbars tab } + +procedure TSpTBXCustomizeForm.lbToolbarsClick(Sender: TObject); +var + I: Integer; + TB: TTBCustomToolbar; +begin + I := lbToolbars.ItemIndex; + if I > -1 then begin + TB := lbToolbars.Items.Objects[I] as TTBCustomToolbar; + checkVisible.Checked := TB.Visible; + if TB is TSpTBXToolbar then + cbText.ItemIndex := Ord(TSpTBXToolbar(TB).DisplayMode) + else + cbText.ItemIndex := -1; + end; +end; + +procedure TSpTBXCustomizeForm.lbToolbarsClickCheck(Sender: TObject); +var + I: Integer; + TB: TTBCustomToolbar; +begin + I := lbToolbars.ItemIndex; + if I > -1 then begin + TB := lbToolbars.Items.Objects[I] as TTBCustomToolbar; + TB.Visible := lbToolbars.Checked[I]; + end; +end; + +procedure TSpTBXCustomizeForm.ResetButtonClick(Sender: TObject); +begin + Customizer.Reset; + FillCommands; +end; + +procedure TSpTBXCustomizeForm.checkVisibleClick(Sender: TObject); +var + I: Integer; +begin + I := lbToolbars.ItemIndex; + if I > -1 then begin + lbToolbars.Checked[I] := checkVisible.Checked; + lbToolbarsClickCheck(nil); + end; +end; + +procedure TSpTBXCustomizeForm.cbTextClick(Sender: TObject); +var + I: Integer; + TB: TSpTBXToolbar; +begin + I := lbToolbars.ItemIndex; + if (I > -1) and (cbText.ItemIndex > -1) then + if lbToolbars.Items.Objects[I] is TSpTBXToolbar then begin + TB := lbToolbars.Items.Objects[I] as TSpTBXToolbar; + TB.DisplayMode := TSpTBXToolbarDisplayMode(cbText.ItemIndex); + end; +end; + +procedure TSpTBXCustomizeForm.cbSkinsClick(Sender: TObject); +begin + if cbSkins.ItemIndex > -1 then + SkinManager.SetSkin(cbSkins.Text); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Commands tab } + +procedure TSpTBXCustomizeForm.lbCommandsStartDrag(Sender: TObject; + var DragObject: TDragObject); +var + L: TSpTBXListBox; + I: Integer; + Item: TTBCustomItem; + Sep: TTBSeparatorItem; +begin + L := Sender as TSpTBXListBox; + I := L.ItemIndex; + if I > -1 then begin + if I = 0 then begin + // When dragging the separator item use the first one available, or create one + if FSeparatorList.Count = 0 then begin + Sep := SpCreateUniqueSeparator(False); + Customizer.Items.Add(Sep); + FSeparatorList.AddObject(Sep.Name, Sep); + end; + Item := FSeparatorList.Objects[0] as TTBCustomItem; + // SpOutputDebugString('Start ' + FSeparatorList[0]); + end + else + if (I = 1) and Customizer.BlankSeparators then begin + // When dragging the blank separator item use the first one available, or create one + if FBlankSeparatorList.Count = 0 then begin + Sep := SpCreateUniqueSeparator(True); + Customizer.Items.Add(Sep); + FBlankSeparatorList.AddObject(Sep.Name, Sep); + end; + Item := FBlankSeparatorList.Objects[0] as TTBCustomItem; + end + else + Item := L.Items.Objects[I] as TTBCustomItem; + DragObject := TSpTBXItemDragObject.Create(L, Item); + end; +end; + +procedure TSpTBXCustomizeForm.lbCommandsEndDrag(Sender, + Target: TObject; X, Y: Integer); +var + Accepted: Boolean; + I: Integer; +begin + // When dropping an item on a toolbar we must remove the item from the list + Accepted := Assigned(Target) and (Target <> Sender); + if Accepted then begin + I := lbCommands.ItemIndex; + if I > -1 then + if I = 0 then begin + // SpOutputDebugString('End ' + FSeparatorList[0]); + FSeparatorList.Delete(0); + end + else + if (I = 1) and Customizer.BlankSeparators then + FBlankSeparatorList.Delete(0) + else + lbCommands.Items.Delete(I); + end; +end; + +procedure TSpTBXCustomizeForm.lbCommandsDragOver(Sender, + Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); +begin + Accept := Assigned(Source) and (Source is TSpTBXItemDragObject); +end; + +procedure TSpTBXCustomizeForm.lbCommandsDragDrop(Sender, + Source: TObject; X, Y: Integer); +var + OrigItem: TTBCustomItem; + WS: WideString; +begin + if Assigned(Source) and (Source is TSpTBXItemDragObject) and + (TSpTBXItemDragObject(Source).SourceControl <> Sender) then + begin + OrigItem := TSpTBXItemDragObject(Source).SouceItem; + // Remove the item from its parent + OrigItem.Parent.Remove(OrigItem); + // Add the item to the Customizer.Items property + Customizer.Items.Add(OrigItem); + WS := SpCustomizerGetWideCaption(OrigItem); + // Add the item entry in the commands list + if OrigItem is TTBSeparatorItem then begin + if Customizer.BlankSeparators and TTBSeparatorItem(OrigItem).Blank then + FBlankSeparatorList.InsertObject(0, WS, OrigItem) // Insert the blank separator in the first position + else + FSeparatorList.InsertObject(0, WS, OrigItem) // Insert the separator in the first position + end + else + lbCommands.AddItem(WS, OrigItem); + // SpOutputDebugString('Dropped ' + WS); + end; +end; + +procedure TSpTBXCustomizeForm.lbCommandsDrawItem(Sender: TObject; + ACanvas: TCanvas; var ARect: TRect; Index: Integer; + const State: TOwnerDrawState; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + if PaintStage = pstPrePaint then begin + PaintDefault := False; + if Index = 0 then begin + // Draw the separator + SpDrawXPText(ACanvas, SSpTBXCustomizerFormSeparator, ARect, DT_SINGLELINE or DT_CENTER or DT_VCENTER); + end + else + if (Index = 1) and Customizer.BlankSeparators then begin + // Draw the blank separator + SpDrawXPText(ACanvas, SSpTBXCustomizerFormBlankSeparator, ARect, DT_SINGLELINE or DT_CENTER or DT_VCENTER); + end + else + SpDrawListboxItem(Sender as TSpTBXListBox, Index, ARect, State, False, Customizer.Images); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Shortcuts tab } + +procedure TSpTBXCustomizeForm.lbShortcutsClick(Sender: TObject); +var + Item: TTBCustomItem; +begin + if lbShortcuts.ItemIndex > -1 then begin + Item := lbShortcuts.Items.Objects[lbShortcuts.ItemIndex] as TTBCustomItem; + HotKey1.HotKey := Item.ShortCut; + end; +end; + +procedure TSpTBXCustomizeForm.lbShortcutsDrawItem(Sender: TObject; + ACanvas: TCanvas; var ARect: TRect; Index: Integer; + const State: TOwnerDrawState; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + if PaintStage = pstPrePaint then begin + PaintDefault := False; + SpDrawListboxItem(Sender as TSpTBXListBox, Index, ARect, State, True, Customizer.Images); + end; +end; + +procedure TSpTBXCustomizeForm.ChangeShortcutClick(Sender: TObject); +var + Item, F: TTBCustomItem; + WS, WS2: WideString; + T: TShortCut; + I: Integer; + ChangeShortCut: Boolean; +begin + if lbShortcuts.ItemIndex < 0 then Exit; + T := HotKey1.HotKey; + Item := lbShortcuts.Items.Objects[lbShortcuts.ItemIndex] as TTBCustomItem; + + ChangeShortCut := True; + + if T <> 0 then begin + // Find if the shortcut is already being used + for I := 0 to lbShortcuts.Count - 1 do begin + F := lbShortcuts.Items.Objects[I] as TTBCustomItem; + if F.ShortCut = T then begin + WS := WideFormat(SSpTBXCustomizerFormChangeShortcut, [SpCustomizerGetWideCaption(F), SpCustomizerGetWideCaption(Item)]); + WS2 := SSpTBXCustomizerFormChangeShortcutTitle; + ChangeShortCut := MessageBoxW(Handle, PWideChar(WS), PWideChar(WS2), MB_APPLMODAL+MB_ICONWARNING+MB_OKCANCEL+MB_DEFBUTTON1) = IDOK; + if ChangeShortCut then + if Assigned(F.Action) and (F.Action is TAction) then + TAction(F.Action).ShortCut := 0 + else + F.ShortCut := 0; + + Break; + end; + end; + end; + + if ChangeShortCut then begin + if Assigned(Item.Action) and (Item.Action is TAction) then + TAction(Item.Action).ShortCut := T + else + Item.ShortCut := T; + lbShortcuts.Invalidate; + end; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.dcu new file mode 100644 index 0000000..891f92e Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.hpp new file mode 100644 index 0000000..1c9ef10 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.hpp @@ -0,0 +1,256 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxdefaultskins.pas' rev: 20.00 + +#ifndef SptbxdefaultskinsHPP +#define SptbxdefaultskinsHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxdefaultskins +{ +//-- type declarations ------------------------------------------------------- +typedef StaticArray TSpTBXAluminumColors; + +class DELPHICLASS TSpTBXAluminumSkin; +class PASCALIMPLEMENTATION TSpTBXAluminumSkin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +private: + void __fastcall SetDefaultColorScheme(const Sptbxskins::TSpTBXLunaScheme Value); + +protected: + TSpTBXAluminumColors FColors; + Sptbxskins::TSpTBXLunaScheme FDefaultColorScheme; + Graphics::TColor FLightMetalColor; + Graphics::TColor FDarkMetalColor; + int FRoughness; + virtual void __fastcall FillColors(void); + virtual Graphics::TColor __fastcall GetBrushMetalColor(Sptbxskins::TSpTBXSkinComponentsType Component, Sptbxskins::TSpTBXSkinStatesType State); + +public: + __fastcall virtual TSpTBXAluminumSkin(void); + __fastcall virtual ~TSpTBXAluminumSkin(void); + virtual void __fastcall FillOptions(void); + virtual void __fastcall PaintBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Sptbxskins::TSpTBXSkinComponentsType Component, Sptbxskins::TSpTBXSkinStatesType State, bool Background, bool Borders, bool Vertical = false, Controls::TAnchors ForceRectBorders = Controls::TAnchors() ); + __property Graphics::TColor LightMetalColor = {read=FLightMetalColor, write=FLightMetalColor, nodefault}; + __property Graphics::TColor DarkMetalColor = {read=FDarkMetalColor, write=FDarkMetalColor, nodefault}; + __property Sptbxskins::TSpTBXLunaScheme DefaultColorScheme = {read=FDefaultColorScheme, write=SetDefaultColorScheme, default=3}; +}; + + +class DELPHICLASS TSpTBXAthenSkin; +class PASCALIMPLEMENTATION TSpTBXAthenSkin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +public: + virtual void __fastcall FillOptions(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXAthenSkin(void) : Sptbxskins::TSpTBXSkinOptions() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXAthenSkin(void) { } + +}; + + +class DELPHICLASS TSpTBXDreamSkin; +class PASCALIMPLEMENTATION TSpTBXDreamSkin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +public: + virtual void __fastcall FillOptions(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXDreamSkin(void) : Sptbxskins::TSpTBXSkinOptions() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXDreamSkin(void) { } + +}; + + +class DELPHICLASS TSpTBXEosSkin; +class PASCALIMPLEMENTATION TSpTBXEosSkin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +public: + virtual void __fastcall FillOptions(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXEosSkin(void) : Sptbxskins::TSpTBXSkinOptions() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXEosSkin(void) { } + +}; + + +class DELPHICLASS TSpTBXHumanSkin; +class PASCALIMPLEMENTATION TSpTBXHumanSkin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +public: + virtual void __fastcall FillOptions(void); + virtual void __fastcall PaintBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Sptbxskins::TSpTBXSkinComponentsType Component, Sptbxskins::TSpTBXSkinStatesType State, bool Background, bool Borders, bool Vertical = false, Controls::TAnchors ForceRectBorders = Controls::TAnchors() ); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXHumanSkin(void) : Sptbxskins::TSpTBXSkinOptions() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXHumanSkin(void) { } + +}; + + +class DELPHICLASS TSpTBXLeopardSkin; +class PASCALIMPLEMENTATION TSpTBXLeopardSkin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +public: + virtual void __fastcall FillOptions(void); + virtual void __fastcall PaintBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Sptbxskins::TSpTBXSkinComponentsType Component, Sptbxskins::TSpTBXSkinStatesType State, bool Background, bool Borders, bool Vertical = false, Controls::TAnchors ForceRectBorders = Controls::TAnchors() ); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXLeopardSkin(void) : Sptbxskins::TSpTBXSkinOptions() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXLeopardSkin(void) { } + +}; + + +class DELPHICLASS TSpTBXXitoSkin; +class PASCALIMPLEMENTATION TSpTBXXitoSkin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +public: + virtual void __fastcall FillOptions(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXXitoSkin(void) : Sptbxskins::TSpTBXSkinOptions() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXXitoSkin(void) { } + +}; + + +class DELPHICLASS TSpTBXOfficeXPSkin; +class PASCALIMPLEMENTATION TSpTBXOfficeXPSkin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +public: + virtual void __fastcall FillOptions(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXOfficeXPSkin(void) : Sptbxskins::TSpTBXSkinOptions() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXOfficeXPSkin(void) { } + +}; + + +typedef StaticArray TSpTBXOffice2003Colors; + +class DELPHICLASS TSpTBXOffice2003Skin; +class PASCALIMPLEMENTATION TSpTBXOffice2003Skin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +private: + void __fastcall SetDefaultColorScheme(const Sptbxskins::TSpTBXLunaScheme Value); + +protected: + TSpTBXOffice2003Colors FColors; + Sptbxskins::TSpTBXLunaScheme FDefaultColorScheme; + virtual void __fastcall FillColors(void); + +public: + __fastcall virtual TSpTBXOffice2003Skin(void); + virtual void __fastcall FillOptions(void); + __property Sptbxskins::TSpTBXLunaScheme DefaultColorScheme = {read=FDefaultColorScheme, write=SetDefaultColorScheme, default=3}; +public: + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXOffice2003Skin(void) { } + +}; + + +typedef StaticArray TSpTBXOffice2007Colors; + +class DELPHICLASS TSpTBXOffice2007Skin; +class PASCALIMPLEMENTATION TSpTBXOffice2007Skin : public Sptbxskins::TSpTBXSkinOptions +{ + typedef Sptbxskins::TSpTBXSkinOptions inherited; + +protected: + TSpTBXOffice2007Colors FColors; + virtual void __fastcall FillColors(void) = 0 ; + +public: + virtual void __fastcall FillOptions(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXOffice2007Skin(void) : Sptbxskins::TSpTBXSkinOptions() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXOffice2007Skin(void) { } + +}; + + +class DELPHICLASS TSpTBXOffice2007BlueSkin; +class PASCALIMPLEMENTATION TSpTBXOffice2007BlueSkin : public TSpTBXOffice2007Skin +{ + typedef TSpTBXOffice2007Skin inherited; + +protected: + virtual void __fastcall FillColors(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXOffice2007BlueSkin(void) : TSpTBXOffice2007Skin() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXOffice2007BlueSkin(void) { } + +}; + + +class DELPHICLASS TSpTBXOffice2007BlackSkin; +class PASCALIMPLEMENTATION TSpTBXOffice2007BlackSkin : public TSpTBXOffice2007Skin +{ + typedef TSpTBXOffice2007Skin inherited; + +protected: + virtual void __fastcall FillColors(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXOffice2007BlackSkin(void) : TSpTBXOffice2007Skin() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXOffice2007BlackSkin(void) { } + +}; + + +class DELPHICLASS TSpTBXOffice2007SilverSkin; +class PASCALIMPLEMENTATION TSpTBXOffice2007SilverSkin : public TSpTBXOffice2007Skin +{ + typedef TSpTBXOffice2007Skin inherited; + +protected: + virtual void __fastcall FillColors(void); +public: + /* TSpTBXSkinOptions.Create */ inline __fastcall virtual TSpTBXOffice2007SilverSkin(void) : TSpTBXOffice2007Skin() { } + /* TSpTBXSkinOptions.Destroy */ inline __fastcall virtual ~TSpTBXOffice2007SilverSkin(void) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- + +} /* namespace Sptbxdefaultskins */ +using namespace Sptbxdefaultskins; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxdefaultskinsHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.pas new file mode 100644 index 0000000..6079623 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDefaultSkins.pas @@ -0,0 +1,2105 @@ +unit SpTBXDefaultSkins; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +History: +8 May 2009 - version 2.4.2 + - No changes. + +15 March 2009 - version 2.4.1 + - No changes. + +17 January 2009 - version 2.4 + - No changes. + +26 September 2008 - version 2.3 + - No changes. + +29 July 2008 - version 2.2 + - Fixed incorrect TRGBQuadArray declaration, thanks to Arvid + for reporting this. + - Fixed incorrect gradients in Office 2003 skins, thanks to + David for reporting this. + - Fixed Vista painting bug, the menu checkboxes are stretched + by the themes API, this doesn't happen on XP, thanks to + Arvid for reporting this. + +26 June 2008 - version 2.1 + - New skin added: Aluminum, thanks to Pete for his contribution. + +3 May 2008 - version 2.0 + - No changes. + +2 April 2008 - version 1.9.5 + - No changes. + +3 February 2008 - version 1.9.4 + - No changes. + +19 January 2008 - version 1.9.3 + - New skin added: Human. + +26 December 2007 - version 1.9.2 + - No changes. + +1 December 2007 - version 1.9.1 + - No changes. + +20 November 2007 - version 1.9 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, Classes, SysUtils, Graphics, Controls, SpTBXSkins; + +type + { Skins } + + TSpTBXAluminumColors = array[0..3] of TColor; + + TSpTBXAluminumSkin = class(TSpTBXSkinOptions) + private + procedure SetDefaultColorScheme(const Value: TSpTBXLunaScheme); + protected + FColors: TSpTBXAluminumColors; + FDefaultColorScheme: TSpTBXLunaScheme; + FLightMetalColor: TColor; + FDarkMetalColor: TColor; + FRoughness: Integer; + procedure FillColors; virtual; + function GetBrushMetalColor(Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType): TColor; virtual; + public + constructor Create; override; + destructor Destroy; override; + procedure FillOptions; override; + procedure PaintBackground(ACanvas: TCanvas; ARect: TRect; Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; Background, Borders: Boolean; Vertical: Boolean = False; ForceRectBorders: TAnchors = []); override; + property LightMetalColor: TColor read FLightMetalColor write FLightMetalColor; + property DarkMetalColor: TColor read FDarkMetalColor write FDarkMetalColor; + property DefaultColorScheme: TSpTBXLunaScheme read FDefaultColorScheme write SetDefaultColorScheme default lusUnknown; + end; + + TSpTBXAthenSkin = class(TSpTBXSkinOptions) + public + procedure FillOptions; override; + end; + + TSpTBXDreamSkin = class(TSpTBXSkinOptions) + public + procedure FillOptions; override; + end; + + TSpTBXEosSkin = class(TSpTBXSkinOptions) + public + procedure FillOptions; override; + end; + + TSpTBXHumanSkin = class(TSpTBXSkinOptions) + public + procedure FillOptions; override; + procedure PaintBackground(ACanvas: TCanvas; ARect: TRect; Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; Background, Borders: Boolean; Vertical: Boolean = False; ForceRectBorders: TAnchors = []); override; + end; + + TSpTBXLeopardSkin = class(TSpTBXSkinOptions) + public + procedure FillOptions; override; + procedure PaintBackground(ACanvas: TCanvas; ARect: TRect; Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; Background, Borders: Boolean; Vertical: Boolean = False; ForceRectBorders: TAnchors = []); override; + end; + + TSpTBXXitoSkin = class(TSpTBXSkinOptions) + public + procedure FillOptions; override; + end; + + { Office Skins } + + TSpTBXOfficeXPSkin = class(TSpTBXSkinOptions) + public + procedure FillOptions; override; + end; + + TSpTBXOffice2003Colors = array[0..22] of TColor; + + TSpTBXOffice2003Skin = class(TSpTBXSkinOptions) + private + procedure SetDefaultColorScheme(const Value: TSpTBXLunaScheme); + protected + FColors: TSpTBXOffice2003Colors; + FDefaultColorScheme: TSpTBXLunaScheme; + procedure FillColors; virtual; + public + constructor Create; override; + procedure FillOptions; override; + property DefaultColorScheme: TSpTBXLunaScheme read FDefaultColorScheme write SetDefaultColorScheme default lusUnknown; + end; + + TSpTBXOffice2007Colors = array[0..17] of TColor; + + TSpTBXOffice2007Skin = class(TSpTBXSkinOptions) + protected + FColors: TSpTBXOffice2007Colors; + procedure FillColors; virtual; abstract; + public + procedure FillOptions; override; + end; + + TSpTBXOffice2007BlueSkin = class(TSpTBXOffice2007Skin) + protected + procedure FillColors; override; + end; + + TSpTBXOffice2007BlackSkin = class(TSpTBXOffice2007Skin) + protected + procedure FillColors; override; + end; + + TSpTBXOffice2007SilverSkin = class(TSpTBXOffice2007Skin) + protected + procedure FillColors; override; + end; + +implementation + +uses + Math; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Brushed Fill } + +const + THREAD_CACHE_SIZE = 16; + NUM_TEMPLATES = 8; + MIN_TEMPLATE_SIZE = 100; + MAX_TEMPLATE_SIZE = 200; + NUM_RANDTHREADS = 1024; + +type + PRGBQuad = ^TRGBQuad; + TRGBQuad = Integer; + PRGBQuadArray = ^TRGBQuadArray; + TRGBQuadArray = array [Byte] of TRGBQuad; + TThreadCacheItem = record + BaseColor: TColorRef; + Roughness: Integer; + Bitmaps: array [0..NUM_TEMPLATES - 1] of HBITMAP; + end; + +var + ThreadTemplates: array of array of Integer; + RandThreadIndex: array of Integer; + RandThreadPositions: array of Integer; + ThreadCache: array of TThreadCacheItem; + NextCacheEntry: Integer = 0; + +function GetBGR(C: TColorRef): Cardinal; +asm + MOV ECX,EAX // this function swaps R and B bytes in ABGR + SHR EAX,16 + XCHG AL,CL + MOV AH,$FF // and writes $FF into A component } + SHL EAX,16 + MOV AX,CX +end; + +procedure InitializeBrushedFill; +const + Pi = 3.14159265358987; +var + TemplateIndex, Size, I, V, V1, V2: Integer; + T, R12, R13, R14, R21, R22, R23, R24: Single; +begin + + SetLength(ThreadTemplates, NUM_TEMPLATES); + SetLength(RandThreadIndex, NUM_RANDTHREADS); + SetLength(RandThreadPositions, NUM_RANDTHREADS); + + { Make thread templates } + for TemplateIndex := 0 to NUM_TEMPLATES - 1 do begin + Size := (MIN_TEMPLATE_SIZE + Random(MAX_TEMPLATE_SIZE - MIN_TEMPLATE_SIZE + 1)) div 2; + SetLength(ThreadTemplates[TemplateIndex], Size * 2); + R12 := Random * 2 * Pi; + R13 := Random * 2 * Pi; + R14 := Random * 2 * Pi; + R21 := Random * 2 * Pi; + R22 := Random * 2 * Pi; + R23 := Random * 2 * Pi; + R24 := Random * 2 * Pi; + for I := 0 to Size - 1 do begin + T := 2 * Pi * I / Size; + V1 := Round(150 * Sin(T) + 100 * Sin(2 * T + R12) + 50 * Sin(3 * T + R13) + 20 * Sin(4 * T + R14)); + if V1 > 255 then V1 := 255; + if V1 < -255 then V1 := -255; + + V2 := Round(150 * Sin(T + R21) + 100 * Sin(2 * T + R22) + 50 * Sin(3 * T + R23) + 20 * Sin(4 * T + R24)); + if V2 > 255 then V2 := 255; + if V2 < -255 then V2 := -255; + + if Abs(V2 - V1) > 300 then begin + V := (V1 + V2) div 2; + V1 := V - 150; + V2 := V + 150; + end; + + ThreadTemplates[TemplateIndex][I * 2] := Min(V1, V2); + ThreadTemplates[TemplateIndex][I * 2 + 1] := Max(V1, V2); + end; + end; + + { Initialize Rand arrays } + for I := 0 to NUM_RANDTHREADS- 1 do begin + RandThreadIndex[I] := Random(NUM_TEMPLATES); + V1 := Random(Length(ThreadTemplates[RandThreadIndex[I]])) and not $1; + if Odd(I) then Inc(V1); + RandThreadPositions[I] := V1; + end; +end; + +procedure ClearCacheItem(var CacheItem: TThreadCacheItem); +var + I: Integer; +begin + with CacheItem do begin + BaseColor := $FFFFFFFF; + Roughness := -1; + for I := NUM_TEMPLATES- 1 downto 0 do + if Bitmaps[I] <> 0 then begin + DeleteObject(Bitmaps[I]); + Bitmaps[I] := 0; + end; + end; +end; + +procedure ResetBrushedFillCache; +var + I: Integer; +begin + { Should be called each time the screen parameters change } + for I := High(ThreadCache) downto 0 do ClearCacheItem(ThreadCache[I]); +end; + +procedure FinalizeBrushedFill; +begin + ResetBrushedFillCache; + SetLength(ThreadCache, 0); + ThreadCache := nil; + SetLength(RandThreadPositions, 0); + RandThreadPositions := nil; + SetLength(RandThreadIndex, 0); + RandThreadIndex := nil; + SetLength(ThreadTemplates, 0, 0); + ThreadTemplates := nil; +end; + +procedure MakeCacheItem(var CacheItem: TThreadCacheItem; Color: TColorRef; Roughness: Integer); +var + TemplateIndex, Size, I, V: Integer; + CR, CG, CB: Integer; + R, G, B: Integer; + ScreenDC: HDC; + BMI: TBitmapInfo; + Bits: PRGBQuadArray; + DIBSection: HBITMAP; + DIBDC, CacheDC: HDC; +begin + ScreenDC := GetDC(0); + FillChar(BMI, SizeOf(TBitmapInfo), 0); + with BMI.bmiHeader do begin + biSize := SizeOf(TBitmapInfoHeader); + biPlanes := 1; + biCompression := BI_RGB; + biWidth := MAX_TEMPLATE_SIZE; + biHeight := -1; + biBitCount := 32; + end; + DIBSection := CreateDIBSection(0, BMI, DIB_RGB_COLORS, Pointer(Bits), 0, 0); + DIBDC := CreateCompatibleDC(0); + SelectObject(DIBDC, DIBSection); + CacheDC := CreateCompatibleDC(0); + + CR := Color shl 8 and $FF00; + CG := Color and $FF00; + CB := Color shr 8 and $FF00; + try + for TemplateIndex := 0 to NUM_TEMPLATES - 1 do begin + CacheItem.BaseColor := Color; + CacheItem.Roughness := Roughness; + Size := Length(ThreadTemplates[TemplateIndex]); + + if CacheItem.Bitmaps[TemplateIndex] = 0 then + CacheItem.Bitmaps[TemplateIndex] := CreateCompatibleBitmap(ScreenDC, Size, 1); + SelectObject(CacheDC, CacheItem.Bitmaps[TemplateIndex]); + + for I := 0 to Size - 1 do begin + V := ThreadTemplates[TemplateIndex][I]; + R := CR + V * Roughness; + G := CG + V * Roughness; + B := CB + V * Roughness; + if R < 0 then R := 0; + if G < 0 then G := 0; + if B < 0 then B := 0; + if R > $EF00 then R := $EF00; + if G > $EF00 then G := $EF00; + if B > $EF00 then B := $EF00; + Bits^[I] := (R and $FF00 + (G and $FF00) shl 8 + (B and $FF00) shl 16) shr 8; + end; + + BitBlt(CacheDC, 0, 0, Size, 1, DIBDC, 0, 0, SRCCOPY); + end; + finally + DeleteDC(CacheDC); + DeleteDC(DIBDC); + DeleteObject(DIBSection); + ReleaseDC(0, ScreenDC); + end; +end; + +function FindCacheItem(Color: TColorRef; Roughness: Integer): Integer; +begin + Result := High(ThreadCache); + while Result >= 0 do + if (ThreadCache[Result].BaseColor = Color) and (ThreadCache[Result].Roughness = Roughness) then + Exit + else + Dec(Result); +end; + +function GetCacheItem(Color: TColorRef; Roughness: Integer): Integer; +begin + Result := FindCacheItem(Color, Roughness); + if Result >= 0 then + Exit + else begin + Result := NextCacheEntry; + if Result > High(ThreadCache) then begin + SetLength(ThreadCache, Result+ 1); + ClearCacheItem(ThreadCache[Result]); + end; + MakeCacheItem(ThreadCache[Result], Color, Roughness); + NextCacheEntry := (NextCacheEntry + 1) mod THREAD_CACHE_SIZE; + end; +end; + +procedure BrushedFill(DC: HDC; Origin: PPoint; ARect: TRect; Color: TColor; Roughness: Integer); +const + ZeroOrigin: TPoint = (X: 0; Y: 0); +var + CR: TColorRef; + X, Y: Integer; + CacheIndex: Integer; + TemplateIndex: Integer; + CacheDC: HDC; + Size: Integer; + BoxR: TRect; +begin + if (Color = clNone) or not RectVisible(DC, ARect) then Exit; + CR := GetBGR(ColorToRGB(Color)); + if Origin = nil then Origin := @ZeroOrigin; + if ThreadTemplates = nil then InitializeBrushedFill; + CacheIndex := GetCacheItem(CR, Roughness); + GetClipBox(DC, BoxR); + IntersectRect(ARect, ARect, BoxR); + SaveDC(DC); + IntersectClipRect(DC, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom); + + CacheDC := CreateCompatibleDC(0); + for Y := ARect.Top to ARect.Bottom - 1 do begin + TemplateIndex := RandThreadIndex[(65536 + Y - Origin.Y) mod NUM_RANDTHREADS]; + Size := Length(ThreadTemplates[TemplateIndex]); + X := -RandThreadPositions[(65536 + Y - Origin.Y) mod NUM_RANDTHREADS] + Origin.X; + SelectObject(CacheDC, ThreadCache[CacheIndex].Bitmaps[TemplateIndex]); + while X < ARect.Right do begin + if X + Size >= ARect.Left then BitBlt(DC, X, Y, Size, 1, CacheDC, 0, 0, SRCCOPY); + Inc(X, Size); + end; + end; + DeleteDC(CacheDC); + RestoreDC(DC, -1); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXAluminumSkin } + +constructor TSpTBXAluminumSkin.Create; +begin + FRoughness := 12; + FDefaultColorScheme := lusUnknown; + inherited; +end; + +destructor TSpTBXAluminumSkin.Destroy; +begin + FinalizeBrushedFill; + inherited; +end; + +procedure TSpTBXAluminumSkin.FillColors; +const + AluminumColors: array[lusBlue..lusGreen] of TSpTBXAluminumColors = ( + ($C56A31, // 0: Item borders + $E0D7D1, // 1: Item Checked + $E2B598, // 2: Item Pushed + $EED2C1), // 3: Item HotTrack + + ($BFB4B2, // 0: Item borders + $DDDCDC, // 1: Item Checked + $DFDAD9, // 2: Item Pushed + $ECE9E8), // 3: Item HotTrack + + ($70A093, // 0: Item borders + $D8DCDB, // 1: Item Checked + $B8D0C9, // 2: Item Pushed + $D4E3DF) // 3: Item HotTrack + ); +var + Luna: TSpTBXLunaScheme; +begin + if FDefaultColorScheme <> lusUnknown then + Luna := FDefaultColorScheme + else begin + Luna := SpGetLunaScheme; + if Luna = lusUnknown then Luna := lusMetallic; + end; + + FColors := AluminumColors[Luna]; + FRoughness := 12; + FLightMetalColor := $C7C7C7; + FDarkMetalColor := $DFDFDF; +end; + +procedure TSpTBXAluminumSkin.FillOptions; +begin + SkinName := 'Aluminum'; + + //---- Colors ----// + + FillColors; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); // Dummy, uses BrushedFill + + Options(skncDockablePanel, sknsNormal).Body.Fill(0, $F9F9F9, clNone, clNone, clNone); + Options(skncDockablePanel, sknsNormal).Borders.Fill(0, $C7C7C7, $C7C7C7, clWhite, clWhite); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(1, clWhite, $D8D8D8, clNone, clNone); + Options(skncDockablePanelTitleBar, sknsNormal).Borders.Fill(0, clWhite, $9F9F9F, clNone, clNone); + + Options(skncPanel, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); // Dummy, uses BrushedFill + Options(skncPanel, sknsNormal).Borders.Fill(2, FColors[0], FColors[0], clWhite, clWhite); + + Options(skncPopup, sknsNormal).Body.Fill(0, $F9F9F9, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, $7F7F7F, $7F7F7F, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); // Dummy, uses BrushedFill + + Options(skncSplitter, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); // Dummy, uses BrushedFill + + Options(skncToolbar, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); // Dummy, uses BrushedFill + Options(skncToolbar, sknsNormal).Borders.Fill(2, clWhite, $7F7F7F, clNone, clNone); + + CopyOptions(skncToolbar, skncMenuBar); // Dummy, uses BrushedFill + + Options(skncWindow, sknsNormal).Borders.Fill(0, $808080, $808080, $C0C0C0, $DDD9D2); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(1, clWhite, $D8D8D8, clNone, clNone); + + //---- Elements ----// + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, $9F9F9F, clWhite, clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(0, FColors[3], clNone, clNone, clNone); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(1, FColors[0], FColors[0], clNone, clNone); + Options(skncToolbarItem, sknsPushed).Body.Fill(0, FColors[2], clNone, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(1, FColors[0], FColors[0], clNone, clNone); + Options(skncToolbarItem, sknsChecked).Body.Fill(0, FColors[1], clNone, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Borders.Fill(1, FColors[0], FColors[0], clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(0, FColors[2], clNone, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(1, FColors[0], FColors[0], clNone, clNone); + + Options(skncOpenToolbarItem, sknsNormal).Body.Fill(0, $ECECEC, clNone, clNone, clNone); + Options(skncOpenToolbarItem, sknsNormal).Borders.Fill(0, $7F7F7F, $7F7F7F, clNone, clNone); + + CopyOptions(skncToolbarItem, skncMenuBarItem); + + CopyOptions(skncToolbarItem, skncMenuItem); + + Options(skncButton, sknsNormal).Body.Fill(1, $EFEFEF, $D1D1D1, clNone, clNone); + Options(skncButton, sknsNormal).Borders.Fill(1, $9F9F9F, $9F9F9F, $F7F7F7, $C7C7C7); + Options(skncButton, sknsDisabled).Body.Fill(1, $EFEFEF, $D1D1D1, clNone, clNone); + Options(skncButton, sknsDisabled).Borders.Fill(1, $9F9F9F, $9F9F9F, $F7F7F7, $C7C7C7); + Options(skncButton, sknsHotTrack).Body.Fill(1, $F2F2F2, $DDDDDD, clNone, clNone); + Options(skncButton, sknsHotTrack).Borders.Fill(1, $BABABA, $BABABA, $F8F8F8, $D6D6D6); + Options(skncButton, sknsPushed).Body.Fill(1, $D1D1D1, $EFEFEF, clNone, clNone); + Options(skncButton, sknsPushed).Borders.Fill(1, $9F9F9F, $9F9F9F, $C7C7C7, $F7F7F7); + Options(skncButton, sknsChecked).Body.Fill(1, $D1D1D1, $EFEFEF, clNone, clNone); + Options(skncButton, sknsChecked).Borders.Fill(1, $9F9F9F, $9F9F9F, $C7C7C7, $F7F7F7); + Options(skncButton, sknsCheckedAndHotTrack).Body.Fill(1, $D1D1D1, $EFEFEF, clNone, clNone); + Options(skncButton, sknsCheckedAndHotTrack).Borders.Fill(1, $9F9F9F, $9F9F9F, $C7C7C7, $F7F7F7); + + CopyOptions(skncToolbarItem, skncListItem); + + CopyOptions(skncToolbarItem, skncCheckBox); + Options(skncCheckBox, sknsNormal).Borders.Fill(1, $9F9F9F, $9F9F9F, clNone, clNone); + Options(skncCheckBox, sknsDisabled).Borders.Fill(1, $99A8AC, $99A8AC, clNone, clNone); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, $9F9F9F, $9F9F9F); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, $99A8AC, $99A8AC); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, clNone, clNone, $9F9F9F, $9F9F9F); + + CopyOptions(skncButton, skncEditButton); + Options(skncEditButton, sknsNormal).Reset; + + //---- Tabs ----// + CopyOptions(skncToolbarItem, skncTab); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(0, FColors[1], clNone, clNone, clNone); + Options(skncTabBackground, sknsNormal).Borders.Fill(0, FColors[0], FColors[0], clNone, clNone); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(0, FColors[2], clNone, clNone, clNone); + Options(skncProgressBar, sknsNormal).Borders.Fill(1, FColors[0], FColors[0], clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(0, FColors[3], clNone, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(1, FColors[0], FColors[0], clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(0, FColors[3], clNone, clNone, clNone); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(1, FColors[0], FColors[0], clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Body.Fill(0, FColors[1], clNone, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(1, FColors[0], FColors[0], clNone, clNone); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(1, $EFEFEF, $D1D1D1, clNone, clNone); + Options(skncHeader, sknsNormal).Borders.Fill(0, $F7F7F7, $C7C7C7, clNone, clNone); + Options(skncHeader, sknsHotTrack).Body.Fill(1, $F2F2F2, $DDDDDD, clNone, clNone); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, $F8F8F8, $D6D6D6, clNone, clNone); + Options(skncHeader, sknsPushed).Body.Fill(1, $D1D1D1, $EFEFEF, clNone, clNone); + Options(skncHeader, sknsPushed).Borders.Fill(0, $C7C7C7, $F7F7F7, clNone, clNone); +end; + +function TSpTBXAluminumSkin.GetBrushMetalColor(Component: TSpTBXSkinComponentsType; + State: TSpTBXSkinStatesType): TColor; +begin + Result := clNone; + if Component in [skncDock, skncPanel, skncTabToolbar, skncStatusBar, skncSplitter] then + Result := FLightMetalColor + else + if Component in [skncToolbar, skncMenuBar] then + Result := FDarkMetalColor; +end; + +procedure TSpTBXAluminumSkin.PaintBackground(ACanvas: TCanvas; ARect: TRect; + Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; + Background, Borders, Vertical: Boolean; ForceRectBorders: TAnchors); +var + BackgroundRect: TRect; + Op: TSpTBXSkinOptionCategory; + BrushColor: TColor; +begin + BrushColor := GetBrushMetalColor(Component, State); + + if BrushColor = clNone then + inherited + else begin + Op := Options(Component, State); + + if Op.Borders.IsEmpty then + Borders := False; + if Op.Body.IsEmpty then + Background := False; + + if Background then begin + BackgroundRect := ARect; + if Borders then + InflateRect(BackgroundRect, -1, -1); + BrushedFill(ACanvas.Handle, nil, BackgroundRect, BrushColor, FRoughness); + end; + + if Borders then + SpPaintSkinBorders(ACanvas, ARect, Op, ForceRectBorders); + end; +end; + +procedure TSpTBXAluminumSkin.SetDefaultColorScheme(const Value: TSpTBXLunaScheme); +begin + if FDefaultColorScheme <> Value then begin + FDefaultColorScheme := Value; + Reset; + FillOptions; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXAthenSkin } + +procedure TSpTBXAthenSkin.FillOptions; +begin + SkinName := 'Athen'; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(0, $E0E0E0, clNone, clNone, clNone); + + Options(skncDockablePanel, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); + Options(skncDockablePanel, sknsNormal).Borders.Fill(0, $E0E0E0, $E0E0E0, clWhite, clWhite); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + + Options(skncPanel, sknsNormal).Body.Fill(1, $FBF9A0, clWhite, clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(2, $D0D0D0, $D0D0D0, $F8F8F8, $F8F8F8); + + Options(skncPopup, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, $C0C0C0, $C0C0C0, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + + Options(skncSplitter, sknsNormal).Body.Fill(1, $D8D8D8, $F0F0F0, clNone, clNone); + + Options(skncToolbar, sknsNormal).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + Options(skncToolbar, sknsNormal).Borders.Fill(1, clWhite, $B0B0B0, clNone, clNone); + + CopyOptions(skncToolbar, skncMenuBar); + + Options(skncWindow, sknsNormal).Borders.Fill(0, $808080, $808080, $C0C0C0, $DDD9D2); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + + //---- Elements ----// + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(1, $DAB370, $DAB370, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Body.Fill(1, $C0C0C0, clWhite, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(1, $D0D0D0, $B0B0B0, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncToolbarItem, sknsChecked).Borders.Fill(1, $DAB370, $DAB370, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(3, $FAECDE, $E0B080, $EDDE73, $FFFFBA); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(1, $DAB370, $DAB370, clNone, clNone); + + Options(skncOpenToolbarItem, sknsNormal).Body.Fill(1, $C0C0C0, clWhite, clNone, clNone); + Options(skncOpenToolbarItem, sknsNormal).Borders.Fill(1, $D0D0D0, $B0B0B0, clNone, clNone); + + Options(skncMenuBarItem, sknsHotTrack).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncMenuBarItem, sknsPushed).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncMenuBarItem, sknsChecked).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncMenuBarItem, sknsCheckedAndHotTrack).Body.Fill(3, $FAECDE, $E0B080, $EDDE73, $FFFFBA); + + CopyOptions(skncToolbarItem, skncMenuItem); + Options(skncMenuItem, sknsHotTrack).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + Options(skncMenuItem, sknsHotTrack).Borders.Fill(1, $C0C0C0, $C0C0C0, clNone, clNone); + + CopyOptions(skncToolbarItem, skncButton); + Options(skncButton, sknsNormal).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + Options(skncButton, sknsNormal).Borders.Fill(1, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncButton, sknsDisabled).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + Options(skncButton, sknsDisabled).Borders.Fill(1, $C0C0C0, $C0C0C0, clNone, clNone); + + CopyOptions(skncToolbarItem, skncListItem); + + CopyOptions(skncToolbarItem, skncCheckBox); + Options(skncCheckBox, sknsNormal).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + Options(skncCheckBox, sknsNormal).Borders.Fill(0, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncCheckBox, sknsDisabled).Borders.Fill(0, $99A8AC, $99A8AC, clNone, clNone); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, $D0D0D0, $D0D0D0); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, $99A8AC, $99A8AC); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, clNone, clNone, $DAB370, $DAB370); + + CopyOptions(skncToolbarItem, skncEditButton); + + //---- Tabs ----// + Options(skncTab, sknsHotTrack).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncTab, sknsHotTrack).Borders.Fill(2, $DAB370, $DAB370, clNone, clNone); + Options(skncTab, sknsChecked).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncTab, sknsChecked).Borders.Fill(2, $DAB370, $DAB370, clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Body.Fill(3, $FAECDE, $E0B080, $EDDE73, $FFFFBA); + Options(skncTab, sknsCheckedAndHotTrack).Borders.Fill(2, $DAB370, $DAB370, clNone, clNone); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(1, $FBF9A0, clWhite, clNone, clNone); + Options(skncTabBackground, sknsNormal).Borders.Fill(0, $DAB370, $DAB370, clNone, clNone); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(1, $C0C0C0, clWhite, clNone, clNone); + Options(skncProgressBar, sknsNormal).Borders.Fill(1, $D0D0D0, $B0B0B0, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(2, $DAB370, $DAB370, clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(1, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(1, $DAB370, $DAB370, clNone, clNone); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(3, $F8F8F8, $D8D8D8, $F0F0F0, $F8F8F8); + Options(skncHeader, sknsNormal).Borders.Fill(0, $E7E7E7, $C0C0C0, clNone, clNone); + Options(skncHeader, sknsHotTrack).Body.Fill(3, $FFF8F0, $E0B080, $F0E870, $FFFFB0); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, $F7E4D0, $DAB370, clNone, clNone); + Options(skncHeader, sknsPushed).Body.Fill(1, $C0C0C0, clWhite, clNone, clNone); + Options(skncHeader, sknsPushed).Borders.Fill(0, $D0D0D0, $B0B0B0, clNone, clNone); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXDreamSkin } + +procedure TSpTBXDreamSkin.FillOptions; +begin + SkinName := 'Dream'; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(0, $E0E0E0, clNone, clNone, clNone); + + Options(skncDockablePanel, sknsNormal).Body.Fill(1, clWhite, $DDD9D2, clNone, clNone); + Options(skncDockablePanel, sknsNormal).Borders.Fill(0, $E0E0E0, $E0E0E0, clWhite, clWhite); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(1, clWhite, $DDD9D2, clNone, clNone); + + Options(skncPanel, sknsNormal).Body.Fill(1, $D1F9FF, clWhite, clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(2, $808080, $808080, $B0D4DF, clWhite); + + Options(skncPopup, sknsNormal).Body.Fill(0, $F9F9F9, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, $C0C0C0, $C0C0C0, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(1, $DDD9D2, clWhite, clNone, clNone); + + Options(skncSplitter, sknsNormal).Body.Fill(1, clWhite, $DDD9D2, clNone, clNone); + + Options(skncToolbar, sknsNormal).Body.Fill(1, clWhite, $DDD9D2, clNone, clNone); + Options(skncToolbar, sknsNormal).Borders.Fill(2, clWhite, $B0B0B0, clNone, clNone); + + CopyOptions(skncToolbar, skncMenuBar); + + Options(skncWindow, sknsNormal).Borders.Fill(0, $808080, $808080, $C0C0C0, $DDD9D2); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(1, clWhite, $DDD9D2, clNone, clNone); + + //---- Elements ----// + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(1, clWhite, $E5E2DB, clNone, clNone); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(1, $909090, $909090, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Body.Fill(1, $C0C0C0, clWhite, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(1, $909090, $909090, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Body.Fill(1, $D2F9FF, $F0FDFF, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Borders.Fill(1, $808080, $808080, $B0D4DF, $F0FDFF); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(1, $2695EA, $80E0FF, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(1, $808080, $808080, $60B0E8, $80E0FF); + + Options(skncOpenToolbarItem, sknsNormal).Body.Fill(1, $C0C0C0, clWhite, clNone, clNone); + Options(skncOpenToolbarItem, sknsNormal).Borders.Fill(1, $909090, $909090, clNone, clNone); + + CopyOptions(skncToolbarItem, skncMenuBarItem); + + CopyOptions(skncToolbarItem, skncMenuItem); + + CopyOptions(skncToolbarItem, skncButton); + Options(skncButton, sknsNormal).Body.Fill(1, clWhite, $DCD8D0, clNone, clNone); + Options(skncButton, sknsNormal).Borders.Fill(1, $909090, $909090, clNone, clNone); + Options(skncButton, sknsDisabled).Body.Fill(1, clWhite, $DCD8D0, clNone, clNone); + Options(skncButton, sknsDisabled).Borders.Fill(1, $909090, $909090, clNone, clNone); + + CopyOptions(skncToolbarItem, skncListItem); + + CopyOptions(skncToolbarItem, skncCheckBox); + Options(skncCheckBox, sknsNormal).Borders.Fill(0, $808080, $808080, clNone, clNone); + Options(skncCheckBox, sknsDisabled).Borders.Fill(0, $99A8AC, $99A8AC, clNone, clNone); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, $D0D0D0, $D0D0D0); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, $99A8AC, $99A8AC); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, clNone, clNone, $909090, $909090); + + CopyOptions(skncToolbarItem, skncEditButton); + + //---- Tabs ----// + Options(skncTab, sknsHotTrack).Body.Fill(0, $F4F0F0, clNone, clNone, clNone); + Options(skncTab, sknsHotTrack).Borders.Fill(1, $A0A0A0, $A0A0A0, clNone, clNone); + Options(skncTab, sknsChecked).Body.Fill(1, $F0FDFF, $D2F9FF, clNone, clNone); + Options(skncTab, sknsChecked).Borders.Fill(1, $808080, $808080, $B0D4DF, $F0FDFF); + Options(skncTab, sknsCheckedAndHotTrack).Body.Fill(1, $2695EA, $80E0FF, clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Borders.Fill(1, $808080, $808080, $60B0E8, $80E0FF); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(1, $D2F9FF, $F0FDFF, clNone, clNone); + Options(skncTabBackground, sknsNormal).Borders.Fill(0, $808080, $808080, $B0D4DF, $F0FDFF); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(1, $C0C0C0, clWhite, clNone, clNone); + Options(skncProgressBar, sknsNormal).Borders.Fill(2, $909090, $909090, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(1, clWhite, $DDD9D2, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(2, $909090, $909090, clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(0, $F4F0F0, clNone, clNone, clNone); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(1, $909090, $909090, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Body.Fill(1, $D1F9FF, clWhite, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(1, $808080, $808080, $B0D4DF, clWhite); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(1, clWhite, $DCD8D0, clNone, clNone); + Options(skncHeader, sknsNormal).Borders.Fill(0, $E7E7E7, $C0C0C0, clNone, clNone); + Options(skncHeader, sknsHotTrack).Body.Fill(1, clWhite, $E5E2DB, clNone, clNone); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, $E7E7E7, $C0C0C0, clNone, clNone); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXEosSkin } + +procedure TSpTBXEosSkin.FillOptions; +begin + SkinName := 'Eos'; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(0, $809090, clNone, clNone, clNone); + + Options(skncDockablePanel, sknsNormal).Body.Fill(0, $809090, clNone, clNone, clNone); + Options(skncDockablePanel, sknsNormal).Borders.Fill(0, $838C8C, $838C8C, clNone, clNone); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(0, $5A6666, clNone, clNone, clNone); + + Options(skncPanel, sknsNormal).Body.Fill(0, $809090, clNone, clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(0, $5A6666, $5A6666, clNone, clNone); + + Options(skncPopup, sknsNormal).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, $5A6666, $5A6666, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(0, $708080, clNone, clNone, clNone); + + Options(skncSplitter, sknsNormal).Body.Fill(0, $708080, clNone, clNone, clNone); + + Options(skncToolbar, sknsNormal).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncToolbar, sknsNormal).Borders.Fill(0, $838C8C, $5A6666, clNone, clNone); + + CopyOptions(skncToolbar, skncMenuBar); + + Options(skncWindow, sknsNormal).Borders.Fill(0, $808080, $808080, $C0C0C0, $DDD9D2); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(0, $5A6666, clNone, clNone, clNone); + Options(skncWindowTitleBar, sknsNormal).TextColor := $EEEEEE; // This overrides the Items text color + + //---- Elements ----// + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, $576363, clWhite, clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, $576363, clWhite, clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, $869999, clNone, clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsNormal).TextColor := $EEEEEE; + Options(skncToolbarItem, sknsHotTrack).TextColor := $68CAE6; + Options(skncToolbarItem, sknsHotTrack).Body.Fill(0, $5F6D6D, clNone, clNone, clNone); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(0, $94A0A0, $94A0A0, clNone, clNone); + Options(skncToolbarItem, sknsPushed).TextColor := clBlack; + Options(skncToolbarItem, sknsPushed).Body.Fill(0, $7AD2EA, clNone, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(0, $94A0A0, $94A0A0, clNone, clNone); + Options(skncToolbarItem, sknsChecked).TextColor := $EEEEEE; + Options(skncToolbarItem, sknsChecked).Body.Fill(0, $94A0A0, clNone, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Borders.Fill(0, $94A0A0, $94A0A0, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).TextColor := clBlack; + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(0, $8ED7EC, clNone, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(0, $94A0A0, $94A0A0, clNone, clNone); + Options(skncToolbarItem, sknsDisabled).TextColor := $99A8AC; + + CopyOptions(skncToolbarItem, skncMenuBarItem); + + CopyOptions(skncToolbarItem, skncMenuItem); + Options(skncMenuItem, sknsPushed).TextColor := $68CAE6; + Options(skncMenuItem, sknsCheckedAndHotTrack).Body.Fill(0, $94A0A0, clNone, clNone, clNone); + Options(skncMenuItem, sknsCheckedAndHotTrack).TextColor := $68CAE6; + + Options(skncButton, sknsNormal).TextColor := $EEEEEE; + Options(skncButton, sknsNormal).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncButton, sknsNormal).Borders.Fill(0, clWhite, $3C4444, $838C8C, $5A6666); + Options(skncButton, sknsHotTrack).TextColor := $68CAE6; + Options(skncButton, sknsHotTrack).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncButton, sknsHotTrack).Borders.Fill(0, clWhite, $3C4444, $838C8C, $5A6666); + Options(skncButton, sknsPushed).TextColor := $EEEEEE; + Options(skncButton, sknsPushed).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncButton, sknsPushed).Borders.Fill(0, $3C4444, clWhite, $5A6666, $838C8C); + Options(skncButton, sknsChecked).TextColor := $EEEEEE; + Options(skncButton, sknsChecked).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncButton, sknsChecked).Borders.Fill(0, $3C4444, clWhite, $5A6666, $838C8C); + Options(skncButton, sknsCheckedAndHotTrack).TextColor := $68CAE6; + Options(skncButton, sknsCheckedAndHotTrack).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncButton, sknsCheckedAndHotTrack).Borders.Fill(0, $3C4444, clWhite, $5A6666, $838C8C); + Options(skncButton, sknsDisabled).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncButton, sknsDisabled).Borders.Fill(0, clWhite, $3C4444, $838C8C, $5A6666); + Options(skncButton, sknsDisabled).TextColor := $99A8AC; + + CopyOptions(skncToolbarItem, skncListItem); + + Options(skncCheckBox, sknsNormal).Borders.Fill(0, $5A6666, $5A6666, clNone, clNone); + Options(skncCheckBox, sknsHotTrack).Body.Fill(0, $5F6D6D, clNone, clNone, clNone); + Options(skncCheckBox, sknsHotTrack).Borders.Fill(0, $94A0A0, $94A0A0, clNone, clNone); + Options(skncCheckBox, sknsPushed).Body.Fill(0, $7AD2EA, clNone, clNone, clNone); + Options(skncCheckBox, sknsPushed).Borders.Fill(0, $94A0A0, $94A0A0, clNone, clNone); + Options(skncCheckBox, sknsChecked).Body.Fill(0, $94A0A0, clNone, clNone, clNone); + Options(skncCheckBox, sknsChecked).Borders.Fill(0, $94A0A0, $94A0A0, clNone, clNone); + Options(skncCheckBox, sknsCheckedAndHotTrack).Body.Fill(0, $8ED7EC, clNone, clNone, clNone); + Options(skncCheckBox, sknsCheckedAndHotTrack).Borders.Fill(0, $94A0A0, $94A0A0, clNone, clNone); + Options(skncCheckBox, sknsDisabled).Borders.Fill(0, $99A8AC, $99A8AC, clNone, clNone); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, $D0D0D0, $D0D0D0); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, $99A8AC, $99A8AC); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, clNone, clNone, $94A0A0, $94A0A0); + + CopyOptions(skncToolbarItem, skncEditButton); + Options(skncEditButton, sknsNormal).TextColor := clBlack; + + //---- Tabs ----// + Options(skncTab, sknsNormal).TextColor := $EEEEEE; + Options(skncTab, sknsHotTrack).TextColor := $68CAE6; + Options(skncTab, sknsHotTrack).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncTab, sknsHotTrack).Borders.Fill(0, $5A6666, $5A6666, clNone, clNone); + Options(skncTab, sknsChecked).TextColor := $EEEEEE; + Options(skncTab, sknsChecked).Body.Fill(0, $809090, clNone, clNone, clNone); + Options(skncTab, sknsChecked).Borders.Fill(0, $5A6666, $5A6666, clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).TextColor := $68CAE6; + Options(skncTab, sknsCheckedAndHotTrack).Body.Fill(0, $809090, clNone, clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Borders.Fill(0, $5A6666, $5A6666, clNone, clNone); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(0, $809090, clNone, clNone, clNone); + Options(skncTabBackground, sknsNormal).Borders.Fill(0, $5A6666, $5A6666, clNone, clNone); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(0, $809090, clNone, clNone, clNone); + Options(skncProgressBar, sknsNormal).Borders.Fill(0, $5A6666, $5A6666, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(0, $94A0A0, clNone, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(1, $5A6666, $5A6666, clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + Options(skncTrackBar, sknsNormal).TextColor := $5A6666; + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(0, $5A6666, clNone, clNone, clNone); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(1, $94A0A0, $94A0A0, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Body.Fill(0, $809090, clNone, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(1, $94A0A0, $94A0A0, clNone, clNone); + + //---- Header ----// + Options(skncHeader, sknsNormal).TextColor := $EEEEEE; + Options(skncHeader, sknsNormal).Body.Fill(0, $708080, clNone, clNone, clNone); + Options(skncHeader, sknsNormal).Borders.Fill(0, $838C8C, $5A6666, clNone, clNone); + Options(skncHeader, sknsHotTrack).TextColor := $68CAE6; + Options(skncHeader, sknsHotTrack).Body.Fill(0, $5F6D6D, clNone, clNone, clNone); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, $838C8C, $5A6666, clNone, clNone); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXHumanSkin } + +procedure TSpTBXHumanSkin.FillOptions; +begin + SkinName := 'Human'; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(0, $E7EBEF, clNone, clNone, clNone); + + Options(skncDockablePanel, sknsNormal).Body.Fill(0, $F1F6F9, clNone, clNone, clNone); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(0, $E7EBEF, clNone, clNone, clNone); + Options(skncDockablePanelTitleBar, sknsNormal).Borders.Fill(0, $B9BCBF, $B9BCBF, clWhite, clNone); + + Options(skncPanel, sknsNormal).Body.Fill(0, $F1F6F9, clNone, clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(2, $B7C1CB, $B7C1CB, clNone, clNone); + + Options(skncPopup, sknsNormal).Body.Fill(0, $F2F5F8, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, $91A3B6, $91A3B6, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(0, $E7EBEF, clNone, clNone, clNone); + + Options(skncSplitter, sknsNormal).Body.Fill(0, $E7EBEF, clNone, clNone, clNone); + + Options(skncToolbar, sknsNormal).Body.Fill(0, $E7EBEF, clNone, clNone, clNone); + Options(skncToolbar, sknsNormal).Borders.Fill(0, clWhite, $B7C1CB, clNone, clNone); + + CopyOptions(skncToolbar, skncMenuBar); + + Options(skncWindow, sknsNormal).Borders.Fill(0, $383A3D, $C7CFD8, $E7EBEF, $E7EBEF); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(5, $6AAAE8, $468CD1, $3A82C8, $488ED3); + Options(skncWindowTitleBar, sknsNormal).TextColor := clWhite; // This overrides the Items text color + + //---- Elements ----// + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, $B7C1CB, clWhite, clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, $B7C1CB, clWhite, clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, $B7C1CB, clWhite, clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(2, $1E4B8F, $1E4B8F, $1975FF, $1975FF); + Options(skncToolbarItem, sknsPushed).Body.Fill(0, $D4DBE0, clNone, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(2, $606A73, $606A73, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Body.Fill(0, $D4DBE0, clNone, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Borders.Fill(2, $606A73, $606A73, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(2, $1E4B8F, $1E4B8F, $1975FF, $1975FF); + + Options(skncMenuBarItem, sknsHotTrack).Body.Fill(1, $ACDEFE, $7BC5F5, clNone, clNone); + Options(skncMenuBarItem, sknsPushed).Body.Fill(1, $ACDEFE, $7BC5F5, clNone, clNone); + Options(skncMenuBarItem, sknsChecked).Body.Fill(1, $ACDEFE, $7BC5F5, clNone, clNone); + Options(skncMenuBarItem, sknsCheckedAndHotTrack).Body.Fill(1, $ACDEFE, $7BC5F5, clNone, clNone); + + Options(skncMenuItem, sknsHotTrack).Body.Fill(1, $ACDEFE, $7BC5F5, clNone, clNone); + Options(skncMenuItem, sknsHotTrack).Borders.Fill(1, $69BAEF, $69BAEF, clNone, clNone); + Options(skncMenuItem, sknsChecked).Body.Fill(1, $ACDEFE, $7BC5F5, clNone, clNone); + Options(skncMenuItem, sknsChecked).Borders.Fill(1, $69BAEF, $69BAEF, clNone, clNone); + Options(skncMenuItem, sknsCheckedAndHotTrack).Body.Fill(1, $ACDEFE, $7BC5F5, clNone, clNone); + Options(skncMenuItem, sknsCheckedAndHotTrack).Borders.Fill(1, $69BAEF, $69BAEF, clNone, clNone); + + CopyOptions(skncToolbarItem, skncButton); + Options(skncButton, sknsNormal).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncButton, sknsNormal).Borders.Fill(2, $D0D4D8, $D0D4D8, $606A73, $606A73); + Options(skncButton, sknsDisabled).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncButton, sknsDisabled).Borders.Fill(2, $D0D4D8, $D0D4D8, $606A73, $606A73); + + CopyOptions(skncMenuBarItem, skncListItem); + + Options(skncCheckBox, sknsNormal).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncCheckBox, sknsNormal).Borders.Fill(2, $666666, $666666, $F1F1F1, $F1F1F1); + Options(skncCheckBox, sknsDisabled).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncCheckBox, sknsDisabled).Borders.Fill(2, $D0D4D8, $D0D4D8, $606A73, $606A73); + Options(skncCheckBox, sknsPushed).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncCheckBox, sknsPushed).Borders.Fill(2, $666666, $666666, $F1F1F1, $F1F1F1); + Options(skncCheckBox, sknsHotTrack).Body.Fill(1, $76ADFF, $2C7DF7, clNone, clNone); + Options(skncCheckBox, sknsHotTrack).Borders.Fill(2, $214A87, $214A87, $8FBCFD, $8FBCFD); + Options(skncCheckBox, sknsChecked).Body.Fill(1, $76ADFF, $2C7DF7, clNone, clNone); + Options(skncCheckBox, sknsChecked).Borders.Fill(2, $214A87, $214A87, $8FBCFD, $8FBCFD); + Options(skncCheckBox, sknsCheckedAndHotTrack).Body.Fill(1, $76ADFF, $2C7DF7, clNone, clNone); + Options(skncCheckBox, sknsCheckedAndHotTrack).Borders.Fill(2, $214A87, $214A87, $8FBCFD, $8FBCFD); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, $778B97, $778B97, $E6E6E6, $E6E6E6); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, $E6E6E6, $E6E6E6); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, $1E4B8F, $1E4B8F, $1975FF, $1975FF); + + Options(skncEditButton, sknsHotTrack).Body.Fill(1, $76ADFF, $2C7DF7, clNone, clNone); + Options(skncEditButton, sknsHotTrack).Borders.Fill(0, $1975FF, $1975FF, $8FBCFD, $8FBCFD); + Options(skncEditButton, sknsPushed).Body.Fill(1, $3787FF, $0A66F0, clNone, clNone); + Options(skncEditButton, sknsPushed).Borders.Fill(0, $1975FF, $1975FF, $589AFC, $589AFC); + + //---- Tabs ----// + Options(skncTab, sknsNormal).Body.Fill(0, $DBDFE4, clNone, clNone, clNone); + Options(skncTab, sknsNormal).Borders.Fill(2, $B8C2CA, $B8C2CA, $E1E4E8, $E1E4E8); + Options(skncTab, sknsDisabled).Body.Fill(0, $DBDFE4, clNone, clNone, clNone); + Options(skncTab, sknsDisabled).Borders.Fill(2, $B8C2CA, $B8C2CA, $E1E4E8, $E1E4E8); + + Options(skncTab, sknsHotTrack).Body.Fill(1, clWhite, $E7EBEF, clNone, clNone); + Options(skncTab, sknsHotTrack).Borders.Fill(2, $677883, $677883, clWhite, $DCE0E4); + Options(skncTab, sknsChecked).Body.Fill(1, clWhite, $E7EBEF, clNone, clNone); + Options(skncTab, sknsChecked).Borders.Fill(2, $677883, $677883, clWhite, $DCE0E4); + Options(skncTab, sknsCheckedAndHotTrack).Body.Fill(1, clWhite, $E7EBEF, clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Borders.Fill(2, $677883, $677883, clWhite, $DCE0E4); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(0, $E7EBEF, clNone, clNone, clNone); + Options(skncTabBackground, sknsNormal).Borders.Fill(0, $677883, $677883, clWhite, $DCE0E4); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncProgressBar, sknsNormal).Borders.Fill(2, $D0D4D8, $D0D4D8, $606A73, $606A73); + Options(skncProgressBar, sknsHotTrack).Body.Fill(5, $9CC3FF, $60A0FF, $1672FD, $63A1FF); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(2, $D0D4D8, $D0D4D8, $606A73, $606A73); + + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(5, clWhite, $EDF0F3, $E2E7EC, $E7EBEF); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(2, $D0D4D8, $D0D4D8, $606A73, $606A73); + Options(skncTrackBarButton, sknsPushed).Body.Fill(5, $9CC3FF, $60A0FF, $1672FD, $63A1FF); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(2, $D0D4D8, $D0D4D8, $606A73, $606A73); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(0, $E7EBEF, clNone, clNone, clNone); + Options(skncHeader, sknsNormal).Borders.Fill(0, $F3F5F7, $8F9CAA, clNone, $D4D8DB); + Options(skncHeader, sknsHotTrack).Body.Fill(0, $EEF2F6, clNone, clNone, clNone); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, $F3F5F7, $8F9CAA, clNone, $D4D8DB); +end; + +procedure TSpTBXHumanSkin.PaintBackground(ACanvas: TCanvas; ARect: TRect; + Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; Background, + Borders, Vertical: Boolean; ForceRectBorders: TAnchors); +begin + inherited; + // Override the Tab painting + if (Component = skncTab) and (State in [sknsHotTrack, sknsPushed, sknsChecked, sknsCheckedAndHotTrack]) then begin + SpDrawLine(ACanvas, ARect.Left + 2, ARect.Top, ARect.Right - 2, ARect.Top, $1E4B8F); + SpDrawLine(ACanvas, ARect.Left + 1, ARect.Top + 1, ARect.Right - 1, ARect.Top + 1, $1975FF); + SpDrawLine(ACanvas, ARect.Left, ARect.Top + 2, ARect.Right, ARect.Top + 2, $1975FF); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXLeopardSkin } + +procedure TSpTBXLeopardSkin.FillOptions; +begin + SkinName := 'Leopard'; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(1, $CFCFCF, $999797, clNone, clNone); + + Options(skncDockablePanel, sknsNormal).Body.Fill(0, $EAE4DD, clNone, clNone, clNone); + Options(skncDockablePanel, sknsNormal).Borders.Fill(0, $999797, $999797, clNone, clNone); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(1, $C0C0C0, $999797, clNone, clNone); + + Options(skncPanel, sknsNormal).Body.Fill(0, $EAE4DD, clNone, clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(2, $999797, $999797, clNone, clNone); + + Options(skncPopup, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, $C0C0C0, $C0C0C0, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(1, $C2C5C3, $999797, clNone, clNone); + + Options(skncSplitter, sknsNormal).Body.Fill(1, $C2C5C3, $999797, clNone, clNone); + + Options(skncWindow, sknsNormal).Borders.Fill(0, $808080, $808080, $C0C0C0, $DDD9D2); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(1, $C2C5C3, $999797, clNone, clNone); + + //---- Elements ----// + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, $646262, $CECECE, clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, $646262, $CECECE, clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, $646262, $CECECE, clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(1, clWhite, $A8A8A8, clNone, clNone); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(2, $848484, $848484, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Body.Fill(1, $343434, $696969, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(2, $272727, $272727, clNone, clNone); + Options(skncToolbarItem, sknsPushed).TextColor := clWhite; + Options(skncToolbarItem, sknsChecked).Body.Fill(1, $343434, $696969, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Borders.Fill(2, $272727, $272727, clNone, clNone); + Options(skncToolbarItem, sknsChecked).TextColor := clWhite; + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(1, $343434, $696969, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(2, $272727, $272727, $343434, $343434); + Options(skncToolbarItem, sknsCheckedAndHotTrack).TextColor := clWhite; + Options(skncToolbarItem, sknsDisabled).TextColor := $89736D; + + Options(skncMenuBarItem, sknsHotTrack).Body.Fill(0, $D87439, clNone, clNone, clNone); + Options(skncMenuBarItem, sknsHotTrack).TextColor := clWhite; + Options(skncMenuBarItem, sknsPushed).Body.Fill(0, $D87439, clNone, clNone, clNone); + Options(skncMenuBarItem, sknsPushed).TextColor := clWhite; + Options(skncMenuBarItem, sknsChecked).Body.Fill(0, $D87439, clNone, clNone, clNone); + Options(skncMenuBarItem, sknsChecked).TextColor := clWhite; + Options(skncMenuBarItem, sknsCheckedAndHotTrack).Body.Fill(0, $D87439, clNone, clNone, clNone); + Options(skncMenuBarItem, sknsCheckedAndHotTrack).TextColor := clWhite; + + Options(skncMenuItem, sknsHotTrack).Body.Fill(0, $D87439, clNone, clNone, clNone); + Options(skncMenuItem, sknsHotTrack).TextColor := clWhite; + Options(skncMenuItem, sknsChecked).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncMenuItem, sknsChecked).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + Options(skncMenuItem, sknsCheckedAndHotTrack).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncMenuItem, sknsCheckedAndHotTrack).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + Options(skncMenuItem, sknsCheckedAndHotTrack).TextColor := clWhite; + + Options(skncButton, sknsNormal).Body.Fill(5, clWhite, $EFEFEF, $E3E3E3, clWhite); + Options(skncButton, sknsNormal).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncButton, sknsDisabled).Body.Fill(5, clWhite, $EFEFEF, $E3E3E3, clWhite); + Options(skncButton, sknsDisabled).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncButton, sknsHotTrack).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncButton, sknsHotTrack).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + Options(skncButton, sknsPushed).Body.Fill(5, $FFD6B7, $FFC689, $F3AF67, $FCFBBE); + Options(skncButton, sknsPushed).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + Options(skncButton, sknsChecked).Body.Fill(5, $FFD6B7, $FFC689, $F3AF67, $FCFBBE); + Options(skncButton, sknsChecked).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + Options(skncButton, sknsCheckedAndHotTrack).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncButton, sknsCheckedAndHotTrack).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + + CopyOptions(skncButton, skncListItem); + + CopyOptions(skncButton, skncCheckBox); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, $D0D0D0, $D0D0D0); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, $99A8AC, $99A8AC); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, $D99D51, $D99D51, $FFD3A7, $FFD3A7); + + Options(skncEditButton, sknsHotTrack).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncEditButton, sknsHotTrack).Borders.Fill(0, $DB9D79, $DB9D79, clNone, clNone); + Options(skncEditButton, sknsPushed).Body.Fill(5, $FFD6B7, $FFC689, $F3AF67, $FCFBBE); + Options(skncEditButton, sknsPushed).Borders.Fill(0, $DB9D79, $DB9D79, clNone, clNone); + Options(skncEditButton, sknsChecked).Body.Fill(5, $FFD6B7, $FFC689, $F3AF67, $FCFBBE); + Options(skncEditButton, sknsChecked).Borders.Fill(0, $DB9D79, $DB9D79, clNone, clNone); + Options(skncEditButton, sknsCheckedAndHotTrack).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncEditButton, sknsCheckedAndHotTrack).Borders.Fill(0, $DB9D79, $DB9D79, clNone, clNone); + + //---- Tabs ----// + Options(skncTab, sknsNormal).Body.Fill(5, clWhite, $EFEFEF, $E3E3E3, clWhite); + Options(skncTab, sknsNormal).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncTab, sknsDisabled).Body.Fill(5, clWhite, $EFEFEF, $E3E3E3, clWhite); + Options(skncTab, sknsDisabled).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncTab, sknsHotTrack).Body.Fill(5, $FFD6B7, $FFC689, $F3AF67, $FCFBBE); + Options(skncTab, sknsHotTrack).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + Options(skncTab, sknsChecked).Body.Fill(5, $FFD6B7, $FFC689, $F3AF67, $FCFBBE); + Options(skncTab, sknsChecked).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncTab, sknsCheckedAndHotTrack).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(0, $EAE4DD, clNone, clNone, clNone); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(5, clWhite, $EFEFEF, $E3E3E3, clWhite); + Options(skncProgressBar, sknsNormal).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(5, $FFD6B7, $FFC689, $F3AF67, $FCFBBE); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(5, $FFD6B7, $FFC689, $F3AF67, $FCFBBE); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(2, $DB9D79, $DB9D79, clNone, clNone); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(5, clWhite, $EFEFEF, $E3E3E3, clWhite); + Options(skncHeader, sknsNormal).Borders.Fill(0, $E7E7E7, $C0C0C0, clNone, clNone); + Options(skncHeader, sknsHotTrack).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, $F5BA82, $DB9D79, clNone, clNone); + Options(skncHeader, sknsPushed).Body.Fill(5, $FFE7D5, $FFD0A2, $F5BA82, $FDFCDA); + Options(skncHeader, sknsPushed).Borders.Fill(0, $F5BA82, $DB9D79, clNone, clNone); +end; + +procedure TSpTBXLeopardSkin.PaintBackground(ACanvas: TCanvas; ARect: TRect; + Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; Background, + Borders, Vertical: Boolean; ForceRectBorders: TAnchors); +begin + inherited; + // Override the TabBackground painting + if Component = skncTabBackground then begin + SpDrawLine(ACanvas, ARect.Left, ARect.Top, ARect.Right, ARect.Top, $DB9D79); + SpDrawLine(ACanvas, ARect.Left, ARect.Top + 1, ARect.Right, ARect.Top + 1, $FAEEAF); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXXitoSkin } + +procedure TSpTBXXitoSkin.FillOptions; +begin + SkinName := 'Xito'; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(0, $E0E0E0, clNone, clNone, clNone); + + Options(skncDockablePanel, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); + Options(skncDockablePanel, sknsNormal).Borders.Fill(0, $E0E0E0, $E0E0E0, clWhite, clWhite); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(5, clWhite, $F2F2F2, $EAEAEA, $EFEFEF); + + Options(skncPanel, sknsNormal).Body.Fill(0, $D8D8D8, clNone, clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(2, $909090, $909090, $D0D0D0, $D0D0D0); + + Options(skncPopup, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, $C0C0C0, $C0C0C0, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(5, clWhite, $F2F2F2, $EAEAEA, $EFEFEF); + + Options(skncSplitter, sknsNormal).Body.Fill(5, clWhite, $F2F2F2, $EAEAEA, $EFEFEF); + + Options(skncToolbar, sknsNormal).Body.Fill(5, clWhite, $F2F2F2, $EAEAEA, $EFEFEF); + Options(skncToolbar, sknsNormal).Borders.Fill(2, clWhite, $B0B0B0, clNone, clNone); + + CopyOptions(skncToolbar, skncMenuBar); + + Options(skncWindow, sknsNormal).Borders.Fill(0, $808080, $808080, $C0C0C0, $DDD9D2); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(1, $C0C0C0, clWhite, clNone, clNone); + + //---- Elements ----// + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, $B0B0B0, clWhite, clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, $D0D0D0, clWhite, clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(0, $E0E0E0, clNone, clNone, clNone); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(2, $A0A0A0, $A0A0A0, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Body.Fill(0, $C0C0C0, clNone, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(2, $909090, $909090, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Body.Fill(0, $D8D8D8, clNone, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Borders.Fill(2, $B8B8B8, $F8F8F8, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(0, $D0D0D0, clNone, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(2, $808080, $808080, clNone, clNone); + + CopyOptions(skncToolbarItem, skncMenuBarItem); + + CopyOptions(skncToolbarItem, skncMenuItem); + + Options(skncButton, sknsNormal).Body.Fill(5, clWhite, $DADADA, $D0D0D0, $E0E0E0); + Options(skncButton, sknsNormal).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncButton, sknsDisabled).Body.Fill(5, clWhite, $DADADA, $D0D0D0, $E0E0E0); + Options(skncButton, sknsDisabled).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncButton, sknsHotTrack).Body.Fill(5, clWhite, $DADADA, $DFDFDF, $E0E0E0); + Options(skncButton, sknsHotTrack).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncButton, sknsPushed).Body.Fill(1, $D0D0D0, clWhite, clNone, clNone); + Options(skncButton, sknsPushed).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncButton, sknsChecked).Body.Fill(1, $D0D0D0, clWhite, clNone, clNone); + Options(skncButton, sknsChecked).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + Options(skncButton, sknsCheckedAndHotTrack).Body.Fill(1, $EFEFEF, clWhite, clNone, clNone); + Options(skncButton, sknsCheckedAndHotTrack).Borders.Fill(2, $C0C0C0, $C0C0C0, clNone, clNone); + + CopyOptions(skncButton, skncListItem); + + CopyOptions(skncButton, skncCheckBox); + Options(skncCheckBox, sknsNormal).Body.Reset; + Options(skncCheckBox, sknsChecked).Body.Fill(5, clWhite, $DADADA, $D0D0D0, $E0E0E0); + Options(skncCheckBox, sknsDisabled).Body.Reset; + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, $E0E0E0, $E0E0E0); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, $99A8AC, $99A8AC); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, clNone, clNone, $C0C0C0, $C0C0C0); + + CopyOptions(skncButton, skncEditButton); + Options(skncEditButton, sknsNormal).Reset; + Options(skncEditButton, sknsDisabled).Borders.SkinType := 0; + Options(skncEditButton, sknsHotTrack).Borders.SkinType := 0; + Options(skncEditButton, sknsPushed).Borders.SkinType := 0; + Options(skncEditButton, sknsChecked).Borders.SkinType := 0; + Options(skncEditButton, sknsCheckedAndHotTrack).Borders.SkinType := 0; + + //---- Tabs ----// + CopyOptions(skncToolbarItem, skncTab); + Options(skncTab, sknsCheckedAndHotTrack).Borders.Fill(2, $B8B8B8, $F8F8F8, clNone, clNone); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(0, $D8D8D8, clNone, clNone, clNone); + Options(skncTabBackground, sknsNormal).Borders.Fill(2, $B8B8B8, $F8F8F8, clNone, clNone); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(0, $C0C0C0, clNone, clNone, clNone); + Options(skncProgressBar, sknsNormal).Borders.Fill(2, $909090, $909090, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(0, $E0E0E0, clNone, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(2, $909090, $909090, clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(0, $E0E0E0, clNone, clNone, clNone); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(2, $909090, $909090, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Body.Fill(0, $F0F0F0, clNone, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(2, $909090, $909090, clNone, clNone); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(5, clWhite, $DADADA, $D0D0D0, $E0E0E0); + Options(skncHeader, sknsNormal).Borders.Fill(0, $E7E7E7, $C0C0C0, clNone, clNone); + Options(skncHeader, sknsHotTrack).Body.Fill(5, clWhite, $DADADA, $DFDFDF, $E0E0E0); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, $E7E7E7, $C0C0C0, clNone, clNone); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXOfficeXPSkin } + +procedure TSpTBXOfficeXPSkin.FillOptions; +var + ToolbarC, PopupC, HotTrackC, CheckedC, EditHotTrackC: TColor; +begin + //---- Skin Properties ----// + + SkinName := 'Office XP'; + OfficeIcons := True; + OfficeMenuSeparator := True; + OfficeStatusBar := True; + + //---- Colors ----// + + ToolbarC := SpBlendColors(clWindow, clBtnFace, 165); + PopupC := SpBlendColors(clBtnFace, clWindow, 143); + + HotTrackC := SpBlendColors(clHighlight, clWindow, 30); + HotTrackC := SpLighten(HotTrackC, -15); //-7 original, -30 silver + + CheckedC := SpBlendColors(clBtnFace, clWindow, 50); + CheckedC := SpBlendColors(clHighlight, CheckedC, 10); + + EditHotTrackC := clHighlight; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + + Options(skncDockablePanel, sknsNormal).Body.Fill(0, PopupC, clNone, clNone, clNone); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncDockablePanelTitleBar, sknsNormal).Borders.Fill(0, PopupC, PopupC, clNone, clNone); + + Options(skncPanel, sknsNormal).Body.Fill(1, clBtnFace, clWhite, clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(2, $808080, $808080, $B0D4DF, clWhite); + + Options(skncPopup, sknsNormal).Body.Fill(0, PopupC, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + + Options(skncSplitter, sknsNormal).Body.Fill(0, ToolbarC, clNone, clNone, clNone); + + Options(skncToolbar, sknsNormal).Body.Fill(0, ToolbarC, clNone, clNone, clNone); + Options(skncToolbar, sknsNormal).Borders.Fill(2, clBtnFace, clBtnFace, clNone, clNone); + + CopyOptions(skncToolbar, skncMenuBar); + + Options(skncWindow, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncWindow, sknsNormal).Borders.Fill(0, $808080, $808080, clBtnShadow, clBtnShadow); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(0, clBtnShadow, clNone, clNone, clNone); + Options(skncWindowTitleBar, sknsNormal).Borders.Fill(0, clBtnFace, clBtnFace, clNone, clNone); + + //---- Elements ----// + Options(skncGutter, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, clBtnShadow, clWhite, clNone, clNone);////// + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, clBtnShadow, clWhite, clNone, clNone);////// + + Options(skncSeparator, sknsNormal).Body.Fill(0, clBtnShadow, clNone, clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(0, HotTrackC, clNone, clNone, clNone); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(0, clHighlight, clHighlight, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Body.Fill(0, CheckedC, clNone, clNone, clNone); + Options(skncToolbarItem, sknsChecked).Borders.Fill(0, clHighlight, clHighlight, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(0, HotTrackC, clNone, clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(0, clHighlight, clHighlight, clNone, clNone); + + Options(skncOpenToolbarItem, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncOpenToolbarItem, sknsNormal).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + + CopyOptions(skncToolbarItem, skncMenuBarItem); + + CopyOptions(skncToolbarItem, skncMenuItem); + + CopyOptions(skncToolbarItem, skncButton); + Options(skncButton, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncButton, sknsNormal).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + Options(skncButton, sknsDisabled).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncButton, sknsDisabled).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + + CopyOptions(skncToolbarItem, skncListItem); + + CopyOptions(skncToolbarItem, skncCheckBox); + Options(skncCheckBox, sknsNormal).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + Options(skncCheckBox, sknsDisabled).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, clBtnFace, clBtnFace); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, clBtnShadow, clBtnShadow); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, clNone, clNone, EditHotTrackC, EditHotTrackC); + + CopyOptions(skncToolbarItem, skncEditButton); + Options(skncEditButton, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncEditButton, sknsNormal).Borders.Fill(0, clWindow, clWindow, clNone, clNone); + Options(skncEditButton, sknsPushed).Body.Fill(0, HotTrackC, clNone, clNone, clNone); + Options(skncEditButton, sknsPushed).Borders.Fill(0, EditHotTrackC, EditHotTrackC, clNone, clNone); + Options(skncEditButton, sknsPushed).TextColor := clHighlightText; + + //---- Tabs ----// + Options(skncTab, sknsHotTrack).Body.Fill(0, HotTrackC, clNone, clNone, clNone); + Options(skncTab, sknsHotTrack).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + Options(skncTab, sknsChecked).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncTab, sknsChecked).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Body.Fill(0, HotTrackC, clNone, clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncTabBackground, sknsNormal).Borders.Fill(0, clBtnShadow, clBtnShadow, clNone, clNone); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(0, CheckedC, clWhite, clNone, clNone); + Options(skncProgressBar, sknsNormal).Borders.Fill(0, clHighlight, clHighlight, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(0, HotTrackC, clNone, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(0, clHighlight, clHighlight, clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(0, CheckedC, clNone, clNone, clNone); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(0, clHighlight, clHighlight, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Body.Fill(0, HotTrackC, clWhite, clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(0, clHighlight, clHighlight, clNone, clNone); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(0, clBtnFace, clNone, clNone, clNone); + Options(skncHeader, sknsNormal).Borders.Fill(0, clWindow, clBtnShadow, clNone, clNone); + Options(skncHeader, sknsHotTrack).Body.Fill(0, HotTrackC, clNone, clNone, clNone); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, clBtnFace, clBtnShadow, clNone, clNone); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXOffice2003Skin } + +constructor TSpTBXOffice2003Skin.Create; +begin + FDefaultColorScheme := lusUnknown; + inherited; +end; + +procedure TSpTBXOffice2003Skin.FillColors; +const + Office2003Colors: array[lusBlue..lusGreen] of TSpTBXOffice2003Colors = ( + ($F5BE9E, $F9D9C3, // 0, 1: Dock + $FEECDD, $E2A981, // 2, 3: Toolbar + $CB8C6A, $F5BE9E, // 4, 5: Toolbar borders + $F6F6F6, // 6: Popup + $962D00, // 7: Popup borders + $800000, // 8: Item borders + $C9662A, // 9: Window borders + $8CD5FF, $55ADFF, // 10, 11: Item Checked + $4E91FE, $8ED3FF, // 12, 13: Item Pushed + $CCF4FF, $91D0FF, // 14, 15: Item HotTrack + $FFEFE3, $E7B593, // 16, 17: OpenToolbarItem + $91420D, // 18: Button external border + $FBD0B3, $CB8C6A, // 19, 20: Button internal borders + $FEECDD, // 21: Grip/Separator soft color + $E2A981), // 22: Panel/CheckBox/Tabs/ProgressBar/TrackBar borders + + ($E5D7D7, $F7F3F3, // 0, 1: Dock + $FAF4F3, $B59799, // 2, 3: Toolbar + $8F6D6E, $E5D7D7, // 4, 5: Toolbar borders + $FFFAFD, // 6: Popup + $947C7C, // 7: Popup borders + $6F4B4B, // 8: Item borders + $99797A, // 9: Window borders + $8CD5FF, $55ADFF, // 10, 11: Item Checked + $4E91FE, $8ED3FF, // 12, 13: Item Pushed + $CCF4FF, $91D0FF, // 14, 15: Item HotTrack + $F1E9E8, $CDB9BA, // 16, 17: OpenToolbarItem + $988B8A, // 18: Button external border + clWhite, $B0A7A6, // 19, 20: Button internal borders + $FFFFFF, // 21: Grip/Separator soft color + $B59799), // 22: Panel/CheckBox/Tabs/ProgressBar/TrackBar borders + + ($A7D9D9, $E4F2F0, // 0, 1: Dock + $DEF7F4, $91C6B7, // 2, 3: Toolbar + $588060, $A7D9D9, // 4, 5: Toolbar borders + $EEF4F4, // 6: Popup + $5E8D75, // 7: Popup borders + $385D3F, // 8: Item borders + $5E8674, // 9: Window borders + $8CD5FF, $55ADFF, // 10, 11: Item Checked + $4E91FE, $8ED3FF, // 12, 13: Item Pushed + $CCF4FF, $91D0FF, // 14, 15: Item HotTrack + $D5F0EC, $9FCEC2, // 16, 17: OpenToolbarItem + $5B8479, // 18: Button external border + $E3FFFA, $86ADAA, // 19, 20: Button internal borders + $DEF7F4, // 21: Grip/Separator soft color + $91C6B7) // 22: Panel/CheckBox/Tabs/ProgressBar/TrackBar borders + ); +var + Luna: TSpTBXLunaScheme; +begin + if FDefaultColorScheme <> lusUnknown then + Luna := FDefaultColorScheme + else + Luna := SpGetLunaScheme; + + if Luna <> lusUnknown then + FColors := Office2003Colors[Luna] + else begin + // Use adapted colors + // 0, 1: Dock + FColors[0] := clBtnFace; + FColors[1] := SpBlendColors(clBtnFace, clWindow, 35); + // 2, 3: Toolbar + FColors[2] := SpBlendColors(clBtnFace, clWindow, 20); + FColors[3] := SpBlendColors(clBtnFace, clWindow, 95); + // 4, 5: Toolbar borders + FColors[4] := SpBlendColors(clBtnShadow, clWindow, 70); + FColors[5] := SpBlendColors(clBtnFace, clWindow, 62); + // 6: Popup + FColors[6] := SpBlendColors(clBtnFace, clWindow, 15); + // 7: Popup borders + FColors[7] := SpBlendColors(clBtnFace, clBtnShadow, 20); + // 8: Item borders + FColors[8] := clHighlight; + // 9: Window borders + FColors[9] := SpBlendColors(clBtnText, clBtnShadow, 15); + // 10, 11: Item Checked + FColors[10] := SpBlendColors(clHighlight, SpBlendColors(clBtnFace, clWindow, 50), 10); + FColors[11] := FColors[10]; + // 12, 13: Item Pushed + FColors[12] := SpBlendColors(clHighlight, clWindow, 50); + FColors[13] := FColors[12]; + // 14, 15: Item HotTrack + FColors[14] := SpBlendColors(clHighlight, clWindow, 30); + FColors[15] := FColors[14]; + // 16, 17: OpenToolbarItem + FColors[16] := SpBlendColors(clBtnFace, clWindow, 16); + FColors[17] := SpBlendColors(clBtnFace, clWindow, 42); + // 18: Button external border + FColors[18] := FColors[4]; + // 19, 20: Button internal borders + FColors[19] := FColors[5]; + FColors[20] := SpBlendColors(clBtnShadow, clWindow, 40); + // 21: Grip/Separator soft color + FColors[21] := clWhite; + // 22: Panel/CheckBox/Tabs/ProgressBar/TrackBar borders + FColors[22] := SpBlendColors(clBtnShadow, clWindow, 70); + end; +end; + +procedure TSpTBXOffice2003Skin.FillOptions; +var + IsUnknownLuna: Boolean; +begin + //---- Skin Properties ----// + + SkinName := 'Office 2003'; + OfficeMenuSeparator := True; + + //---- Colors ----// + + FillColors; + IsUnknownLuna := FColors[0] = clBtnFace; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(2, FColors[0], FColors[1], clNone, clNone); + + Options(skncDockablePanel, sknsNormal).Body.Fill(0, FColors[6], clNone, clNone, clNone); + Options(skncDockablePanel, sknsNormal).Borders.Fill(0, FColors[3], FColors[3], clNone, clNone); + + Options(skncDockablePanelTitleBar, sknsNormal).Body.Fill(1, FColors[2], FColors[3], clNone, clNone); + Options(skncDockablePanelTitleBar, sknsNormal).Borders.Fill(0, FColors[6], FColors[6], clNone, clNone); + + Options(skncPanel, sknsNormal).Body.Fill(0, FColors[6], clNone, clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(2, FColors[22], FColors[22], clNone, clNone); + + Options(skncPopup, sknsNormal).Body.Fill(0, FColors[6], clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, FColors[7], FColors[7], clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(1, FColors[2], FColors[3], clNone, clNone); + + Options(skncSplitter, sknsNormal).Body.Fill(1, FColors[2], FColors[3], clNone, clNone); + + Options(skncToolbar, sknsNormal).Body.Fill(1, FColors[2], FColors[3], clNone, clNone); + Options(skncToolbar, sknsNormal).Borders.Fill(2, FColors[5], FColors[4], clNone, clNone); + + Options(skncWindow, sknsNormal).Body.Fill(0, FColors[6], clNone, clNone, clNone); + Options(skncWindow, sknsNormal).Borders.Fill(0, FColors[9], FColors[9], FColors[9], FColors[9]); + + Options(skncWindowTitleBar, sknsNormal).Body.Fill(0, FColors[9], clNone, clNone, clNone); + if IsUnknownLuna then + Options(skncWindowTitleBar, sknsNormal).TextColor := clBtnHighlight; + + //---- Elements ----// + Options(skncGutter, sknsNormal).Body.Fill(2, FColors[2], FColors[3], clNone, clNone); + + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, FColors[4], FColors[21], clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, FColors[4], FColors[21], clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, FColors[4], FColors[21], clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(1, FColors[14], FColors[15], clNone, clNone); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(0, FColors[8], FColors[8], clNone, clNone); + Options(skncToolbarItem, sknsPushed).Body.Fill(1, FColors[12], FColors[13], clNone, clNone); + Options(skncToolbarItem, sknsPushed).Borders.Fill(0, FColors[8], FColors[8], clNone, clNone); + Options(skncToolbarItem, sknsChecked).Body.Fill(1, FColors[10], FColors[11], clNone, clNone); + Options(skncToolbarItem, sknsChecked).Borders.Fill(0, FColors[8], FColors[8], clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(1, FColors[12], FColors[13], clNone, clNone); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(0, FColors[8], FColors[8], clNone, clNone); + + Options(skncOpenToolbarItem, sknsNormal).Body.Fill(1, FColors[16], FColors[17], clNone, clNone); + Options(skncOpenToolbarItem, sknsNormal).Borders.Fill(0, FColors[7], FColors[7], clNone, clNone); + + CopyOptions(skncToolbarItem, skncMenuBarItem); + + CopyOptions(skncToolbarItem, skncMenuItem); + + Options(skncButton, sknsNormal).Body.Fill(1, FColors[2], FColors[3], clNone, clNone); + Options(skncButton, sknsNormal).Borders.Fill(1, FColors[18], FColors[18], FColors[19], FColors[20]); + Options(skncButton, sknsDisabled).Body.Fill(1, FColors[2], FColors[3], clNone, clNone); + Options(skncButton, sknsDisabled).Borders.Fill(1, FColors[18], FColors[18], FColors[19], FColors[20]); + Options(skncButton, sknsHotTrack).Body.Fill(1, FColors[14], FColors[15], clNone, clNone); + Options(skncButton, sknsHotTrack).Borders.Fill(1, FColors[18], FColors[18], FColors[19], FColors[20]); + Options(skncButton, sknsPushed).Body.Fill(1, FColors[12], FColors[13], clNone, clNone); + Options(skncButton, sknsPushed).Borders.Fill(1, FColors[18], FColors[18], FColors[19], FColors[20]); + Options(skncButton, sknsChecked).Body.Fill(1, FColors[10], FColors[11], clNone, clNone); + Options(skncButton, sknsChecked).Borders.Fill(1, FColors[18], FColors[18], FColors[19], FColors[20]); + Options(skncButton, sknsCheckedAndHotTrack).Body.Fill(1, SpLighten(FColors[12], 15), FColors[13], clNone, clNone); + Options(skncButton, sknsCheckedAndHotTrack).Borders.Fill(1, FColors[18], FColors[18], FColors[19], FColors[20]); + + CopyOptions(skncToolbarItem, skncListItem); + + CopyOptions(skncToolbarItem, skncCheckBox); + Options(skncCheckBox, sknsNormal).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + Options(skncCheckBox, sknsDisabled).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, FColors[3], FColors[3]); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, clBtnShadow, clBtnShadow); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, clNone, clNone, FColors[8], FColors[8]); + + CopyOptions(skncToolbarItem, skncEditButton); + Options(skncEditButton, sknsNormal).Body.Fill(1, FColors[2], FColors[3], clNone, clNone); + Options(skncEditButton, sknsNormal).Borders.Fill(0, clWindow, clWindow, clNone, clNone); + + //---- Tabs ----// + Options(skncTab, sknsHotTrack).Body.Fill(1, FColors[14], FColors[15], clNone, clNone); + Options(skncTab, sknsHotTrack).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + Options(skncTab, sknsChecked).Body.Fill(0, FColors[6], clNone, clNone, clNone); + Options(skncTab, sknsChecked).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Body.Fill(1, FColors[14], FColors[15], clNone, clNone); + Options(skncTab, sknsCheckedAndHotTrack).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Body.Fill(0, FColors[6], clNone, clNone, clNone); + Options(skncTabBackground, sknsNormal).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(0, FColors[6], clWhite, clNone, clNone); + Options(skncProgressBar, sknsNormal).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(0, FColors[0], clNone, clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Body.Fill(0, FColors[0], clNone, clNone, clNone); + Options(skncTrackBarButton, sknsNormal).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Body.Fill(1, FColors[12], FColors[13], clNone, clNone); + Options(skncTrackBarButton, sknsPushed).Borders.Fill(0, FColors[22], FColors[22], clNone, clNone); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(1, FColors[2], FColors[3], clNone, clNone); + Options(skncHeader, sknsNormal).Borders.Fill(0, FColors[19], FColors[20], clNone, clNone); + Options(skncHeader, sknsHotTrack).Body.Fill(1, FColors[14], FColors[15], clNone, clNone); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, FColors[19], FColors[20], clNone, clNone); +end; + +procedure TSpTBXOffice2003Skin.SetDefaultColorScheme(const Value: TSpTBXLunaScheme); +begin + if FDefaultColorScheme <> Value then begin + FDefaultColorScheme := Value; + Reset; + FillOptions; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXOffice2007Skin } + +procedure TSpTBXOffice2007Skin.FillOptions; +begin + //---- Skin Properties ----// + + SkinName := 'Office 2007'; + OfficeMenuSeparator := True; + + //---- Colors ----// + + FillColors; + + //---- Single State ----// + Options(skncDock, sknsNormal).Body.Fill(7, FColors[0], FColors[1], FColors[2], FColors[3]); + + Options(skncDockablePanel, sknsNormal).Body.Fill(1, FColors[13], FColors[14], clNone, clNone); + Options(skncDockablePanel, sknsNormal).Borders.Fill(0, FColors[11], FColors[11], FColors[12], FColors[12]); + + Options(skncPanel, sknsNormal).Body.Fill(1, FColors[13], FColors[14], clNone, clNone); + Options(skncPanel, sknsNormal).Borders.Fill(1, FColors[11], FColors[11], FColors[12], FColors[12]); + + Options(skncPopup, sknsNormal).Body.Fill(0, clWhite, clNone, clNone, clNone); + Options(skncPopup, sknsNormal).Borders.Fill(0, $C0C0C0, $C0C0C0, clNone, clNone); + + Options(skncStatusBar, sknsNormal).Body.Fill(7, FColors[7], FColors[8], FColors[9], FColors[10]); + Options(skncStatusBar, sknsNormal).TextColor := FColors[6]; // This overrides the Items text color + + CopyOptions(skncStatusBar, skncDockablePanelTitleBar); + + CopyOptions(skncDock, skncSplitter); + + Options(skncWindow, sknsNormal).Body.Fill(1, FColors[13], FColors[14], clNone, clNone); + Options(skncWindow, sknsNormal).Borders.Fill(0, FColors[15], FColors[16], FColors[17], FColors[16]); + + CopyOptions(skncStatusBar, skncWindowTitleBar); + + //---- Elements ----// + Options(skncGutter, sknsNormal).Body.Fill(0, $EEEEE9, clNone, clNone, clNone); + Options(skncGutter, sknsNormal).Borders.Fill(0, $C5C5C5, clNone, clNone, clNone); + + Options(skncToolbarGrip, sknsNormal).Body.Fill(0, FColors[4], FColors[5], clNone, clNone); + + Options(skncStatusBarGrip, sknsNormal).Body.Fill(0, FColors[4], FColors[5], clNone, clNone); + + Options(skncSeparator, sknsNormal).Body.Fill(0, FColors[4], FColors[5], clNone, clNone); + + //---- Buttons ----// + Options(skncToolbarItem, sknsHotTrack).Body.Fill(7, $DBFDFF, $95E7FF, $4CD7FF, $96E7FF); + Options(skncToolbarItem, sknsHotTrack).Borders.Fill(1, $9BCFDD, $9BCFDD, $D2FBFF, $B3FAFF); + Options(skncToolbarItem, sknsPushed).Body.Fill(7, $70BAFC, $59A5F3, $388FEF, $64CDFD); + Options(skncToolbarItem, sknsPushed).Borders.Fill(1, $65818E, $AEBDC3, $66C1FA, $66C1FA); + Options(skncToolbarItem, sknsChecked).Body.Fill(7, $A8D6FE, $61AFFC, $329BFB, $ACF0FF); + Options(skncToolbarItem, sknsChecked).Borders.Fill(1, $65818E, $AEBDC3, $66C1FA, $66C1FA); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Body.Fill(7, $70BAFC, $59A5F3, $388FEF, $64CDFD); + Options(skncToolbarItem, sknsCheckedAndHotTrack).Borders.Fill(1, $65818E, $AEBDC3, $66C1FA, $66C1FA); + + CopyOptions(skncToolbarItem, skncMenuBarItem); + + CopyOptions(skncToolbarItem, skncMenuItem); + + CopyOptions(skncToolbarItem, skncButton); + Options(skncButton, sknsNormal).Body.Fill(1, FColors[13], FColors[14], clNone, clNone); + Options(skncButton, sknsNormal).Borders.Fill(1, FColors[11], FColors[11], FColors[12], FColors[12]); + Options(skncButton, sknsDisabled).Body.Fill(1, FColors[13], FColors[14], clNone, clNone); + Options(skncButton, sknsDisabled).Borders.Fill(1, FColors[11], FColors[11], FColors[12], FColors[12]); + + CopyOptions(skncToolbarItem, skncListItem); + + CopyOptions(skncToolbarItem, skncCheckBox); + Options(skncCheckBox, sknsNormal).Borders.Fill(1, FColors[11], FColors[11], clNone, clNone); + Options(skncCheckBox, sknsDisabled).Borders.Fill(1, FColors[11], FColors[11], clNone, clNone); + + CopyOptions(skncCheckBox, skncRadioButton); + + //---- Editors ----// + Options(skncEditFrame, sknsNormal).Borders.Fill(1, clNone, clNone, FColors[4], FColors[4]); + Options(skncEditFrame, sknsDisabled).Borders.Fill(1, clNone, clNone, FColors[4], FColors[4]); + Options(skncEditFrame, sknsHotTrack).Borders.Fill(1, clNone, clNone, FColors[4], FColors[4]); + + CopyOptions(skncToolbarItem, skncEditButton); + + //---- Tabs ----// + Options(skncTab, sknsHotTrack).Assign(Options(skncButton, sknsHotTrack)); + Options(skncTab, sknsChecked).Body.Fill(0, FColors[13], clNone, clNone, clNone); + Options(skncTab, sknsChecked).Borders.Fill(1, FColors[11], FColors[11], FColors[12], FColors[12]); + Options(skncTab, sknsCheckedAndHotTrack).Assign(Options(skncButton, sknsHotTrack)); + + // TabBackground: Only Normal state is used + Options(skncTabBackground, sknsNormal).Assign(Options(skncButton, sknsNormal)); + + //---- ProgressBar ----// + // ProgressBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + Options(skncProgressBar, sknsNormal).Body.Fill(0, FColors[5], clWhite, clNone, clNone); + Options(skncProgressBar, sknsNormal).Borders.Fill(1, FColors[2], FColors[2], clNone, clNone); + Options(skncProgressBar, sknsHotTrack).Body.Fill(7, $DBFDFF, $95E7FF, $4CD7FF, $96E7FF); + Options(skncProgressBar, sknsHotTrack).Borders.Fill(1, FColors[2], FColors[2], clNone, clNone); + + //---- TrackBar ----// + // TrackBar: Only Normal and HotTrack states are used + // HotTrack represents the selection + CopyOptions(skncProgressBar, skncTrackBar); + + // TrackBarButton: Only Normal and Pushed states are used + Options(skncTrackBarButton, sknsNormal).Assign(Options(skncToolbarItem, sknsChecked)); + Options(skncTrackBarButton, sknsPushed).Assign(Options(skncToolbarItem, sknsPushed)); + + //---- Header ----// + Options(skncHeader, sknsNormal).Body.Fill(1, FColors[13], FColors[14], clNone, clNone); + Options(skncHeader, sknsNormal).Borders.Fill(0, FColors[11], FColors[11], FColors[12], FColors[12]); + Options(skncHeader, sknsHotTrack).Body.Fill(7, $DBFDFF, $95E7FF, $4CD7FF, $96E7FF); + Options(skncHeader, sknsHotTrack).Borders.Fill(0, $7E99A9, $7E99A9, $D2FBFF, $D2FBFF); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXOffice2007BlueSkin } + +procedure TSpTBXOffice2007BlueSkin.FillColors; +const + ColorConst: TSpTBXOffice2007Colors = ( + $F4E6DB, $F0DECF, $EDD9C9, $FFF2E7, // 0, 1, 2, 3: Dock + $D6AE90, $FFFFFF, // 4, 5: Separator + clNone, // 6: StatusBar Text Color + $F9E6D7, $F7D7BF, $F5D0B4, $F7E5D6, // 7, 8, 9, 10: StatusBar + $EDC4A5, $FEF6ED, // 11, 12: Button Borders + $FEF9F6, $FBE7D9, // 13, 14: Button Normal + $825A3B, $E1C6B1, $F7D9C2 // 15, 16, 17: Window Borders + ); +begin + FColors := ColorConst; + SkinName := 'Office 2007 Blue'; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXOffice2007BlackSkin } + +procedure TSpTBXOffice2007BlackSkin.FillColors; +const + ColorConst: TSpTBXOffice2007Colors = ( + $DDD8D5, $CFC6C1, $C5BBB4, $EAEAEA, // 0, 1, 2, 3: Dock + $989898, $CCCCCC, // 4, 5: Separator + clWhite, // 6: StatusBar Text Color + $524743, $463E3B, $30302F, $454545, // 7, 8, 9, 10: StatusBar + $B4B0AE, $DBD4D0, // 11, 12: Button Borders + $E5E0DD, $CFC6C1, // 13, 14: Button Normal + $2F2F2F, $4D4D4D, $666666 // 15, 16, 17: Window Borders + ); +begin + FColors := ColorConst; + SkinName := 'Office 2007 Black'; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXOffice2007SilverSkin } + +procedure TSpTBXOffice2007SilverSkin.FillColors; +const + ColorConst: TSpTBXOffice2007Colors = ( + $DDD8D5, $CFC6C1, $C5BBB4, $EAEAEA, // 0, 1, 2, 3: Dock + $AAA6A2, $FFFFFF, // 4, 5: Separator + clNone, // 6: StatusBar Text Color + $EBE8E7, $C2B7B1, $B6AFA9, $CEC9C7, // 7, 8, 9, 10: StatusBar + $B4B0AE, $DBD4D0, // 11, 12: Button Borders + $E5E0DD, $CFC6C1, // 13, 14: Button Normal + $989898, $BABABB, $DEDDDE // 15, 16, 17: Window Borders + ); +begin + FColors := ColorConst; + SkinName := 'Office 2007 Silver'; +end; + +initialization + SkinManager.SkinsList.AddSkin('Aluminum', TSpTBXAluminumSkin); + SkinManager.SkinsList.AddSkin('Athen', TSpTBXAthenSkin); + SkinManager.SkinsList.AddSkin('Dream', TSpTBXDreamSkin); + SkinManager.SkinsList.AddSkin('Eos', TSpTBXEosSkin); + SkinManager.SkinsList.AddSkin('Human', TSpTBXHumanSkin); + SkinManager.SkinsList.AddSkin('Leopard', TSpTBXLeopardSkin); + SkinManager.SkinsList.AddSkin('Xito', TSpTBXXitoSkin); + { Office } + SkinManager.SkinsList.AddSkin('Office XP', TSpTBXOfficeXPSkin); + SkinManager.SkinsList.AddSkin('Office 2003', TSpTBXOffice2003Skin); + SkinManager.SkinsList.AddSkin('Office 2007 Blue', TSpTBXOffice2007BlueSkin); + SkinManager.SkinsList.AddSkin('Office 2007 Black', TSpTBXOffice2007BlackSkin); + SkinManager.SkinsList.AddSkin('Office 2007 Silver', TSpTBXOffice2007SilverSkin); + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.dcu new file mode 100644 index 0000000..6c0cc6f Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.hpp new file mode 100644 index 0000000..6790e68 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.hpp @@ -0,0 +1,517 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxdkpanels.pas' rev: 20.00 + +#ifndef SptbxdkpanelsHPP +#define SptbxdkpanelsHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxdkpanels +{ +//-- type declarations ------------------------------------------------------- +struct TSpTBXDockStateRec +{ + +public: + Forms::TWindowState DockedState; + int RestoreSize; +}; + + +#pragma option push -b- +enum TSpTBXDockPosition { dpxLeft, dpxTop, dpxRight, dpxBottom, dpxClient }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXDPResizeType { dprtManualResize, dprtMinimizeOrRestore, dprtMinimizeOrRestoreTaskPaneStyle, dprtSplitResize }; +#pragma option pop + +typedef void __fastcall (__closure *TSpTBXWindowStateChangedEvent)(System::TObject* Sender, Forms::TWindowState AWindowState); + +class DELPHICLASS TSpTBXCustomMultiDock; +class DELPHICLASS TSpTBXCustomSplitter; +class DELPHICLASS TSpTBXCustomDockablePanel; +class PASCALIMPLEMENTATION TSpTBXCustomMultiDock : public Tb2dock::TTBDock +{ + typedef Tb2dock::TTBDock inherited; + +private: + bool FAutoSplitterVisibility; + bool FLimitToOneRow; + TSpTBXCustomSplitter* FLastSplitter; + TSpTBXDockPosition FPosition; + bool FUpdatingLateralSize; + Tb2dock::TTBInsertRemoveEvent FOnInsertRemoveBar; + Tb2dock::TTBRequestDockEvent FOnRequestDock; + void __fastcall UpdateDPLateralSize(int AWidth, int AHeight); + HIDESBASE void __fastcall SetPosition(const TSpTBXDockPosition Value); + void __fastcall SetLimitToOneRow(const bool Value); + +protected: + virtual void __fastcall AlignControls(Controls::TControl* AControl, Types::TRect &Rect); + virtual void __fastcall DoInsertRemoveBar(System::TObject* Sender, bool Inserting, Tb2dock::TTBCustomDockableWindow* Bar); + virtual void __fastcall DoRequestDock(System::TObject* Sender, Tb2dock::TTBCustomDockableWindow* Bar, bool &Accept); + virtual void __fastcall Loaded(void); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + DYNAMIC void __fastcall ValidateInsert(Classes::TComponent* AComponent); + void __fastcall InsertingOnEmptyDock(void); + TSpTBXCustomSplitter* __fastcall GetAdjacentSplitter(int SpacingDelta = 0x1); + +public: + __fastcall virtual TSpTBXCustomMultiDock(Classes::TComponent* AOwner); + bool __fastcall IsVertical(void); + void __fastcall GetDockablePanelList(Classes::TList* DPList); + void __fastcall GetDockablePanelDockIndex(Classes::TList* DPList, TSpTBXCustomDockablePanel* DP, /* out */ int &DPDockIndex); + virtual void __fastcall SetBounds(int ALeft, int ATop, int AWidth, int AHeight); + __property bool UpdatingLateralSize = {read=FUpdatingLateralSize, nodefault}; + +__published: + __property bool LimitToOneRow = {read=FLimitToOneRow, write=SetLimitToOneRow, default=1}; + __property TSpTBXDockPosition Position = {read=FPosition, write=SetPosition, default=0}; + __property bool AutoSplitterVisibility = {read=FAutoSplitterVisibility, write=FAutoSplitterVisibility, default=1}; + __property Tb2dock::TTBInsertRemoveEvent OnInsertRemoveBar = {read=FOnInsertRemoveBar, write=FOnInsertRemoveBar}; + __property Tb2dock::TTBRequestDockEvent OnRequestDock = {read=FOnRequestDock, write=FOnRequestDock}; +public: + /* TTBDock.Destroy */ inline __fastcall virtual ~TSpTBXCustomMultiDock(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomMultiDock(HWND ParentWindow) : Tb2dock::TTBDock(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXMultiDock; +class PASCALIMPLEMENTATION TSpTBXMultiDock : public TSpTBXCustomMultiDock +{ + typedef TSpTBXCustomMultiDock inherited; + +public: + /* TSpTBXCustomMultiDock.Create */ inline __fastcall virtual TSpTBXMultiDock(Classes::TComponent* AOwner) : TSpTBXCustomMultiDock(AOwner) { } + +public: + /* TTBDock.Destroy */ inline __fastcall virtual ~TSpTBXMultiDock(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXMultiDock(HWND ParentWindow) : TSpTBXCustomMultiDock(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXDockablePanelButtonOptions; +class PASCALIMPLEMENTATION TSpTBXDockablePanelButtonOptions : public Sptbxitem::TSpTBXButtonOptions +{ + typedef Sptbxitem::TSpTBXButtonOptions inherited; + +private: + bool FTaskPaneStyleResize; + +protected: + TSpTBXCustomDockablePanel* FDockablePanel; + virtual void __fastcall ButtonsClick(System::TObject* Sender); + virtual void __fastcall CreateButtons(void); + virtual bool __fastcall Restoring(Sptbxitem::TSpTBXCustomItem* B); + virtual void __fastcall SetupButton(Sptbxitem::TSpTBXCustomItem* B); + +public: + __fastcall virtual TSpTBXDockablePanelButtonOptions(Controls::TWinControl* AParent); + +__published: + __property Maximize = {default=0}; + __property Minimize = {default=0}; + __property bool TaskPaneStyleResize = {read=FTaskPaneStyleResize, write=FTaskPaneStyleResize, default=0}; + __property TitleBarMaxSize = {default=19}; +public: + /* TPersistent.Destroy */ inline __fastcall virtual ~TSpTBXDockablePanelButtonOptions(void) { } + +}; + + +class DELPHICLASS TSpTBXDockablePanelToolbar; +class PASCALIMPLEMENTATION TSpTBXDockablePanelToolbar : public Sptbxitem::TSpTBXToolbar +{ + typedef Sptbxitem::TSpTBXToolbar inherited; + +protected: + virtual bool __fastcall CanItemClick(Tb2item::TTBCustomItem* Item, Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + virtual Graphics::TColor __fastcall GetItemsTextColor(Sptbxskins::TSpTBXSkinStatesType State); + virtual int __fastcall GetRightAlignMargin(void); + +public: + __fastcall virtual TSpTBXDockablePanelToolbar(Classes::TComponent* AOwner); + TSpTBXCustomDockablePanel* __fastcall GetParentDockablePanel(void); +public: + /* TSpTBXToolbar.Destroy */ inline __fastcall virtual ~TSpTBXDockablePanelToolbar(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXDockablePanelToolbar(HWND ParentWindow) : Sptbxitem::TSpTBXToolbar(ParentWindow) { } + +}; + + +class PASCALIMPLEMENTATION TSpTBXCustomDockablePanel : public Sptbxitem::TSpTBXCustomToolWindow +{ + typedef Sptbxitem::TSpTBXCustomToolWindow inherited; + +private: + int FDefaultDockedSize; + bool FFixedDockedSize; + int FFloatingClientHeight; + int FFloatingClientWidth; + bool FIsDockedMoving; + bool FIsManualSizing; + tagSIZE FLoadedBarSize; + int FLoadedDockPos; + Forms::TWindowState FLoadedState; + TSpTBXDockablePanelButtonOptions* FOptions; + bool FShowCaption; + bool FShowCaptionWhenDocked; + Sptbxitem::TSpTBXDrawEvent FOnDrawCaptionPanel; + TSpTBXWindowStateChangedEvent FOnWindowStateChanged; + bool FShowVerticalCaption; + bool __fastcall CanSplitResize(Tb2dock::TTBDockPosition EdgePosition); + void __fastcall DockRequestDock(System::TObject* Sender, Tb2dock::TTBCustomDockableWindow* Bar, bool &Accept); + void __fastcall DockResize(System::TObject* Sender); + bool __fastcall InternalMaximize(bool Restore); + void __fastcall UpdateTitleBarRotation(void); + Types::TPoint __fastcall GetCaptionPanelSize(); + int __fastcall GetEffectiveHeight(void); + int __fastcall GetEffectiveWidth(void); + int __fastcall GetFloatingClientHeight(void); + int __fastcall GetFloatingClientWidth(void); + Imglist::TCustomImageList* __fastcall GetImages(void); + Tb2item::TTBCustomItem* __fastcall GetItems(void); + Tb2item::TTBRootItem* __fastcall GetRootItems(void); + Sptbxitem::TSpTBXToolbar* __fastcall GetToolbar(void); + Tb2toolbar::TTBToolbarView* __fastcall GetView(void); + void __fastcall SetDefaultDockedSize(int Value); + void __fastcall SetEffectiveHeight(const int Value); + void __fastcall SetEffectiveWidth(const int Value); + void __fastcall SetFloatingClientHeight(const int Value); + void __fastcall SetFloatingClientWidth(const int Value); + void __fastcall SetImages(const Imglist::TCustomImageList* Value); + HIDESBASE void __fastcall SetShowCaption(const bool Value); + void __fastcall SetShowCaptionWhenDocked(const bool Value); + void __fastcall SetShowVerticalCaption(const bool Value); + HIDESBASE MESSAGE void __fastcall CMTextChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMNCCalcSize(Messages::TWMNCCalcSize &Message); + HIDESBASE MESSAGE void __fastcall WMNCHitTest(Messages::TWMNCHitTest &Message); + HIDESBASE MESSAGE void __fastcall WMNCLButtonDown(Messages::TWMNCHitMessage &Message); + HIDESBASE MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &Message); + +protected: + Extctrls::TPanel* FPanel; + Sptbxitem::TSpTBXDock* FToolbarDock; + TSpTBXDockablePanelToolbar* FToolbar; + TSpTBXDockStateRec FState; + Classes::TList* FDockForms; + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + virtual void __fastcall Loaded(void); + virtual void __fastcall SetParent(Controls::TWinControl* AParent); + DYNAMIC void __fastcall ValidateContainer(Classes::TComponent* AComponent); + void __fastcall BeginDockedMoving(void); + void __fastcall BeginSplitResizing(int HitTest); + virtual void __fastcall ConstrainedResize(int &MinWidth, int &MinHeight, int &MaxWidth, int &MaxHeight); + virtual void __fastcall DoWindowStateChanged(Forms::TWindowState AWindowState); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall Resize(void); + virtual void __fastcall DoDrawCaptionPanel(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DockDrawBackground(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall ToolbarDrawBackground(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall InternalDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool PaintOnNCArea, bool PaintBorders = true); + __property int DefaultDockedSize = {read=FDefaultDockedSize, write=SetDefaultDockedSize, default=0}; + __property bool FixedDockedSize = {read=FFixedDockedSize, write=FFixedDockedSize, default=0}; + __property Imglist::TCustomImageList* Images = {read=GetImages, write=SetImages}; + __property Tb2item::TTBRootItem* Items = {read=GetRootItems}; + __property TSpTBXDockablePanelButtonOptions* Options = {read=FOptions, write=FOptions}; + __property bool ShowCaption = {read=FShowCaption, write=SetShowCaption, default=1}; + __property bool ShowCaptionWhenDocked = {read=FShowCaptionWhenDocked, write=SetShowCaptionWhenDocked, default=1}; + __property bool ShowVerticalCaption = {read=FShowVerticalCaption, write=SetShowVerticalCaption, default=0}; + __property Sptbxitem::TSpTBXDrawEvent OnDrawCaptionPanel = {read=FOnDrawCaptionPanel, write=FOnDrawCaptionPanel}; + __property TSpTBXWindowStateChangedEvent OnWindowStateChanged = {read=FOnWindowStateChanged, write=FOnWindowStateChanged}; + +public: + __fastcall virtual TSpTBXCustomDockablePanel(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomDockablePanel(void); + HIDESBASE void __fastcall AddDockForm(const Forms::TCustomForm* Form); + HIDESBASE void __fastcall RemoveDockForm(const Forms::TCustomForm* Form); + DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root); + DYNAMIC void __fastcall DoneReadingPositionData(const Tb2dock::TTBReadPositionData &Data); + DYNAMIC void __fastcall ReadPositionData(const Tb2dock::TTBReadPositionData &Data); + DYNAMIC void __fastcall WritePositionData(const Tb2dock::TTBWritePositionData &Data); + virtual void __fastcall InvalidateBackground(bool InvalidateChildren = true); + bool __fastcall IsVerticalTitleBar(void); + virtual bool __fastcall Maximize(void); + bool __fastcall Maximized(void); + virtual bool __fastcall Minimize(void); + bool __fastcall Minimized(void); + virtual bool __fastcall Restore(void); + bool __fastcall SizeToggle(bool ToMaximize); + __property Types::TPoint CaptionPanelSize = {read=GetCaptionPanelSize}; + __property int EffectiveWidth = {read=GetEffectiveWidth, write=SetEffectiveWidth, nodefault}; + __property int EffectiveHeight = {read=GetEffectiveHeight, write=SetEffectiveHeight, nodefault}; + __property int FloatingClientHeight = {read=GetFloatingClientHeight, write=SetFloatingClientHeight, nodefault}; + __property int FloatingClientWidth = {read=GetFloatingClientWidth, write=SetFloatingClientWidth, nodefault}; + __property Sptbxitem::TSpTBXToolbar* Toolbar = {read=GetToolbar}; + __property Tb2toolbar::TTBToolbarView* View = {read=GetView}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomDockablePanel(HWND ParentWindow) : Sptbxitem::TSpTBXCustomToolWindow(ParentWindow) { } + +private: + void *__ITBItems; /* Tb2item::ITBItems */ + +public: + #if defined(MANAGED_INTERFACE_OPERATORS) + operator Tb2item::_di_ITBItems() + { + Tb2item::_di_ITBItems intf; + GetInterface(intf); + return intf; + } + #else + operator ITBItems*(void) { return (ITBItems*)&__ITBItems; } + #endif + +}; + + +class DELPHICLASS TSpTBXDockablePanel; +class PASCALIMPLEMENTATION TSpTBXDockablePanel : public TSpTBXCustomDockablePanel +{ + typedef TSpTBXCustomDockablePanel inherited; + +__published: + __property ActivateParent = {default=1}; + __property Align = {default=0}; + __property Anchors = {default=3}; + __property CurrentDock; + __property DefaultDock; + __property DockableTo = {default=15}; + __property DockMode = {default=0}; + __property DockPos = {default=-1}; + __property DockRow = {default=0}; + __property FloatingMode = {default=0}; + __property Font; + __property HideWhenInactive = {default=1}; + __property LastDock; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property Resizable = {default=1}; + __property ShowHint; + __property TabOrder = {default=-1}; + __property UseLastDock = {default=1}; + __property Visible = {default=1}; + __property Height = {stored=true}; + __property Width = {stored=true}; + __property OnClose; + __property OnCloseQuery; + __property OnContextPopup; + __property OnDragDrop; + __property OnDragOver; + __property OnDockChanged; + __property OnDockChanging; + __property OnDockChangingHidden; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnMove; + __property OnRecreated; + __property OnRecreating; + __property OnResize; + __property OnVisibleChanged; + __property DefaultDockedSize = {default=0}; + __property FixedDockedSize = {default=0}; + __property Images; + __property Items; + __property Options; + __property ShowCaption = {default=1}; + __property ShowCaptionWhenDocked = {default=1}; + __property ShowVerticalCaption = {default=0}; + __property OnDrawCaptionPanel; + __property OnWindowStateChanged; +public: + /* TSpTBXCustomDockablePanel.Create */ inline __fastcall virtual TSpTBXDockablePanel(Classes::TComponent* AOwner) : TSpTBXCustomDockablePanel(AOwner) { } + /* TSpTBXCustomDockablePanel.Destroy */ inline __fastcall virtual ~TSpTBXDockablePanel(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXDockablePanel(HWND ParentWindow) : TSpTBXCustomDockablePanel(ParentWindow) { } + +}; + + +class PASCALIMPLEMENTATION TSpTBXCustomSplitter : public Controls::TCustomControl +{ + typedef Controls::TCustomControl inherited; + +private: + bool FAutoCalcMaxSize; + int FGripSize; + bool FGripHotTrack; + Controls::TControl* FMouseSplitControl; + Controls::TWinControl* FMouseActiveControl; + Graphics::TBrush* FMouseBrush; + Types::TPoint FMouseDownPos; + int FMousePrevSplitControlSize; + bool FMouseDownOnGrip; + bool FMouseOverGrip; + HDC FMouseLineDC; + bool FMouseLineVisible; + HBRUSH FMousePrevBrush; + bool FMoving; + int FMinSize; + int FMaxSize; + int FNewSize; + int FOldSize; + Controls::TKeyEvent FOldKeyDown; + Extctrls::TResizeStyle FResizeStyle; + Sptbxskins::TSpTBXSkinType FSkinType; + int FSplitLinePaintingPos; + Sptbxitem::TSpTBXDrawEvent FOnDrawBackground; + Sptbxcontrols::TSpTBXCanResizeEvent FOnMoving; + Classes::TNotifyEvent FOnMoved; + Types::TRect __fastcall GetGripRect(); + bool __fastcall GetMinimized(void); + void __fastcall SetGripSize(const int Value); + void __fastcall SetMinSize(const int Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + void __fastcall UpdateControlSize(Controls::TControl* SplitControl); + void __fastcall MouseCalcSplitSize(int X, int Y, int &NewSize, int &Split); + void __fastcall MouseAllocateLineDC(void); + void __fastcall MouseReleaseLineDC(void); + void __fastcall MouseDrawLine(void); + void __fastcall MouseFocusKeyDown(System::TObject* Sender, System::Word &Key, Classes::TShiftState Shift); + Controls::TControl* __fastcall ValidateSplitControl(void); + HIDESBASE MESSAGE void __fastcall CMMouseleave(Messages::TMessage &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + +protected: + int FRestorePos; + virtual void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoMoved(void); + virtual bool __fastcall DoMoving(int &NewSize); + bool __fastcall IsVertical(void); + DYNAMIC void __fastcall MouseStopSizing(void); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + virtual void __fastcall Paint(void); + virtual void __fastcall RequestAlign(void); + __property bool AutoCalcMaxSize = {read=FAutoCalcMaxSize, write=FAutoCalcMaxSize, default=1}; + __property int GripSize = {read=FGripSize, write=SetGripSize, default=50}; + __property bool GripHotTrack = {read=FGripHotTrack, write=FGripHotTrack, default=1}; + __property int MinSize = {read=FMinSize, write=SetMinSize, default=0}; + __property Extctrls::TResizeStyle ResizeStyle = {read=FResizeStyle, write=FResizeStyle, default=2}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; + __property Sptbxitem::TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; + __property Sptbxcontrols::TSpTBXCanResizeEvent OnMoving = {read=FOnMoving, write=FOnMoving}; + __property Classes::TNotifyEvent OnMoved = {read=FOnMoved, write=FOnMoved}; + +public: + __fastcall virtual TSpTBXCustomSplitter(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomSplitter(void); + void __fastcall ChangeSplitControlSize(int NewControlSize); + void __fastcall InvalidateGrip(void); + void __fastcall Minimize(void); + void __fastcall Restore(void); + void __fastcall Toggle(void); + __property Types::TRect GripRect = {read=GetGripRect}; + __property bool Minimized = {read=GetMinimized, nodefault}; + __property bool MouseOverGrip = {read=FMouseOverGrip, nodefault}; + __property bool Moving = {read=FMoving, nodefault}; + +__published: + __property Align = {default=3}; + __property Width = {default=5}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomSplitter(HWND ParentWindow) : Controls::TCustomControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXSplitter; +class PASCALIMPLEMENTATION TSpTBXSplitter : public TSpTBXCustomSplitter +{ + typedef TSpTBXCustomSplitter inherited; + +__published: + __property Align = {default=3}; + __property Color = {default=-16777211}; + __property Constraints; + __property ParentColor = {default=1}; + __property PopupMenu; + __property ShowHint; + __property Visible = {default=1}; + __property OnClick; + __property OnContextPopup; + __property OnDblClick; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property AutoCalcMaxSize = {default=1}; + __property GripSize = {default=50}; + __property MinSize = {default=0}; + __property ResizeStyle = {default=2}; + __property SkinType = {default=2}; + __property OnDrawBackground; + __property OnMoving; + __property OnMoved; +public: + /* TSpTBXCustomSplitter.Create */ inline __fastcall virtual TSpTBXSplitter(Classes::TComponent* AOwner) : TSpTBXCustomSplitter(AOwner) { } + /* TSpTBXCustomSplitter.Destroy */ inline __fastcall virtual ~TSpTBXSplitter(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXSplitter(HWND ParentWindow) : TSpTBXCustomSplitter(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +extern PACKAGE void __fastcall SpDrawXPDockablePanelTitleBar(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool IsActive, bool Vertical); +extern PACKAGE void __fastcall SpDrawXPDockablePanelBody(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool IsActive, bool IsFloating); +extern PACKAGE void __fastcall SpTBRegLoadPositions(const Classes::TComponent* OwnerComponent, const unsigned RootKey, const System::UnicodeString BaseRegistryKey); +extern PACKAGE void __fastcall SpTBRegSavePositions(const Classes::TComponent* OwnerComponent, const unsigned RootKey, const System::UnicodeString BaseRegistryKey); +extern PACKAGE void __fastcall SpTBIniLoadPositions(const Classes::TComponent* OwnerComponent, const Inifiles::TCustomIniFile* IniFile, const System::UnicodeString SectionNamePrefix)/* overload */; +extern PACKAGE void __fastcall SpTBIniSavePositions(const Classes::TComponent* OwnerComponent, const Inifiles::TCustomIniFile* IniFile, const System::UnicodeString SectionNamePrefix)/* overload */; +extern PACKAGE void __fastcall SpTBIniLoadPositions(const Classes::TComponent* OwnerComponent, const System::UnicodeString Filename, const System::UnicodeString SectionNamePrefix)/* overload */; +extern PACKAGE void __fastcall SpTBIniSavePositions(const Classes::TComponent* OwnerComponent, const System::UnicodeString Filename, const System::UnicodeString SectionNamePrefix)/* overload */; + +} /* namespace Sptbxdkpanels */ +using namespace Sptbxdkpanels; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxdkpanelsHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.pas new file mode 100644 index 0000000..7109441 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXDkPanels.pas @@ -0,0 +1,3547 @@ +unit SpTBXDkPanels; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development notes: + - All the Windows and Delphi bugs fixes are marked with '[Bugfix]'. + - All the theme changes and adjustments are marked with '[Theme-Change]'. + - All the DockablePanels rules are marked with '[DockablePanel-Rule]'. + - To handle the size constraints use GetMinMaxSize when the DP is floating, + and ConstrainedResize when is Docked (explicitly check if it's docked). + +Limitations: + - DockablePanels can be docked only on MultiDocks. + - MultiDocks doesn't have lateral splitters, you can solve this by + adding a TSpTBXSplitter on the Form. + +History: +8 May 2009 - version 2.4.2 + - Fixed incorrect TSpTBXDockablePanel floating border + painting on Vista with Aero enabled, thanks to Mattias + Andersson for reporting this. + +15 March 2009 - version 2.4.1 + - Fixed TSpTBXSplitter bug, it wasn't correctly minimized + when MinSize was 1, 2 or 3, thanks to Sertac Akyuz for + fixing this. + - Fixed TSpTBXSplitter bug, it wasn't correctly restored + when SpTBIniLoadPositions was called. + - Fixed incorrect TSpTBXDockablePanel behavior, when DockMode + is dmCannotFloat the DP should be able to be re-docked, + thanks to Ivan Petrovic for reporting this. + - Fixed incorrect TSpTBXDockablePanel behavior, it wasn't + correctly resized when using the embedded splitter, thanks + to Gilles Arcas for reporting this. + - Fixed incorrect TSpTBXDockablePanel painting, + OnDrawCaptionPanel wasn't called when painting the NC + area borders, thanks to Mikael Stalvik for reporting this. + +17 January 2009 - version 2.4 + - Added FloatingClientWidth and FloatingClientHeight public + properties to TSpTBXDockablePanel. + - Added TaskPaneStyleResize property to TSpTBXDockablePanel, + when this property is set to True the Minimize/Restore + behavior will be the same as the Windows Task Pane (the + DockablePanel is minimized from bottom to top). + - Changed TSpTBXDockablePanel undocking behavior the panel + will remember the previous floating size when it is + undocked. + - Changed TSpTBXDockablePanel docking behavior, when the + panel is docked on an empty MultiDock it will use the + DefaultDockedSize property to set its size. + If DefaultDockedSize is 0 it will use the floating size. + +26 September 2008 - version 2.3 + - Added DefaultDockedSize property to TSpTBXDockablePanel, + this property is used to set the DockablePanel size when + it's docked on an empty MultiDock. + - Added ShowVerticalCaption property to TSpTBXDockablePanel, + this property is used to rotate the caption panel vertically. + When the DockablePanel is floating or docked on a vertical + MultiDock the caption will be horizontal regardless of the + value of ShowVerticalCaption. + - Fixed TSpTBXDockablePanel bug, anchored children were not + correctly resized when the Form was loaded, thanks to + Alex Neznanov for reporting this. + - Fixed TSpTBXDockablePanel bug, hiding/restoring a DP + misaligned the adjacent splitter, thanks to Alexander for + reporting this (related to Delphi's zero size align bug). + - Fixed TSpTBXDockablePanel bug, dragging a floating DP + with CTRL key pressed should not dock the DP. + +29 July 2008 - version 2.2 + - Fixed TSpTBXDockablePanel bug, an AV was raised when the + DockablePanel was undocked when it was minimized by an + adjacent splitter, thanks to Minoru Yoshida for reporting this. + +26 June 2008 - version 2.1 + - Added AutoSplitterVisibility property to TSpTBXMultiDock, + use this property to automatically hide the adjacent + splitter when the MultiDock is empty. + - Added OnWindowStateChanged event to TSpTBXDockablePanel, + this event is fired when the DockablePanel gets minimized, + maximized or restored. + - Fixed TSpTBXDockablePanel bug, the floating panel was able to be + dragged offscreen leaving no way to move it back, thanks to + Minoru Yoshida for reporting this. + - Fixed TSpTBXSplitter bug, incorrect alignment when the split + control was minimized and the Form was resized, thanks to + Den and Minoru Yoshida for reporting this. + +3 May 2008 - version 2.0 + - Decoupled from TBX. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, Classes, SysUtils, Controls, Graphics, ImgList, Forms, + Menus, StdCtrls, ExtCtrls, ActnList, IniFiles, + TB2Item, TB2Dock, TB2Toolbar, + SpTBXSkins, SpTBXItem, SpTBXControls; + +type + TSpTBXCustomDockablePanel = class; + TSpTBXCustomSplitter = class; + + TSpTBXDockStateRec = record + DockedState: TWindowState; + RestoreSize: Integer; + end; + + TSpTBXDockPosition = ( + dpxLeft, // dpLeft + dpxTop, // dpTop + dpxRight, // dpRight + dpxBottom, // dpBottom + dpxClient // dpRight + ); + + TSpTBXDPResizeType = ( + dprtManualResize, + dprtMinimizeOrRestore, + dprtMinimizeOrRestoreTaskPaneStyle, + dprtSplitResize + ); + + TSpTBXWindowStateChangedEvent = procedure(Sender: TObject; AWindowState: TWindowState) of object; + + { TSpTBXMultiDock } + + TSpTBXCustomMultiDock = class(TTBDock) + private + FAutoSplitterVisibility: Boolean; + FLimitToOneRow: Boolean; + FLastSplitter: TSpTBXCustomSplitter; + FPosition: TSpTBXDockPosition; + FUpdatingLateralSize: Boolean; + FOnInsertRemoveBar: TTBInsertRemoveEvent; + FOnRequestDock: TTBRequestDockEvent; + procedure UpdateDPLateralSize(AWidth, AHeight: Integer); + procedure SetPosition(const Value: TSpTBXDockPosition); + procedure SetLimitToOneRow(const Value: Boolean); + protected + procedure AlignControls(AControl: TControl; var Rect: TRect); override; + procedure DoInsertRemoveBar(Sender: TObject; Inserting: Boolean; Bar: TTBCustomDockableWindow); virtual; // OnInsertRemoveBar is republished + procedure DoRequestDock(Sender: TObject; Bar: TTBCustomDockableWindow; var Accept: Boolean); virtual; // OnRequestDock is republished + procedure Loaded; override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure ValidateInsert(AComponent: TComponent); override; + + procedure InsertingOnEmptyDock; + function GetAdjacentSplitter(SpacingDelta: Integer = 1): TSpTBXCustomSplitter; + public + constructor Create(AOwner: TComponent); override; + function IsVertical: Boolean; + procedure GetDockablePanelList(DPList: TList); + procedure GetDockablePanelDockIndex(DPList: TList; DP: TSpTBXCustomDockablePanel; out DPDockIndex: Integer); + procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override; + property UpdatingLateralSize: Boolean read FUpdatingLateralSize; + published + // Republish LimitToOneRow, the inherited LimitToOneRow should always be True + property LimitToOneRow: Boolean read FLimitToOneRow write SetLimitToOneRow default True; + property Position: TSpTBXDockPosition read FPosition write SetPosition default dpxLeft; + property AutoSplitterVisibility: Boolean read FAutoSplitterVisibility write FAutoSplitterVisibility default True; + // Republish OnInsertRemoveBar, use the inherited OnRequestDock to show/hide the Splitter + property OnInsertRemoveBar: TTBInsertRemoveEvent read FOnInsertRemoveBar write FOnInsertRemoveBar; + // Republish OnRequestDock, use the inherited OnRequestDock to deny non DPs + property OnRequestDock: TTBRequestDockEvent read FOnRequestDock write FOnRequestDock; + end; + + TSpTBXMultiDock = class(TSpTBXCustomMultiDock); + + { TSpTBXDockablePanelButtonOptions } + + TSpTBXDockablePanelButtonOptions = class(TSpTBXButtonOptions) + private + FTaskPaneStyleResize: Boolean; + protected + FDockablePanel: TSpTBXCustomDockablePanel; + procedure ButtonsClick(Sender: TObject); override; + procedure CreateButtons; override; + function Restoring(B: TSpTBXCustomItem): Boolean; override; + procedure SetupButton(B: TSpTBXCustomItem); override; + public + constructor Create(AParent: TWinControl); override; + published + property Maximize default False; + property Minimize default False; + property TaskPaneStyleResize: Boolean read FTaskPaneStyleResize write FTaskPaneStyleResize default False; + property TitleBarMaxSize default 19; + end; + + { TSpTBXDockablePanelToolbar } + + TSpTBXDockablePanelToolbar = class(TSpTBXToolbar) + protected + function CanItemClick(Item: TTBCustomItem; Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer): Boolean; override; + function GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; override; + function GetRightAlignMargin: Integer; override; + public + constructor Create(AOwner: TComponent); override; + function GetParentDockablePanel: TSpTBXCustomDockablePanel; + end; + + { TSpTBXDockablePanel } + + TSpTBXCustomDockablePanel = class(TSpTBXCustomToolWindow, ITBItems) + private + FDefaultDockedSize: Integer; + FFixedDockedSize: Boolean; + FFloatingClientHeight: Integer; + FFloatingClientWidth: Integer; + FIsDockedMoving: Boolean; + FIsManualSizing: Boolean; + FLoadedBarSize: TSize; + FLoadedDockPos: Integer; + FLoadedState: TWindowState; + FOptions: TSpTBXDockablePanelButtonOptions; + FShowCaption: Boolean; + FShowCaptionWhenDocked: Boolean; + FOnDrawCaptionPanel: TSpTBXDrawEvent; + FOnWindowStateChanged: TSpTBXWindowStateChangedEvent; + FShowVerticalCaption: Boolean; + function CanSplitResize(EdgePosition: TTBDockPosition): Boolean; + procedure DockRequestDock(Sender: TObject; Bar: TTBCustomDockableWindow; var Accept: Boolean); + procedure DockResize(Sender: TObject); + function InternalMaximize(Restore: Boolean): Boolean; + procedure UpdateTitleBarRotation; + function GetCaptionPanelSize: TPoint; + function GetEffectiveHeight: Integer; + function GetEffectiveWidth: Integer; + function GetFloatingClientHeight: Integer; + function GetFloatingClientWidth: Integer; + function GetImages: TCustomImageList; + function GetItems: TTBCustomItem; // For ITBItems interface + function GetRootItems: TTBRootItem; + function GetToolbar: TSpTBXToolbar; + function GetView: TTBToolbarView; + procedure SetDefaultDockedSize(Value: Integer); + procedure SetEffectiveHeight(const Value: Integer); + procedure SetEffectiveWidth(const Value: Integer); + procedure SetFloatingClientHeight(const Value: Integer); + procedure SetFloatingClientWidth(const Value: Integer); + procedure SetImages(const Value: TCustomImageList); + procedure SetShowCaption(const Value: Boolean); + procedure SetShowCaptionWhenDocked(const Value: Boolean); + procedure SetShowVerticalCaption(const Value: Boolean); + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE; + procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; + procedure WMNCLButtonDown(var Message: TWMNCLButtonDown); message WM_NCLBUTTONDOWN; + procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR; + protected + FPanel: TPanel; + FToolbarDock: TSpTBXDock; + FToolbar: TSpTBXDockablePanelToolbar; + FState: TSpTBXDockStateRec; + FDockForms: TList; + + // Component + procedure CreateParams(var Params: TCreateParams); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure Loaded; override; + procedure SetParent(AParent: TWinControl); override; + procedure ValidateContainer(AComponent: TComponent); override; + + // Sizing + procedure BeginDockedMoving; + procedure BeginSplitResizing(HitTest: Integer); + procedure ConstrainedResize(var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer); override; + procedure DoWindowStateChanged(AWindowState: TWindowState); virtual; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure Resize; override; + + // Painting + procedure DoDrawCaptionPanel(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DockDrawBackground(Sender: TObject; ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure ToolbarDrawBackground(Sender: TObject; ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure InternalDrawBackground(ACanvas: TCanvas; ARect: TRect; PaintOnNCArea: Boolean; PaintBorders: Boolean = True); override; + + property DefaultDockedSize: Integer read FDefaultDockedSize write SetDefaultDockedSize default 0; + property FixedDockedSize: Boolean read FFixedDockedSize write FFixedDockedSize default False; + property Images: TCustomImageList read GetImages write SetImages; + property Items: TTBRootItem read GetRootItems; + property Options: TSpTBXDockablePanelButtonOptions read FOptions write FOptions; + property ShowCaption: Boolean read FShowCaption write SetShowCaption default True; + property ShowCaptionWhenDocked: Boolean read FShowCaptionWhenDocked write SetShowCaptionWhenDocked default True; + property ShowVerticalCaption: Boolean read FShowVerticalCaption write SetShowVerticalCaption default False; + property OnDrawCaptionPanel: TSpTBXDrawEvent read FOnDrawCaptionPanel write FOnDrawCaptionPanel; + property OnWindowStateChanged: TSpTBXWindowStateChangedEvent read FOnWindowStateChanged write FOnWindowStateChanged; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + procedure AddDockForm(const Form: TTBCustomForm); + procedure RemoveDockForm(const Form: TTBCustomForm); + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; // For ITBItems interface + procedure DoneReadingPositionData(const Data: TTBReadPositionData); override; + procedure ReadPositionData(const Data: TTBReadPositionData); override; + procedure WritePositionData(const Data: TTBWritePositionData); override; + procedure InvalidateBackground(InvalidateChildren: Boolean = True); override; + function IsVerticalTitleBar: Boolean; + function Maximize: Boolean; virtual; + function Maximized: Boolean; + function Minimize: Boolean; virtual; + function Minimized: Boolean; + function Restore: Boolean; virtual; + function SizeToggle(ToMaximize: Boolean): Boolean; + + property CaptionPanelSize: TPoint read GetCaptionPanelSize; + property EffectiveWidth: Integer read GetEffectiveWidth write SetEffectiveWidth; + property EffectiveHeight: Integer read GetEffectiveHeight write SetEffectiveHeight; + property FloatingClientHeight: Integer read GetFloatingClientHeight write SetFloatingClientHeight; + property FloatingClientWidth: Integer read GetFloatingClientWidth write SetFloatingClientWidth; + property Toolbar: TSpTBXToolbar read GetToolbar; + property View: TTBToolbarView read GetView; + end; + + TSpTBXDockablePanel = class(TSpTBXCustomDockablePanel) + published + property ActivateParent; + property Align; + property Anchors; + property CurrentDock; + property DefaultDock; + property DockableTo; + property DockMode; + property DockPos; + property DockRow; + property FloatingMode; + property Font; + property HideWhenInactive; + property LastDock; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property Resizable; + property ShowHint; + property TabOrder; + property UseLastDock; + property Visible; + // TTBCustomDockableWindow doesn't store the Width and Height, make + // sure it is stored and do not store TSpTBXCustomToolWindow + // ClientWidth/ClientHeight + property Height stored True; + property Width stored True; + property OnClose; + property OnCloseQuery; + property OnContextPopup; + property OnDragDrop; + property OnDragOver; + property OnDockChanged; + property OnDockChanging; + property OnDockChangingHidden; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnMove; + property OnRecreated; + property OnRecreating; + property OnResize; + property OnVisibleChanged; + // TSpTBXCustomDockablePanel properties + property DefaultDockedSize; + property FixedDockedSize; + property Images; + property Items; + property Options; + property ShowCaption; + property ShowCaptionWhenDocked; + property ShowVerticalCaption; + property OnDrawCaptionPanel; + property OnWindowStateChanged; + end; + + { TSpTBXSplitter } + + TSpTBXCustomSplitter = class(TCustomControl) + private + FAutoCalcMaxSize: Boolean; + FGripSize: Integer; + FGripHotTrack: Boolean; + FMouseSplitControl: TControl; + FMouseActiveControl: TWinControl; + FMouseBrush: TBrush; + FMouseDownPos: TPoint; + FMousePrevSplitControlSize: Integer; + FMouseDownOnGrip: Boolean; + FMouseOverGrip: Boolean; + FMouseLineDC: HDC; + FMouseLineVisible: Boolean; + FMousePrevBrush: HBrush; + FMoving: Boolean; + FMinSize: Integer; + FMaxSize: Integer; + FNewSize: Integer; + FOldSize: Integer; + FOldKeyDown: TKeyEvent; + FResizeStyle: TResizeStyle; + FSkinType: TSpTBXSkinType; + FSplitLinePaintingPos: Integer; + FOnDrawBackground: TSpTBXDrawEvent; + FOnMoving: TSpTBXCanResizeEvent; + FOnMoved: TNotifyEvent; + function GetGripRect: TRect; + function GetMinimized: Boolean; + procedure SetGripSize(const Value: Integer); + procedure SetMinSize(const Value: integer); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure UpdateControlSize(SplitControl: TControl); + procedure MouseCalcSplitSize(X, Y: Integer; var NewSize, Split: Integer); + procedure MouseAllocateLineDC; + procedure MouseReleaseLineDC; + procedure MouseDrawLine; + procedure MouseFocusKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + function ValidateSplitControl: TControl; + procedure CMMouseleave(var Message: TMessage); message CM_MOUSELEAVE; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + procedure WMEraseBkgnd(var Message: TWmEraseBkgnd); message WM_ERASEBKGND; + protected + FRestorePos: Integer; + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DoMoved; virtual; + function DoMoving(var NewSize: Integer): Boolean; virtual; + function IsVertical: Boolean; + procedure MouseStopSizing; dynamic; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure Paint; override; + procedure RequestAlign; override; + property AutoCalcMaxSize: Boolean read FAutoCalcMaxSize write FAutoCalcMaxSize default True; + property GripSize: Integer read FGripSize write SetGripSize default 50; + property GripHotTrack: Boolean read FGripHotTrack write FGripHotTrack default True; + property MinSize: Integer read FMinSize write SetMinSize default 0; + property ResizeStyle: TResizeStyle read FResizeStyle write FResizeStyle default rsUpdate; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + property OnMoving: TSpTBXCanResizeEvent read FOnMoving write FOnMoving; + property OnMoved: TNotifyEvent read FOnMoved write FOnMoved; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure ChangeSplitControlSize(NewControlSize: Integer); + procedure InvalidateGrip; + procedure Minimize; + procedure Restore; + procedure Toggle; + property GripRect: TRect read GetGripRect; + property Minimized: Boolean read GetMinimized; + property MouseOverGrip: Boolean read FMouseOverGrip; + property Moving: Boolean read FMoving; + published + property Align default alLeft; + property Width default 5; + end; + + TSpTBXSplitter = class(TSpTBXCustomSplitter) + published + property Align; + property Color; + property Constraints; + property ParentColor; + property PopupMenu; + property ShowHint; + property Visible; + property OnClick; + property OnContextPopup; + property OnDblClick; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + // TSpTBXCustomSplitter properties + property AutoCalcMaxSize; + property GripSize; + property MinSize; + property ResizeStyle; + property SkinType; + property OnDrawBackground; + property OnMoving; + property OnMoved; + end; + +{ Painting helpers } +procedure SpDrawXPDockablePanelTitleBar(ACanvas: TCanvas; ARect: TRect; IsActive, Vertical: Boolean); +procedure SpDrawXPDockablePanelBody(ACanvas: TCanvas; ARect: TRect; IsActive, IsFloating: Boolean); + +{ Toolbar Load/Save Position helpers } +procedure SpTBRegLoadPositions(const OwnerComponent: TComponent; const RootKey: DWORD; const BaseRegistryKey: string); +procedure SpTBRegSavePositions(const OwnerComponent: TComponent; const RootKey: DWORD; const BaseRegistryKey: string); +procedure SpTBIniLoadPositions(const OwnerComponent: TComponent; const Filename, SectionNamePrefix: string); overload; +procedure SpTBIniLoadPositions(const OwnerComponent: TComponent; const IniFile: TCustomIniFile; const SectionNamePrefix: string); overload; +procedure SpTBIniSavePositions(const OwnerComponent: TComponent; const Filename, SectionNamePrefix: string); overload; +procedure SpTBIniSavePositions(const OwnerComponent: TComponent; const IniFile: TCustomIniFile; const SectionNamePrefix: string); overload; + +implementation + +uses + Types, ComCtrls, Registry, TB2Consts, TB2Common; + +const + DockedBorderSize = 2; + HT_TB2k_Border = 2000; + HT_DP_SPLITRESIZELEFT = 86; + HT_DP_SPLITRESIZERIGHT = 87; + HT_DP_SPLITRESIZETOP = 88; + HT_DP_SPLITRESIZEBOTTOM = 89; + // Constants for ini/registry values. Do not localize! + rvMultiDockWidth = 'MultiDockWidth'; + rvMultiDockHeight = 'MultiDockHeight'; + rvFloatingClientWidth = 'FloatingClientWidth'; + rvFloatingClientHeight = 'FloatingClientHeight'; + rvRestoreSize = 'RestoreSize'; + rvState = 'State'; + rvSplitterRestorePos = 'SplitterRestorePos'; + +type + TTBCustomItemAccess = class(TTBCustomItem); + TSpTBXCustomItemAccess = class(TSpTBXCustomItem); + TTBDockAccess = class(TTBDock); + TControlAccess = class(TControl); + TWinControlAccess = class(TWinControl); + + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +procedure SpFixDelphiAlignBug(W: TControl; NewSize: Integer; Splitter: TControl); +// [Bugfix] +{ Try to fix a Delphi align bug when a control is right or bottom aligned and + its size is changed. + To reproduce this: + - On a new form drop 3 TPanels, align them to the bottom, don't change the size. + - Drop a button, on its OnClick event change the middle panel size to 200. + - Run the app, when you click the button the middle panel will be moved to the bottom of the form. + + Another Delphi bug: the controls aligning is based on the Controls array when they + have the same position. + For example: + Form1.DisableAlign; + try + Control1.Left:= 10; Control1.Top:= 10; + Control1.Align:= alLeft; + Control2.Left:= 10; Control2.Top:= 10; + Control2.Align:= alLeft; + // Control1 has the aligning priority because it has lower index in the Controls array + finally + Form1.EnableAlign; + end; + + This will affect the splitter when the splitter is Minimized or Maximazed to 0. + Thats why the standard Borland TSplitter must minimize to a value higher than 0. + + Solution: we must move the splitter before or after the other control + based on the Align property, for that we use SendToBack and BringToFront methods. + SendToBack and BringToFront besides of changing the "z-order" changes the + order of the control in the Controls array, SendToBack moves the control + to the first position while BringToFront moves it the last position. + + When Align is alLeft or alTop we should make the splitter to have the + aligning priority using BringToFront. + And when Align is alRight or alBottom we will use SendToBack. } +var + I, Delta: Integer; + PrevBounds: TRect; + C: TControl; +begin + case W.Align of + alLeft: + begin + if Assigned(Splitter) then Splitter.BringToFront; + W.SendToBack; + W.Width := NewSize; + end; + alTop: + begin + if Assigned(Splitter) then Splitter.BringToFront; + W.SendToBack; + W.Height := NewSize; + end; + alRight: + begin + W.Parent.DisableAlign; + if W is TSpTBXCustomMultiDock then + TSpTBXCustomMultiDock(W).BeginUpdate; + try + if Assigned(Splitter) then Splitter.SendToBack; + W.BringToFront; + PrevBounds := W.BoundsRect; + W.Width := NewSize; + Delta := (PrevBounds.Right - PrevBounds.Left) - W.Width; + + // Move all children + for I := 0 to W.Parent.ControlCount - 1 do begin + C := W.Parent.Controls[I]; + if C.Align = W.Align then + if (C = Splitter) and (PrevBounds.Right - PrevBounds.Left = 0) then + C.Left := C.Left + Delta - 1 + else + if (C.Left < PrevBounds.Right) or ((C = W) and (C.Left = PrevBounds.Right)) then + C.Left := C.Left + Delta; + end; + finally + if W is TSpTBXCustomMultiDock then + TSpTBXCustomMultiDock(W).EndUpdate; + W.Parent.EnableAlign; + end; + end; + alBottom: + begin + W.Parent.DisableAlign; + if W is TSpTBXCustomMultiDock then + TSpTBXCustomMultiDock(W).BeginUpdate; + try + if Assigned(Splitter) then Splitter.SendToBack; + W.BringToFront; + PrevBounds := W.BoundsRect; + W.Height := NewSize; + Delta := (PrevBounds.Bottom - PrevBounds.Top) - W.Height; + + // Move all children + for I := 0 to W.Parent.ControlCount - 1 do begin + C := W.Parent.Controls[I]; + if C.Align = W.Align then + if (C = Splitter) and (PrevBounds.Bottom - PrevBounds.Top = 0) then + C.Top := C.Top + Delta - 1 + else + if (C.Top < PrevBounds.Bottom) or ((C = W) and (C.Top = PrevBounds.Bottom)) then + C.Top := C.Top + Delta; + end; + finally + if W is TSpTBXCustomMultiDock then + TSpTBXCustomMultiDock(W).EndUpdate; + W.Parent.EnableAlign; + end; + end; + end; +end; + +function SpAdjacentSplitter(Dock: TTBDock; Space: Integer = 1): TSpTBXCustomSplitter; +var + I: Integer; + P: TPoint; + R: TRect; + C: TControl; +begin + Result := nil; + + P := Point(Dock.Left, Dock.Top); + case Dock.Position of + dpLeft: Inc(P.X, Dock.Width + Space); + dpRight: Dec(P.X, Space); + dpTop: Inc(P.Y, Dock.Height + Space); + dpBottom: Dec(P.Y, Space); + end; + + for I := 0 to Dock.Parent.ControlCount - 1 do begin + C := Dock.Parent.Controls[I]; + R := C.BoundsRect; + if (C.Align = Dock.Align) and (C is TSpTBXCustomSplitter) then begin + // The splitter should be adjacent to the Dock + // Or the splitter is not visible and a DP is being docked on an + // empty Dock. + if PtInRect(R, P) or + (not C.Visible and (Space = -1)) then + begin + Result := TSpTBXCustomSplitter(C); + Break; + end; + end; + end; +end; + +procedure SpDPGetDockableMultiDockList(DP: TSpTBXCustomDockablePanel; var L: TList); +// Returns a valid list of MultiDocks where the DP can dock to. + + procedure Recurse(const ParentCtl: TWinControl); + var + M: TTBDock; + I: Integer; + begin + if DP.ContainsControl(ParentCtl) or not ParentCtl.Showing then Exit; + + for I := 0 to ParentCtl.ControlCount-1 do + if ParentCtl.Controls[I] is TSpTBXCustomMultiDock then begin + M := TSpTBXCustomMultiDock(ParentCtl.Controls[I]); + if (L.IndexOf(M) = -1) and M.Visible and M.AllowDrag and (M.Position in DP.DockableTo) then + if DP.CurrentDock = M then + L.Insert(0, M) // Add CurrentDock to the DockList first so that it gets priority + else + L.Add(M); + end + else + if (ParentCtl.Controls[I] is TWinControl) and not (ParentCtl.Controls[I] is TTBDock) then + Recurse(TWinControl(ParentCtl.Controls[I])); + end; + +var + ParentForm: TTBCustomForm; + DockFormsList: TList; + I, J: Integer; +begin + L.Clear; + ParentForm := TBGetToolWindowParentForm(DP); + DockFormsList := TList.Create; + try + if Assigned(DP.FDockForms) then begin + for I := 0 to Screen.CustomFormCount - 1 do begin + J := DP.FDockForms.IndexOf(Screen.CustomForms[I]); + if (J > -1) and (DP.FDockForms[J] <> ParentForm) then + DockFormsList.Add(DP.FDockForms[J]); + end; + end; + + if Assigned(ParentForm) then + DockFormsList.Insert(0, ParentForm); + + for I := 0 to DockFormsList.Count - 1 do + Recurse(DockFormsList[I]); + finally + DockFormsList.Free; + end; +end; + +function SpDPInmediateResizableSibling(DP: TSpTBXCustomDockablePanel; + ResizeType: TSpTBXDPResizeType; out IsAdjacent: Boolean): TSpTBXCustomDockablePanel; +// Returns the inmediate resizable DP sibling + + function CanResizeAdjacent(Adjacent: TSpTBXCustomDockablePanel): Boolean; + var + R: TRect; + begin + Result := False; + if Adjacent.FState.DockedState <> wsMinimized then begin + R := Rect(1, 1, 0, 0); + Adjacent.ConstrainedResize(R.Left, R.Top, R.Right, R.Bottom); + Result := (R.Top <> R.Bottom) and (R.Left <> R.Right); + end; + end; + +var + I, J: Integer; + MultiDock: TSpTBXCustomMultiDock; + L: TList; + DkPanel: TSpTBXCustomDockablePanel; +begin + Result := nil; + DkPanel := nil; + IsAdjacent := False; + if not (DP.CurrentDock is TSpTBXCustomMultiDock) then Exit; + + if DP.Docked then begin + L := TList.Create; + try + MultiDock := TSpTBXCustomMultiDock(DP.CurrentDock); + MultiDock.GetDockablePanelList(L); + if L.Count <= 1 then Exit; + + // Resize only the inmediate dockable panel sibling + // Find DP on the DockList + for I := 0 to L.Count - 1 do + if L[I] = DP then begin + DkPanel := L[I]; + Break; + end; + + // Find the inmediate resizable sibling + if Assigned(DkPanel) then + if ResizeType = dprtMinimizeOrRestore then begin + // Find the prev sibling + if I > 0 then + for J := I - 1 downto 0 do begin + if CanResizeAdjacent(L[J]) then begin + Result := L[J]; + IsAdjacent := J = I - 1; + Break; + end; + end; + // If not found find the next sibling + if not Assigned(Result) then + for J := I + 1 to L.Count - 1 do + if CanResizeAdjacent(L[J]) then begin + Result := L[J]; + IsAdjacent := J = I + 1; + Break; + end; + end + else begin + // Find the next sibling + if I + 1 < L.Count then + for J := I + 1 to L.Count - 1 do + if CanResizeAdjacent(L[J]) then begin + Result := L[J]; + IsAdjacent := J = I + 1; + Break; + end; + // If not found find the prev sibling + if not Assigned(Result) then + for J := I - 1 downto 0 do + if CanResizeAdjacent(L[J]) then begin + Result := L[J]; + IsAdjacent := J = I - 1; + Break; + end; + end; + finally + L.Free; + end; + end; +end; + +procedure SpDPUpdateDockPos(DPList: TList; IsVertical: Boolean); overload; +// Updates the DP.DockPos on all the DPs on the list +var + I, TotalDockPos: Integer; + DP: TSpTBXCustomDockablePanel; +begin + TotalDockPos := 0; + for I := 0 to DPList.Count - 1 do begin + DP := DPList[I]; + if IsVertical then begin + DP.DockPos := TotalDockPos; + Inc(TotalDockPos, DP.Height); + end + else begin + DP.DockPos := TotalDockPos; + Inc(TotalDockPos, DP.Width); + end; + end; +end; + +procedure SpDPUpdateDockPos(MultiDock: TSpTBXCustomMultiDock); overload; +// Updates the DP.DockPos on all the DPs on a MultiDock +var + L: TList; +begin + L := TList.Create; + MultiDock.BeginUpdate; + try + MultiDock.GetDockablePanelList(L); + SpDPUpdateDockPos(L, MultiDock.IsVertical); + finally + Multidock.EndUpdate; + L.Free; + end; +end; + +procedure SpDPSwapPos(MultiDock: TSpTBXCustomMultiDock; DP1, DP2: TSpTBXCustomDockablePanel); +// Swaps the positions of two DPs +var + L: TList; + I, DP1Index, DP2Index: Integer; + Temp: TSpTBXCustomDockablePanel; +begin + L := TList.Create; + MultiDock.BeginUpdate; + try + MultiDock.GetDockablePanelList(L); + + // Find the DPs indexes + DP1Index := -1; + DP2Index := -1; + for I := 0 to L.Count - 1 do begin + Temp := L[I]; + if Temp = DP1 then DP1Index := I; + if Temp = DP2 then DP2Index := I; + if (DP1Index > -1) and (DP2Index > -1) then Break; + end; + + if (DP1Index > -1) and (DP2Index > -1) then begin + // Swap the DPs + Temp := L[DP1Index]; + L[DP1Index] := L[DP2Index]; + L[DP2Index] := Temp; + // Adjust the Dock Pos + SpDPUpdateDockPos(L, MultiDock.IsVertical); + end; + finally + Multidock.EndUpdate; + L.Free; + end; +end; + +function SpDPResize(DP: TSpTBXCustomDockablePanel; NewSize: Integer; ResizeType: TSpTBXDPResizeType = dprtManualResize): Boolean; +var + PrevSize, Delta, MinSize: Integer; + MultiDock: TSpTBXCustomMultiDock; + DPSibling: TSpTBXCustomDockablePanel; + IsDPSiblingAdjacent: Boolean; +begin + Result := False; + + if DP.Docked then begin + if not (DP.CurrentDock is TSpTBXCustomMultiDock) then Exit; + + MultiDock := TSpTBXCustomMultiDock(DP.CurrentDock); + if MultiDock.ToolbarCount < 2 then Exit; + + MultiDock.BeginUpdate; + try + // Resize only the inmediate dockable panel sibling + DPSibling := SpDPInmediateResizableSibling(DP, ResizeType, IsDPSiblingAdjacent); + if Assigned(DPSibling) then begin + case ResizeType of + dprtManualResize, dprtMinimizeOrRestore, dprtMinimizeOrRestoreTaskPaneStyle: + begin + if MultiDock.IsVertical then begin + PrevSize := DP.Height; + DP.Height := NewSize; + Delta := DP.Height - PrevSize; + DPSibling.Height := DPSibling.Height - Delta; + end + else begin + PrevSize := DP.Width; + DP.Width := NewSize; + Delta := DP.Width - PrevSize; + DPSibling.Width := DPSibling.Width - Delta; + end; + SpDPUpdateDockPos(MultiDock); + end; + dprtSplitResize: + begin + // If DP can't be resized find another sibling + if DP.FixedDockedSize then begin + if MultiDock.IsVertical then + Delta := NewSize - DP.Height + else + Delta := NewSize - DP.Width; + + DP := DPSibling; + DPSibling := SpDPInmediateResizableSibling(DP, ResizeType, IsDPSiblingAdjacent); + if not Assigned(DPSibling) then + Exit; + + if MultiDock.IsVertical then begin + NewSize := DP.Height - Delta; + if (DPSibling.Height + Delta < DPSibling.MinClientHeight + (DockedBorderSize * 2)) or + (NewSize < DP.MinClientHeight + (DockedBorderSize * 2)) then + begin + Exit; + end; + DPSibling.Height := DPSibling.Height + Delta; + end + else begin + NewSize := DP.Width - Delta; + if (DPSibling.Width + Delta < DPSibling.MinClientWidth + (DockedBorderSize * 2)) or + (NewSize < DP.MinClientWidth + (DockedBorderSize * 2)) then + begin + Exit; + end; + DPSibling.Width := DPSibling.Width + Delta; + end; + end; + + // Resize the DP and DPSibling + if MultiDock.IsVertical then begin + if NewSize < DP.MinClientHeight + (DockedBorderSize * 2) then + Exit; + PrevSize := DP.Height; + Delta := NewSize - PrevSize; + MinSize := DPSibling.MinClientHeight + (DockedBorderSize * 2); + if DPSibling.Height - Delta < MinSize then begin + Delta := DPSibling.Height - MinSize; + if Delta <= 0 then Exit; + DP.Height := PrevSize + Delta; + end + else + DP.Height := NewSize; + end + else begin + if NewSize < DP.MinClientWidth + (DockedBorderSize * 2) then + Exit; + PrevSize := DP.Width; + Delta := NewSize - PrevSize; + MinSize := DPSibling.MinClientWidth + (DockedBorderSize * 2); + if DPSibling.Width - Delta < MinSize then begin + Delta := DPSibling.Width - MinSize; + if Delta <= 0 then Exit; + DP.Width := PrevSize + Delta; + end + else + DP.Width := NewSize; + end; + + if IsDPSiblingAdjacent then + if DP.EffectiveDockPos < DPSibling.EffectiveDockPos then + DPSibling.DockPos := DPSibling.EffectiveDockPos + Delta + else + DP.DockPos := DP.EffectiveDockPos - Delta; + end; + end; + + Result := True; + end; + finally + MultiDock.EndUpdate; + if ResizeType = dprtSplitResize then + SpDPUpdateDockPos(MultiDock) // Update DockPos of all the DPs, including the non-visible DPs + end; + end + else begin + // Not docked nor floating + DP.Width := NewSize + end; +end; + +function SpPtInMultiDock(P: TPoint; MultiDockList: TList): TSpTBXCustomMultiDock; +// Returns the Dock that is under the point, on screen coordinates +var + I: Integer; + MultiDock: TSpTBXCustomMultiDock; + R: TRect; +const + SnapBuffer = 24; + MinDockSize = 4; +begin + Result := nil; + for I := 0 to MultiDockList.Count - 1 do + if TControl(MultiDockList[I]) is TSpTBXCustomMultiDock then begin + MultiDock := TSpTBXCustomMultiDock(MultiDockList[I]); + GetWindowRect(MultiDock.Handle, R); + + // Ensure there is a minimum size for mouse sensibility + case MultiDock.Position of + dpxTop: + if (R.Bottom - R.Top) < MinDockSize then + Inc(R.Bottom, SnapBuffer); + dpxBottom: + if (R.Bottom - R.Top) < MinDockSize then + Dec(R.Top, SnapBuffer); + dpxLeft: + if (R.Right - R.Left) < MinDockSize then + Inc(R.Right, SnapBuffer); + dpxRight, dpxClient: + if (R.Right - R.Left) < MinDockSize then + Dec(R.Left, SnapBuffer); + end; + + if PtInRect(R, P) then begin + Result := MultiDock; + Break; + end; + end; +end; + +function SpPtInDP(P: TPoint; MultiDock: TSpTBXCustomMultiDock; OnlyOnTitleBar: Boolean): TSpTBXCustomDockablePanel; +// Returns a DP that is under the point, on screen coordinates +// If OnlyOnTitleBar is true it returns a DP if the point is under the DP's TitleBar. +var + I: Integer; + DP: TSpTBXCustomDockablePanel; + R: TRect; +begin + Result := nil; + for I := 0 to MultiDock.ToolbarCount - 1 do + if MultiDock.Toolbars[I] is TSpTBXCustomDockablePanel then begin + DP := TSpTBXCustomDockablePanel(MultiDock.Toolbars[I]); + if OnlyOnTitleBar then begin + if MultiDock.IsVertical then + GetWindowRect(DP.FToolbar.Handle, R) + else begin + // When the DP is horizontal track 20 pixels from the left + R.TopLeft := DP.ClientToScreen(Point(0, 0)); + R.BottomRight := DP.ClientToScreen(Point(20, DP.ClientHeight)); + end; + end + else + GetWindowRect(DP.Handle, R); + + if PtInRect(R, P) then begin + Result := DP; + Break; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Painting helpers } + +procedure SpDrawXPDockablePanelTitleBar(ACanvas: TCanvas; ARect: TRect; IsActive, Vertical: Boolean); +begin + case SkinManager.GetSkinType of + sknNone, sknWindows: + begin + // [Theme-Change] + // When the XP theme is used just paint a gradient + SpGradientFill(ACanvas, ARect, SpLighten(clBtnFace, 12), SpLighten(clBtnFace, -12), not Vertical); + Windows.DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_RECT); + end; + sknSkin: + CurrentSkin.PaintBackground(ACanvas, ARect, skncDockablePanelTitleBar, sknsNormal, True, True, Vertical); + end; +end; + +procedure SpDrawXPDockablePanelBody(ACanvas: TCanvas; ARect: TRect; IsActive, IsFloating: Boolean); +var + C: TColor; +begin + case SkinManager.GetSkinType of + sknNone, sknWindows: + begin + C := ACanvas.Brush.Color; + ACanvas.Brush.Color := SpMixColors(clBtnFace, clWindow, 80); + ACanvas.FillRect(ARect); + if not IsFloating then begin + ACanvas.Brush.Color := clBtnFace; + ACanvas.FrameRect(ARect); + InflateRect(ARect, -1, -1); + ACanvas.Brush.Color := clWhite; + ACanvas.FrameRect(ARect); + end; + ACanvas.Brush.Color := C; + end; + sknSkin: + CurrentSkin.PaintBackground(ACanvas, ARect, skncDockablePanel, sknsNormal, True, not IsFloating); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Toolbar Load/Save Position helpers } + +procedure SpTBUpdateMultiDocksAfterLoad(const M: TSpTBXMultiDock); +// TBCustomLoadPositions doesn't correctly position the DPs after they are loaded. +// To reproduce: +// 1) Drop a top aligned MultiDock with 3 DPs (DP1, DP2, DP3), and drop a left +// aligned Multidock with a single DP (DP4) +// 2) Use TBIniLoadPositions in Form.OnShow and TBIniSavePositions in Form.OnClose +// 3) Run the app, position the top DPs in this order: DP4, DP3, DP1, and +// dock DP2 on the left aligned Multidock +// 4) Close and run the app, the top DPs are not correctly positioned/sized +// This happens because TBCustomLoadPositions updates the DockPos and Size +// after the toolbar Parent is set, toolbar by toolbar. +// DockPos and Size should be changed after all the toolbars parent is changed. +// http://news.jrsoftware.org/read/article.php?id=15131&group=jrsoftware.toolbar2000.thirdparty#15131 +var + J: Integer; + DP: TSpTBXCustomDockablePanel; + L: TList; + Sz: TSize; + R: TRect; +begin + L := TList.Create; + M.BeginUpdate; + try + M.GetDockablePanelList(L); + for J := 0 to L.Count - 1 do begin + DP := TSpTBXCustomDockablePanel(L[J]); + if DP.FLoadedDockPos > -1 then + DP.DockPos := DP.FLoadedDockPos; + Windows.GetClientRect(DP.Handle, R); + Sz := DP.FLoadedBarSize; + if M.IsVertical then begin + if Sz.cy > 0 then + DP.Height := DP.Height - R.Bottom + Sz.cy; + end + else begin + if Sz.cx > 0 then + DP.Width := DP.Width - R.Right + Sz.cx; + end; + end; + finally + M.EndUpdate; + L.Free; + end; +end; + +procedure SpTBUpdateAfterLoadIni(const OwnerComponent: TComponent; + const IniFile: TCustomIniFile; const SectionNamePrefix: string); +var + I, W, H: Integer; + MultiDock: TSpTBXMultiDock; + Splitter: TSpTBXCustomSplitter; +begin + for I := 0 to OwnerComponent.ComponentCount - 1 do begin + // Load the MultiDock size + if OwnerComponent.Components[I] is TSpTBXMultiDock then begin + MultiDock := TSpTBXMultiDock(OwnerComponent.Components[I]); + if MultiDock.ToolbarCount > 0 then begin + W := IniFile.ReadInteger(SectionNamePrefix + MultiDock.Name, rvMultiDockWidth, -1); + H := IniFile.ReadInteger(SectionNamePrefix + MultiDock.Name, rvMultiDockHeight, -1); + Splitter := MultiDock.GetAdjacentSplitter; + if Assigned(Splitter) then begin + case MultiDock.Align of + alLeft: if W > -1 then SpFixDelphiAlignBug(MultiDock, W, Splitter); + alTop: if H > -1 then SpFixDelphiAlignBug(MultiDock, H, Splitter); + alRight: if W > -1 then SpFixDelphiAlignBug(MultiDock, W, Splitter); + alBottom: if H > -1 then SpFixDelphiAlignBug(MultiDock, H, Splitter); + end; + end; + // Update the size and position of the DPs + SpTBUpdateMultiDocksAfterLoad(MultiDock); + end; + end; + + // Load Splitter.RestorePos + if OwnerComponent.Components[I] is TSpTBXCustomSplitter then begin + Splitter := TSpTBXCustomSplitter(OwnerComponent.Components[I]); + Splitter.FRestorePos := IniFile.ReadInteger(SectionNamePrefix + Splitter.Name, rvSplitterRestorePos, 60); + end; + end; +end; + +procedure SpTBUpdateAfterSaveIni(const OwnerComponent: TComponent; + const IniFile: TCustomIniFile; const SectionNamePrefix: string); +var + I: Integer; + MultiDock: TSpTBXMultiDock; + Splitter: TSpTBXCustomSplitter; +begin + for I := 0 to OwnerComponent.ComponentCount - 1 do begin + // Save the MultiDock size + if OwnerComponent.Components[I] is TSpTBXMultiDock then begin + MultiDock := TSpTBXMultiDock(OwnerComponent.Components[I]); + if MultiDock.ToolbarCount > 0 then begin + IniFile.WriteInteger(SectionNamePrefix + MultiDock.Name, rvMultiDockWidth, MultiDock.Width); + IniFile.WriteInteger(SectionNamePrefix + MultiDock.Name, rvMultiDockHeight, MultiDock.Height); + end; + end; + + // Save the Splitter.RestorePos + if OwnerComponent.Components[I] is TSpTBXCustomSplitter then begin + Splitter := TSpTBXCustomSplitter(OwnerComponent.Components[I]); + IniFile.WriteInteger(SectionNamePrefix + Splitter.Name, rvSplitterRestorePos, Splitter.FRestorePos); + end; + end; +end; + +procedure SpTBRegLoadPositions(const OwnerComponent: TComponent; + const RootKey: DWORD; const BaseRegistryKey: string); +var + Reg: TRegistryIniFile; +begin + TBRegLoadPositions(OwnerComponent, RootKey, BaseRegistryKey); + // Use TRegistryIniFile to call SpTBUpdateAfterLoadIni + Reg := TRegistryIniFile.Create('', KEY_QUERY_VALUE); + try + Reg.RegIniFile.RootKey := RootKey; + if Reg.RegIniFile.OpenKey(BaseRegistryKey, False) then + SpTBUpdateAfterLoadIni(OwnerComponent, Reg, ''); + finally + Reg.Free; + end; +end; + +procedure SpTBRegSavePositions(const OwnerComponent: TComponent; + const RootKey: DWORD; const BaseRegistryKey: string); +var + Reg: TRegistryIniFile; +begin + TBRegSavePositions(OwnerComponent, RootKey, BaseRegistryKey); + // Use TRegistryIniFile to call SpTBUpdateAfterSaveIni + Reg := TRegistryIniFile.Create(''); + try + Reg.RegIniFile.RootKey := RootKey; + Reg.RegIniFile.CreateKey(BaseRegistryKey); + if Reg.RegIniFile.OpenKey(BaseRegistryKey, True) then + SpTBUpdateAfterSaveIni(OwnerComponent, Reg, ''); + finally + Reg.Free; + end; +end; + +procedure SpTBIniLoadPositions(const OwnerComponent: TComponent; + const IniFile: TCustomIniFile; const SectionNamePrefix: string); +begin + TBIniLoadPositions(OwnerComponent, IniFile, SectionNamePrefix); + SpTBUpdateAfterLoadIni(OwnerComponent, IniFile, SectionNamePrefix); +end; + +procedure SpTBIniSavePositions(const OwnerComponent: TComponent; + const IniFile: TCustomIniFile; const SectionNamePrefix: string); +begin + TBIniSavePositions(OwnerComponent, IniFile, SectionNamePrefix); + SpTBUpdateAfterSaveIni(OwnerComponent, IniFile, SectionNamePrefix); +end; + +procedure SpTBIniLoadPositions(const OwnerComponent: TComponent; + const Filename, SectionNamePrefix: string); +// Use TMemIniFile instead of TIniFile for better readability and to solve +// the #7363 bug report from QC: http://qc.borland.com/wc/qcmain.aspx?d=7363 +var + MemIniFile: TMemIniFile; +begin + MemIniFile := TMemIniFile.Create(Filename); + try + SpTBIniLoadPositions(OwnerComponent, MemIniFile, SectionNamePrefix); + finally + MemIniFile.Free; + end; +end; + +procedure SpTBIniSavePositions(const OwnerComponent: TComponent; + const Filename, SectionNamePrefix: string); +// Use TMemIniFile instead of TIniFile for better readability and to solve +// the #7363 bug report from QC: http://qc.borland.com/wc/qcmain.aspx?d=7363 +var + MemIniFile: TMemIniFile; +begin + MemIniFile := TMemIniFile.Create(Filename); + try + SpTBIniSavePositions(OwnerComponent, MemIniFile, SectionNamePrefix); + MemIniFile.UpdateFile; + finally + MemIniFile.Free; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomMultiDock } + +constructor TSpTBXCustomMultiDock.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + inherited LimitToOneRow := True; + FAutoSplitterVisibility := True; + FLimitToOneRow := True; + FPosition := dpxTop; + SetPosition(dpxLeft); + inherited OnInsertRemoveBar := DoInsertRemoveBar; + inherited OnRequestDock := DoRequestDock; +end; + +procedure TSpTBXCustomMultiDock.DoInsertRemoveBar(Sender: TObject; + Inserting: Boolean; Bar: TTBCustomDockableWindow); +var + SpacingDelta: Integer; + Splitter: TSpTBXCustomSplitter; +begin + // Automatically Show or Hide the adjacent splitter when + // the MultiDock is empty + if FAutoSplitterVisibility then begin + if Inserting and (ToolbarCount = 1) then + SpacingDelta := -1 // Inserting on an empty Dock + else + SpacingDelta := 1; + + Splitter := GetAdjacentSplitter(SpacingDelta); + + if Assigned(Splitter) then begin + if Inserting and (ToolbarCount = 1) then begin + // Inserting on an empty Dock, re-align adjacent splitter + // When Width/Height = 0 the realign must be done by SetParent + Splitter.Visible := True; + if (IsVertical and (Width > 0)) or (not IsVertical and (Height > 0)) then + InsertingOnEmptyDock; + end + else begin + if ToolbarCount = 0 then + Splitter.Visible := False; + end; + end; + end; + + if Assigned(FOnInsertRemoveBar) then FOnInsertRemoveBar(Sender, Inserting, Bar); +end; + +procedure TSpTBXCustomMultiDock.DoRequestDock(Sender: TObject; + Bar: TTBCustomDockableWindow; var Accept: Boolean); +begin + Accept := Assigned(Bar) and (Bar is TSpTBXCustomDockablePanel); + if Accept then + if Assigned(FOnRequestDock) then FOnRequestDock(Sender, Bar, Accept); +end; + +procedure TSpTBXCustomMultiDock.AlignControls(AControl: TControl; + var Rect: TRect); +begin + inherited; + if FPosition = dpxClient then + UpdateDPLateralSize(Width, Height); +end; + +function CompareEffectiveDockPos(Item1, Item2: Pointer): Integer; +begin + Result := TSpTBXCustomDockablePanel(Item1).EffectiveDockPos - TSpTBXCustomDockablePanel(Item2).EffectiveDockPos; +end; + +procedure TSpTBXCustomMultiDock.GetDockablePanelList(DPList: TList); +var + I: Integer; + T: TTBCustomDockableWindow; +begin + DPList.Clear; + for I := 0 to ToolbarCount - 1 do begin + T := Toolbars[I]; + if T is TSpTBXCustomDockablePanel then + DPList.Add(T); + end; + // Sort the list based on the dock pos + DPList.Sort(CompareEffectiveDockPos); +end; + +function TSpTBXCustomMultiDock.GetAdjacentSplitter(SpacingDelta: Integer = 1): TSpTBXCustomSplitter; +begin + if Assigned(FLastSplitter) then + Result := FLastSplitter + else begin + Result := SpAdjacentSplitter(Self, SpacingDelta); + if Result <> FLastSplitter then begin + if Assigned(FLastSplitter) then FLastSplitter.RemoveFreeNotification(Self); + FLastSplitter := Result; + if Assigned(FLastSplitter) then + FLastSplitter.FreeNotification(Self); + end; + end; +end; + +procedure TSpTBXCustomMultiDock.GetDockablePanelDockIndex(DPList: TList; + DP: TSpTBXCustomDockablePanel; out DPDockIndex: Integer); +var + I: Integer; +begin + DPDockIndex := -1; + GetDockablePanelList(DPList); + for I := 0 to DPList.Count - 1 do + if DPList[I] = DP then begin + DPDockIndex := I; + Break; + end; +end; + +procedure TSpTBXCustomMultiDock.InsertingOnEmptyDock; +var + Splitter: TSpTBXCustomSplitter; +begin + // When a DP is docked on an empty right/bottom aligned MultiDock and there's + // an adjacent Splitter, the Splitter is moved to the right/bottom side + // of the MultiDock: + // http://news.jrsoftware.org/read/article.php?id=14410&group=jrsoftware.toolbar2000.thirdparty#14410 + // To fix this, re align the Splitter after the MultiDock is resized. + Splitter := GetAdjacentSplitter; + if Assigned(Splitter) then begin + Parent.DisableAlign; + try + case Splitter.Align of + alTop: Splitter.Top := Top + Height + 1; + alBottom: Splitter.Top := Top - 1; + alLeft: Splitter.Left := Left + Width + 1; + alRight: Splitter.Left := Left - 1; + end; + finally + Parent.EnableAlign; + end; + end; +end; + +function TSpTBXCustomMultiDock.IsVertical: Boolean; +begin + Result := not (Position in [dpxTop, dpxBottom]); +end; + +procedure TSpTBXCustomMultiDock.Loaded; +var + Splitter: TSpTBXCustomSplitter; +begin + inherited; + + // Automatically Hide the adjacent splitter when + // the MultiDock is empty + if FAutoSplitterVisibility and (ToolbarCount = 0) then begin + Splitter := GetAdjacentSplitter; + if Assigned(Splitter) then + Splitter.Visible := False; + end; +end; + +procedure TSpTBXCustomMultiDock.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = FLastSplitter) then + FLastSplitter := nil; +end; + +procedure TSpTBXCustomMultiDock.SetBounds(ALeft, ATop, AWidth, AHeight: Integer); +begin + inherited; + UpdateDPLateralSize(AWidth, AHeight); +end; + +procedure TSpTBXCustomMultiDock.SetLimitToOneRow(const Value: Boolean); +begin + FLimitToOneRow := True; +end; + +procedure TSpTBXCustomMultiDock.SetPosition(const Value: TSpTBXDockPosition); +begin + if FPosition <> Value then begin + if (ControlCount <> 0) then + raise EInvalidOperation.Create(STBDockCannotChangePosition); + FPosition := Value; + case Value of + dpxLeft: inherited Position := dpLeft; + dpxTop: inherited Position := dpTop; + dpxRight: inherited Position := dpRight; + dpxBottom: inherited Position := dpBottom; + dpxClient: + begin + inherited Position := dpRight; + Align := alClient; + end; + end; + ArrangeToolbars; + end; +end; + +procedure TSpTBXCustomMultiDock.UpdateDPLateralSize(AWidth, AHeight: Integer); +// Update the lateral size of all the DPs relative to the MultiDock +// This causes flicker! +var + L: TList; + I: Integer; + DP: TSpTBXCustomDockablePanel; +begin + FUpdatingLateralSize := True; + BeginUpdate; + L := TList.Create; + try + GetDockablePanelList(L); + for I := 0 to L.Count - 1 do begin + DP := TSpTBXCustomDockablePanel(L[I]); + if IsVertical then + DP.Width := AWidth + else + DP.Height := AHeight; + end; + finally + L.Free; + EndUpdate; + FUpdatingLateralSize := False; + end; +end; + +procedure TSpTBXCustomMultiDock.ValidateInsert(AComponent: TComponent); +begin + inherited; + if not (AComponent is TSpTBXCustomDockablePanel) then + raise EInvalidOperation.CreateFmt('Cannot insert %s into MultiDock', [AComponent.ClassName]); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXDockablePanelButtonOptions } + +constructor TSpTBXDockablePanelButtonOptions.Create(AParent: TWinControl); +begin + FDockablePanel := AParent as TSpTBXCustomDockablePanel; + inherited; + Maximize := False; + Minimize := False; + TitleBarMaxSize := 19; +end; + +procedure TSpTBXDockablePanelButtonOptions.CreateButtons; +begin + FToolbar := FDockablePanel.FToolbar; + inherited; +end; + +procedure TSpTBXDockablePanelButtonOptions.ButtonsClick(Sender: TObject); +begin + if Sender = MinimizeButton then FDockablePanel.SizeToggle(False) + else if Sender = MaximizeButton then FDockablePanel.SizeToggle(True) + else if Sender = CloseButton then FDockablePanel.Close; +end; + +function TSpTBXDockablePanelButtonOptions.Restoring(B: TSpTBXCustomItem): Boolean; +begin + Result := False; + if Assigned(FDockablePanel) then + if B = MinimizeButton then + Result := FDockablePanel.Minimized + else + if B = MaximizeButton then + Result := FDockablePanel.Maximized; +end; + +procedure TSpTBXDockablePanelButtonOptions.SetupButton(B: TSpTBXCustomItem); +begin + inherited; + TSpTBXCustomItemAccess(B).CustomWidth := 15; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXDockablePanelToolbar } + +constructor TSpTBXDockablePanelToolbar.Create(AOwner: TComponent); +begin + inherited; + CompoundToolbar := True; +end; + +function TSpTBXDockablePanelToolbar.GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; +begin + Result := CurrentSkin.GetTextColor(skncDockablePanelTitleBar, State); +end; + +function TSpTBXDockablePanelToolbar.GetParentDockablePanel: TSpTBXCustomDockablePanel; +var + P: TWinControl; +begin + Result := nil; + P := Parent; + while Assigned(P) do + if P is TSpTBXCustomDockablePanel then begin + Result := P as TSpTBXCustomDockablePanel; + Break; + end + else + P := P.Parent; +end; + +function TSpTBXDockablePanelToolbar.GetRightAlignMargin: Integer; +begin + Result := 4; +end; + +function TSpTBXDockablePanelToolbar.CanItemClick(Item: TTBCustomItem; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer): Boolean; +var + TransparentClick: Boolean; + DP: TSpTBXCustomDockablePanel; +begin + Result := True; + + // Move the DockablePanel if the toolbar client area or an item with + // tbisClicksTransparent itemstyle is clicked (like a LabelItem) + if Button = mbLeft then begin + DP := GetParentDockablePanel; + if Assigned(DP) and DP.IsMovable then begin + if Assigned(Item) then + TransparentClick := tbisClicksTransparent in TTBCustomItemAccess(Item).ItemStyle + else + TransparentClick := True; + if TransparentClick then + if ssDouble in Shift then + DP.DoubleClick + else begin + Result := False; + SendMessage(DP.Handle, WM_NCLBUTTONDOWN, HT_TB2k_Border, 0); + end; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomDockablePanel } + +constructor TSpTBXCustomDockablePanel.Create(AOwner: TComponent); +begin + inherited; + + FLoadedDockPos := -1; + FLoadedBarSize.cx := -1; + FLoadedBarSize.cy := -1; + + Stretch := True; + DragHandleStyle := dhNone; + + SetBounds(Left, Top, 160, 128); + + FPanel := TPanel.Create(Self); + FPanel.Parent := Self; + FPanel.Align := alTop; + FPanel.BevelOuter := bvNone; + + FToolbarDock := TSpTBXDock.Create(Self); + FToolbarDock.Parent := FPanel; + FToolbarDock.OnRequestDock := DockRequestDock; + FToolbarDock.OnDrawBackground := DockDrawBackground; + FToolbarDock.OnResize := DockResize; + + FToolbar := TSpTBXDockablePanelToolbar.Create(Self); + FToolbar.Parent := FToolbarDock; + FToolbar.CurrentDock := FToolbarDock; + FToolbar.Name := Name + 'Toolbar'; + FToolbar.Customizable := False; + FToolbar.BorderStyle := bsNone; + FToolbar.DockMode := dmCannotFloatOrChangeDocks; + FToolbar.DragHandleStyle := dhNone; + FToolbar.Options := FToolbar.Options + [tboNoAutoHint]; + FToolbar.Stretch := True; + FToolbar.ShrinkMode := tbsmNone; + FToolbar.ShowCaption := False; + FToolbar.OnDrawBackground := ToolbarDrawBackground; + + FOptions := TSpTBXDockablePanelButtonOptions.Create(Self); + FOptions.CaptionLabel := Caption; + + inherited ShowCaption := False; // Re-publish it, should always be False + FShowCaption := True; + FShowCaptionWhenDocked := True; + + DockResize(FToolbarDock); // Adjust ToolbarDock resizing +end; + +procedure TSpTBXCustomDockablePanel.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + + if not (csDesigning in ComponentState) then + with Params do + Params.Style := Params.Style or WS_CLIPCHILDREN; +end; + +destructor TSpTBXCustomDockablePanel.Destroy; +begin + FOptions.Free; + FToolbar.Free; + FToolbarDock.Free; + FPanel.Free; + + inherited; + + FreeAndNil(FDockForms); // After inherited, Notification accesses FDockForms +end; + +procedure TSpTBXCustomDockablePanel.Loaded; +var + I: Integer; + C: TControl; + DesignerRootItem: TTBCustomItem; +begin + inherited; + + // The parent of TTBControlItem.Control should be the toolbar, not Self + // (as setted in GetChildren for dfm streaming). + DesignerRootItem := GetItems; + for I := 0 to DesignerRootItem.Count - 1 do + if DesignerRootItem[I] is TTBControlItem then begin + C := TTBControlItem(DesignerRootItem[I]).Control; + if Assigned(C) and (C.Parent <> FToolbar) then + C.Parent := FToolbar; + end; +end; + +procedure TSpTBXCustomDockablePanel.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if Operation = opRemove then + RemoveFromList(FDockForms, AComponent); +end; + +function TSpTBXCustomDockablePanel.Maximize: Boolean; +var + PrevState: TWindowState; +begin + Result := False; + if not Maximized then begin + // [DockablePanel-Rule] + // Do not maximize if it's the only DP on the dock + if Docked and (CurrentDock.ToolbarCount > 1) then begin + PrevState := FState.DockedState; + FIsManualSizing := True; + try + if InternalMaximize(False) then begin + Result := True; + FState.DockedState := wsMaximized; + FOptions.SetupButtonIcon(FOptions.MinimizeButton); + FOptions.SetupButtonIcon(FOptions.MaximizeButton); + end + else + FState.DockedState := PrevState; + finally + FIsManualSizing := False; + end; + end; + end; + + if Result then + DoWindowStateChanged(wsMaximized); +end; + +function TSpTBXCustomDockablePanel.Maximized: Boolean; +begin + if Floating then + Result := False + else + Result := FState.DockedState = wsMaximized; +end; + +function TSpTBXCustomDockablePanel.Minimize: Boolean; +var + CanMinimize: Boolean; + I, MinimizedCount: Integer; + L: TList; + MultiDock: TSpTBXCustomMultiDock; + RS: TSpTBXDPResizeType; +begin + Result := False; + if Floating then begin + if FState.DockedState <> wsMinimized then begin + FState.DockedState := wsMinimized; + FState.RestoreSize := Parent.Height; + Parent.ClientHeight := FPanel.Height; + FOptions.SetupButtonIcon(FOptions.MinimizeButton); + FOptions.SetupButtonIcon(FOptions.MaximizeButton); + Result := True; + end; + end + else + if Docked and (FState.DockedState <> wsMinimized) and (CurrentDock is TSpTBXCustomMultiDock) then begin + MultiDock := TSpTBXCustomMultiDock(CurrentDock); + L := TList.Create; + try + MultiDock.GetDockablePanelList(L); + // [DockablePanel-Rule] + // Only minimize if it's horizontal and is the only DP on the dock + // Or if it's vertical and it's not the only DP on the dock and the rest of the siblings are not minimized + MinimizedCount := 0; + if not MultiDock.IsVertical then + CanMinimize := L.Count = 1 + else begin + for I := 0 to L.Count - 1 do + if TSpTBXCustomDockablePanel(L[I]).FState.DockedState = wsMinimized then + Inc(MinimizedCount); + CanMinimize := (L.Count > 1) and (L.Count - 1 > MinimizedCount); + end; + + if CanMinimize then begin + FIsManualSizing := True; + try + if Height > FPanel.Height then + FState.RestoreSize := Height; + if Options.TaskPaneStyleResize then + RS := dprtMinimizeOrRestoreTaskPaneStyle + else + RS := dprtMinimizeOrRestore; + SpDPResize(Self, FPanel.Height, RS); + FState.DockedState := wsMinimized; + FOptions.SetupButtonIcon(FOptions.MinimizeButton); + FOptions.SetupButtonIcon(FOptions.MaximizeButton); + Result := True; + finally + FIsManualSizing := False; + end; + end; + + finally + L.Free; + end; + end; + + if Result then + DoWindowStateChanged(wsMinimized); +end; + +function TSpTBXCustomDockablePanel.Minimized: Boolean; +begin + Result := FState.DockedState = wsMinimized; +end; + +procedure TSpTBXCustomDockablePanel.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + // Don't let the DP be dragged by the client area + // Override TTBCustomDockableWindow.MouseDown + if (Button <> mbLeft) or not IsMovable then + inherited + else + if Assigned(OnMouseDown) then OnMouseDown(Self, Button, Shift, X, Y); +end; + +procedure TSpTBXCustomDockablePanel.Resize; +var + TotalBorderSize: Integer; +begin + inherited; + + if Floating and Assigned(Parent) then begin + // When Floating the caption panel is always horizontal + // Make sure to calculate the floating form constraints taking into + // account the borders and the close button. + TotalBorderSize := GetFloatingBorderSize.Y * 2; + Parent.Constraints.MinWidth := 20 + TotalBorderSize; + Parent.Constraints.MinHeight := FPanel.Height + TotalBorderSize; + if (FState.DockedState = wsMinimized) and (Parent.ClientHeight > FPanel.Height) then begin + FState.DockedState := wsNormal; + FOptions.SetupButtonIcon(FOptions.MinimizeButton); + end; + end + else begin + if (FState.DockedState = wsMinimized) and (ClientHeight > FPanel.Height) then begin + FState.DockedState := wsNormal; + FOptions.SetupButtonIcon(FOptions.MinimizeButton); + end; + end; +end; + +function TSpTBXCustomDockablePanel.Restore: Boolean; +var + I: Integer; + DkPanel: TSpTBXCustomDockablePanel; + RS: TSpTBXDPResizeType; +begin + Result := False; + FIsManualSizing := True; + try + if Floating then begin + if FState.DockedState = wsMinimized then begin + FState.DockedState := wsNormal; + Parent.Height := FState.RestoreSize; + Result := True; + end; + end + else + if Docked then begin + case FState.DockedState of + wsNormal: ; + wsMinimized: + begin + if Options.TaskPaneStyleResize then + RS := dprtMinimizeOrRestoreTaskPaneStyle + else + RS := dprtMinimizeOrRestore; + Result := SpDPResize(Self, FState.RestoreSize, RS); + if Result then begin + FState.DockedState := wsNormal; + + // If a sibling was Maximized restore it + if Assigned(CurrentDock) then begin + for I := 0 to CurrentDock.ToolbarCount - 1 do + if (CurrentDock.Toolbars[I] <> Self) and (CurrentDock.Toolbars[I] is TSpTBXCustomDockablePanel) then begin + DkPanel := TSpTBXCustomDockablePanel(CurrentDock.Toolbars[I]); + if DkPanel.Maximized then begin + DkPanel.FState.DockedState := wsNormal; + DkPanel.Options.SetupButtonIcon(DkPanel.Options.MaximizeButton); + Break; + end; + end; + end; + end; + end; + wsMaximized: + begin + Result := InternalMaximize(True); + if Result then + FState.DockedState := wsNormal; + end; + end; + end; + + FOptions.SetupButtonIcon(FOptions.MinimizeButton); + FOptions.SetupButtonIcon(FOptions.MaximizeButton); + finally + FIsManualSizing := False; + end; + + if Result then + DoWindowStateChanged(wsNormal); +end; + +procedure TSpTBXCustomDockablePanel.AddDockForm(const Form: TTBCustomForm); +begin + if Assigned(Form) and AddToList(FDockForms, Form) then + Form.FreeNotification(Self); +end; + +procedure TSpTBXCustomDockablePanel.RemoveDockForm(const Form: TTBCustomForm); +begin + RemoveFromList(FDockForms, Form); +end; + +procedure TSpTBXCustomDockablePanel.BeginDockedMoving; + + function DockDPOnMultiDock(DockList: TList; CursorPos: TPoint): Boolean; + var + MultiDock: TSpTBXCustomMultiDock; + DP: TSpTBXCustomDockablePanel; + begin + Result := False; + MultiDock := SpPtInMultiDock(CursorPos, DockList); + if Assigned(MultiDock) then begin + Result := True; + MultiDock.DoRequestDock(MultiDock, Self, Result); + end; + + if Result then begin + // Dock the DP if the cursor is over a valid dock + DP := SpPtInDP(CursorPos, MultiDock, False); + if Assigned(DP) then begin + if MultiDock.IsVertical then + DockPos := DP.EffectiveDockPos + (DP.Height) div 2 + else + DockPos := DP.EffectiveDockPos + (DP.Width) div 2; + end; + CurrentDock := MultiDock; + end + end; + + procedure MouseMoved(DockList: TList; ClientClickPos: TPoint; + OldCursor: HCURSOR; PreventDocking: Boolean; var OldCursorPos: TPoint); + var + CursorPos, Delta: TPoint; + R, TitleBarR, FloatR1, FloatR2: TRect; + MultiDock: TSpTBXCustomMultiDock; + DP: TSpTBXCustomDockablePanel; + FloatingW: Integer; + begin + GetCursorPos(CursorPos); + if (CursorPos.X = OldCursorPos.X) and (CursorPos.Y = OldCursorPos.Y) then Exit; + + SetCursor(OldCursor); + + if Docked and (CurrentDock is TSpTBXCustomMultiDock) then begin + GetWindowRect(CurrentDock.Handle, R); + if PtInRect(R, CursorPos) then begin + MultiDock := TSpTBXCustomMultiDock(CurrentDock); + DP := SpPtInDP(CursorPos, MultiDock, True); + if Assigned(DP) then begin + // The cursor is over another dockable window, swap the pos + SpDPSwapPos(MultiDock, Self, DP); + end; + end + else begin + // Change the cursor if it can't float + if DockMode = dmCanFloat then begin + // The cursor is outside the Dock, make the DP float + // Position the DP at the center of the clicked point + if FFloatingClientWidth > 0 then + FloatingW := FFloatingClientWidth + else + FloatingW := ClientAreaWidth; + FloatingPosition := Point(CursorPos.X - (FloatingW div 2), CursorPos.Y - 10); + Floating := True; + MoveOnScreen(True); + end + else begin + SetCursor(LoadCursor(0, IDC_NO)); + if DockMode = dmCannotFloat then + // The DP can't float but can be re-docked on a different MultiDock + DockDPOnMultiDock(DockList, CursorPos); + end; + end; + OldCursorPos := CursorPos; + end + else + if Floating then + if DockMode <> dmCanFloat then + SetCursor(LoadCursor(0, IDC_NO)) + else begin + // Clip the point so it doesn't get dragged under the taskbar + R := GetRectOfMonitorContainingPoint(CursorPos, True); + if CursorPos.X < R.Left then CursorPos.X := R.Left; + if CursorPos.X > R.Right then CursorPos.X := R.Right; + if CursorPos.Y < R.Top then CursorPos.Y := R.Top; + if CursorPos.Y > R.Bottom then CursorPos.Y := R.Bottom; + + // Try to dock it on a MultiDock + if not PreventDocking and DockDPOnMultiDock(DockList, CursorPos) then + OldCursorPos := CursorPos + else begin + Delta := Point(CursorPos.X - OldCursorPos.X, CursorPos.Y - OldCursorPos.Y); + + // Make sure the TitleBar is still accessible if it's dragged almost + // completely off the screen so it can be dragged back. + GetWindowRect(FToolbar.Handle, TitleBarR); + OffsetRect(TitleBarR, Delta.X, Delta.Y); + with GetFloatingBorderSize do + InflateRect(TitleBarR, -X, -Y); + if TitleBarR.Right < R.Left then Delta.X := 0; + if TitleBarR.Left > R.Right then Delta.X := 0; + if TitleBarR.Bottom < R.Top then Delta.Y := 0; + if TitleBarR.Top > R.Bottom then Delta.Y := 0; + + // Move the floating DP + GetWindowRect(Parent.Handle, FloatR1); + FloatingPosition := Point(Parent.Left + Delta.X, Parent.Top + Delta.Y); + GetWindowRect(Parent.Handle, FloatR2); + + // Don't change OldCursorPos if the floating DP wasn't moved + if not EqualRect(FloatR1, FloatR2) then begin + if FloatR1.Left <> FloatR2.Left then + OldCursorPos.X := CursorPos.X; + if FloatR1.Top <> FloatR2.Top then + OldCursorPos.Y := CursorPos.Y; + end; + end; + end; + end; + +var + L: TList; + ClientClickPos, OldCursorPos: TPoint; + OldCursor: HCURSOR; + PreventDocking: Boolean; + Msg: TMsg; +begin + L := TList.Create; + FIsDockedMoving := True; + try + OldCursor := GetCursor; // Save the original mouse cursor + + SpDPGetDockableMultiDockList(Self, L); + + SetCapture(Handle); + GetCursorPos(OldCursorPos); + ClientClickPos := ScreenToClient(OldCursorPos); + PreventDocking := GetKeyState(VK_CONTROL) < 0; + + while GetCapture = Handle do begin + case Integer(GetMessage(Msg, 0, 0, 0)) of + -1: Break; // if GetMessage failed + 0: begin + // Repost WM_QUIT messages + PostQuitMessage(Msg.WParam); + Break; + end; + end; + case Msg.Message of + WM_KEYDOWN, WM_KEYUP: + if (Msg.wParam = VK_CONTROL) and (PreventDocking <> (Msg.Message = WM_KEYDOWN)) then begin + PreventDocking := Msg.Message = WM_KEYDOWN; + MouseMoved(L, ClientClickPos, OldCursor, PreventDocking, OldCursorPos); + end + else + if Msg.wParam = VK_ESCAPE then Break; + WM_MOUSEMOVE: + MouseMoved(L, ClientClickPos, OldCursor, PreventDocking, OldCursorPos); + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK: + Break; + WM_LBUTTONUP: + Break; + WM_RBUTTONDOWN..WM_MBUTTONDBLCLK: ; + else + TranslateMessage(Msg); + DispatchMessage(Msg); + end; + end; + + finally + if GetCapture = Handle then + ReleaseCapture; + FIsDockedMoving := False; + L.Free; + end; +end; + +procedure TSpTBXCustomDockablePanel.BeginSplitResizing(HitTest: Integer); + + procedure MouseMoved(DP: TSpTBXCustomDockablePanel; VerticalSplitting: Boolean; var OldCursorPos: TPoint); + var + CursorPos: TPoint; + Delta: Integer; + begin + GetCursorPos(CursorPos); + if (CursorPos.X = OldCursorPos.X) and (CursorPos.Y = OldCursorPos.Y) then Exit; + + if VerticalSplitting then begin + Delta := CursorPos.Y - OldCursorPos.Y; + if Delta = 0 then Exit; + if not SpDPResize(DP, DP.Height + Delta, dprtSplitResize) then + Exit; // Exit if it couldn't be resized + end + else begin + Delta := CursorPos.X - OldCursorPos.X; + if Delta = 0 then Exit; + if not SpDPResize(DP, DP.Width + Delta, dprtSplitResize) then + Exit; // Exit if it couldn't be resized + end; + + OldCursorPos := CursorPos; + end; + +var + M: TSpTBXCustomMultiDock; + L: TList; + VerticalSplitting: Boolean; + DockIndex: Integer; + OldCursorPos: TPoint; + Msg: TMsg; + EffectivePanel: TSpTBXCustomDockablePanel; + Form: TCustomForm; +begin + if not (CurrentDock is TSpTBXCustomMultiDock) then Exit; + M := TSpTBXCustomMultiDock(CurrentDock); + + // Get the EffectivePanel + EffectivePanel := Self; + VerticalSplitting := False; + case HitTest of + HT_DP_SPLITRESIZELEFT, HT_DP_SPLITRESIZETOP: + begin + // If we are grabbing the left or top side of the DP the + // EffectivePanel should be the previous sibling + L := TList.Create; + try + M.GetDockablePanelDockIndex(L, Self, DockIndex); + if DockIndex > 0 then + EffectivePanel := TSpTBXCustomDockablePanel(L[DockIndex - 1]); + if HitTest = HT_DP_SPLITRESIZETOP then + VerticalSplitting := True; + finally + L.Free; + end; + end; + HT_DP_SPLITRESIZEBOTTOM: VerticalSplitting := True; + HT_DP_SPLITRESIZERIGHT: VerticalSplitting := False; + end; + + try + SetCapture(Handle); + GetCursorPos(OldCursorPos); + + while GetCapture = Handle do begin + case Integer(GetMessage(Msg, 0, 0, 0)) of + -1: Break; { if GetMessage failed } + 0: begin + { Repost WM_QUIT messages } + PostQuitMessage(Msg.WParam); + Break; + end; + end; + case Msg.Message of + WM_KEYDOWN, WM_KEYUP: + if Msg.WParam = VK_ESCAPE then Break; + WM_MOUSEMOVE: + MouseMoved(EffectivePanel, VerticalSplitting, OldCursorPos); + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK: + Break; + WM_LBUTTONUP: + Break; + WM_RBUTTONDOWN..WM_MBUTTONDBLCLK: ; + else + TranslateMessage(Msg); + DispatchMessage(Msg); + end; + end; + + finally + if GetCapture = Handle then + ReleaseCapture; + if csDesigning in ComponentState then begin + Form := GetParentForm(Self); + if (Form <> nil) and (Form.Designer <> nil) then + Form.Designer.Modified; + end; + end; +end; + +function TSpTBXCustomDockablePanel.CanSplitResize(EdgePosition: TTBDockPosition): Boolean; +var + M: TSpTBXCustomMultiDock; + L: TList; +begin + Result := Docked and (CurrentDock is TSpTBXCustomMultiDock) and HandleAllocated; + + if not Result then Exit; + + M := TSpTBXCustomMultiDock(CurrentDock); + + L := TList.Create; + try + M.GetDockablePanelList(L); + + if M.IsVertical then begin + case EdgePosition of + dpTop: Result := EffectiveDockPos > 0; + dpBottom: Result := L.Last <> Self; + else + Result := False; + end; + end + else begin + case EdgePosition of + dpLeft: Result := EffectiveDockPos > 0; + dpRight: Result := L.Last <> Self; + else + Result := False; + end; + end; + finally + L.Free; + end; +end; + +procedure TSpTBXCustomDockablePanel.ConstrainedResize(var MinWidth, MinHeight, + MaxWidth, MaxHeight: Integer); +var + Sz: TPoint; + M: TSpTBXCustomMultiDock; +begin + Sz := CalcNCSizes; + + if MinClientWidth > 0 then MinWidth := MinClientWidth + Sz.X; + if MinClientHeight > 0 then MinHeight := MinClientHeight + Sz.Y; + if MaxClientWidth > 0 then MaxWidth := MaxClientWidth + Sz.X; + if MaxClientHeight > 0 then MaxHeight := MaxClientHeight + Sz.Y; + + // Disallow lateral Width change when the DP is docked + if Docked and (CurrentDock is TSpTBXCustomMultiDock) then begin + M := TSpTBXCustomMultiDock(CurrentDock); + if M.IsVertical then begin + if not M.UpdatingLateralSize then + MinWidth := Width; + if FFixedDockedSize and not FIsManualSizing and not (csDesigning in ComponentState) then begin + MinHeight := Height; + MaxHeight := Height; + end; + end + else begin + if not M.UpdatingLateralSize then + MinHeight := Height; + if FFixedDockedSize and not FIsManualSizing and not (csDesigning in ComponentState) then begin + MinWidth := Width; + MaxWidth := Width; + end; + end; + end; +end; + +procedure TSpTBXCustomDockablePanel.DockDrawBackground(Sender: TObject; + ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +var + DefaultPainting: Boolean; +begin + if PaintStage = pstPrePaint then begin + PaintDefault := False; + + if Docked and not Floating then begin + // When the DP is not floating draws the CaptionBar borders on the NC area + // of the DockablePanel, see InternalDrawBackground + // Just draw 1 pixel from the left and right, and 2 pixels from the top + // ARect.Bottom should remain the same + if IsVerticalTitleBar then begin + InflateRect(ARect, 0, 1); + ARect.Left := ARect.Left - DockedBorderSize; + end + else begin + InflateRect(ARect, 1, 0); + ARect.Top := ARect.Top - DockedBorderSize; + end; + end; + + DefaultPainting := True; + DoDrawCaptionPanel(ACanvas, ARect, pstPrePaint, DefaultPainting); + if DefaultPainting then + SpDrawXPDockablePanelTitleBar(ACanvas, ARect, True, IsVerticalTitleBar); + DefaultPainting := True; + DoDrawCaptionPanel(ACanvas, ARect, pstPostPaint, DefaultPainting); + end; +end; + +procedure TSpTBXCustomDockablePanel.ToolbarDrawBackground(Sender: TObject; + ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + // Let the background be painted by the Dock + if PaintStage = pstPrePaint then + PaintDefault := False; +end; + +procedure TSpTBXCustomDockablePanel.DockRequestDock(Sender: TObject; + Bar: TTBCustomDockableWindow; var Accept: Boolean); +begin + Accept := False; + if Assigned(FToolbar) then + Accept := Bar = FToolbar; +end; + +procedure TSpTBXCustomDockablePanel.DockResize(Sender: TObject); +begin + if IsVerticalTitleBar then begin + // If the Panel is left/right aligned + if FPanel.Width <> FToolbarDock.Width then begin + FPanel.Width := FToolbarDock.Width; + if Floating and Assigned(Parent) then begin + Parent.Constraints.MinWidth := FPanel.Width + GetFloatingBorderSize.X * 2; + Parent.Constraints.MinHeight := 0; + end; + end; + MinClientWidth := FPanel.Width; + MinClientHeight := 0; + end + else begin + if FPanel.Height <> FToolbarDock.Height then begin + FPanel.Height := FToolbarDock.Height; + if Floating and Assigned(Parent) then begin + Parent.Constraints.MinWidth := 0; + Parent.Constraints.MinHeight := FPanel.Height + GetFloatingBorderSize.Y * 2; + end; + end; + MinClientWidth := 0; + MinClientHeight := FPanel.Height; + end; +end; + +procedure TSpTBXCustomDockablePanel.DoDrawCaptionPanel(ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawCaptionPanel) then FOnDrawCaptionPanel(Self, ACanvas, ARect, PaintStage, PaintDefault); +end; + +procedure TSpTBXCustomDockablePanel.DoWindowStateChanged(AWindowState: TWindowState); +begin + if Assigned(FOnWindowStateChanged) then FOnWindowStateChanged(Self, AWindowState); +end; + +function TSpTBXCustomDockablePanel.GetCaptionPanelSize: TPoint; +begin + Result := Point(FPanel.Width, FPanel.Height); +end; + +procedure TSpTBXCustomDockablePanel.GetChildren(Proc: TGetChildProc; + Root: TComponent); +var + I: Integer; + C: TControl; + DesignerRootItem: TTBCustomItem; +begin + // Needed to fake the DFM streaming system because the owner of the items + // is the Form and not the Toolbar nor Self. + // But the parent must be the Toolbar. + // GetChildren is used to pass the children components of Self to the DFM + // streaming system. + // We also need to do the same with the controls of TTBControlItems. + // More info on the Delphi help or Classes.TWriter.WriteData + // Same as TSpTBXCompoundItemsControl and TSpTBXCustomDockablePanel + + DesignerRootItem := GetItems; + TTBCustomItemAccess(DesignerRootItem).GetChildren(Proc, Root); + for I := 0 to DesignerRootItem.Count - 1 do + if (DesignerRootItem[I] is TTBControlItem) then begin + C := TTBControlItem(DesignerRootItem[I]).Control; + if Assigned(C) then + if SpFindControl(Self, C) = -1 then Proc(C); + end; + inherited; +end; + +function TSpTBXCustomDockablePanel.GetImages: TCustomImageList; +begin + if Assigned(FToolbar) then + Result := FToolbar.Images + else + Result := nil; +end; + +function TSpTBXCustomDockablePanel.GetItems: TTBCustomItem; +begin + // The ToolbarEditor designer will open the editable items and + // not the Toolbar.Items + Result := Options.EditableItems; +end; + +function TSpTBXCustomDockablePanel.GetRootItems: TTBRootItem; +begin + Result := FToolbar.Items; +end; + +function TSpTBXCustomDockablePanel.GetToolbar: TSpTBXToolbar; +begin + Result := FToolbar; +end; + +function TSpTBXCustomDockablePanel.GetView: TTBToolbarView; +begin + Result := FToolbar.View; +end; + +function TSpTBXCustomDockablePanel.GetEffectiveHeight: Integer; +begin + Result := Height; +end; + +function TSpTBXCustomDockablePanel.GetEffectiveWidth: Integer; +begin + Result := Width; +end; + +function TSpTBXCustomDockablePanel.GetFloatingClientHeight: Integer; +begin + if Docked then + Result := FFloatingClientHeight + else + Result := ClientAreaHeight; +end; + +function TSpTBXCustomDockablePanel.GetFloatingClientWidth: Integer; +begin + if Docked then + Result := FFloatingClientWidth + else + Result := ClientAreaWidth; +end; + +procedure TSpTBXCustomDockablePanel.InternalDrawBackground(ACanvas: TCanvas; + ARect: TRect; PaintOnNCArea, PaintBorders: Boolean); +var + DefaultPainting: Boolean; +begin + if Color = clNone then + SpDrawXPDockablePanelBody(ACanvas, ARect, True, Floating) + else begin + ACanvas.Brush.Color := Color; + ACanvas.FillRect(ARect); + end; + + if PaintOnNCArea and FPanel.Visible then begin + // Draw the CaptionBar borders on the NC Area of the embedded Dock + // See DockDrawBackground. + // Just draw 1 pixel from the left and right, and 2 pixels from the top + // ARect.Top should remain the same + if IsVerticalTitleBar then begin + ARect.Right := ARect.Left + CaptionPanelSize.X + 2; + InflateRect(ARect, 0, -(DockedBorderSize - 1)); + end + else begin + ARect.Bottom := ARect.Top + CaptionPanelSize.Y + 2; + InflateRect(ARect, -(DockedBorderSize - 1), 0); + end; + + DefaultPainting := True; + DoDrawCaptionPanel(ACanvas, ARect, pstPrePaint, DefaultPainting); + if DefaultPainting then + SpDrawXPDockablePanelTitleBar(ACanvas, ARect, True, IsVerticalTitleBar); + DefaultPainting := True; + DoDrawCaptionPanel(ACanvas, ARect, pstPostPaint, DefaultPainting); + end; +end; + +function TSpTBXCustomDockablePanel.InternalMaximize(Restore: Boolean): Boolean; +// Resize the dockable panel to the maximum size, and minimize the rest of +// the panels +// Horizontal resizing is not supported. +var + I: Integer; + L, PrevRestoreSize: TList; + DP: TSpTBXCustomDockablePanel; + MultiDock: TSpTBXCustomMultiDock; +begin + Result := False; + if not Docked or not (CurrentDock is TSpTBXCustomMultiDock) or (CurrentDock.Position in [dpTop, dpBottom]) then Exit; + MultiDock := TSpTBXCustomMultiDock(CurrentDock); + + L := TList.Create; + PrevRestoreSize := TList.Create; + try + MultiDock.GetDockablePanelList(L); + if L.Count < 2 then Exit; + + if Restore then begin + // Restore the minimized DPs, from down-to-top + for I := L.Count - 1 downto 0 do + if L[I] <> Self then begin + DP := TSpTBXCustomDockablePanel(L[I]); + if DP.Minimized then begin + DP.FIsManualSizing := True; + if SpDPResize(DP, DP.FState.RestoreSize, dprtMinimizeOrRestore) then + PrevRestoreSize.Add(DP); + DP.FIsManualSizing := False; + end; + end; + // Now set the DockedState + for I := 0 to PrevRestoreSize.Count - 1 do begin + DP := TSpTBXCustomDockablePanel(PrevRestoreSize[I]); + DP.FState.DockedState := wsNormal; + DP.Options.SetupButtonIcon(DP.Options.MinimizeButton); + DP.Options.SetupButtonIcon(DP.Options.MaximizeButton); + end; + end + else begin + // Remember the previous Height of the DPs + for I := 0 to L.Count - 1 do begin + DP := TSpTBXCustomDockablePanel(L[I]); + PrevRestoreSize.Add(Pointer(DP.Height)); + end; + // Minimize the DPs + for I := 0 to L.Count - 1 do + if L[I] <> Self then begin + DP := TSpTBXCustomDockablePanel(L[I]); + if not DP.Minimized then begin + if not DP.Maximized then begin + DP.FState.RestoreSize := Integer(PrevRestoreSize[I]); + end; + DP.FIsManualSizing := True; + SpDPResize(DP, DP.CaptionPanelSize.Y, dprtMinimizeOrRestore); + DP.FIsManualSizing := False; + DP.FState.DockedState := wsMinimized; + DP.Options.SetupButtonIcon(DP.Options.MinimizeButton); + DP.Options.SetupButtonIcon(DP.Options.MaximizeButton); + end; + end; + end; + + Result := True; + finally + L.Free; + PrevRestoreSize.Free; + end; +end; + +procedure TSpTBXCustomDockablePanel.InvalidateBackground(InvalidateChildren: Boolean); +begin + SpInvalidateSpTBXControl(Self, True, True); +end; + +function TSpTBXCustomDockablePanel.IsVerticalTitleBar: Boolean; +begin + Result := FPanel.Align in [alLeft, alRight]; +end; + +procedure TSpTBXCustomDockablePanel.DoneReadingPositionData(const Data: TTBReadPositionData); +begin + inherited; + + // Special case when it's floating and minimized force the state + if Floating and (FLoadedState = wsMinimized) then begin + FState.DockedState := FLoadedState; + Parent.ClientHeight := FPanel.Height; + end; + + // Update buttons state + FOptions.SetupButtonIcon(FOptions.MinimizeButton); + FOptions.SetupButtonIcon(FOptions.MaximizeButton); +end; + +procedure TSpTBXCustomDockablePanel.ReadPositionData(const Data: TTBReadPositionData); +begin + inherited; + + // Load FLoadedBarSize and FLoadedDockPos + FLoadedBarSize.cx := ClientAreaWidth; + FLoadedBarSize.cy := ClientAreaHeight; + FLoadedDockPos := DockPos; + + // Load FloatingClientWidth/FloatingClientHeight, RestoreSize, State + with Data do begin + FFloatingClientWidth := ReadIntProc(Name, rvFloatingClientWidth, 0, ExtraData); + FFloatingClientHeight := ReadIntProc(Name, rvFloatingClientHeight, 0, ExtraData); + FState.RestoreSize := ReadIntProc(Name, rvRestoreSize, 0, ExtraData); + FState.DockedState := TWindowState(ReadIntProc(Name, rvState, 0, ExtraData)); + FLoadedState := FState.DockedState; + end; +end; + +procedure TSpTBXCustomDockablePanel.WritePositionData(const Data: TTBWritePositionData); +begin + inherited; + + // Save FloatingClientWidth/FloatingClientHeight, RestoreSize, State + with Data do begin + WriteIntProc(Name, rvFloatingClientWidth, FFloatingClientWidth, ExtraData); + WriteIntProc(Name, rvFloatingClientHeight, FFloatingClientHeight, ExtraData); + WriteIntProc(Name, rvRestoreSize, FState.RestoreSize, ExtraData); + WriteIntProc(Name, rvState, Integer(FState.DockedState), ExtraData); + end; +end; + +procedure TSpTBXCustomDockablePanel.SetDefaultDockedSize(Value: Integer); +begin + if FDefaultDockedSize <> Value then + FDefaultDockedSize := Value; +end; + +procedure TSpTBXCustomDockablePanel.SetEffectiveHeight(const Value: Integer); +begin + if Docked and IsVertical and (CurrentDock is TSpTBXCustomMultiDock) then + SpDPResize(Self, Value) + else + Height := Value; +end; + +procedure TSpTBXCustomDockablePanel.SetEffectiveWidth(const Value: Integer); +begin + if Docked and not IsVertical and (CurrentDock is TSpTBXCustomMultiDock) then + SpDPResize(Self, Value) + else + Width := Value; +end; + +procedure TSpTBXCustomDockablePanel.SetFloatingClientHeight(const Value: Integer); +begin + if Docked then + FFloatingClientHeight := Value + else + ClientAreaHeight := Value; +end; + +procedure TSpTBXCustomDockablePanel.SetFloatingClientWidth(const Value: Integer); +begin + if Docked then + FFloatingClientWidth := Value + else + ClientAreaWidth := Value; +end; + +procedure TSpTBXCustomDockablePanel.SetImages(const Value: TCustomImageList); +begin + if Assigned(FToolbar) then + FToolbar.Images := Value; +end; + +procedure TSpTBXCustomDockablePanel.SetParent(AParent: TWinControl); +var + ToDock, ToFloating, ToEmptyMultiDock, WasMinimized, WasNotDocked: Boolean; + PrevSize: TSize; + D: TTBDock; +begin + if not (csDestroying in ComponentState) and Assigned(Parent) and Assigned(AParent) and (AParent <> Parent) then begin + ToDock := AParent is TTBDock; + ToFloating := AParent is TTBFloatingWindowParent; + ToEmptyMultiDock := False; + WasMinimized := Minimized; + WasNotDocked := not (Parent is TTBDock); + + if ToDock then FPanel.Visible := FShowCaptionWhenDocked + else FPanel.Visible := FShowCaption; + + PrevSize.cx := ClientAreaWidth; + PrevSize.cy := ClientAreaHeight; + + if Floating then begin + FFloatingClientWidth := PrevSize.cx; + FFloatingClientHeight := PrevSize.cy; + end; + + if ToDock then begin + // [DockablePanel-Rule] + // When a floating DP is re-docked the DP size should be the same + // as the rest of the DPs that are present on the MultiDock. + // If the MultiDock is empty then the size should be DefaultDockedSize, + // and if DefaultDockedSize is 0 use the previous size. + D := TTBDock(AParent); + if D is TSpTBXCustomMultiDock then begin + ToEmptyMultiDock := D.ToolbarCount = 0; + if D.Position in [dpLeft, dpRight] then begin + if ToEmptyMultiDock then begin + if FDefaultDockedSize > 0 then EffectiveWidth := FDefaultDockedSize; + end + else + if Floating then // If it's still floating compute the borders + EffectiveWidth := D.ClientWidth - (DockedBorderSize * 2) + else + EffectiveWidth := D.ClientWidth; + end + else begin + if ToEmptyMultiDock then begin + if FDefaultDockedSize > 0 then EffectiveHeight := FDefaultDockedSize; + end + else + if Floating then // If it's still floating compute the borders + EffectiveHeight := D.ClientHeight - (DockedBorderSize * 2) + else + EffectiveHeight := D.ClientHeight; + end; + end; + end; + + inherited; + + if ToEmptyMultiDock then + TSpTBXMultiDock(AParent).InsertingOnEmptyDock // Re-align adjacent splitter + else + if ToDock and WasNotDocked then begin + D := TTBDock(AParent); + if D is TSpTBXCustomMultiDock then + if D.Position in [dpLeft, dpRight] then + EffectiveHeight := PrevSize.cy + else + EffectiveWidth := PrevSize.cx + end + else + if ToFloating then begin + // [DockablePanel-Rule] + // Remember the previous floating size + if FFloatingClientWidth > 0 then + ClientAreaWidth := FFloatingClientWidth + else + ClientAreaWidth := PrevSize.cx; + if FFloatingClientHeight > 0 then + ClientAreaHeight := FFloatingClientHeight + else + // [DockablePanel-Rule] + // If the previous floating size is not valid and the DP was minimized + // when it was undocked then use the Restore size. + if WasMinimized then + ClientAreaHeight := FState.RestoreSize + else + ClientAreaHeight := PrevSize.cy; + + if Assigned(Parent) and (Parent is TSpTBXFloatingWindowParent) then begin + Parent.Constraints.MinHeight := FPanel.Height + GetFloatingBorderSize.Y * 2; + TSpTBXFloatingWindowParent(Parent).CloseOnAltF4 := True; + end; + end; + + UpdateTitleBarRotation; // Update the rotation of the titlebar + end + else + inherited; +end; + +procedure TSpTBXCustomDockablePanel.SetShowCaption(const Value: Boolean); +begin + if FShowCaption <> Value then begin + FShowCaption := Value; + if not Docked then begin + FPanel.Visible := Value; + RedrawWindow(Parent.Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); + end; + end; +end; + +procedure TSpTBXCustomDockablePanel.SetShowCaptionWhenDocked(const Value: Boolean); +begin + if FShowCaptionWhenDocked <> Value then begin + FShowCaptionWhenDocked := Value; + if not Floating then begin + FPanel.Visible := Value; + // The panel can't be hidden at designtime, move it outside the client area + if (csDesigning in ComponentState) then + if Value then + FPanel.Align := alTop + else begin + FPanel.Align := alNone; + FPanel.Top := FPanel.Top - FPanel.Height - 60; + end; + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); + end; + end; +end; + +procedure TSpTBXCustomDockablePanel.SetShowVerticalCaption(const Value: Boolean); +begin + if FShowVerticalCaption <> Value then begin + FShowVerticalCaption := Value; + UpdateTitleBarRotation; + end; +end; + +function TSpTBXCustomDockablePanel.SizeToggle(ToMaximize: Boolean): Boolean; +begin + if (Minimized and not ToMaximize) or (Maximized and ToMaximize) then + Result := Restore + else + if ToMaximize then Result := Maximize + else Result := Minimize; +end; + +procedure TSpTBXCustomDockablePanel.UpdateTitleBarRotation; +begin + if not HandleAllocated then Exit; + + if FShowVerticalCaption and not (Floating or IsVertical) then begin + if not IsVerticalTitleBar then begin + // TTBDock doesn't allow us to change the position when there are + // docked toolbars, we have to undock the toolbar + FToolbar.Visible := False; + FToolbar.Floating := True; + FToolbarDock.Position := dpLeft; + FPanel.Align := alLeft; + FToolbar.CurrentDock := FToolbarDock; + FToolbar.Visible := True; + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); + end; + end + else begin + if IsVerticalTitleBar then begin + // TTBDock doesn't allow us to change the position when there are + // docked toolbars, we have to undock the toolbar + FToolbar.Visible := False; + FToolbar.Floating := True; + FToolbarDock.Position := dpTop; + FPanel.Align := alTop; + FToolbar.CurrentDock := FToolbarDock; + FToolbar.Visible := True; + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); + end; + end; + + // Update buttons glyphs + FOptions.SetupButtonIcon(FOptions.MinimizeButton); + FOptions.SetupButtonIcon(FOptions.MaximizeButton); +end; + +procedure TSpTBXCustomDockablePanel.ValidateContainer(AComponent: TComponent); +begin + inherited; + if (AComponent is TTBDock) and not (AComponent is TSpTBXCustomMultiDock) then + raise EInvalidOperation.CreateFmt('Cannot insert %s into %s. Place it on a MultiDock instead', [Self.ClassName, AComponent.ClassName]); +end; + +procedure TSpTBXCustomDockablePanel.CMTextChanged(var Message: TMessage); +begin + inherited; + if Assigned(FOptions) then + FOptions.CaptionLabel := Caption; +end; + +procedure TSpTBXCustomDockablePanel.WMNCCalcSize(var Message: TWMNCCalcSize); +begin + Message.Result := 0; + if Docked then + with Message.CalcSize_Params^ do + InflateRect(rgrc[0], -DockedBorderSize, -DockedBorderSize); +end; + +procedure TSpTBXCustomDockablePanel.WMNCHitTest(var Message: TWMNCHitTest); +var + P: TPoint; + R: TRect; +begin + inherited; + + if Docked then begin + P := SmallPointToPoint(Message.Pos); + GetWindowRect(Handle, R); + + if IsVertical then begin + if (P.Y >= R.Bottom - DockedBorderSize) and CanSplitResize(dpBottom) then + Message.Result := HT_DP_SPLITRESIZEBOTTOM + else if (P.Y <= R.Top + DockedBorderSize) and CanSplitResize(dpTop) then + Message.Result := HT_DP_SPLITRESIZETOP; + end + else begin + if (P.X >= R.Right - DockedBorderSize) and CanSplitResize(dpRight) then Message.Result := HT_DP_SPLITRESIZERIGHT + else if (P.X <= R.Left + DockedBorderSize) and CanSplitResize(dpLeft) then Message.Result := HT_DP_SPLITRESIZELEFT; + end; + end; +end; + +procedure TSpTBXCustomDockablePanel.WMNCLButtonDown(var Message: TWMNCLButtonDown); +var + OldCursor: HCURSOR; +begin + if Message.HitTest in [HT_DP_SPLITRESIZELEFT..HT_DP_SPLITRESIZEBOTTOM] then + BeginSplitResizing(Message.HitTest) + else + if (Message.HitTest = HT_TB2k_Border) and IsMovable then begin + FIsDockedMoving := True; + OldCursor := SetCursor(LoadCursor(0, IDC_SIZEALL)); + try + // To prevent resizing when clicking on the CaptionPanel: + // Instead of calling inherited call BeginDockedMoving + // that mimics TTBCustomDockableWindow.BeginMoving. + // The new method should only change position and change dock/floating + // it won't resize the DP. + BeginDockedMoving; + finally + SetCursor(OldCursor); + FIsDockedMoving := False; + end; + end + else + inherited; +end; + +procedure TSpTBXCustomDockablePanel.WMSetCursor(var Message: TWMSetCursor); +begin + if Docked and CurrentDock.AllowDrag and (Message.CursorWnd = WindowHandle) then begin + case Message.HitTest of + HT_DP_SPLITRESIZELEFT, HT_DP_SPLITRESIZERIGHT: + begin + SetCursor(LoadCursor(0, IDC_SIZEWE)); + Message.Result := 1; + Exit; + end; + HT_DP_SPLITRESIZETOP, HT_DP_SPLITRESIZEBOTTOM: + begin + SetCursor(LoadCursor(0, IDC_SIZENS)); + Message.Result := 1; + Exit; + end; + end; + end; + + inherited; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSplitter } + +constructor TSpTBXCustomSplitter.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + ControlStyle := ControlStyle + [csOpaque]; + + Width := 5; + Height := 100; + Align := alLeft; + Cursor := crSizeWE; + FResizeStyle := rsUpdate; + FOldSize := -1; + FMinSize := 0; + FGripSize := 50; + FGripHotTrack := True; + FAutoCalcMaxSize := True; + FSkinType := sknSkin; + FRestorePos := 60; + + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXCustomSplitter.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + FreeAndNil(FMouseBrush); + inherited Destroy; +end; + +procedure TSpTBXCustomSplitter.RequestAlign; +begin + inherited; + if Align in [alTop, alBottom] then Cursor:= crSizeNS + else Cursor:= crSizeWE; +end; + +function TSpTBXCustomSplitter.IsVertical: Boolean; +begin + Result := not (Align in [alTop, alBottom]); +end; + +function TSpTBXCustomSplitter.ValidateSplitControl: TControl; +// Find the control that the splitter must resize +var + P: TPoint; + I: Integer; + R: TRect; + C, ZeroSized: TControl; +begin + Result := nil; + ZeroSized := nil; + + P := Point(Left, Top); + case Align of + alLeft: Dec(P.X); + alRight: Inc(P.X, Width); + alTop: Dec(P.Y); + alBottom: Inc(P.Y, Height); + else + Exit; + end; + + // Try to find the Split Control + for I := 0 to Parent.ControlCount - 1 do begin + C := Parent.Controls[I]; + // Can't be a StatusBar, a Splitter or a regular Toolbar Dock + if C.Visible and (C.Align = Align) and + not ((C is TSpTBXCustomStatusBar) or (C is TCustomStatusBar)) and + not ((C is TSpTBXCustomSplitter) or (C is TSplitter)) and + not ((C is TTBDock) and not (C is TSpTBXCustomMultiDock)) then + begin + R := C.BoundsRect; + case Align of + alLeft, alRight: + if (R.Right - R.Left) = 0 then begin + if (R.Left = Left) or (R.Left = Left + Width) then + ZeroSized := C; + end; + alTop, alBottom: + if (R.Bottom - R.Top) = 0 then begin + if (R.Top = Top) or (R.Top = Top + Height) then + ZeroSized := C; + end; + end; + + if (Result = nil) and PtInRect(R, P) then + Result := C; + end; + end; + + // Zero sized control has the priority + if Assigned(ZeroSized) then + Result := ZeroSized; + + // Don't try to resize an empty MultiDock + if Assigned(Result) and (Result is TSpTBXCustomMultiDock) then + if TSpTBXCustomMultiDock(Result).ToolbarCount = 0 then begin + Result := nil; + Exit; + end; +end; + +procedure TSpTBXCustomSplitter.WMEraseBkgnd(var Message: TWmEraseBkgnd); +begin + Message.Result := 1; +end; + +procedure TSpTBXCustomSplitter.WMSpSkinChange(var Message: TMessage); +begin + Invalidate; +end; + +procedure TSpTBXCustomSplitter.MouseAllocateLineDC; +begin + FMouseLineDC := GetDCEx(Parent.Handle, 0, DCX_CACHE or DCX_CLIPSIBLINGS or DCX_LOCKWINDOWUPDATE); + if ResizeStyle = rsPattern then begin + if FMouseBrush = nil then begin + FMouseBrush := TBrush.Create; + FMouseBrush.Bitmap:= AllocPatternBitmap(clBlack,clWhite); + end; + FMousePrevBrush := SelectObject(FMouseLineDC, FMouseBrush.Handle); + end; +end; + +procedure TSpTBXCustomSplitter.MouseReleaseLineDC; +begin + if FMousePrevBrush <> 0 then SelectObject(FMouseLineDC, FMousePrevBrush); + ReleaseDC(Parent.Handle, FMouseLineDC); + if FMouseBrush <> nil then + FreeAndNil(FMouseBrush); +end; + +procedure TSpTBXCustomSplitter.MouseDrawLine; +var + P: TPoint; +begin + FMouseLineVisible := not FMouseLineVisible; + P := Point(Left, Top); + if IsVertical then + P.X := Left + FSplitLinePaintingPos + else + P.Y := Top + FSplitLinePaintingPos; + PatBlt(FMouseLineDC, P.X, P.Y, Width, Height, PATINVERT); +end; + +procedure TSpTBXCustomSplitter.MouseCalcSplitSize(X, Y: Integer; var NewSize, + Split: Integer); +var + I: Integer; +begin + if Assigned(FMouseSplitControl) then begin + if IsVertical then + Split := X - FMouseDownPos.X + else + Split := Y - FMouseDownPos.Y; + + I := 0; + case Align of + alLeft: I := FMouseSplitControl.Width + Split; + alRight: I := FMouseSplitControl.Width - Split; + alTop: I := FMouseSplitControl.Height + Split; + alBottom: I := FMouseSplitControl.Height - Split; + end; + + NewSize := I; + if I < FMinSize then + NewSize := FMinSize + else + if AutoCalcMaxSize and (I > FMaxSize) then + NewSize := FMaxSize; // Use the Maximum Size + + if I <> NewSize then begin + if Align in [alRight, alBottom] then + I := I - NewSize + else + I := NewSize - I; + Inc(Split, I); + end; + end; +end; + +procedure TSpTBXCustomSplitter.MouseStopSizing; +begin + if Assigned(FMouseSplitControl) then begin + if FMouseLineVisible then MouseDrawLine; + FMouseSplitControl := nil; + MouseReleaseLineDC; + if Assigned(FMouseActiveControl) then begin + TWinControlAccess(FMouseActiveControl).OnKeyDown := FOldKeyDown; + FMouseActiveControl := nil; + end; + end; + DoMoved; + FMoving:= False; +end; + +procedure TSpTBXCustomSplitter.MouseFocusKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if Key = VK_ESCAPE then MouseStopSizing + else if Assigned(FOldKeyDown) then FOldKeyDown(Sender,Key,Shift); +end; + +procedure TSpTBXCustomSplitter.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + C: TControl; + F: TCustomForm; + P: TPoint; + I: Integer; +begin + inherited; + + if (Button = mbLeft) and not (ssDouble in Shift) then begin + C := ValidateSplitControl; + if C = nil then Exit; + + P := Point(X,Y); + if (FGripSize > 0) and PtInRect(GripRect, P) then + FMouseDownOnGrip := True; + + FMouseSplitControl := C; + FMouseDownPos := P; + + if AutoCalcMaxSize and Assigned(FMouseSplitControl) then begin + if Align in [alLeft, alRight] then begin + FMaxSize := Parent.ClientWidth - FMinSize - Width; + for I := 0 to Parent.ControlCount - 1 do + with Parent.Controls[I] do + if Visible and (Align in [alLeft, alRight]) then Dec(FMaxSize, Width); + Inc(FMaxSize, FMouseSplitControl.Width); + end + else begin + FMaxSize := Parent.ClientHeight - FMinSize - Height; + for I := 0 to Parent.ControlCount - 1 do + with Parent.Controls[I] do + if Visible and (Align in [alTop, alBottom]) then Dec(FMaxSize, Height); + Inc(FMaxSize, FMouseSplitControl.Height); + end; + end; + + MouseCalcSplitSize(X, Y, FNewSize, FSplitLinePaintingPos); + MouseAllocateLineDC; + FMousePrevSplitControlSize := FNewSize; + + // When the ESC key is pressed we must abort the moving with StopSizing, + // for that we must intercept the key event from the Active control. + F := ValidParentForm(Self); + if Assigned(F) then + if F.ActiveControl <> nil then begin + FMouseActiveControl := F.ActiveControl; + FOldKeyDown := TWinControlAccess(FMouseActiveControl).OnKeyDown; + TWinControlAccess(FMouseActiveControl).OnKeyDown := MouseFocusKeyDown; + end; + + if ResizeStyle in [rsLine, rsPattern] then MouseDrawLine; + end; +end; + +procedure TSpTBXCustomSplitter.MouseMove(Shift: TShiftState; X, Y: Integer); +var + I, Split: Integer; + GripR: TRect; + MouseInGrip: Boolean; +begin + inherited; + + if (ssLeft in Shift) and not (ssDouble in Shift) and Assigned(FMouseSplitControl) then begin + MouseCalcSplitSize(X, Y, I, Split); + if DoMoving(I) then begin + FMoving := True; + if ResizeStyle in [rsLine, rsPattern] then MouseDrawLine; + FNewSize := I; + FSplitLinePaintingPos := Split; + case ResizeStyle of + rsUpdate: UpdateControlSize(FMouseSplitControl); + rsLine, rsPattern: MouseDrawLine; + end; + end; + end; + + // Track the mouse to invalidate the Grip when the mouse enters or leaves the grip zone + if (FGripSize > 0) and not FMoving then begin + GripR := GripRect; + MouseInGrip := PtInRect(GripR, Point(X, Y)); + if (MouseInGrip <> FMouseOverGrip) then begin + FMouseOverGrip := MouseInGrip; + InvalidateGrip; + end; + end; +end; + +procedure TSpTBXCustomSplitter.MouseUp(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + P: TPoint; +begin + inherited; + + if (Button = mbLeft) and not (ssDouble in Shift) and Assigned(FMouseSplitControl) then begin + P := Point(X, Y); + if ResizeStyle in [rsLine, rsPattern] then MouseDrawLine; + UpdateControlSize(FMouseSplitControl); + // If the splitter was minimized then RestorePos should be the MouseDown point + if not FMouseDownOnGrip and FMoving and (FNewSize = 0) and (FMousePrevSplitControlSize <> 0) then + FRestorePos := FMousePrevSplitControlSize; + MouseStopSizing; + + if (FGripSize > 0) and FMouseDownOnGrip then begin + if (P.X = FMouseDownPos.X) and (P.Y = FMouseDownPos.Y) and PtInRect(GripRect, P) then + Toggle; + FMouseDownOnGrip := False; + FMouseOverGrip := False; + InvalidateGrip; + end; + end; +end; + +procedure TSpTBXCustomSplitter.Paint; +var + ClientR, R, DragHandleR: TRect; + C1, C2: TColor; + PaintDefault: Boolean; +begin + ClientR := ClientRect; + PaintDefault := True; + DoDrawBackground(Canvas, ClientR, pstPrePaint, PaintDefault); + if PaintDefault then begin + // Paint background + if SpTBXSkinType(SkinType) = sknSkin then + CurrentSkin.PaintBackground(Canvas, ClientR, skncSplitter, sknsNormal, True, False, IsVertical) + else begin + if Color = clNone then + Canvas.Brush.Color := clBtnFace + else + Canvas.Brush.Color := Color; + Canvas.FillRect(ClientR); + end; + + // Paint grip + R := GripRect; + DragHandleR := R; + if IsVertical then + InflateRect(DragHandleR, -1, -10) + else + InflateRect(DragHandleR, -10, -1); + + case SpTBXSkinType(SkinType) of + sknNone, sknWindows: + begin + C1 := clBtnShadow; + C2 := clWindow; + SpDrawXPGrip(Canvas, DragHandleR, C1, C2); + end; + sknSkin: + begin + if FMouseOverGrip then + CurrentSkin.PaintBackground(Canvas, R, skncButton, sknsNormal, True, True, False, [akLeft, akTop, akRight, akBottom]); + C1 := SkinManager.CurrentSkin.Options(skncToolbarGrip).Body.Color1; + C2 := SkinManager.CurrentSkin.Options(skncToolbarGrip).Body.Color2; + SpDrawXPGrip(Canvas, DragHandleR, C1, C2); + end; + end; + end; + + PaintDefault := True; + DoDrawBackground(Canvas, ClientR, pstPostPaint, PaintDefault); +end; + +procedure TSpTBXCustomSplitter.CMMouseleave(var Message: TMessage); +begin + inherited; + if FMouseOverGrip and not FMoving then begin + FMouseOverGrip := False; + InvalidateGrip; + end; +end; + +procedure TSpTBXCustomSplitter.ChangeSplitControlSize(NewControlSize: Integer); +var + C: TControl; +begin + if not (csDesigning in ComponentState) then begin + C := ValidateSplitControl; + if C = nil then Exit; + + if NewControlSize < FMinSize then + NewControlSize := FMinSize; + if DoMoving(NewControlSize) then begin + // If minimizing save restore position + if NewControlSize = FMinSize then begin + if IsVertical then FRestorePos := C.Width + else FRestorePos := C.Height; + end; + + FMoving := True; + FNewSize := NewControlSize; + UpdateControlSize(C); + end; + FMoving := False; + end; +end; + +function TSpTBXCustomSplitter.GetMinimized: Boolean; +var + I, MinW, MinH: Integer; + C: TControl; +begin + Result := False; + C := ValidateSplitControl; + if Assigned(C) then begin + MinW := C.Constraints.MinWidth; + MinH := C.Constraints.MinHeight; + + if FMinSize > MinW then + MinW := FMinSize; + if FMinSize > MinH then + MinH := FMinSize; + + if IsVertical then begin + I := C.Width; + Result := I <= MinW; + end + else begin + I := C.Height; + Result := I <= MinH; + end; + end; +end; + +procedure TSpTBXCustomSplitter.Minimize; +begin + ChangeSplitControlSize(0); +end; + +procedure TSpTBXCustomSplitter.Restore; +begin + if Minimized then + ChangeSplitControlSize(FRestorePos); +end; + +procedure TSpTBXCustomSplitter.Toggle; +begin + if Minimized then + Restore + else + Minimize; +end; + +procedure TSpTBXCustomSplitter.DoDrawBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, PaintStage, PaintDefault); +end; + +procedure TSpTBXCustomSplitter.DoMoved; +begin + if Assigned(FOnMoved) then FOnMoved(Self); +end; + +function TSpTBXCustomSplitter.DoMoving(var NewSize: Integer): Boolean; +begin + Result := True; + if Assigned(FOnMoving) then FOnMoving(Self, NewSize, Result); + if Result and (NewSize < FMinSize) then NewSize := 0; +end; + +procedure TSpTBXCustomSplitter.SetMinSize(const Value: integer); +begin + if (Value <> FMinSize) and (Value >= 0) then FMinSize := Value; +end; + +procedure TSpTBXCustomSplitter.SetSkinType(const Value: TSpTBXSkinType); +begin + if Value <> FSkinType then begin + FSkinType := Value; + Invalidate; + end; +end; + +procedure TSpTBXCustomSplitter.UpdateControlSize(SplitControl: TControl); +begin + if (FOldSize <> FNewSize) and Assigned(SplitControl) then begin + case Align of + alLeft: + begin + SpFixDelphiAlignBug(SplitControl, FNewSize, Self); + FOldSize := SplitControl.Width; + end; + alTop: + begin + SpFixDelphiAlignBug(SplitControl, FNewSize, Self); + FOldSize := SplitControl.Height; + end; + alRight: + begin + SpFixDelphiAlignBug(SplitControl, FNewSize, Self); + FOldSize := SplitControl.Width; + end; + alBottom: + begin + SpFixDelphiAlignBug(SplitControl, FNewSize, Self); + FOldSize := SplitControl.Height; + end; + end; + Update; + DoMoved; + end; +end; + +function TSpTBXCustomSplitter.GetGripRect: TRect; +begin + Result := Rect(0, 0, 0, 0); + if FGripSize > 0 then + if IsVertical then + Result := Bounds(0, (Height - FGripSize) div 2, Width, FGripSize) + else + Result := Bounds((Width - FGripSize) div 2, 0, FGripSize, Height); +end; + +procedure TSpTBXCustomSplitter.SetGripSize(const Value: Integer); +begin + if FGripSize <> Value then begin + if Value < 0 then FGripSize := 0 + else FGripSize := Value; + InvalidateGrip; + end; +end; + +procedure TSpTBXCustomSplitter.InvalidateGrip; +begin + if FGripHotTrack then Invalidate; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.dcu new file mode 100644 index 0000000..fd2dee9 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.hpp new file mode 100644 index 0000000..1945c02 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.hpp @@ -0,0 +1,741 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxeditors.pas' rev: 20.00 + +#ifndef SptbxeditorsHPP +#define SptbxeditorsHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxeditors +{ +//-- type declarations ------------------------------------------------------- +typedef Stdctrls::TComboBox* TTntComboBox; + +typedef Stdctrls::TListBox* TTntListBox; + +typedef Checklst::TCheckListBox* TTntCheckListBox; + +#pragma option push -b- +enum TSpTBXSpinType { spnInteger, spnFloat, spnHex }; +#pragma option pop + +typedef void __fastcall (__closure *TSpTBXEditChangeEvent)(System::TObject* Sender, const System::WideString AText); + +typedef void __fastcall (__closure *TSpTBXEditAcceptTextEvent)(System::TObject* Sender, System::WideString &NewText, bool &Accept); + +typedef void __fastcall (__closure *TSpTBXEditGetTextEvent)(System::TObject* Sender, System::WideString &AText); + +class DELPHICLASS TSpTBXEditItemViewer; +typedef void __fastcall (__closure *TSpTBXBeginEditEvent)(System::TObject* Sender, TSpTBXEditItemViewer* Viewer, Stdctrls::TCustomEdit* EditControl); + +typedef void __fastcall (__closure *TSpTBXEditMessageEvent)(System::TObject* Sender, TSpTBXEditItemViewer* Viewer, Messages::TMessage &Message, bool &Handled); + +typedef void __fastcall (__closure *TSpTBXDrawListItemEvent)(System::TObject* Sender, Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + +class DELPHICLASS TSpTBXEditButton; +class PASCALIMPLEMENTATION TSpTBXEditButton : public Sptbxcontrols::TSpTBXSpeedButton +{ + typedef Sptbxcontrols::TSpTBXSpeedButton inherited; + +protected: + virtual void __fastcall AdjustFont(Graphics::TFont* AFont); + virtual bool __fastcall DoDrawDropDownArrow(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + virtual bool __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + bool __fastcall GetFrameHotTrack(void); + +public: + __fastcall virtual TSpTBXEditButton(Classes::TComponent* AOwner); + DYNAMIC void __fastcall Click(void); +public: + /* TSpTBXCustomButton.Destroy */ inline __fastcall virtual ~TSpTBXEditButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXEditButton(HWND ParentWindow) : Sptbxcontrols::TSpTBXSpeedButton(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXSpinButton; +class PASCALIMPLEMENTATION TSpTBXSpinButton : public TSpTBXEditButton +{ + typedef TSpTBXEditButton inherited; + +private: + bool FUpPushed; + bool FDownPushed; + Classes::TNotifyEvent FOnUpClick; + Classes::TNotifyEvent FOnDownClick; + +protected: + virtual bool __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + virtual void __fastcall DoMouseLeave(void); + DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + __property Classes::TNotifyEvent OnUpClick = {read=FOnUpClick, write=FOnUpClick}; + __property Classes::TNotifyEvent OnDownClick = {read=FOnDownClick, write=FOnDownClick}; + +public: + __fastcall virtual TSpTBXSpinButton(Classes::TComponent* AOwner); + DYNAMIC void __fastcall Click(void); + void __fastcall IsHotTracking(/* out */ bool &UpButton, /* out */ bool &DownButton, /* out */ bool &EditFrame); + +__published: + __property Repeating = {default=1}; +public: + /* TSpTBXCustomButton.Destroy */ inline __fastcall virtual ~TSpTBXSpinButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXSpinButton(HWND ParentWindow) : TSpTBXEditButton(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXUnicodeAdaptEdit; +class PASCALIMPLEMENTATION TSpTBXUnicodeAdaptEdit : public Stdctrls::TEdit +{ + typedef Stdctrls::TEdit inherited; + +public: + /* TCustomEdit.Create */ inline __fastcall virtual TSpTBXUnicodeAdaptEdit(Classes::TComponent* AOwner) : Stdctrls::TEdit(AOwner) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXUnicodeAdaptEdit(HWND ParentWindow) : Stdctrls::TEdit(ParentWindow) { } + /* TWinControl.Destroy */ inline __fastcall virtual ~TSpTBXUnicodeAdaptEdit(void) { } + +}; + + +class DELPHICLASS TSpTBXUnicodeEdit; +class PASCALIMPLEMENTATION TSpTBXUnicodeEdit : public TSpTBXUnicodeAdaptEdit +{ + typedef TSpTBXUnicodeAdaptEdit inherited; + +private: + Classes::TAlignment FAlignment; + HIDESBASE void __fastcall SetAlignment(Classes::TAlignment Value); + HIDESBASE MESSAGE void __fastcall CMEnabledChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message); + +protected: + virtual void __fastcall CreateWnd(void); + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual void __fastcall UpdateEditRect(void); + +public: + TSpTBXEditButton* __fastcall AddEditButton(bool RightAligned = true, int AWidth = 0xffffffff); + bool __fastcall HasEditButton(void); + +__published: + __property Classes::TAlignment Alignment = {read=FAlignment, write=SetAlignment, default=0}; +public: + /* TCustomEdit.Create */ inline __fastcall virtual TSpTBXUnicodeEdit(Classes::TComponent* AOwner) : TSpTBXUnicodeAdaptEdit(AOwner) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXUnicodeEdit(HWND ParentWindow) : TSpTBXUnicodeAdaptEdit(ParentWindow) { } + /* TWinControl.Destroy */ inline __fastcall virtual ~TSpTBXUnicodeEdit(void) { } + +}; + + +class DELPHICLASS TSpTBXEdit; +class PASCALIMPLEMENTATION TSpTBXEdit : public TSpTBXUnicodeEdit +{ + typedef TSpTBXUnicodeEdit inherited; + +private: + Forms::TFormBorderStyle FBorderStyle; + bool FHotTrack; + Sptbxskins::TSpTBXSkinType FSkinType; + bool FMouseInControl; + HIDESBASE void __fastcall SetBorderStyle(const Forms::TBorderStyle Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + HIDESBASE MESSAGE void __fastcall CMEnabledChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMEnter(Messages::TWMNoParams &Message); + HIDESBASE MESSAGE void __fastcall CMExit(Messages::TWMNoParams &Message); + HIDESBASE MESSAGE void __fastcall CMMouseEnter(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMMouseLeave(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMNCPaint(Messages::TWMNCPaint &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +public: + __fastcall virtual TSpTBXEdit(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXEdit(void); + HIDESBASE void __fastcall InvalidateFrame(void); + __property bool MouseInControl = {read=FMouseInControl, nodefault}; + +__published: + __property Forms::TBorderStyle BorderStyle = {read=FBorderStyle, write=SetBorderStyle, default=1}; + __property bool HotTrack = {read=FHotTrack, write=FHotTrack, default=1}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXEdit(HWND ParentWindow) : TSpTBXUnicodeEdit(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomButtonEdit; +class PASCALIMPLEMENTATION TSpTBXCustomButtonEdit : public TSpTBXEdit +{ + typedef TSpTBXEdit inherited; + +private: + TSpTBXEditButton* FEditButton; + +protected: + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + virtual void __fastcall SetName(const Classes::TComponentName Value); + __property TSpTBXEditButton* EditButton = {read=FEditButton}; + +public: + __fastcall virtual TSpTBXCustomButtonEdit(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomButtonEdit(void); +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomButtonEdit(HWND ParentWindow) : TSpTBXEdit(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXButtonEdit; +class PASCALIMPLEMENTATION TSpTBXButtonEdit : public TSpTBXCustomButtonEdit +{ + typedef TSpTBXCustomButtonEdit inherited; + +__published: + __property EditButton; +public: + /* TSpTBXCustomButtonEdit.Create */ inline __fastcall virtual TSpTBXButtonEdit(Classes::TComponent* AOwner) : TSpTBXCustomButtonEdit(AOwner) { } + /* TSpTBXCustomButtonEdit.Destroy */ inline __fastcall virtual ~TSpTBXButtonEdit(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXButtonEdit(HWND ParentWindow) : TSpTBXCustomButtonEdit(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXSpinEditOptions; +class PASCALIMPLEMENTATION TSpTBXSpinEditOptions : public Classes::TPersistent +{ + typedef Classes::TPersistent inherited; + +private: + int FDecimal; + System::Extended FIncrement; + System::Extended FMinValue; + System::Extended FMaxValue; + System::Extended FValue; + bool FValueSnap; + TSpTBXSpinType FValueType; + System::WideString FPrefix; + System::WideString FPostfix; + TSpTBXEditAcceptTextEvent FOnGetText; + TSpTBXEditChangeEvent FOnSetText; + Classes::TNotifyEvent FOnValueChanged; + bool __fastcall IsIncrementStored(void); + bool __fastcall IsMaxValueStored(void); + bool __fastcall IsMinValueStored(void); + bool __fastcall IsValueStored(void); + void __fastcall SetDecimal(int NewDecimal); + void __fastcall SetMaxValue(const System::Extended NewValue); + void __fastcall SetMinValue(const System::Extended NewValue); + void __fastcall SetValue(const System::Extended NewValue); + void __fastcall SetValueType(TSpTBXSpinType NewType); + void __fastcall SetPostfix(const System::WideString ValueString); + void __fastcall SetPrefix(const System::WideString ValueString); + __int64 __fastcall GetValueAsInteger(void); + void __fastcall SetValueAsInteger(const __int64 NewValue); + +protected: + virtual void __fastcall DoValueChanged(void); + void __fastcall UpdateTextFromValue(void); + void __fastcall UpdateValueFromText(bool RevertWhenInvalid = true); + __property TSpTBXEditAcceptTextEvent OnGetText = {read=FOnGetText, write=FOnGetText}; + __property TSpTBXEditChangeEvent OnSetText = {read=FOnSetText, write=FOnSetText}; + __property Classes::TNotifyEvent OnValueChanged = {read=FOnValueChanged, write=FOnValueChanged}; + +public: + __fastcall virtual TSpTBXSpinEditOptions(void); + void __fastcall ValueInc(void); + void __fastcall ValueDec(void); + __property __int64 ValueAsInteger = {read=GetValueAsInteger, write=SetValueAsInteger}; + +__published: + __property int Decimal = {read=FDecimal, write=SetDecimal, default=2}; + __property System::Extended Increment = {read=FIncrement, write=FIncrement, stored=IsIncrementStored}; + __property System::Extended MaxValue = {read=FMaxValue, write=SetMaxValue, stored=IsMaxValueStored}; + __property System::Extended MinValue = {read=FMinValue, write=SetMinValue, stored=IsMinValueStored}; + __property System::WideString Postfix = {read=FPostfix, write=SetPostfix}; + __property System::WideString Prefix = {read=FPrefix, write=SetPrefix}; + __property System::Extended Value = {read=FValue, write=SetValue, stored=IsValueStored}; + __property bool ValueSnap = {read=FValueSnap, write=FValueSnap, default=1}; + __property TSpTBXSpinType ValueType = {read=FValueType, write=SetValueType, default=0}; +public: + /* TPersistent.Destroy */ inline __fastcall virtual ~TSpTBXSpinEditOptions(void) { } + +}; + + +class DELPHICLASS TSpTBXSpinEdit; +class PASCALIMPLEMENTATION TSpTBXSpinEdit : public TSpTBXEdit +{ + typedef TSpTBXEdit inherited; + +private: + bool FExtendedAccept; + TSpTBXSpinButton* FSpinButton; + TSpTBXSpinEditOptions* FSpinOptions; + void __fastcall SpinOptionsGetText(System::TObject* Sender, System::WideString &NewText, bool &Accept); + void __fastcall SpinOptionsSetText(System::TObject* Sender, const System::WideString AText); + System::Extended __fastcall GetValue(void); + Classes::TNotifyEvent __fastcall GetValueChanged(); + void __fastcall SetValue(const System::Extended Value); + void __fastcall SetValueChanged(const Classes::TNotifyEvent ValueChangedEvent); + HIDESBASE MESSAGE void __fastcall CMExit(Messages::TWMNoParams &Message); + +protected: + DYNAMIC void __fastcall Change(void); + DYNAMIC void __fastcall KeyDown(System::Word &Key, Classes::TShiftState Shift); + DYNAMIC void __fastcall KeyPress(System::WideChar &Key); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + virtual void __fastcall UpClick(System::TObject* Sender); + virtual void __fastcall DownClick(System::TObject* Sender); + +public: + __fastcall virtual TSpTBXSpinEdit(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXSpinEdit(void); + +__published: + __property Alignment = {default=1}; + __property bool ExtendedAccept = {read=FExtendedAccept, write=FExtendedAccept, default=0}; + __property Text = {stored=false}; + __property TSpTBXSpinButton* SpinButton = {read=FSpinButton}; + __property TSpTBXSpinEditOptions* SpinOptions = {read=FSpinOptions, write=FSpinOptions}; + __property System::Extended Value = {read=GetValue, write=SetValue, stored=false}; + __property Classes::TNotifyEvent OnValueChanged = {read=GetValueChanged, write=SetValueChanged}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXSpinEdit(HWND ParentWindow) : TSpTBXEdit(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXComboBox; +class PASCALIMPLEMENTATION TSpTBXComboBox : public Stdctrls::TComboBox +{ + typedef Stdctrls::TComboBox inherited; + +private: + bool FAutoDropDownWidth; + bool FAutoItemHeight; + bool FFontChanging; + bool FHotTrack; + int FInternalItemHeight; + bool FMouseInControl; + bool FMouseInDropDownButton; + Extctrls::TTimer* FMouseTimer; + Sptbxskins::TSpTBXSkinType FSkinType; + Sptbxitem::TSpTBXDrawEvent FOnDrawBackground; + TSpTBXDrawListItemEvent FOnDrawItem; + TSpTBXDrawListItemEvent FOnDrawItemBackground; + void __fastcall MouseTimerHandler(System::TObject* Sender); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + void __fastcall UpdateDropDownButton(void); + HIDESBASE MESSAGE void __fastcall CMEnter(Messages::TWMNoParams &Message); + HIDESBASE MESSAGE void __fastcall CMExit(Messages::TWMNoParams &Message); + HIDESBASE MESSAGE void __fastcall CNMeasureItem(Messages::TWMMeasureItem &Message); + HIDESBASE MESSAGE void __fastcall CMMouseEnter(Messages::TMessage &Message); + MESSAGE void __fastcall CMSPFontChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CNDrawItem(Messages::TWMDrawItem &Message); + HIDESBASE MESSAGE void __fastcall WMMouseMove(Messages::TWMMouse &Message); + HIDESBASE MESSAGE void __fastcall WMNCCalcSize(Messages::TWMNCCalcSize &Message); + HIDESBASE MESSAGE void __fastcall WMPaint(Messages::TWMPaint &Message); + MESSAGE void __fastcall WMSetFont(Messages::TWMSetFont &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + int FAutoDropDownWidthRightMargin; + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual void __fastcall CreateWnd(void); + DYNAMIC void __fastcall CloseUp(void); + virtual void __fastcall DoCalcMaxDropDownWidth(void); + virtual void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawItemBackground(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DrawItem(int Index, const Types::TRect &Rect, Windows::TOwnerDrawState State); + virtual void __fastcall DrawItemBackground(int Index, const Types::TRect &Rect, Windows::TOwnerDrawState State); + virtual void __fastcall EditWndProc(Messages::TMessage &Message); + virtual int __fastcall GetItemHt(void); + virtual void __fastcall SetItemHeight(int Value); + +public: + __fastcall virtual TSpTBXComboBox(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXComboBox(void); + Types::TRect __fastcall GetDropDownButtonRect(); + bool __fastcall GetMouseInDropDownButton(void); + HIDESBASE void __fastcall InvalidateFrame(void); + __property bool MouseInControl = {read=FMouseInControl, nodefault}; + +__published: + __property bool AutoDropDownWidth = {read=FAutoDropDownWidth, write=FAutoDropDownWidth, default=0}; + __property bool AutoItemHeight = {read=FAutoItemHeight, write=FAutoItemHeight, default=1}; + __property bool HotTrack = {read=FHotTrack, write=FHotTrack, default=1}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; + __property Sptbxitem::TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; + __property TSpTBXDrawListItemEvent OnDrawItem = {read=FOnDrawItem, write=FOnDrawItem}; + __property TSpTBXDrawListItemEvent OnDrawItemBackground = {read=FOnDrawItemBackground, write=FOnDrawItemBackground}; + __property OnMouseMove; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXComboBox(HWND ParentWindow) : Stdctrls::TComboBox(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXListBox; +class PASCALIMPLEMENTATION TSpTBXListBox : public Stdctrls::TListBox +{ + typedef Stdctrls::TListBox inherited; + +private: + bool FHotTracking; + bool FHotTrack; + Sptbxskins::TSpTBXSkinType FSkinType; + bool FChildFocused; + TSpTBXDrawListItemEvent FOnDrawItem; + TSpTBXDrawListItemEvent FOnDrawItemBackground; + void __fastcall SetHotTrack(const bool Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + HIDESBASE MESSAGE void __fastcall CMMouseEnter(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMMouseLeave(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMFocusChanged(Controls::TCMFocusChanged &Message); + HIDESBASE MESSAGE void __fastcall CNDrawItem(Messages::TWMDrawItem &Message); + HIDESBASE MESSAGE void __fastcall WMNCPaint(Messages::TWMNCPaint &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual void __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawItemBackground(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DrawItem(int Index, const Types::TRect &Rect, Windows::TOwnerDrawState State); + virtual void __fastcall DrawItemBackground(int Index, const Types::TRect &Rect, Windows::TOwnerDrawState State); + +public: + __fastcall virtual TSpTBXListBox(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXListBox(void); + void __fastcall InvalidateBorders(void); + __property bool HotTracking = {read=FHotTracking, nodefault}; + +__published: + __property Style = {default=1}; + __property bool HotTrack = {read=FHotTrack, write=SetHotTrack, default=1}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; + __property TSpTBXDrawListItemEvent OnDrawItem = {read=FOnDrawItem, write=FOnDrawItem}; + __property TSpTBXDrawListItemEvent OnDrawItemBackground = {read=FOnDrawItemBackground, write=FOnDrawItemBackground}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXListBox(HWND ParentWindow) : Stdctrls::TListBox(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCheckListBox; +class PASCALIMPLEMENTATION TSpTBXCheckListBox : public Checklst::TCheckListBox +{ + typedef Checklst::TCheckListBox inherited; + +private: + bool FHotTracking; + bool FHotTrack; + Sptbxskins::TSpTBXSkinType FSkinType; + bool FChildFocused; + TSpTBXDrawListItemEvent FOnDrawItem; + TSpTBXDrawListItemEvent FOnDrawItemBackground; + void __fastcall SetHotTrack(const bool Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + HIDESBASE MESSAGE void __fastcall CMMouseEnter(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMMouseLeave(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMFocusChanged(Controls::TCMFocusChanged &Message); + HIDESBASE MESSAGE void __fastcall CNDrawItem(Messages::TWMDrawItem &Message); + HIDESBASE MESSAGE void __fastcall WMNCPaint(Messages::TWMNCPaint &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + virtual void __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawItemBackground(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DrawItem(int Index, const Types::TRect &Rect, Windows::TOwnerDrawState State); + virtual void __fastcall DrawItemBackground(int Index, const Types::TRect &Rect, Windows::TOwnerDrawState State); + +public: + __fastcall virtual TSpTBXCheckListBox(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCheckListBox(void); + void __fastcall InvalidateBorders(void); + __property bool HotTracking = {read=FHotTracking, nodefault}; + +__published: + __property Style = {default=1}; + __property bool HotTrack = {read=FHotTrack, write=SetHotTrack, default=1}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; + __property TSpTBXDrawListItemEvent OnDrawItem = {read=FOnDrawItem, write=FOnDrawItem}; + __property TSpTBXDrawListItemEvent OnDrawItemBackground = {read=FOnDrawItemBackground, write=FOnDrawItemBackground}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCheckListBox(HWND ParentWindow) : Checklst::TCheckListBox(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXEditItem; +class PASCALIMPLEMENTATION TSpTBXEditItem : public Sptbxitem::TSpTBXCustomItem +{ + typedef Sptbxitem::TSpTBXCustomItem inherited; + +private: + System::WideString FEditCaption; + Imglist::TImageIndex FEditImageIndex; + System::WideString FText; + bool FAllowVerticalEditor; + Stdctrls::TEditCharCase FCharCase; + Sptbxitem::TSpTBXFontSettings* FEditorFontSettings; + bool FExtendedAccept; + Sptbxitem::TSpTBXFontSettings* FFontSettings; + int FMaxLength; + System::WideChar FPasswordChar; + bool FReadOnly; + bool FShowImage; + TSpTBXEditAcceptTextEvent FOnAcceptText; + TSpTBXBeginEditEvent FOnBeginEdit; + TSpTBXEditChangeEvent FOnChange; + TSpTBXEditMessageEvent FOnEditMessage; + HIDESBASE void __fastcall FontSettingsChanged(System::TObject* Sender); + void __fastcall SetAllowVerticalEditor(const bool Value); + void __fastcall SetCharCase(Stdctrls::TEditCharCase Value); + void __fastcall SetEditCaption(const System::WideString Value); + void __fastcall SetEditorFontSettings(const Sptbxitem::TSpTBXFontSettings* Value); + void __fastcall SetMaxLength(int Value); + void __fastcall SetPasswordChar(System::WideChar Value); + void __fastcall SetShowImage(const bool Value); + void __fastcall SetText(System::WideString Value); + +protected: + virtual bool __fastcall DoAcceptText(System::WideString &NewText); + virtual bool __fastcall DoAutoComplete(System::WideString &AText); + virtual void __fastcall DoBeginEdit(TSpTBXEditItemViewer* Viewer); + virtual void __fastcall DoChange(const System::WideString AText); + virtual void __fastcall DoTextChanging(const System::WideString OldText, System::WideString &NewText, int Reason); + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); + virtual bool __fastcall NeedToRecreateViewer(Tb2item::TTBItemViewer* AViewer); + virtual void __fastcall SetTextEx(System::WideString Value, int Reason); + +public: + bool __fastcall StartEditing(Tb2item::TTBView* AView); + __fastcall virtual TSpTBXEditItem(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXEditItem(void); + +__published: + __property Action; + __property Alignment = {default=0}; + __property Caption; + __property CustomWidth = {default=64}; + __property CustomHeight = {default=-1}; + __property DisplayMode = {default=0}; + __property Enabled = {default=1}; + __property FontSettings; + __property GroupIndex = {default=0}; + __property HelpContext = {default=0}; + __property Hint; + __property ImageIndex = {default=-1}; + __property Images; + __property ShortCut = {default=0}; + __property Visible = {default=1}; + __property OnClick; + __property OnDrawCaption; + __property OnDrawHint; + __property OnDrawImage; + __property OnDrawItem; + __property OnSelect; + __property System::WideString EditCaption = {read=FEditCaption, write=SetEditCaption}; + __property Imglist::TImageIndex EditImageIndex = {read=FEditImageIndex, write=FEditImageIndex, default=-1}; + __property System::WideString Text = {read=FText, write=SetText}; + __property bool AllowVerticalEditor = {read=FAllowVerticalEditor, write=SetAllowVerticalEditor, default=0}; + __property Stdctrls::TEditCharCase CharCase = {read=FCharCase, write=SetCharCase, default=0}; + __property Sptbxitem::TSpTBXFontSettings* EditorFontSettings = {read=FEditorFontSettings, write=SetEditorFontSettings}; + __property bool ExtendedAccept = {read=FExtendedAccept, write=FExtendedAccept, default=0}; + __property int MaxLength = {read=FMaxLength, write=SetMaxLength, default=0}; + __property System::WideChar PasswordChar = {read=FPasswordChar, write=SetPasswordChar, default=0}; + __property bool ReadOnly = {read=FReadOnly, write=FReadOnly, default=0}; + __property bool ShowImage = {read=FShowImage, write=SetShowImage, default=0}; + __property TSpTBXEditAcceptTextEvent OnAcceptText = {read=FOnAcceptText, write=FOnAcceptText}; + __property TSpTBXBeginEditEvent OnBeginEdit = {read=FOnBeginEdit, write=FOnBeginEdit}; + __property TSpTBXEditChangeEvent OnChange = {read=FOnChange, write=FOnChange}; + __property TSpTBXEditMessageEvent OnEditMessage = {read=FOnEditMessage, write=FOnEditMessage}; +}; + + +typedef TMetaClass* TEditClass; + +class PASCALIMPLEMENTATION TSpTBXEditItemViewer : public Sptbxitem::TSpTBXItemViewer +{ + typedef Sptbxitem::TSpTBXItemViewer inherited; + +private: + #pragma option push -b- + enum _TSpTBXEditItemViewer__1 { ecsContinueLoop, ecsAccept, ecsClose }; + #pragma option pop + + +private: + bool __fastcall EditLoop(const HWND CapHandle); + void __fastcall EditWndProc(Messages::TMessage &Message); + System::WideString __fastcall GetEditControlText(); + void __fastcall GetEditHeight(const HDC DC, /* out */ int &EditHeight, /* out */ int &ExternalLeading); + HIDESBASE TSpTBXEditItem* __fastcall GetItem(void); + void __fastcall MouseBeginEdit(void); + tagSIZE __fastcall MeasureEditCaption(); + int __fastcall MeasureTextHeight(void); + +protected: + Stdctrls::TCustomEdit* FEditControl; + Set<_TSpTBXEditItemViewer__1, ecsContinueLoop, ecsClose> FEditControlStatus; + virtual void __fastcall CalcSize(const Graphics::TCanvas* Canvas, int &AWidth, int &AHeight); + DYNAMIC bool __fastcall CaptionShown(void); + virtual void __fastcall DoBeginEdit(void); + virtual bool __fastcall DoExecute(void); + virtual bool __fastcall HandleEditMessage(Messages::TMessage &Message); + virtual int __fastcall GetAccRole(void); + virtual bool __fastcall GetAccValue(System::WideString &Value); + virtual void __fastcall GetCursor(const Types::TPoint &Pt, HICON &ACursor); + virtual TEditClass __fastcall GetEditControlClass(void); + virtual void __fastcall GetEditRect(Types::TRect &R); + virtual bool __fastcall GetImageShown(void); + virtual int __fastcall GetIndentBefore(void); + virtual int __fastcall GetIndentAfter(void); + virtual void __fastcall InternalDrawFrame(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); + virtual void __fastcall InternalEditControlChange(System::TObject* Sender); + virtual void __fastcall InternalEditControlExit(void); + virtual void __fastcall MouseDown(Classes::TShiftState Shift, int X, int Y, bool &MouseDownOnMenu); + virtual void __fastcall MouseUp(int X, int Y, bool MouseWasDownOnMenu); + virtual void __fastcall Paint(const Graphics::TCanvas* Canvas, const Types::TRect &ClientAreaRect, bool IsSelected, bool IsPushed, bool UseDisabledShadow); + virtual bool __fastcall ShowImage(void); + virtual bool __fastcall UsesSameWidth(void); + +public: + virtual System::WideString __fastcall GetCaptionText(); + __property Stdctrls::TCustomEdit* EditControl = {read=FEditControl}; + __property TSpTBXEditItem* Item = {read=GetItem}; +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXEditItemViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : Sptbxitem::TSpTBXItemViewer(AView, AItem, AGroupLevel) { } + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXEditItemViewer(void) { } + +}; + + +class DELPHICLASS TSpTBXSpinEditItem; +class PASCALIMPLEMENTATION TSpTBXSpinEditItem : public TSpTBXEditItem +{ + typedef TSpTBXEditItem inherited; + +private: + TSpTBXSpinEditOptions* FSpinOptions; + void __fastcall SpinOptionsGetText(System::TObject* Sender, System::WideString &NewText, bool &Accept); + void __fastcall SpinOptionsSetText(System::TObject* Sender, const System::WideString AText); + System::Extended __fastcall GetValue(void); + Classes::TNotifyEvent __fastcall GetValueChanged(); + void __fastcall SetValue(const System::Extended Value); + void __fastcall SetValueChanged(const Classes::TNotifyEvent ValueChangedEvent); + +protected: + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); + +public: + __fastcall virtual TSpTBXSpinEditItem(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXSpinEditItem(void); + +__published: + __property Alignment = {default=1}; + __property Text = {stored=false}; + __property TSpTBXSpinEditOptions* SpinOptions = {read=FSpinOptions, write=FSpinOptions}; + __property System::Extended Value = {read=GetValue, write=SetValue, stored=false}; + __property Classes::TNotifyEvent OnValueChanged = {read=GetValueChanged, write=SetValueChanged}; +}; + + +class DELPHICLASS TSpTBXSpinEditViewer; +class PASCALIMPLEMENTATION TSpTBXSpinEditViewer : public TSpTBXEditItemViewer +{ + typedef TSpTBXEditItemViewer inherited; + +private: + bool FUpPushed; + bool FDownPushed; + Extctrls::TTimer* FTimer; + void __fastcall TimerHandler(System::TObject* Sender); + HIDESBASE TSpTBXSpinEditItem* __fastcall GetItem(void); + +protected: + virtual int __fastcall GetAccRole(void); + virtual int __fastcall GetIndentAfter(void); + virtual bool __fastcall HandleEditMessage(Messages::TMessage &Message); + void __fastcall InvalidateButtons(void); + virtual bool __fastcall IsPtInButtonPart(int X, int Y); + virtual void __fastcall LosingCapture(void); + virtual void __fastcall MouseDown(Classes::TShiftState Shift, int X, int Y, bool &MouseDownOnMenu); + virtual void __fastcall MouseUp(int X, int Y, bool MouseWasDownOnMenu); + virtual void __fastcall InternalDrawFrame(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); + virtual void __fastcall InternalEditControlChange(System::TObject* Sender); + virtual void __fastcall InternalEditControlExit(void); + +public: + __fastcall virtual ~TSpTBXSpinEditViewer(void); + __property TSpTBXSpinEditItem* Item = {read=GetItem}; +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXSpinEditViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : TSpTBXEditItemViewer(AView, AItem, AGroupLevel) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +static const Word CM_SPFONTCHANGED = 0xb8ad; +static const ShortInt tcrSetProperty = 0x0; +static const ShortInt tcrActionLink = 0x1; +static const ShortInt tcrEditControl = 0x2; +extern PACKAGE void __fastcall SpCalcMaxDropDownWidth(TSpTBXComboBox* Combo, int RightMargin = 0x8); +extern PACKAGE bool __fastcall SpFocusEditItem(Tb2item::TTBCustomItem* Item, Tb2item::TTBView* View); +extern PACKAGE bool __fastcall SpStartsTextW(const System::WideString ASubText, const System::WideString AText); +extern PACKAGE bool __fastcall SpCanEditFrameBeHotTracked(Forms::TBorderStyle BorderStyle, Sptbxskins::TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPEditButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, bool FrameHotTrack, bool HotTrack, bool Pushed, bool RightAligned); +extern PACKAGE void __fastcall SpDrawXPComboButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, bool FrameHotTrack, bool HotTrack, bool DroppedDown, bool RightAligned, Sptbxskins::TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPSpinButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, bool FrameHotTrack, bool UpHotTrack, bool DownHotTrack, bool UpPushed, bool DownPushed, bool RightAligned, Sptbxskins::TSpTBXSkinType SkinType); + +} /* namespace Sptbxeditors */ +using namespace Sptbxeditors; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxeditorsHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.pas new file mode 100644 index 0000000..dc93482 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXEditors.pas @@ -0,0 +1,3725 @@ +unit SpTBXEditors; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development notes: + - All the Windows and Delphi bugs fixes are marked with '[Bugfix]'. + - All the theme changes and adjustments are marked with '[Theme-Change]'. + +To Do: + - Rotated caption painting. + +Known Issues: + - + +History: +8 May 2009 - version 2.4.2 + - Added AutoDropDownWidth property to TSpTBXComboBox, use + this to automatically calculate the DropDown window + size. + - Changed params of OnDrawItem and OnDrawItemBackground events + from TSpTBXComboBox. + +15 March 2009 - version 2.4.1 + - Added HasEditButton public method to TSpTBXEdit. + - Added GetDropDownButtonRect public method to TSpTBXComboBox. + - Fixed TSpTBXEdit frame flicker, thanks to Marc Hoffmann for + reporting this. + - Fixed incorrect TSpTBXEdit frame painting when the edit was + placed on a Toolbar, thanks to Alfred Vink for reporting this. + - Fixed incorrect TSpTBXListBox painting when OnDrawItem event + was used, thanks to Evgeny Efimov for reporting this. + +17 January 2009 - version 2.4 + - Added AutoItemHeight property to TSpTBXComboBox, use this + to automatically calculate the ItemHeight property when the + Style is csDropDown, csDropDownList or csSimple. + +26 September 2008 - version 2.3 + - Added skinning support to TSpTBXComboBox items. + - Fixed incorrect TSpTBXEditItem OnChange event handling, + the event was only fired if the text property was changed, + thanks to Anta for reporting this. + - Added hack to automatically adjust the ItemHeight based on + the ComboBox font size. Delphi doesn't do this when the + ComboBox is owner drawed. + +29 July 2008 - version 2.2 + - Fixed incorrect TSpTBXEditItem size when the item is on + a menu, thanks to David for reporting it. + +26 June 2008 - version 2.1 + - Added EditImageIndex property to TSpTBXEditItem and + TSpTBXSpinEditItem, use this to show an icon image + on the left of the EditCaption when the item is on a menu. + +3 May 2008 - version 2.0 + - No changes. + +2 April 2008 - version 1.9.5 + - Added ExtendedAccept property to TSpTBXSpinEditor. + - Fixed incorrect TSpTBXSpinEditor.ValueInc/ValueDec behavior + when ValueSnap was true and Increment was a fraction, thanks + to John for reporting this. + +3 Febrary 2008 - version 1.9.4 + - Fixed incorrect TSpTBXSpinEditor.ValueInc/ValueDec behavior + when ValueSnap was true and Increment was higher than + 10000, thanks to Yucel for reporting this. + +19 January 2008 - version 1.9.3 + - Fixed incorrect TSpTBXComboBox painting on Windows Vista, + thanks to Santiago Vila for reporting this. + +26 December 2007 - version 1.9.2 + - Fixed incorrect TSpTBXSpinEdit font behavior, when the font + was changed at runtime the edit rect was not updated, thanks + to Beta Xiong for reporting this. + +1 December 2007 - version 1.9.1 + - Fixed incorrect TSpTBXEditButton painting, when the caption + was empty and DropDownMenu was assigned 2 arrows were painted + instead of 1, thanks to Costas Stergiou for reporting this. + +20 November 2007 - version 1.9 + - Removed TBX dependency. + +20 April 2007 - version 1.8.4 + - Added CustomWidth and CustomHeight properties to the toolbar + editor items. + - Fixed incorrect TSpTBXEditItem.StartEditing behavior, + thanks to Daniel Rikowski for reporting this. + +8 February 2007 - version 1.8.3 + - Fixed incorrect OnChange event handling in TSpTBXEditItem, + thanks to Daniel Rikowski for reporting this. + +17 December 2006 - version 1.8.2 + - Fixed a BDS 2006 bug related to Comboboxes, CM_MOUSEENTER and + CM_MOUSELEAVE are fired everytime the mouse is moved over the + internal edit control. In D7 these messages were only fired when + the mouse entered or leaved the combobox. + +24 November 2006 - version 1.8.1 + - Fixed incorrect TSpTBXSpinEdit behavior, the Value was not updated + when the control was unfocused, thanks to Steve and Sebastian for + reporting this. + +27 August 2006 - version 1.8 + - Improved editor's button painting. + +15 June 2006 - version 1.7 + - Fixed edit items incorrect painting, the items were not painted + using the color of FontSettings and EditorFontSettings properties, + the same happens with the TBX items. + +4 May 2006 - version 1.6 + - No changes. + +12 April 2006 - version 1.5 + - Added ValueType, ValueAsInteger, Decimals, Prefix and Postfix + properties to TSpTBXSpinEdit, thanks to Maxim Rylov for his + code donation. + - Fixed TSpTBXSpinEdit painting. + +27 February 2006 - version 1.4 + - New component added, TSpTBXSpinEdit: a SpinEdit control + that has TBX themes support. + - Fixed TSpTBXComboBoxItem bug, when AutoComplete is set to + false the ComboBox still autocompletes the text, thanks to + Erwin Denissen for reporting this. + - Fixed Delphi 2005/2006 bug, CM_MOUSEENTER and CM_MOUSELEAVE + are fired everytime the mouse enters the combobox internal + edit control. In prior versions of Delphi these messages + were only fired when the mouse entered or leaved the combobox, + including the internal edit control. + +10 February 2006 - version 1.3 + - New component added, TSpTBXButtonEdit: an Edit control that + has a multipurpose button attached. + - Added new public method, AddEditButton, to TSpTBXEdit. + +28 December 2005 - version 1.2 + - No changes. + +18 October 2005 - version 1.1 + - New component added, TSpTBXListBox: a ListBox + with Unicode and TBX themes support that paints + a hottrack border and TBX theme style selection. + - New component added, TSpTBXCheckListBox: a CheckListBox + with Unicode and TBX themes support that paints + a hottrack border and TBX theme style selection. + - Fixed TSpTBXComboBoxItem dynamic creation problem. + +18 August 2005 - version 1.0 + - No changes. + +10 June 2005 - version 0.9 + - SpTBXLib may now alternatively, at your option, be used and/or + distributed under the terms of the SpTBXLib License. + Please see the updated LICENSE.TXT file for more information. + +20 May 2005 - version 0.8 + - Fixed TSpTBXDropDownItem and TSpTBXComboBoxItem bugs, the popup list + should be closed when F4 is pressed, thanks to Rune Moberg for + reporting this. + - Fixed TSpTBXComboBoxItem bug, the ComboBox didn't check the ItemIndex + bounds when pressing Up or Down keys, thanks to Rune Moberg for + reporting this. + - Fixed AV when trying to dock a toolbar with a TSpTBXComboBoxItem + on a vertical dock, thanks to Pavel for reporting this. + +16 February 2005 - version 0.7 + - Fixed unicode support in W9x, thanks to Daniel Rikowski for + reporting this. + - Fixed editors bug, the editors autocomplete was case sensitive, + this is a TBX bug but it was fixed without patching the source, + thanks to Daniel Rikowski for reporting this. + - Fixed TSpTBXComboBox painting bug, the edit frame was not + correctly highlighted when using the Default theme. + - Added HotTrack property to TSpTBXEdit and TSpTBXComboBox, when + setted to true a TBX style frame will be painted when the mouse + is over the control. + - Added OnDrawBackground event to TSpTBXEdit and TSpTBXComboBox. + +23 December 2004 - version 0.6 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, Classes, SysUtils, Controls, Graphics, ImgList, Forms, + Menus, StdCtrls, ExtCtrls, ActnList, CheckLst, + {$IFNDEF UNICODE} + TntClasses, TntControls, TntStdCtrls, TntCheckLst, TntSysUtils, + {$ENDIF} + TB2Toolbar, TB2Item, TB2ExtItems, + SpTBXSkins, SpTBXItem, SpTBXControls; + +{$IFDEF UNICODE} +type + TTntComboBox = TComboBox; + TTntListBox = TListBox; + TTntCheckListBox = TCheckListBox; +{$ENDIF} + +const + CM_SPFONTCHANGED = CM_BASE + 2221; // Message sent to the control when the font is changed + + { Change reasons for EditItem.Text property } + tcrSetProperty = 0; // direct assignment to Text property + tcrActionLink = 1; // change comes from an action link + tcrEditControl = 2; // change is caused by typing in edit area + +type + TSpTBXSpinType = ( + spnInteger, + spnFloat, + spnHex + ); + + TSpTBXEditItemViewer = class; + TSpTBXSpinEditViewer = class; + + TSpTBXEditChangeEvent = procedure(Sender: TObject; const AText: WideString) of object; + TSpTBXEditAcceptTextEvent = procedure(Sender: TObject; var NewText: WideString; var Accept: Boolean) of object; + TSpTBXEditGetTextEvent = procedure(Sender: TObject; var AText: WideString) of object; + TSpTBXBeginEditEvent = procedure(Sender: TObject; Viewer: TSpTBXEditItemViewer; EditControl: TCustomEdit) of object; + TSpTBXEditMessageEvent = procedure(Sender: TObject; Viewer: TSpTBXEditItemViewer; var Message: TMessage; var Handled: Boolean) of object; + TSpTBXDrawListItemEvent = procedure(Sender: TObject; ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean) of object; + + { TSpTBXEditButton } + + TSpTBXEditButton = class(TSpTBXSpeedButton) + protected + procedure AdjustFont(AFont: TFont); override; + function DoDrawDropDownArrow(ACanvas: TCanvas; ARect: TRect): Boolean; override; + function DoDrawItem(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; override; + function GetFrameHotTrack: Boolean; + public + constructor Create(AOwner: TComponent); override; + procedure Click; override; + end; + + { TSpTBXSpinButton } + + TSpTBXSpinButton = class(TSpTBXEditButton) + private + FUpPushed: Boolean; + FDownPushed: Boolean; + FOnUpClick: TNotifyEvent; + FOnDownClick: TNotifyEvent; + protected + function DoDrawItem(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; override; + procedure DoMouseLeave; override; + procedure MouseMove(Shift: TShiftState; X: Integer; Y: Integer); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer); override; + property OnUpClick: TNotifyEvent read FOnUpClick write FOnUpClick; + property OnDownClick: TNotifyEvent read FOnDownClick write FOnDownClick; + public + constructor Create(AOwner: TComponent); override; + procedure Click; override; + procedure IsHotTracking(out UpButton, DownButton, EditFrame: Boolean); + published + property Repeating default True; + end; + + { TSpTBXUnicodeAdaptEdit } + + // Do not inherit from TTNTEdit, TBEditItemViewer.GetEditControlClass needs a TEditClass + {$IFNDEF UNICODE} + TSpTBXUnicodeAdaptEdit = class(TEdit) + private + FPasswordChar: WideChar; + procedure SetSelText(const Value: WideString); + function GetText: WideString; + procedure SetText(const Value: WideString); + function GetHint: WideString; + procedure SetHint(const Value: WideString); + function IsHintStored: Boolean; + function GetPasswordChar: WideChar; + procedure SetPasswordChar(const Value: WideChar); + protected + procedure CreateWindowHandle(const Params: TCreateParams); override; + procedure CreateWnd; override; + procedure DefineProperties(Filer: TFiler); override; + function GetActionLinkClass: TControlActionLinkClass; override; + procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; + function GetSelStart: Integer; reintroduce; virtual; + procedure SetSelStart(const Value: Integer); reintroduce; virtual; + function GetSelLength: Integer; reintroduce; virtual; + procedure SetSelLength(const Value: Integer); reintroduce; virtual; + function GetSelText: WideString; reintroduce; virtual; + public + property SelText: WideString read GetSelText write SetSelText; + property SelStart: Integer read GetSelStart write SetSelStart; + property SelLength: Integer read GetSelLength write SetSelLength; + published + // Don't let the streaming system store the WideStrings, use DefineProperties instead + property Text: WideString read GetText write SetText; + property Hint: WideString read GetHint write SetHint stored IsHintStored; + property PasswordChar: WideChar read GetPasswordChar write SetPasswordChar default #0; + end; + {$ELSE} + TSpTBXUnicodeAdaptEdit = class(TEdit); + {$ENDIF} + + { TSpTBXUnicodeEdit } + + TSpTBXUnicodeEdit = class(TSpTBXUnicodeAdaptEdit) + private + FAlignment: TAlignment; + procedure SetAlignment(Value: TAlignment); + procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED; + procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED; + protected + procedure CreateWnd; override; + procedure CreateParams(var Params: TCreateParams); override; + procedure UpdateEditRect; virtual; + public + function AddEditButton(RightAligned: Boolean = True; AWidth: Integer = -1): TSpTBXEditButton; + function HasEditButton: Boolean; + published + property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; + end; + + { TSpTBXEdit } + + TSpTBXEdit = class(TSpTBXUnicodeEdit) + private + FBorderStyle: TBorderStyle; + FHotTrack: Boolean; + FSkinType: TSpTBXSkinType; + FMouseInControl: Boolean; + procedure SetBorderStyle(const Value: TBorderStyle); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED; + procedure CMEnter(var Message: TCMEnter); message CM_ENTER; + procedure CMExit(var Message: TCMExit); message CM_EXIT; + procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; + procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; + procedure WMNCPaint(var Message: TWMNCPaint); message WM_NCPAINT; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure InvalidateFrame; + property MouseInControl: Boolean read FMouseInControl; + published + property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle; // Hides the inherited BorderStyle + property HotTrack: Boolean read FHotTrack write FHotTrack default True; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + end; + + { TSpTBXButtonEdit } + + TSpTBXCustomButtonEdit = class(TSpTBXEdit) + private + FEditButton: TSpTBXEditButton; + protected + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure SetName(const Value: TComponentName); override; + property EditButton: TSpTBXEditButton read FEditButton; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + + TSpTBXButtonEdit = class(TSpTBXCustomButtonEdit) + published + property EditButton; + end; + + { TSpTBXSpinEdit } + + TSpTBXSpinEditOptions = class(TPersistent) + private + FDecimal: Integer; + FIncrement: Extended; + FMinValue: Extended; + FMaxValue: Extended; + FValue: Extended; + FValueSnap: Boolean; + FValueType: TSpTBXSpinType; + FPrefix: WideString; + FPostfix: WideString; + FOnGetText: TSpTBXEditAcceptTextEvent; + FOnSetText: TSpTBXEditChangeEvent; + FOnValueChanged: TNotifyEvent; + function IsIncrementStored: Boolean; + function IsMaxValueStored: Boolean; + function IsMinValueStored: Boolean; + function IsValueStored: Boolean; + procedure SetDecimal(NewDecimal: Integer); + procedure SetMaxValue(const NewValue: Extended); + procedure SetMinValue(const NewValue: Extended); + procedure SetValue(const NewValue: Extended); + procedure SetValueType(NewType: TSpTBXSpinType); + procedure SetPostfix(const ValueString: WideString); + procedure SetPrefix(const ValueString: WideString); + function GetValueAsInteger: Int64; + procedure SetValueAsInteger(const NewValue: Int64); + protected + procedure DoValueChanged; virtual; + procedure UpdateTextFromValue; + procedure UpdateValueFromText(RevertWhenInvalid: Boolean = True); + property OnGetText: TSpTBXEditAcceptTextEvent read FOnGetText write FOnGetText; + property OnSetText: TSpTBXEditChangeEvent read FOnSetText write FOnSetText; + property OnValueChanged: TNotifyEvent read FOnValueChanged write FOnValueChanged; + public + constructor Create; virtual; + procedure ValueInc; + procedure ValueDec; + property ValueAsInteger: Int64 read GetValueAsInteger write SetValueAsInteger; + published + property Decimal: Integer read FDecimal write SetDecimal default 2; + property Increment: Extended read FIncrement write FIncrement stored IsIncrementStored; + property MaxValue: Extended read FMaxValue write SetMaxValue stored IsMaxValueStored; + property MinValue: Extended read FMinValue write SetMinValue stored IsMinValueStored; + property Postfix: WideString read FPostfix write SetPostfix; + property Prefix: WideString read FPrefix write SetPrefix; + property Value: Extended read FValue write SetValue stored IsValueStored; + property ValueSnap: Boolean read FValueSnap write FValueSnap default True; + property ValueType: TSpTBXSpinType read FValueType write SetValueType default spnInteger; + end; + + TSpTBXSpinEdit = class(TSpTBXEdit) + private + FExtendedAccept: Boolean; + FSpinButton: TSpTBXSpinButton; + FSpinOptions: TSpTBXSpinEditOptions; + procedure SpinOptionsGetText(Sender: TObject; var NewText: WideString; var Accept: Boolean); + procedure SpinOptionsSetText(Sender: TObject; const AText: WideString); + function GetValue: Extended; + function GetValueChanged: TNotifyEvent; + procedure SetValue(const Value: Extended); + procedure SetValueChanged(const ValueChangedEvent: TNotifyEvent); + procedure CMExit(var Message: TCMExit); message CM_EXIT; + protected + procedure Change; override; + procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure KeyPress(var Key: Char); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure UpClick(Sender: TObject); virtual; + procedure DownClick(Sender: TObject); virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property Alignment default taRightJustify; + property ExtendedAccept: Boolean read FExtendedAccept write FExtendedAccept default False; + property Text stored False; + property SpinButton: TSpTBXSpinButton read FSpinButton; + property SpinOptions: TSpTBXSpinEditOptions read FSpinOptions write FSpinOptions; + property Value: Extended read GetValue write SetValue stored False; + property OnValueChanged: TNotifyEvent read GetValueChanged write SetValueChanged; + end; + + { TSpTBXComboBox } + + TSpTBXComboBox = class(TTntComboBox) + private + FAutoDropDownWidth: Boolean; + FAutoItemHeight: Boolean; + FFontChanging: Boolean; + FHotTrack: Boolean; + FInternalItemHeight: Integer; + FMouseInControl: Boolean; + FMouseInDropDownButton: Boolean; + FMouseTimer: TTimer; + FSkinType: TSpTBXSkinType; + FOnDrawBackground: TSpTBXDrawEvent; + FOnDrawItem: TSpTBXDrawListItemEvent; + FOnDrawItemBackground: TSpTBXDrawListItemEvent; + procedure MouseTimerHandler(Sender: TObject); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure UpdateDropDownButton; + procedure CMEnter(var Message: TCMEnter); message CM_ENTER; + procedure CMExit(var Message: TCMExit); message CM_EXIT; + procedure CNMeasureItem(var Message: TWMMeasureItem); message CN_MEASUREITEM; + procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; + procedure CMSPFontChanged(var Message: TMessage); message CM_SPFONTCHANGED; + procedure CNDrawItem(var Message: TWMDrawItem); message CN_DRAWITEM; + procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE; + procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE; + procedure WMPaint(var Message: TWMPaint); message WM_PAINT; + procedure WMSetFont(var Message: TWMSetFont); message WM_SETFONT; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + FAutoDropDownWidthRightMargin: Integer; + procedure CreateParams(var Params: TCreateParams); override; + procedure CreateWnd; override; + procedure CloseUp; override; + procedure DoCalcMaxDropDownWidth; virtual; + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DoDrawItem(ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DoDrawItemBackground(ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); override; + procedure DrawItemBackground(Index: Integer; Rect: TRect; State: TOwnerDrawState); virtual; + {$IF CompilerVersion > 17} + procedure EditWndProc(var Message: TMessage); override; + {$IFEND} + function GetItemHt: Integer; override; + procedure SetItemHeight(Value: Integer); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDropDownButtonRect: TRect; + function GetMouseInDropDownButton: Boolean; + procedure InvalidateFrame; + property MouseInControl: Boolean read FMouseInControl; + published + property AutoDropDownWidth: Boolean read FAutoDropDownWidth write FAutoDropDownWidth default False; + property AutoItemHeight: Boolean read FAutoItemHeight write FAutoItemHeight default True; + property HotTrack: Boolean read FHotTrack write FHotTrack default True; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + property OnDrawItem: TSpTBXDrawListItemEvent read FOnDrawItem write FOnDrawItem; // Hides the inherited OnDrawItem + property OnDrawItemBackground: TSpTBXDrawListItemEvent read FOnDrawItemBackground write FOnDrawItemBackground; + property OnMouseMove; + end; + + { TSpTBXListBox } + + TSpTBXListBox = class(TTntListBox) + private + FHotTracking: Boolean; + FHotTrack: Boolean; + FSkinType: TSpTBXSkinType; + FChildFocused: Boolean; + FOnDrawItem: TSpTBXDrawListItemEvent; + FOnDrawItemBackground: TSpTBXDrawListItemEvent; + procedure SetHotTrack(const Value: Boolean); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; + procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; + procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED; + procedure CNDrawItem(var Message: TWMDrawItem); message CN_DRAWITEM; + procedure WMNCPaint(var Message: TWMNCPaint); message WM_NCPAINT; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + procedure CreateParams(var Params: TCreateParams); override; + procedure DoDrawItem(ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DoDrawItemBackground(ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); override; + procedure DrawItemBackground(Index: Integer; Rect: TRect; State: TOwnerDrawState); virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure InvalidateBorders; + property HotTracking: Boolean read FHotTracking; + published + property Style default lbOwnerDrawFixed; + property HotTrack: Boolean read FHotTrack write SetHotTrack default True; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + property OnDrawItem: TSpTBXDrawListItemEvent read FOnDrawItem write FOnDrawItem; // Hides the inherited OnDrawItem + property OnDrawItemBackground: TSpTBXDrawListItemEvent read FOnDrawItemBackground write FOnDrawItemBackground; + end; + + { TSpTBXCheckListBox } + + TSpTBXCheckListBox = class(TTntCheckListBox) + private + FHotTracking: Boolean; + FHotTrack: Boolean; + FSkinType: TSpTBXSkinType; + FChildFocused: Boolean; + FOnDrawItem: TSpTBXDrawListItemEvent; + FOnDrawItemBackground: TSpTBXDrawListItemEvent; + procedure SetHotTrack(const Value: Boolean); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; + procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; + procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED; + procedure CNDrawItem(var Message: TWMDrawItem); message CN_DRAWITEM; + procedure WMNCPaint(var Message: TWMNCPaint); message WM_NCPAINT; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + procedure DoDrawItem(ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DoDrawItemBackground(ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); override; + procedure DrawItemBackground(Index: Integer; Rect: TRect; State: TOwnerDrawState); virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure InvalidateBorders; + property HotTracking: Boolean read FHotTracking; + published + property Style default lbOwnerDrawFixed; + property HotTrack: Boolean read FHotTrack write SetHotTrack default True; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + property OnDrawItem: TSpTBXDrawListItemEvent read FOnDrawItem write FOnDrawItem; + property OnDrawItemBackground: TSpTBXDrawListItemEvent read FOnDrawItemBackground write FOnDrawItemBackground; + end; + + { TSpTBXEditItem } + + TSpTBXEditItem = class(TSpTBXCustomItem) + private + FEditCaption: WideString; + FEditImageIndex: TImageIndex; + FText: WideString; + FAllowVerticalEditor: Boolean; + FCharCase: TEditCharCase; + FEditorFontSettings: TSpTBXFontSettings; + FExtendedAccept: Boolean; + FFontSettings: TSpTBXFontSettings; + FMaxLength: Integer; + FPasswordChar: WideChar; + FReadOnly: Boolean; + FShowImage: Boolean; + FOnAcceptText: TSpTBXEditAcceptTextEvent; + FOnBeginEdit: TSpTBXBeginEditEvent; + FOnChange: TSpTBXEditChangeEvent; + FOnEditMessage: TSpTBXEditMessageEvent; + procedure FontSettingsChanged(Sender: TObject); + procedure SetAllowVerticalEditor(const Value: Boolean); + procedure SetCharCase(Value: TEditCharCase); + procedure SetEditCaption(const Value: WideString); + procedure SetEditorFontSettings(const Value: TSpTBXFontSettings); + procedure SetMaxLength(Value: Integer); + procedure SetPasswordChar(Value: WideChar); + procedure SetShowImage(const Value: Boolean); + procedure SetText(Value: WideString); + protected + function DoAcceptText(var NewText: WideString): Boolean; virtual; + function DoAutoComplete(var AText: WideString): Boolean; virtual; + procedure DoBeginEdit(Viewer: TSpTBXEditItemViewer); virtual; + procedure DoChange(const AText: WideString); virtual; + procedure DoTextChanging(const OldText: WideString; var NewText: WideString; Reason: Integer); virtual; + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + function NeedToRecreateViewer(AViewer: TTBItemViewer): Boolean; override; + procedure SetTextEx(Value: WideString; Reason: Integer); virtual; + public + function StartEditing(AView: TTBView): Boolean; + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + // TSpTBXCustomItem properties + property Action; + property Alignment default taLeftJustify; + property Caption; + property CustomWidth default 64; + property CustomHeight; + property DisplayMode; + property Enabled; + property FontSettings; + property GroupIndex; + property HelpContext; + property Hint; + property ImageIndex; + property Images; + property ShortCut; + property Visible; + property OnClick; + property OnDrawCaption; + property OnDrawHint; + property OnDrawImage; + property OnDrawItem; + property OnSelect; + + // Don't let the streaming system store the WideStrings, use DefineProperties instead + property EditCaption: WideString read FEditCaption write SetEditCaption; // Hides the inherited EditCaption + property EditImageIndex: TImageIndex read FEditImageIndex write FEditImageIndex default -1; + property Text: WideString read FText write SetText; // Hides the inherited Text + property AllowVerticalEditor: Boolean read FAllowVerticalEditor write SetAllowVerticalEditor default False; + property CharCase: TEditCharCase read FCharCase write SetCharCase default ecNormal; + property EditorFontSettings: TSpTBXFontSettings read FEditorFontSettings write SetEditorFontSettings; + property ExtendedAccept: Boolean read FExtendedAccept write FExtendedAccept default False; + property MaxLength: Integer read FMaxLength write SetMaxLength default 0; + property PasswordChar: WideChar read FPasswordChar write SetPasswordChar default #0; + property ReadOnly: Boolean read FReadOnly write FReadOnly default False; + property ShowImage: Boolean read FShowImage write SetShowImage default False; + property OnAcceptText: TSpTBXEditAcceptTextEvent read FOnAcceptText write FOnAcceptText; // Hides the inherited OnAcceptText + property OnBeginEdit: TSpTBXBeginEditEvent read FOnBeginEdit write FOnBeginEdit; + property OnChange: TSpTBXEditChangeEvent read FOnChange write FOnChange; + property OnEditMessage: TSpTBXEditMessageEvent read FOnEditMessage write FOnEditMessage; + end; + + TEditClass = class of TCustomEdit; + + TSpTBXEditItemViewer = class(TSpTBXItemViewer) + private + function EditLoop(const CapHandle: HWND): Boolean; + procedure EditWndProc(var Message: TMessage); + function GetEditControlText: WideString; + procedure GetEditHeight(const DC: HDC; out EditHeight, ExternalLeading: Integer); + function GetItem: TSpTBXEditItem; + procedure MouseBeginEdit; + function MeasureEditCaption: TSize; + function MeasureTextHeight: Integer; + protected + FEditControl: TCustomEdit; + FEditControlStatus: set of (ecsContinueLoop, ecsAccept, ecsClose); + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); override; + function CaptionShown: Boolean; override; + procedure DoBeginEdit; virtual; + function DoExecute: Boolean; override; + function HandleEditMessage(var Message: TMessage): Boolean; virtual; + function GetAccRole: Integer; override; + function GetAccValue(var Value: WideString): Boolean; override; + procedure GetCursor(const Pt: TPoint; var ACursor: HCURSOR); override; + function GetEditControlClass: TEditClass; virtual; + procedure GetEditRect(var R: TRect); virtual; + function GetImageShown: Boolean; override; + function GetIndentBefore: Integer; virtual; + function GetIndentAfter: Integer; virtual; + procedure InternalDrawFrame(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo); virtual; + procedure InternalEditControlChange(Sender: TObject); virtual; + procedure InternalEditControlExit; virtual; + procedure MouseDown(Shift: TShiftState; X, Y: Integer; var MouseDownOnMenu: Boolean); override; + procedure MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); override; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + + function ShowImage: Boolean; virtual; + function UsesSameWidth: Boolean; override; + public + function GetCaptionText: WideString; override; + property EditControl: TCustomEdit read FEditControl; + property Item: TSpTBXEditItem read GetItem; // Hides the inherited TB2K Item property + end; + + { TSpTBXSpinEditItem } + + TSpTBXSpinEditItem = class(TSpTBXEditItem) + private + FSpinOptions: TSpTBXSpinEditOptions; + procedure SpinOptionsGetText(Sender: TObject; var NewText: WideString; var Accept: Boolean); + procedure SpinOptionsSetText(Sender: TObject; const AText: WideString); + function GetValue: Extended; + function GetValueChanged: TNotifyEvent; + procedure SetValue(const Value: Extended); + procedure SetValueChanged(const ValueChangedEvent: TNotifyEvent); + protected + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property Alignment default taRightJustify; + property Text stored False; + property SpinOptions: TSpTBXSpinEditOptions read FSpinOptions write FSpinOptions; + property Value: Extended read GetValue write SetValue stored False; + property OnValueChanged: TNotifyEvent read GetValueChanged write SetValueChanged; + end; + + TSpTBXSpinEditViewer = class(TSpTBXEditItemViewer) + private + FUpPushed: Boolean; + FDownPushed: Boolean; + FTimer: TTimer; + procedure TimerHandler(Sender: TObject); + function GetItem: TSpTBXSpinEditItem; + protected + function GetAccRole: Integer; override; + function GetIndentAfter: Integer; override; + function HandleEditMessage(var Message: TMessage): Boolean; override; + procedure InvalidateButtons; + function IsPtInButtonPart(X, Y: Integer): Boolean; override; + procedure LosingCapture; override; + procedure MouseDown(Shift: TShiftState; X, Y: Integer; var MouseDownOnMenu: Boolean); override; + procedure MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); override; + procedure InternalDrawFrame(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo); override; + procedure InternalEditControlChange(Sender: TObject); override; + procedure InternalEditControlExit; override; + public + destructor Destroy; override; + property Item: TSpTBXSpinEditItem read GetItem; // Hides the inherited TB2K Item property + end; + +{ Helpers } +procedure SpCalcMaxDropDownWidth(Combo: TSpTBXComboBox; RightMargin: Integer = 8); +function SpFocusEditItem(Item: TTBCustomItem; View: TTBView): Boolean; +function SpStartsTextW(const ASubText, AText: WideString): Boolean; + +{ Painting helpers } +function SpCanEditFrameBeHotTracked(BorderStyle: TBorderStyle; SkinType: TSpTBXSkinType): Boolean; +procedure SpDrawXPEditButton(ACanvas: TCanvas; ARect: TRect; Enabled, FrameHotTrack, HotTrack, Pushed, RightAligned: Boolean); +procedure SpDrawXPComboButton(ACanvas: TCanvas; ARect: TRect; Enabled, FrameHotTrack, HotTrack, DroppedDown, RightAligned: Boolean; SkinType: TSpTBXSkinType); +procedure SpDrawXPSpinButton(ACanvas: TCanvas; ARect: TRect; Enabled, FrameHotTrack, UpHotTrack, DownHotTrack, UpPushed, DownPushed, RightAligned: Boolean; SkinType: TSpTBXSkinType); + +implementation + +uses + Themes, UxTheme, + {$IFNDEF UNICODE} TntActnList, TntWindows, {$ENDIF} + Math, TB2Common; + +const + DefaultSpinButtonSize = 14; + +type + TTBViewAccess = class(TTBView); + TSpTBXFontSettingsAccess = class(TSpTBXFontSettings); + TCustomEditAccess = class(TCustomEdit); + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +procedure SpCalcMaxDropDownWidth(Combo: TSpTBXComboBox; RightMargin: Integer = 8); +var + I, MaxWidth: Integer; + Sz: TSize; + C: TControlCanvas; +begin + MaxWidth := 0; + + C := TControlCanvas.Create; + try + C.Control := Combo; + C.Font.Assign(Combo.Font); + for I := 0 to Combo.Items.Count - 1 do begin + Sz := SpGetTextSize(C.Handle, Combo.Items[I], False); + if Sz.cx > MaxWidth then MaxWidth := Sz.cx; + end; + + MaxWidth := MaxWidth + GetSystemMetrics(SM_CXVSCROLL) + RightMargin; + if Combo.Width < MaxWidth then + SendMessage(Combo.Handle, CB_SETDROPPEDWIDTH, MaxWidth, 0); + finally + C.Free; + end; +end; + +function SpFocusEditItem(Item: TTBCustomItem; View: TTBView): Boolean; +var + IV: TTBItemViewer; +begin + Result := False; + IV := View.Find(Item); + if Assigned(IV) then begin + View.Select(IV, False); + View.ExecuteSelected(False); + Result := True; + end; +end; + +function SpStartsTextW(const ASubText, AText: WideString): Boolean; +var + L, L2: Integer; +begin + L := Length(ASubText); + L2 := Length(AText); + if L > L2 then Result := False + else Result := CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, + PWideChar(AText), L, PWideChar(ASubText), L) = 2; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Painting helpers } + +function SpCanEditFrameBeHotTracked(BorderStyle: TBorderStyle; SkinType: TSpTBXSkinType): Boolean; +var + NormalB, HotTrackB: TSpTBXSkinOptionEntry; +begin + Result := False; + if (BorderStyle <> bsNone) and (SpTBXSkinType(SkinType) <> sknNone) then begin + // If the HotTrack borders are different than the Normal borders then + // return true. + NormalB := CurrentSkin.Options(skncEditFrame, sknsNormal).Borders; + HotTrackB := CurrentSkin.Options(skncEditFrame, sknsHotTrack).Borders; + if not NormalB.IsEqual(HotTrackB) then + Result := True; + end; +end; + +procedure SpDrawXPEditButton(ACanvas: TCanvas; ARect: TRect; Enabled, FrameHotTrack, + HotTrack, Pushed, RightAligned: Boolean); +var + State: TSpTBXSkinStatesType; +begin + State := CurrentSkin.GetState(Enabled, Pushed, HotTrack or FrameHotTrack, False); + if FrameHotTrack then begin + InflateRect(ARect, 1, 1); + if RightAligned then + ARect.Left := ARect.Left + 1 + else + ARect.Right := ARect.Right - 1; + end; + CurrentSkin.PaintBackground(ACanvas, ARect, skncEditButton, State, True, True); +end; + +procedure SpDrawXPComboButton(ACanvas: TCanvas; ARect: TRect; Enabled, FrameHotTrack, + HotTrack, DroppedDown, RightAligned: Boolean; SkinType: TSpTBXSkinType); +var + Flags: Integer; + State: TSpTBXSkinStatesType; + C: TColor; + X, Y, Part: Integer; +begin + case SpTBXSkinType(SkinType) of + sknNone: + begin + Inc(ARect.Left, 4); + SpFillRect(ACanvas, ARect, clBtnFace, clWindow); + if DroppedDown then + Windows.DrawEdge(ACanvas.Handle, ARect, BDR_SUNKENOUTER, BF_RECT) + else if FrameHotTrack or HotTrack then + Windows.DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_RECT); + State := CurrentSkin.GetState(Enabled, DroppedDown, HotTrack, False); + C := CurrentSkin.GetTextColor(skncEditButton, State); + X := (ARect.Left + ARect.Right) div 2; + Y := (ARect.Top + ARect.Bottom) div 2 - 1; + SpDrawArrow(ACanvas, X, Y, C, True, False, 2); + end; + sknWindows: + begin + if SpIsWinVistaOrUp then + Part := 6 // (CP_DROPDOWNBUTTONRIGHT) Use the new API on Windows Vista + else + Part := CP_DROPDOWNBUTTON; + if not Enabled then Flags := CBXS_DISABLED + else if DroppedDown then Flags := CBXS_PRESSED + else if HotTrack then Flags := CBXS_HOT + else Flags := CBXS_NORMAL; + DrawThemeBackground(ThemeServices.Theme[teComboBox], ACanvas.Handle, Part, Flags, ARect, nil); + end; + sknSkin: + begin + State := CurrentSkin.GetState(Enabled, DroppedDown, FrameHotTrack, False); + ACanvas.FillRect(ARect); + SpDrawXPEditButton(ACanvas, ARect, Enabled, FrameHotTrack, HotTrack, DroppedDown, RightAligned); + C := CurrentSkin.GetTextColor(skncEditButton, State); + X := (ARect.Left + ARect.Right) div 2; + Y := (ARect.Top + ARect.Bottom) div 2 - 1; + SpDrawArrow(ACanvas, X, Y, C, True, False, 2); + end; + end; +end; + +procedure SpDrawXPSpinButton(ACanvas: TCanvas; ARect: TRect; Enabled, FrameHotTrack, + UpHotTrack, DownHotTrack, UpPushed, DownPushed, RightAligned: Boolean; SkinType: TSpTBXSkinType); +var + ButtonR, BR: TRect; + StateFlags: Integer; + Flags: Cardinal; + X, Y: Integer; + State: TSpTBXSkinStatesType; + C: TColor; +begin + ButtonR := ARect; + + case SpTBXSkinType(SkinType) of + sknNone: + begin + // Up button + Flags := DFCS_SCROLLUP; + if UpPushed then + Flags := Flags or DFCS_PUSHED; + BR := Rect(ButtonR.Left, ButtonR.Top, ButtonR.Right, (ButtonR.Bottom + ButtonR.Top) div 2); + DrawFrameControl(ACanvas.Handle, BR, DFC_SCROLL, Flags); + // Down button + Flags := DFCS_SCROLLDOWN; + if DownPushed then + Flags := Flags or DFCS_PUSHED; + BR := Rect(ButtonR.Left, BR.Bottom - 1, ButtonR.Right, ButtonR.Bottom); + DrawFrameControl(ACanvas.Handle, BR, DFC_SCROLL, Flags); + end; + sknWindows: + begin + InflateRect(ButtonR, 1, 1); + // Up button + BR := ButtonR; + BR.Bottom := (ButtonR.Top + ButtonR.Bottom) div 2; + if not Enabled then StateFlags := UPS_DISABLED + else if UpPushed then StateFlags := UPS_PRESSED + else if UpHotTrack then StateFlags := UPS_HOT + else StateFlags := UPS_NORMAL; + DrawThemeBackground(ThemeServices.Theme[teSpin], ACanvas.Handle, SPNP_UP, StateFlags, BR, nil); + // Down button + BR := ButtonR; + BR.Top := (ButtonR.Top + ButtonR.Bottom) div 2; + if not Enabled then StateFlags := DNS_DISABLED + else if DownPushed then StateFlags := DNS_PRESSED + else if DownHotTrack then StateFlags := DNS_HOT + else StateFlags := DNS_NORMAL; + DrawThemeBackground(ThemeServices.Theme[teSpin], ACanvas.Handle, SPNP_DOWN, StateFlags, BR, nil); + end; + sknSkin: + begin + // Up button + BR := Rect(ButtonR.Left, ButtonR.Top, ButtonR.Right, (ButtonR.Top + ButtonR.Bottom) div 2 + 1); + X := (BR.Left + BR.Right) div 2; + Y := (BR.Top + BR.Bottom) div 2 - 1; + State := CurrentSkin.GetState(Enabled, UpPushed, UpHotTrack or FrameHotTrack, False); + if FrameHotTrack then + BR.Bottom := BR.Bottom - 1; + SpDrawXPEditButton(ACanvas, BR, Enabled, FrameHotTrack, UpHotTrack, UpPushed, RightAligned); + C := CurrentSkin.GetTextColor(skncEditButton, State); + SpDrawArrow(ACanvas, X, Y, C, True, True, 2); + if FrameHotTrack then + BR.Bottom := BR.Bottom + 1; + // Down button + BR := Rect(ButtonR.Left, BR.Bottom - 1, ButtonR.Right, ButtonR.Bottom); + X := (BR.Left + BR.Right) div 2; + Y := (BR.Top + BR.Bottom) div 2 - 1; + State := CurrentSkin.GetState(Enabled, DownPushed, DownHotTrack or FrameHotTrack, False); + if FrameHotTrack then + BR.Top := BR.Top + 1; + SpDrawXPEditButton(ACanvas, BR, Enabled, FrameHotTrack, DownHotTrack, DownPushed, RightAligned); + C := CurrentSkin.GetTextColor(skncEditButton, State); + SpDrawArrow(ACanvas, X, Y, C, True, False, 2); + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXEditButton } + +constructor TSpTBXEditButton.Create(AOwner: TComponent); +var + Index: Integer; +const + DefaultName = 'SubEditButton'; +begin + inherited; + + // Find unique name + if Assigned(AOwner) then begin + Index := 0; + while AOwner.FindComponent(DefaultName + IntToStr(Index)) <> nil do + Inc(Index); + Name := DefaultName + IntToStr(Index); + end; + + // Change the FPopupControl, we need to align + // the DropdownMenu to the Edit control not the button. + // FPopupControl is used in TSpTBXCustomButton.Click + if Assigned(AOwner) and (AOwner is TControl) then + FPopupControl := AOwner as TControl; + + SetSubComponent(True); + SkinType := sknSkin; +end; + +procedure TSpTBXEditButton.AdjustFont(AFont: TFont); +var + State: TSpTBXSkinStatesType; +begin + if (LinkText <> '') and MouseInControl then + inherited + else begin + State := CurrentSkin.GetState(Enabled, Pushed, MouseInControl or GetFrameHotTrack, Checked); + AFont.Color := CurrentSkin.GetTextColor(skncEditButton, State); + end; +end; + +procedure TSpTBXEditButton.Click; +begin + if Assigned(Parent) and SpCanFocus(Parent) then + Parent.SetFocus; + inherited; +end; + +function TSpTBXEditButton.DoDrawDropDownArrow(ACanvas: TCanvas; + ARect: TRect): Boolean; +begin + if (Caption = '') and not IsImageIndexValid then + Result := False // Paint the default Windows combo button + else + Result := inherited DoDrawDropDownArrow(ACanvas, ARect); +end; + +function TSpTBXEditButton.DoDrawItem(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +var + T: TSpTBXSkinType; + FrameHotTrack, RightAligned: Boolean; +begin + if (PaintStage = pstPrePaint) and not BitmapValid then begin + Result := True; + if Assigned(OnDraw) then OnDraw(Self, ACanvas, ARect, PaintStage, Result); + if Result then begin + FrameHotTrack := GetFrameHotTrack; + RightAligned := Align <> alLeft; + + // Draw the ComboButton if the caption is not set + T := SpTBXSkinType(SkinType); + if (Length(Caption) = 0) and not IsImageIndexValid then + SpDrawXPComboButton(ACanvas, ARect, Enabled, FrameHotTrack, MouseInControl, Pushed, RightAligned, T) + else begin + case T of + sknNone: + SpDrawXPButton(ACanvas, ARect, Enabled, Pushed, MouseInControl, Checked, Focused, Default, T); + sknWindows: + begin + InflateRect(ARect, 1, 1); + SpDrawXPButton(ACanvas, ARect, Enabled, Pushed, MouseInControl, Checked, Focused, Default, T); + end; + sknSkin: + SpDrawXPEditButton(ACanvas, ARect, Enabled, FrameHotTrack, FrameHotTrack or MouseInControl, Pushed, RightAligned); + end; + end; + end; + end + else + Result := inherited DoDrawItem(ACanvas, ARect, PaintStage); +end; + +function TSpTBXEditButton.GetFrameHotTrack: Boolean; +begin + if Parent is TSpTBXEdit then + Result := TSpTBXEdit(Parent).MouseInControl or Parent.Focused + else + Result := False; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSpinButton } + +constructor TSpTBXSpinButton.Create(AOwner: TComponent); +begin + inherited; + Repeating := True; +end; + +procedure TSpTBXSpinButton.Click; +var + P: TPoint; +begin + FUpPushed := False; + FDownPushed := False; + if Enabled then begin + GetCursorPos(P); + P := ScreenToClient(P); + if P.Y < Height div 2 then begin + FUpPushed := True; + if Assigned(FOnUpClick) then FOnUpClick(Self); + end + else begin + FDownPushed := True; + if Assigned(FOnDownClick) then FOnDownClick(Self); + end; + end; + + inherited; +end; + +function TSpTBXSpinButton.DoDrawItem(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +var + UpHotTrack, DownHotTrack, EditFrameHotTrack, RightAligned: Boolean; +begin + // Draw rectangle buttons + if (PaintStage = pstPrePaint) and not BitmapValid then begin + Result := True; + if Assigned(OnDraw) then OnDraw(Self, ACanvas, ARect, PaintStage, Result); + if Result then begin + IsHotTracking(UpHotTrack, DownHotTrack, EditFrameHotTrack); + RightAligned := Align <> alLeft; + SpDrawXPSpinButton(ACanvas, ARect, Enabled, EditFrameHotTrack, UpHotTrack, DownHotTrack, FUpPushed, FDownPushed, RightAligned, SkinType); + end; + end + else + Result := inherited DoDrawItem(ACanvas, ARect, PaintStage); +end; + +procedure TSpTBXSpinButton.IsHotTracking(out UpButton, DownButton, EditFrame: Boolean); +var + Edit: TSpTBXEdit; + P: TPoint; + R: TRect; +begin + UpButton := False; + DownButton := False; + EditFrame := False; + + if GetCursorPos(P) then begin + P := ScreenToClient(P); + R := Rect(0, 0, Width, Height div 2); + UpButton := PtInRect(R, P); + if not UpButton then begin + R := Rect(0, Height div 2, Width, Height); + DownButton := PtInRect(R, P); + end; + end; + + if Assigned(Owner) and (Owner is TSpTBXEdit) then begin + Edit := Owner as TSpTBXEdit; + if Edit.HotTrack then + EditFrame := Edit.MouseInControl or Edit.Focused; + end; +end; + +procedure TSpTBXSpinButton.DoMouseLeave; +begin + FUpPushed := False; + FDownPushed := False; + inherited; +end; + +procedure TSpTBXSpinButton.MouseUp(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + FUpPushed := False; + FDownPushed := False; + inherited; +end; + +procedure TSpTBXSpinButton.MouseMove(Shift: TShiftState; X, Y: Integer); +begin + inherited; + if Enabled then + Repaint; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXUnicodeAdaptEdit } + +{$IFNDEF UNICODE} +procedure TSpTBXUnicodeAdaptEdit.CreateWindowHandle(const Params: TCreateParams); +begin + TntCustomEdit_CreateWindowHandle(Self, Params); +end; + +procedure TSpTBXUnicodeAdaptEdit.CreateWnd; +begin + inherited; + TntCustomEdit_AfterInherited_CreateWnd(Self, FPasswordChar); +end; + +procedure TSpTBXUnicodeAdaptEdit.DefineProperties(Filer: TFiler); +begin + inherited; + TntPersistent_AfterInherited_DefineProperties(Filer, Self); +end; + +function TSpTBXUnicodeAdaptEdit.GetSelStart: Integer; +begin + Result := TntCustomEdit_GetSelStart(Self); +end; + +procedure TSpTBXUnicodeAdaptEdit.SetSelStart(const Value: Integer); +begin + TntCustomEdit_SetSelStart(Self, Value); +end; + +function TSpTBXUnicodeAdaptEdit.GetSelLength: Integer; +begin + Result := TntCustomEdit_GetSelLength(Self); +end; + +procedure TSpTBXUnicodeAdaptEdit.SetSelLength(const Value: Integer); +begin + TntCustomEdit_SetSelLength(Self, Value); +end; + +function TSpTBXUnicodeAdaptEdit.GetSelText: WideString; +begin + Result := TntCustomEdit_GetSelText(Self); +end; + +procedure TSpTBXUnicodeAdaptEdit.SetSelText(const Value: WideString); +begin + TntCustomEdit_SetSelText(Self, Value); +end; + +function TSpTBXUnicodeAdaptEdit.GetPasswordChar: WideChar; +begin + Result := TntCustomEdit_GetPasswordChar(Self, FPasswordChar); +end; + +procedure TSpTBXUnicodeAdaptEdit.SetPasswordChar(const Value: WideChar); +begin + TntCustomEdit_SetPasswordChar(Self, FPasswordChar, Value); +end; + +function TSpTBXUnicodeAdaptEdit.GetText: WideString; +begin + Result := TntControl_GetText(Self); +end; + +procedure TSpTBXUnicodeAdaptEdit.SetText(const Value: WideString); +begin + TntControl_SetText(Self, Value); +end; + +function TSpTBXUnicodeAdaptEdit.IsHintStored: Boolean; +begin + Result := TntControl_IsHintStored(Self); +end; + +function TSpTBXUnicodeAdaptEdit.GetHint: WideString; +begin + Result := TntControl_GetHint(Self); +end; + +procedure TSpTBXUnicodeAdaptEdit.SetHint(const Value: WideString); +begin + TntControl_SetHint(Self, Value); +end; + +procedure TSpTBXUnicodeAdaptEdit.ActionChange(Sender: TObject; CheckDefaults: Boolean); +begin + TntControl_BeforeInherited_ActionChange(Self, Sender, CheckDefaults); + inherited; +end; + +function TSpTBXUnicodeAdaptEdit.GetActionLinkClass: TControlActionLinkClass; +begin + Result := TntControl_GetActionLinkClass(Self, inherited GetActionLinkClass); +end; +{$ENDIF} + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXUnicodeEdit } + +procedure TSpTBXUnicodeEdit.CreateWnd; +begin + inherited; + if HandleAllocated then UpdateEditRect; +end; + +procedure TSpTBXUnicodeEdit.CreateParams(var Params: TCreateParams); +const + Alignments: array[TAlignment] of Cardinal = (ES_LEFT, ES_RIGHT, ES_CENTER); +begin + inherited CreateParams(Params); + // WS_CLIPCHILDREN needed for edit buttons + Params.Style := Params.Style or Alignments[FAlignment] or WS_CLIPCHILDREN; +end; + +procedure TSpTBXUnicodeEdit.SetAlignment(Value: TAlignment); +begin + if Value <> FAlignment then begin + FAlignment := Value; + RecreateWnd; + end; +end; + +function TSpTBXUnicodeEdit.AddEditButton(RightAligned: Boolean; + AWidth: Integer): TSpTBXEditButton; +begin + Result := TSpTBXEditButton.Create(Self); + Result.Parent := Self; + Result.FreeNotification(Self); + if RightAligned then + Result.Align := alRight + else + Result.Align := alLeft; + if AWidth = -1 then + Result.Width := GetSystemMetrics(SM_CXVSCROLL) + else + Result.Width := AWidth; + UpdateEditRect; +end; + +function TSpTBXUnicodeEdit.HasEditButton: Boolean; +var + I: Integer; +begin + Result := False; + if not HandleAllocated then Exit; + for I := 0 to ControlCount - 1 do begin + if Controls[I] is TSpTBXEditButton then begin + Result := True; + Break; + end; + end; +end; + +procedure TSpTBXUnicodeEdit.UpdateEditRect; +var + I, X1, X2: Integer; + B: TSpTBXEditButton; +begin + if not HandleAllocated then Exit; + + X1 := 0; + X2 := 0; + + for I := 0 to ControlCount - 1 do begin + if Controls[I] is TSpTBXEditButton then begin + B := Controls[I] as TSpTBXEditButton; + if B.Visible then + case B.Align of + alLeft: X1 := X1 + B.Width; + alRight: X2 := X2 + B.Width; + end; + end; + end; + + if X1 > 0 then Inc(X1, 2); + if X2 > 0 then Inc(X2, 2); + + SendMessage(Handle, EM_SETMARGINS, EC_LEFTMARGIN or EC_RIGHTMARGIN, MakeLong(X1, X2)); +end; + +procedure TSpTBXUnicodeEdit.CMEnabledChanged(var Message: TMessage); +var + I: Integer; +begin + inherited; + for I := 0 to ControlCount - 1 do + if Controls[I] is TSpTBXEditButton then + TSpTBXEditButton(Controls[I]).Enabled := Enabled; +end; + +procedure TSpTBXUnicodeEdit.CMFontChanged(var Message: TMessage); +begin + inherited; + UpdateEditRect; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXEdit } + +constructor TSpTBXEdit.Create(AOwner: TComponent); +begin + inherited; + FSkinType := sknSkin; + FHotTrack := True; + FBorderStyle := bsSingle; + SkinManager.AddSkinNotification(Self); + + if not (csDesigning in ComponentState) then + DoubleBuffered := True; +end; + +destructor TSpTBXEdit.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +procedure TSpTBXEdit.CMEnabledChanged(var Message: TMessage); +begin + inherited; + FMouseInControl := False; + if FHotTrack then InvalidateFrame; +end; + +procedure TSpTBXEdit.CMEnter(var Message: TCMEnter); +begin + inherited; + FMouseInControl := True; + if FHotTrack then InvalidateFrame; +end; + +procedure TSpTBXEdit.CMExit(var Message: TCMExit); +begin + inherited; + FMouseInControl := False; + if FHotTrack then InvalidateFrame; +end; + +procedure TSpTBXEdit.CMMouseEnter(var Message: TMessage); +begin + inherited; + if not FMouseInControl then begin + FMouseInControl := True; + if FHotTrack and not Focused and (HasEditButton or SpCanEditFrameBeHotTracked(BorderStyle, SkinType)) then + InvalidateFrame; + end; +end; + +procedure TSpTBXEdit.CMMouseLeave(var Message: TMessage); +begin + inherited; + if FMouseInControl then begin + FMouseInControl := False; + if FHotTrack and not Focused and (HasEditButton or SpCanEditFrameBeHotTracked(BorderStyle, SkinType)) then + InvalidateFrame; + end; +end; + +procedure TSpTBXEdit.InvalidateFrame; +begin + if HandleAllocated then + RedrawWindow(Handle, nil, 0, RDW_FRAME or RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN); +end; + +procedure TSpTBXEdit.SetBorderStyle(const Value: TBorderStyle); +begin + if FBorderStyle <> Value then begin + FBorderStyle := Value; + InvalidateFrame; + end; +end; + +procedure TSpTBXEdit.SetSkinType(const Value: TSpTBXSkinType); +var + I: Integer; +begin + if Value <> FSkinType then begin + FSkinType := Value; + for I := 0 to ControlCount - 1 do + if Controls[I] is TSpTBXEditButton then + TSpTBXEditButton(Controls[I]).SkinType := Value; + InvalidateFrame; + end; +end; + +procedure TSpTBXEdit.WMNCPaint(var Message: TWMNCPaint); +var + HotTrackFrame: Boolean; +begin + if FHotTrack then + HotTrackFrame := FMouseInControl or Focused + else + HotTrackFrame := False; + + if (SpTBXSkinType(FSkinType) = sknNone) and (FBorderStyle <> bsNone) then + inherited + else + SpDrawXPEditFrame(Self, HotTrackFrame, FSkinType, False, FBorderStyle = bsNone); +end; + +procedure TSpTBXEdit.WMSpSkinChange(var Message: TMessage); +begin + inherited; + InvalidateFrame; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomButtonEdit } + +constructor TSpTBXCustomButtonEdit.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle - [csSetCaption]; + FEditButton := AddEditButton(True, 19); +end; + +destructor TSpTBXCustomButtonEdit.Destroy; +begin + FreeAndNil(FEditButton); + inherited; +end; + +procedure TSpTBXCustomButtonEdit.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (AComponent = FEditButton) and (Operation = opRemove) then + FEditButton := nil; +end; + +procedure TSpTBXCustomButtonEdit.SetName(const Value: TComponentName); +begin + inherited SetName(Value); + if not (csLoading in ComponentState) then begin + FEditButton.Caption := '...'; + Text := ''; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSpinEditOptions } + +constructor TSpTBXSpinEditOptions.Create; +begin + inherited Create; + FDecimal := 2; + FIncrement := 1; + FValueSnap := True; + FValueType := spnInteger; +end; + +procedure TSpTBXSpinEditOptions.DoValueChanged; +begin + if Assigned(FOnValueChanged) then FOnValueChanged(Self); +end; + +function TSpTBXSpinEditOptions.GetValueAsInteger: Int64; +begin + Result := Round(Value); +end; + +function TSpTBXSpinEditOptions.IsIncrementStored: Boolean; +begin + Result := FIncrement <> 1; +end; + +function TSpTBXSpinEditOptions.IsMaxValueStored: Boolean; +begin + Result := FMaxValue <> 0; +end; + +function TSpTBXSpinEditOptions.IsMinValueStored: Boolean; +begin + Result := FMinValue <> 0; +end; + +function TSpTBXSpinEditOptions.IsValueStored: Boolean; +begin + Result := FValue <> 0; +end; + +procedure TSpTBXSpinEditOptions.SetDecimal(NewDecimal: Integer); +begin + if NewDecimal > 10 then NewDecimal := 10; + if NewDecimal < 0 then NewDecimal := 0; + if NewDecimal <> FDecimal then begin + FDecimal := NewDecimal; + UpdateTextFromValue; + end; +end; + +procedure TSpTBXSpinEditOptions.SetMaxValue(const NewValue: Extended); +begin + if NewValue <> FMaxValue then begin + FMaxValue := NewValue; + if FValue > NewValue then SetValue(NewValue); + end; +end; + +procedure TSpTBXSpinEditOptions.SetMinValue(const NewValue: Extended); +begin + if NewValue <> FMinValue then begin + FMinValue := NewValue; + if FValue < NewValue then SetValue(NewValue); + end; +end; + +procedure TSpTBXSpinEditOptions.SetPostfix(const ValueString: WideString); +begin + if FPostfix <> ValueString then begin + FPostfix := ValueString; + UpdateTextFromValue; + end; +end; + +procedure TSpTBXSpinEditOptions.SetPrefix(const ValueString: WideString); +begin + if FPrefix <> ValueString then begin + FPrefix := ValueString; + UpdateTextFromValue; + end; +end; + +procedure TSpTBXSpinEditOptions.SetValue(const NewValue: Extended); +begin + if NewValue <> FValue then + if (FMaxValue = FMinValue) or + (FMaxValue <> FMinValue) and (NewValue >= FMinValue) and (NewValue <= FMaxValue) then + begin + FValue := NewValue; + DoValueChanged; + UpdateTextFromValue; + end; +end; + +procedure TSpTBXSpinEditOptions.SetValueAsInteger(const NewValue: Int64); +begin + Value := NewValue; +end; + +procedure TSpTBXSpinEditOptions.SetValueType(NewType: TSpTBXSpinType); +begin + if NewType <> FValueType then begin + FValueType := NewType; + if NewType in [spnInteger, spnHex] then FIncrement := Max(Round(FIncrement), 1); + UpdateTextFromValue; + end; +end; + +procedure TSpTBXSpinEditOptions.UpdateTextFromValue; +var + WS: WideString; +begin + WS := ''; + case FValueType of + spnInteger: WS := IntToStr(Round(FValue)); + spnFloat: WS := FloatToStrF(FValue, ffFixed, 15, FDecimal); + spnHex: WS := IntToHex(Round(FValue), 1); + end; + if Assigned(FOnSetText) then FOnSetText(Self, FPrefix + WS + FPostfix); +end; + +procedure TSpTBXSpinEditOptions.UpdateValueFromText(RevertWhenInvalid: Boolean = True); +var + WS: WideString; + PrevValue, NewValue: Extended; + I: Integer; + Dummy: Boolean; +begin + PrevValue := FValue; + NewValue := FValue; + Dummy := True; + WS := ''; + if Assigned(FOnGetText) then FOnGetText(Self, WS, Dummy); + + // Remove the Prefix and Postfix from the text + I := Pos(Prefix, WS); + if I > 0 then + Delete(WS, I, Length(Prefix)); + I := Pos(Postfix, WS); + if I > 0 then + Delete(WS, I, Length(Postfix)); + + // Try to parse the text to get the value + WS := Trim(WS); + if Length(WS) > 0 then begin + case FValueType of + spnInteger: NewValue := StrToInt64Def(WS, Round(PrevValue)); + spnFloat: NewValue := StrToFloatDef(WS, PrevValue); + spnHex: NewValue := StrToInt64Def('$' + WS, Round(PrevValue)); + end; + end; + + if RevertWhenInvalid or (NewValue <> PrevValue) then begin + SetValue(NewValue); + UpdateTextFromValue; + end; +end; + +procedure TSpTBXSpinEditOptions.ValueInc; +var + NewValue: Extended; +begin + if FValueSnap then + NewValue := Math.Floor(FValue / FIncrement + 1 + FIncrement * 0.0000000001) * FIncrement + else + NewValue := FValue + FIncrement; + SetValue(NewValue); +end; + +procedure TSpTBXSpinEditOptions.ValueDec; +var + NewValue: Extended; +begin + if FValueSnap then + NewValue := Math.Ceil(FValue / FIncrement - 1 - FIncrement * 0.0000000001) * FIncrement + else + NewValue := FValue - FIncrement; + SetValue(NewValue); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSpinEdit } + +constructor TSpTBXSpinEdit.Create(AOwner: TComponent); +begin + inherited; + Alignment := taRightJustify; + + FSpinOptions := TSpTBXSpinEditOptions.Create; + FSpinOptions.OnGetText := SpinOptionsGetText; + FSpinOptions.OnSetText := SpinOptionsSetText; + + FSpinButton := TSpTBXSpinButton.Create(Self); + FSpinButton.Parent := Self; + FSpinButton.FreeNotification(Self); + FSpinButton.OnUpClick := UpClick; + FSpinButton.OnDownClick := DownClick; + FSpinButton.Align := alRight; + FSpinButton.Width := DefaultSpinButtonSize; + UpdateEditRect; + + Text := '0'; +end; + +destructor TSpTBXSpinEdit.Destroy; +begin + FreeAndNil(FSpinOptions); + FreeAndNil(FSpinButton); + inherited; +end; + +procedure TSpTBXSpinEdit.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (AComponent = FSpinButton) and (Operation = opRemove) then + FSpinButton := nil; +end; + +procedure TSpTBXSpinEdit.KeyDown(var Key: Word; Shift: TShiftState); +begin + inherited; + case Key of + VK_UP: SpinOptions.ValueInc; + VK_DOWN: SpinOptions.ValueDec; + end; +end; + +procedure TSpTBXSpinEdit.KeyPress(var Key: Char); +begin + inherited; + if Key = #13 then begin + Key := #0; + SpinOptions.UpdateValueFromText; + end; +end; + +procedure TSpTBXSpinEdit.UpClick(Sender: TObject); +begin + SpinOptions.ValueInc; +end; + +procedure TSpTBXSpinEdit.DownClick(Sender: TObject); +begin + SpinOptions.ValueDec; +end; + +procedure TSpTBXSpinEdit.Change; +begin + if FExtendedAccept then + SpinOptions.UpdateValueFromText(False); // Don't revert when an invalid text is entered + inherited; +end; + +procedure TSpTBXSpinEdit.CMExit(var Message: TCMExit); +begin + SpinOptions.UpdateValueFromText; + inherited; +end; + +function TSpTBXSpinEdit.GetValue: Extended; +begin + Result := SpinOptions.Value; +end; + +procedure TSpTBXSpinEdit.SetValue(const Value: Extended); +begin + SpinOptions.Value := Value; +end; + +function TSpTBXSpinEdit.GetValueChanged: TNotifyEvent; +begin + Result := SpinOptions.OnValueChanged; +end; + +procedure TSpTBXSpinEdit.SetValueChanged(const ValueChangedEvent: TNotifyEvent); +begin + SpinOptions.OnValueChanged := ValueChangedEvent; +end; + +procedure TSpTBXSpinEdit.SpinOptionsGetText(Sender: TObject; + var NewText: WideString; var Accept: Boolean); +begin + // Event used by SpinOptions to get the text from the edit control + NewText := Text; +end; + +procedure TSpTBXSpinEdit.SpinOptionsSetText(Sender: TObject; + const AText: WideString); +begin + // Event used by SpinOptions to set the edit control text + Text := AText; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXComboBox } + +constructor TSpTBXComboBox.Create(AOwner: TComponent); +begin + inherited; + FAutoDropDownWidthRightMargin := 8; + FAutoItemHeight := True; + FMouseTimer := nil; + FHotTrack := True; + FSkinType := sknSkin; + SkinManager.AddSkinNotification(Self); + + if not (csDesigning in ComponentState) then + DoubleBuffered := True; +end; + +procedure TSpTBXComboBox.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + + // Force the ComboBox to be owner draw + with Params do + if Style and (CBS_OWNERDRAWFIXED or CBS_OWNERDRAWVARIABLE) = 0 then + Style := Style or LBS_OWNERDRAWFIXED; +end; + +procedure TSpTBXComboBox.CreateWnd; +begin + inherited; + DoCalcMaxDropDownWidth; +end; + +destructor TSpTBXComboBox.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + if Assigned(FMouseTimer) then begin + FMouseTimer.Enabled := False; + FreeAndNil(FMouseTimer); + end; + inherited; +end; + +procedure TSpTBXComboBox.CloseUp; +begin + inherited; + InvalidateFrame; +end; + +procedure TSpTBXComboBox.CMEnter(var Message: TCMEnter); +begin + inherited; + FMouseInControl := True; + InvalidateFrame; +end; + +procedure TSpTBXComboBox.CMExit(var Message: TCMExit); +begin + inherited; + FMouseInControl := False; + InvalidateFrame; +end; + +procedure TSpTBXComboBox.CMMouseEnter(var Message: TMessage); +begin + inherited; + if Message.LParam = 0 then begin + if not FMouseInControl then begin + FMouseInControl := True; + if FHotTrack then + InvalidateFrame; + if not Assigned(FMouseTimer) then begin + FMouseTimer := TTimer.Create(nil); + FMouseTimer.Enabled := False; + FMouseTimer.Interval := 125; + FMouseTimer.OnTimer := MouseTimerHandler; + FMouseTimer.Enabled := True; + end; + end; + end; +end; + +procedure TSpTBXComboBox.CNDrawItem(var Message: TWMDrawItem); +var + State: TOwnerDrawState; + SknState: TSpTBXSkinStatesType; +begin + with Message.DrawItemStruct^ do + begin + State := TOwnerDrawState(LongRec(itemState).Lo); + if itemState and ODS_COMBOBOXEDIT <> 0 then + Include(State, odComboBoxEdit); + if itemState and ODS_DEFAULT <> 0 then + Include(State, odDefault); + + Canvas.Handle := hDC; + Canvas.Lock; + try + Canvas.Font := Font; + Canvas.Brush := Brush; + if (Integer(itemID) >= 0) and (Integer(itemID) < Items.Count) then begin + DrawItemBackground(itemID, rcItem, State); + + TControlCanvas(Canvas).UpdateTextFlags; + SknState := CurrentSkin.GetState(not (odDisabled in State), False, odSelected in State, False); + Canvas.Brush.Style := bsClear; + if SknState = sknsHotTrack then + Canvas.Font.Color := CurrentSkin.GetTextColor(skncListItem, sknsHotTrack, SkinType); + DrawItem(itemID, rcItem, State); + end + else + Canvas.FillRect(rcItem); + finally + Canvas.Unlock; + Canvas.Handle := 0; + end; + end; +end; + +procedure TSpTBXComboBox.MouseTimerHandler(Sender: TObject); +var + P: TPoint; + R: TRect; + InControl: Boolean; +begin + if not DroppedDown and GetCursorPos(P) then begin + GetWindowRect(Handle, R); + InControl := PtInRect(R, P); + if InControl <> FMouseInControl then begin + FMouseInControl := InControl; + if FHotTrack then InvalidateFrame; + end; + + if not InControl then begin + FMouseTimer.Enabled := False; + FreeAndNil(FMouseTimer); + end; + end; +end; + +procedure TSpTBXComboBox.DoCalcMaxDropDownWidth; +begin + if FAutoDropDownWidth then + SpCalcMaxDropDownWidth(Self, FAutoDropDownWidthRightMargin); +end; + +procedure TSpTBXComboBox.DoDrawBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, + PaintStage, PaintDefault); +end; + +procedure TSpTBXComboBox.DoDrawItem(ACanvas: TCanvas; var ARect: TRect; + Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawItem) then FOnDrawItem(Self, ACanvas, ARect, Index, State, PaintStage, PaintDefault); +end; + +procedure TSpTBXComboBox.DoDrawItemBackground(ACanvas: TCanvas; + var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawItemBackground) then FOnDrawItemBackground(Self, ACanvas, ARect, Index, State, PaintStage, PaintDefault); +end; + +procedure TSpTBXComboBox.DrawItem(Index: Integer; Rect: TRect; + State: TOwnerDrawState); +var + Flags: Integer; + PaintDefault: Boolean; +begin + // Draw the item text + PaintDefault := True; + DoDrawItem(Canvas, Rect, Index, State, pstPrePaint, PaintDefault); + if PaintDefault then begin + Flags := DrawTextBiDiModeFlags(DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX); + Inc(Rect.Left, 2); + SpDrawXPText(Canvas, Items[Index], Rect, Flags); + end; + + PaintDefault := True; + DoDrawItem(Canvas, Rect, Index, State, pstPostPaint, PaintDefault); +end; + +procedure TSpTBXComboBox.DrawItemBackground(Index: Integer; Rect: TRect; + State: TOwnerDrawState); +var + PaintDefault: Boolean; +begin + // Draw the list items background + PaintDefault := True; + DoDrawItemBackground(Canvas, Rect, Index, State, pstPrePaint, PaintDefault); + if PaintDefault then + SpDrawXPListItemBackground(Canvas, Rect, odSelected in State, False, odFocused in State, SkinType); + + PaintDefault := True; + DoDrawItemBackground(Canvas, Rect, Index, State, pstPostPaint, PaintDefault); +end; + +{$IF CompilerVersion > 17} +procedure TSpTBXComboBox.EditWndProc(var Message: TMessage); +begin + // [Bugfix] Delphi 2006/2007 bug: + // CM_MOUSEENTER and CM_MOUSELEAVE are fired everytime the mouse + // enters the combobox internal edit control. + // In D7 these messages were only fired when the mouse entered or leaved + // the combobox, including the internal edit control. + // We need to block the mouse messages from the internal edit control + // in EditWndProc + if Message.Msg = WM_MOUSEMOVE then + ComboWndProc(Message, FEditHandle, FDefEditProc) + else + inherited; +end; +{$IFEND} + +function TSpTBXComboBox.GetDropDownButtonRect: TRect; +var + ButtonWidth: Integer; + T: TSpTBXSkinType; +begin + if Style = csSimple then + ButtonWidth := 0 + else + ButtonWidth := GetSystemMetrics(SM_CXHSCROLL); + Result.Left := Width - ButtonWidth; + Result.Top := 0; + Result.Right := Result.Left + ButtonWidth; + Result.Bottom := Height; + + T := SpTBXSkinType(FSkinType); + case T of + sknNone: + begin + InflateRect(Result, 0, -1); + OffsetRect(Result, -1, 0); + end; + sknWindows: + begin + InflateRect(Result, 0, -1); + OffsetRect(Result, -1, 0); + end; + sknSkin: + begin + InflateRect(Result, 0, -2); + OffsetRect(Result, -2, 0); + end; + end; +end; + +function TSpTBXComboBox.GetMouseInDropDownButton: Boolean; +var + P: TPoint; + ButtonR: TRect; + ButtonWidth: Integer; +begin + Result := False; + + if not (csDesigning in ComponentState) and GetCursorPos(P) then begin + P := ScreenToClient(P); + if Style = csSimple then + ButtonWidth := 0 + else + ButtonWidth := GetSystemMetrics(SM_CXHSCROLL); + ButtonR.Left := Width - ButtonWidth; + ButtonR.Top := 0; + ButtonR.Right := ButtonR.Left + ButtonWidth; + ButtonR.Bottom := Height; + + Result := PtInRect(ButtonR, P); + end; +end; + +procedure TSpTBXComboBox.InvalidateFrame; +begin + if HandleAllocated then + Invalidate; +end; + +procedure TSpTBXComboBox.UpdateDropDownButton; +var + ButtonState: Boolean; +begin + if not DroppedDown then begin + ButtonState := GetMouseInDropDownButton; + if ButtonState <> FMouseInDropDownButton then + InvalidateFrame; + FMouseInDropDownButton := ButtonState; + end; +end; + +function TSpTBXComboBox.GetItemHt: Integer; +// Automatically update the Height/ItemHeight when Style is csDropDown, +// csDropDownList or csSimple +begin + // CB_GETITEMHEIGHT doesn't work when Style is csOwnerDrawFixed or + // csOwnerDrawVariable. + // Since TSpTBXComboBox is always owner-drawed we must calculate the + // ItemHeight based on the font when Style <> csOwnerDrawFixed/csOwnerDrawVariable. + // Look at TCustomComboBox.GetItemHt + if Style in [csOwnerDrawFixed, csOwnerDrawVariable] then + Result := inherited GetItemHt + else + if not FAutoItemHeight then // When AutoItemHeight is turned off return the ItemHeight + Result := FInternalItemHeight + else + Result := SpGetControlTextHeight(Self, Font); +end; + +procedure TSpTBXComboBox.SetItemHeight(Value: Integer); +begin + if Value > 0 then + FInternalItemHeight := Value; + inherited; +end; + +procedure TSpTBXComboBox.SetSkinType(const Value: TSpTBXSkinType); +begin + if Value <> FSkinType then begin + FSkinType := Value; + InvalidateFrame; + end; +end; + +procedure TSpTBXComboBox.WMMouseMove(var Message: TWMMouseMove); +begin + inherited; + UpdateDropDownButton; +end; + +procedure TSpTBXComboBox.WMNCCalcSize(var Message: TWMNCCalcSize); +begin + // [Bugfix] Delphi 2006 bug: + // Do nothing, fix Delphi 2005/2006 bug: http://qc.borland.com/wc/qcmain.aspx?d=13852 +end; + +procedure TSpTBXComboBox.WMPaint(var Message: TWMPaint); +var + ACanvas: TControlCanvas; + R, ButtonR: TRect; + ButtonWidth: Integer; + T: TSpTBXSkinType; + PaintDefault, HotTrackFrame, VistaNewComCtrls: Boolean; +begin + inherited; + + ACanvas := TControlCanvas.Create; + try + ACanvas.Control := Self; + ACanvas.Lock; // lock the canvas to prevent flicker on mouse click + GetWindowRect(Handle, R); + OffsetRect(R, -R.Left, -R.Top); + + if Style = csSimple then + ButtonWidth := 0 + else + ButtonWidth := GetSystemMetrics(SM_CXHSCROLL); + + T := SpTBXSkinType(FSkinType); + ExcludeClipRect(ACanvas.Handle, 2, 2, R.Right - 2 - ButtonWidth, R.Bottom - 2); + try + PaintDefault := True; + DoDrawBackground(ACanvas, R, pstPrePaint, PaintDefault); + + // Don't custom paint if we are on Vista with ComCtrls 6, let the + // OS draw the frame + VistaNewComCtrls := not (csDesigning in ComponentState) and (T = sknWindows) and SpIsWinVistaOrUp and ThemeServices.ThemesEnabled; + + if PaintDefault and (T <> sknNone) and not VistaNewComCtrls then begin + if csDesigning in ComponentState then + HotTrackFrame := False + else + if FHotTrack then + HotTrackFrame := FMouseInControl or Focused + else + HotTrackFrame := DroppedDown; + + ButtonR := GetDropDownButtonRect; + if T = sknSkin then + SpDrawParentBackground(Self, ACanvas.Handle, R); + SpDrawXPEditFrame(ACanvas, R, Enabled, HotTrackFrame, T); + if Style <> csSimple then + SpDrawXPComboButton(ACanvas, ButtonR, Enabled, HotTrackFrame, GetMouseInDropDownButton, DroppedDown, True, T); + end; + + PaintDefault := True; + DoDrawBackground(ACanvas, R, pstPostPaint, PaintDefault); + finally + SelectClipRgn(ACanvas.Handle, 0); + end; + finally + ACanvas.Unlock; + ACanvas.Free; + end; +end; + +procedure TSpTBXComboBox.CNMeasureItem(var Message: TWMMeasureItem); +// Automatically update the Height/ItemHeight when Style is csDropDown, +// csDropDownList or csSimple +// Recalc ItemHeight based on the font +var + I: Integer; +begin + inherited; + if not (Style in [csOwnerDrawFixed, csOwnerDrawVariable]) then begin + // When itemID = $FFFFFFFFFF the itemHeight is refering to the + // editbox height + if Message.MeasureItemStruct.itemID = High(LongWord) then begin + I := SpGetControlTextHeight(Self, Font); + Inc(I, 2); + end + else + I := GetItemHt; + Message.MeasureItemStruct^.itemHeight := I; + end; +end; + +procedure TSpTBXComboBox.CMSPFontChanged(var Message: TMessage); +// Automatically update the Height/ItemHeight when Style is csDropDown, +// csDropDownList or csSimple +// Recreate when the font is changed +begin + if not FFontChanging and not (Style in [csOwnerDrawFixed, csOwnerDrawVariable]) then begin + FFontChanging := True; + RecreateWnd; + FFontChanging := False; + end; +end; + +procedure TSpTBXComboBox.WMSetFont(var Message: TWMSetFont); +// Automatically update the Height/ItemHeight when Style is csDropDown, +// csDropDownList or csSimple +// Recreate when the font is changed +begin + inherited; + if not FFontChanging and not (Style in [csOwnerDrawFixed, csOwnerDrawVariable]) then + PostMessage(Handle, CM_SPFONTCHANGED, 0, 0); +end; + +procedure TSpTBXComboBox.WMSpSkinChange(var Message: TMessage); +begin + inherited; + InvalidateFrame; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXListBox } + +constructor TSpTBXListBox.Create(AOwner: TComponent); +begin + inherited; + FHotTrack := True; + FSkinType := sknSkin; + SkinManager.AddSkinNotification(Self); + Style := lbOwnerDrawFixed; +end; + +procedure TSpTBXListBox.CreateParams(var Params: TCreateParams); +begin + inherited; + // Force the ListBox to be owner draw + with Params do + if Style and (LBS_OWNERDRAWFIXED or LBS_OWNERDRAWVARIABLE) = 0 then + Style := Style or LBS_OWNERDRAWFIXED; +end; + +destructor TSpTBXListBox.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +procedure TSpTBXListBox.InvalidateBorders; +begin + if HandleAllocated then + RedrawWindow(Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE); +end; + +procedure TSpTBXListBox.SetHotTrack(const Value: Boolean); +begin + if FHotTrack <> Value then begin + FHotTrack := Value; + InvalidateBorders; + end; +end; + +procedure TSpTBXListBox.SetSkinType(const Value: TSpTBXSkinType); +begin + if Value <> FSkinType then begin + FSkinType := Value; + InvalidateBorders; + end; +end; + +procedure TSpTBXListBox.CMFocusChanged(var Message: TCMFocusChanged); +begin + inherited; + if FHotTrack and Assigned(Message.Sender) then begin + FChildFocused := Self = Message.Sender; + if FChildFocused <> FHotTracking then begin + FHotTracking := FChildFocused; + InvalidateBorders; + end; + end; +end; + +procedure TSpTBXListBox.CMMouseEnter(var Message: TMessage); +begin + inherited; + if FHotTrack and not FHotTracking then begin + FHotTracking := True; + if SpCanEditFrameBeHotTracked(BorderStyle, SkinType) then + InvalidateBorders; + end; +end; + +procedure TSpTBXListBox.CMMouseLeave(var Message: TMessage); +begin + inherited; + if FHotTrack and FHotTracking and not FChildFocused then begin + FHotTracking := False; + if SpCanEditFrameBeHotTracked(BorderStyle, SkinType) then + InvalidateBorders; + end; +end; + +procedure TSpTBXListBox.WMSpSkinChange(var Message: TMessage); +begin + inherited; + InvalidateBorders; +end; + +procedure TSpTBXListBox.DoDrawItem(ACanvas: TCanvas; var ARect: TRect; + Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawItem) then FOnDrawItem(Self, ACanvas, ARect, Index, State, PaintStage, PaintDefault); +end; + +procedure TSpTBXListBox.DoDrawItemBackground(ACanvas: TCanvas; var ARect: TRect; + Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawItemBackground) then FOnDrawItemBackground(Self, ACanvas, ARect, Index, State, PaintStage, PaintDefault); +end; + +procedure TSpTBXListBox.DrawItem(Index: Integer; Rect: TRect; + State: TOwnerDrawState); +var + R: TRect; + Flags: Integer; + PaintDefault: Boolean; +begin + // Draw the item text + PaintDefault := True; + DoDrawItem(Canvas, Rect, Index, State, pstPrePaint, PaintDefault); + if PaintDefault then begin + Flags := DrawTextBiDiModeFlags(DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX); + + // It seems TabWidth doesn't work on owner-drawed listboxes, we have to do + // it manually using DT_EXPANDTABS. + // It seems that DrawText uses a different unit metric than LB_SETTABSTOPS, + // don't know how to calculate it correctly for more info: + // http://news.jrsoftware.org/read/article.php?id=15427&group=jrsoftware.toolbar2000.thirdparty#15427 + // Using DrawTextEx doesn't solve the problem, GetDialogBaseUnits doesn't help either + if TabWidth > 0 then + Flags := ((Flags or DT_EXPANDTABS or DT_TABSTOP) and not $800) or (Round(TabWidth * 0.3) shl 8); + + // Add a margin to the rect + R := Rect; + if not UseRightToLeftAlignment then + Inc(R.Left, 3) + else + Dec(R.Right, 3); + SpDrawXPText(Canvas, Items[Index], R, Flags); + end; + + PaintDefault := True; + DoDrawItem(Canvas, Rect, Index, State, pstPostPaint, PaintDefault); +end; + +procedure TSpTBXListBox.DrawItemBackground(Index: Integer; Rect: TRect; + State: TOwnerDrawState); +var + PaintDefault: Boolean; +begin + // Draw the item background + PaintDefault := True; + DoDrawItemBackground(Canvas, Rect, Index, State, pstPrePaint, PaintDefault); + if PaintDefault then + SpDrawXPListItemBackground(Canvas, Rect, odSelected in State, False, odFocused in State, SkinType); + + PaintDefault := True; + DoDrawItemBackground(Canvas, Rect, Index, State, pstPostPaint, PaintDefault); +end; + +procedure TSpTBXListBox.CNDrawItem(var Message: TWMDrawItem); +var + State: TOwnerDrawState; + SknState: TSpTBXSkinStatesType; +begin + with Message.DrawItemStruct^ do + begin + State := TOwnerDrawState(LongRec(itemState).Lo); + Canvas.Handle := hDC; + Canvas.Lock; + try + Canvas.Font := Font; + Canvas.Brush := Brush; + if (Integer(itemID) >= 0) and (Integer(itemID) < Items.Count) then begin + DrawItemBackground(itemID, rcItem, State); + + SknState := CurrentSkin.GetState(not (odDisabled in State), False, odSelected in State, False); + Canvas.Brush.Style := bsClear; + if SknState = sknsHotTrack then + Canvas.Font.Color := CurrentSkin.GetTextColor(skncListItem, sknsHotTrack, SkinType); + DrawItem(itemID, rcItem, State); + end + else + Canvas.FillRect(rcItem); + finally + Canvas.Unlock; + Canvas.Handle := 0; + end; + end; +end; + +procedure TSpTBXListBox.WMNCPaint(var Message: TWMNCPaint); +begin + inherited; + if (BorderStyle <> bsNone) and (SpTBXSkinType(FSkinType) <> sknNone) then + SpDrawXPEditFrame(Self, FHotTracking, FSkinType, True); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCheckListBox } + +constructor TSpTBXCheckListBox.Create(AOwner: TComponent); +begin + inherited; + FHotTrack := True; + FSkinType := sknSkin; + SkinManager.AddSkinNotification(Self); + Style := lbOwnerDrawFixed; +end; + +destructor TSpTBXCheckListBox.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +procedure TSpTBXCheckListBox.InvalidateBorders; +begin + if HandleAllocated then + RedrawWindow(Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE); +end; + +procedure TSpTBXCheckListBox.SetHotTrack(const Value: Boolean); +begin + if FHotTrack <> Value then begin + FHotTrack := Value; + InvalidateBorders; + end; +end; + +procedure TSpTBXCheckListBox.SetSkinType(const Value: TSpTBXSkinType); +begin + if Value <> FSkinType then begin + FSkinType := Value; + InvalidateBorders; + end; +end; + +procedure TSpTBXCheckListBox.CMFocusChanged(var Message: TCMFocusChanged); +begin + inherited; + if FHotTrack and Assigned(Message.Sender) then begin + FChildFocused := Self = Message.Sender; + if FChildFocused <> FHotTracking then begin + FHotTracking := FChildFocused; + InvalidateBorders; + end; + end; +end; + +procedure TSpTBXCheckListBox.CMMouseEnter(var Message: TMessage); +begin + inherited; + if FHotTrack and not FHotTracking then begin + FHotTracking := True; + if SpCanEditFrameBeHotTracked(BorderStyle, SkinType) then + InvalidateBorders; + end; +end; + +procedure TSpTBXCheckListBox.CMMouseLeave(var Message: TMessage); +begin + inherited; + if FHotTrack and FHotTracking and not FChildFocused then begin + FHotTracking := False; + if SpCanEditFrameBeHotTracked(BorderStyle, SkinType) then + InvalidateBorders; + end; +end; + +procedure TSpTBXCheckListBox.WMSpSkinChange(var Message: TMessage); +begin + inherited; + InvalidateBorders; +end; + +procedure TSpTBXCheckListBox.DoDrawItem(ACanvas: TCanvas; var ARect: TRect; + Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawItem) then FOnDrawItem(Self, ACanvas, ARect, Index, State, PaintStage, PaintDefault); +end; + +procedure TSpTBXCheckListBox.DoDrawItemBackground(ACanvas: TCanvas; + var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawItemBackground) then FOnDrawItemBackground(Self, ACanvas, ARect, Index, State, PaintStage, PaintDefault); +end; + +procedure TSpTBXCheckListBox.DrawItem(Index: Integer; Rect: TRect; + State: TOwnerDrawState); +var + R: TRect; + Flags: Integer; + PaintDefault: Boolean; +begin + // Draw the item text + PaintDefault := True; + DoDrawItem(Canvas, Rect, Index, State, pstPrePaint, PaintDefault); + if PaintDefault then begin + Flags := DrawTextBiDiModeFlags(DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX); + + // Add a margin to the rect + R := Rect; + if not UseRightToLeftAlignment then + Inc(R.Left, 3) + else + Dec(R.Right, 3); + SpDrawXPText(Canvas, Items[Index], R, Flags); + end; + + PaintDefault := True; + DoDrawItem(Canvas, Rect, Index, State, pstPostPaint, PaintDefault); +end; + +procedure TSpTBXCheckListBox.DrawItemBackground(Index: Integer; Rect: TRect; + State: TOwnerDrawState); +var + ACheckWidth: Integer; + R: TRect; + PaintDefault: Boolean; +begin + // Draw the checkbox, background and focus + PaintDefault := True; + DoDrawItemBackground(Canvas, Rect, Index, State, pstPrePaint, PaintDefault); + if PaintDefault then begin + if not Header[Index] then begin + // Draw the checkbox + ACheckWidth := GetCheckWidth; + if not UseRightToLeftAlignment then begin + R.Right := Rect.Left; + R.Left := R.Right - ACheckWidth; + end + else begin + R.Left := Rect.Right; + R.Right := R.Left + ACheckWidth; + end; + R.Top := Rect.Top + (Rect.Bottom - Rect.Top - ACheckWidth) div 2; + R.Bottom := R.Top + ACheckWidth; + InflateRect(R, -1, -1); + + Canvas.FillRect(R); + SpDrawXPCheckBoxGlyph(Canvas, R, ItemEnabled[Index], Self.State[Index], False, False, SkinType); + + // Draw the background and focus + SpDrawXPListItemBackground(Canvas, Rect, odSelected in State, False, odFocused in State, SkinType); + end + else begin + Canvas.Font.Color := HeaderColor; + Canvas.Brush.Color := HeaderBackgroundColor; + Canvas.FillRect(Rect); + if odFocused in State then + SpDrawFocusRect(Canvas, Rect); + end; + end; + + PaintDefault := True; + DoDrawItemBackground(Canvas, Rect, Index, State, pstPostPaint, PaintDefault); +end; + +procedure TSpTBXCheckListBox.CNDrawItem(var Message: TWMDrawItem); +var + State: TOwnerDrawState; + SknState: TSpTBXSkinStatesType; +begin + if Items.Count = 0 then Exit; + + with Message.DrawItemStruct^ do + begin + State := TOwnerDrawState(LongRec(itemState).Lo); + Canvas.Handle := hDC; + Canvas.Lock; + try + Canvas.Font := Font; + Canvas.Brush := Brush; + if (Integer(itemID) >= 0) and (Integer(itemID) < Items.Count) then begin + // Exclude the checkbox area + if not Header[itemID] then + if not UseRightToLeftAlignment then + rcItem.Left := rcItem.Left + GetCheckWidth + else + rcItem.Right := rcItem.Right - GetCheckWidth; + + DrawItemBackground(itemID, rcItem, State); + + SknState := CurrentSkin.GetState(not (odDisabled in State), False, odSelected in State, False); + Canvas.Brush.Style := bsClear; + if SknState = sknsHotTrack then + Canvas.Font.Color := CurrentSkin.GetTextColor(skncListItem, sknsHotTrack, SkinType); + DrawItem(itemID, rcItem, State); + end + else + Canvas.FillRect(rcItem); + finally + Canvas.Unlock; + Canvas.Handle := 0; + end; + end; +end; + +procedure TSpTBXCheckListBox.WMNCPaint(var Message: TWMNCPaint); +begin + inherited; + if (BorderStyle <> bsNone) and (SpTBXSkinType(FSkinType) <> sknNone) then + SpDrawXPEditFrame(Self, FHotTracking, FSkinType, True); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXEditItem } + +constructor TSpTBXEditItem.Create(AOwner: TComponent); +begin + inherited; + FEditImageIndex := -1; + FEditorFontSettings := TSpTBXFontSettings.Create; + TSpTBXFontSettingsAccess(FEditorFontSettings).OnChange := FontSettingsChanged; + CustomWidth := 64; + Alignment := taLeftJustify; +end; + +destructor TSpTBXEditItem.Destroy; +begin + FFontSettings.Free; + FEditorFontSettings.Free; + inherited; +end; + +function TSpTBXEditItem.DoAcceptText(var NewText: WideString): Boolean; +begin + Result := True; + if Assigned(FOnAcceptText) then FOnAcceptText(Self, NewText, Result); +end; + +function TSpTBXEditItem.DoAutoComplete(var AText: WideString): Boolean; +begin + Result := False; +end; + +procedure TSpTBXEditItem.DoBeginEdit(Viewer: TSpTBXEditItemViewer); +begin + if Assigned(FOnBeginEdit) then FOnBeginEdit(Self, Viewer, Viewer.EditControl); +end; + +procedure TSpTBXEditItem.DoChange(const AText: WideString); +begin + if Assigned(FOnChange) then FOnChange(Self, AText); +end; + +procedure TSpTBXEditItem.DoTextChanging(const OldText: WideString; + var NewText: WideString; Reason: Integer); +begin + case CharCase of + ecUpperCase: NewText := WideUpperCase(NewText); + ecLowerCase: NewText := WideLowerCase(NewText); + end; +end; + +procedure TSpTBXEditItem.FontSettingsChanged(Sender: TObject); +begin + Change(True); +end; + +function TSpTBXEditItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + if not FAllowVerticalEditor and (AView.Orientation = tbvoVertical) then + Result := inherited GetItemViewerClass(AView) + else + Result := TSpTBXEditItemViewer; +end; + +function TSpTBXEditItem.NeedToRecreateViewer(AViewer: TTBItemViewer): Boolean; +begin + Result := GetItemViewerClass(AViewer.View) <> AViewer.ClassType; +end; + +procedure TSpTBXEditItem.SetPasswordChar(Value: WideChar); +begin + if Value <> FPasswordChar then begin + FPasswordChar := Value; + Change(True); + end; +end; + +procedure TSpTBXEditItem.SetShowImage(const Value: Boolean); +begin + if FShowImage <> Value then begin + FShowImage := Value; + Change(True); + end; +end; + +function TSpTBXEditItem.StartEditing(AView: TTBView): Boolean; +var + SaveText: WideString; +begin + SaveText := Text; + SpFocusEditItem(Self, AView); + // Case Sensitive, Result is true when the text is changed + Result := Text <> SaveText; +end; + +procedure TSpTBXEditItem.SetAllowVerticalEditor(const Value: Boolean); +begin + if FAllowVerticalEditor <> Value then begin + FAllowVerticalEditor := Value; + Change(True); + end; +end; + +procedure TSpTBXEditItem.SetCharCase(Value: TEditCharCase); +begin + if FCharCase <> Value then begin + FCharCase := Value; + SetText(Text); // Updates case + end; +end; + +procedure TSpTBXEditItem.SetEditCaption(const Value: WideString); +begin + if FEditCaption <> Value then begin + FEditCaption := Value; + Change(True); + end; +end; + +procedure TSpTBXEditItem.SetEditorFontSettings(const Value: TSpTBXFontSettings); +begin + FEditorFontSettings.Assign(Value); +end; + +procedure TSpTBXEditItem.SetMaxLength(Value: Integer); +begin + if FMaxLength <> Value then begin + FMaxLength := Value; + Change(False); + end; +end; + +procedure TSpTBXEditItem.SetText(Value: WideString); +begin + SetTextEx(Value, tcrSetProperty); +end; + +procedure TSpTBXEditItem.SetTextEx(Value: WideString; Reason: Integer); +begin + DoTextChanging(FText, Value, Reason); + // Case Sensitive, fire the event when the text is changed + if FText <> Value then begin + FText := Value; + Change(False); + DoChange(Text); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXEditItemViewer } + +procedure TSpTBXEditItemViewer.EditWndProc(var Message: TMessage); + + procedure AcceptText; + var + S: WideString; + begin + S := GetEditControlText; + if Item.DoAcceptText(S) then Item.SetTextEx(S, tcrEditControl); + end; + +begin + if FEditControl = nil then + Exit; + + if not HandleEditMessage(Message) then begin + if Message.Msg = WM_CHAR then + case TWMChar(Message).CharCode of + VK_TAB: begin + FEditControlStatus := [ecsAccept]; + AcceptText; + Exit; + end; + VK_RETURN: begin + FEditControlStatus := [ecsAccept, ecsClose]; + AcceptText; + Exit; + end; + VK_ESCAPE: begin + FEditControlStatus := []; + Exit; + end; + end; + TCustomEditAccess(FEditControl).WndProc(Message); + end; + + if Message.Msg = WM_KILLFOCUS then begin + View.CancelMode; + FEditControlStatus := [ecsClose]; + end; +end; + +function TSpTBXEditItemViewer.GetEditControlClass: TEditClass; +begin + Result := TSpTBXUnicodeEdit; +end; + +function TSpTBXEditItemViewer.GetEditControlText: WideString; +begin + Result := ''; + if Assigned(FEditControl) then begin + if FEditControl is TSpTBXUnicodeEdit then + Result := TSpTBXUnicodeEdit(FEditControl).Text + else + Result := TCustomEditAccess(FEditControl).Text; + end; +end; + +procedure TSpTBXEditItemViewer.GetEditHeight(const DC: HDC; out EditHeight, + ExternalLeading: Integer); +var + TextMetricA: TTextMetricA; + TextMetricW: TTextMetricW; +begin + if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then begin + Windows.GetTextMetricsA(DC, TextMetricA); + EditHeight := TextMetricA.tmHeight; + ExternalLeading := TextMetricA.tmExternalLeading; + end + else begin + Windows.GetTextMetricsW(DC, TextMetricW); + EditHeight := TextMetricW.tmHeight; + ExternalLeading := TextMetricW.tmExternalLeading; + end; +end; + +procedure TSpTBXEditItemViewer.GetEditRect(var R: TRect); +var + TextSize: TSize; + MarginsInfo: TSpTBXMenuItemMarginsInfo; +begin + R := BoundsRect; + if not IsToolbarStyle then begin + TextSize := MeasureEditCaption; + CurrentSkin.GetMenuItemMargins(StockBitmap.Canvas, 0, MarginsInfo); + Inc(R.Left, MarginsInfo.GutterSize + MarginsInfo.ImageTextSpace); + if Length(Item.EditCaption) > 0 then + Inc(R.Left, MarginsInfo.LeftCaptionMargin + TextSize.cx + MarginsInfo.RightCaptionMargin + 1); + end; + + InflateRect(R, 1, 0); + Inc(R.Left, GetIndentBefore); + Dec(R.Right, GetIndentAfter); +end; + +function TSpTBXEditItemViewer.GetImageShown: Boolean; +begin + Result := (Item.EditImageIndex >= 0) and + ((Item.DisplayMode in [nbdmDefault, nbdmImageAndText]) or + (IsToolbarStyle and (Item.DisplayMode = nbdmTextOnlyInMenus))); + + if Assigned(View) and Assigned(View.Owner) and (View.Owner is TSpTBXToolbar) then + if TSpTBXToolbar(View.Owner).DisplayMode = tbdmTextOnly then + Result := False; +end; + +function TSpTBXEditItemViewer.GetIndentAfter: Integer; +begin + Result := 1; +end; + +function TSpTBXEditItemViewer.GetIndentBefore: Integer; +var + ImgList: TCustomImageList; +begin + Result := 1; + + if ShowImage then begin + ImgList := GetImageList; + if Assigned(ImgList) and (Item.ImageIndex >= 0) and (Item.ImageIndex <= ImgList.Count - 1) then + Result := ImgList.Width + 4; + end; +end; + +function TSpTBXEditItemViewer.GetItem: TSpTBXEditItem; +var + TBItem: TTBCustomItem; +begin + TBItem := inherited Item; + if Assigned(TBItem) then + Result := TBItem as TSpTBXEditItem + else + Result := nil; +end; + +function TSpTBXEditItemViewer.HandleEditMessage(var Message: TMessage): Boolean; +begin + Result := False; + if Assigned(Item.FOnEditMessage) then Item.FOnEditMessage(Item, Self, Message, Result); +end; + +procedure TSpTBXEditItemViewer.CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); +var + TextSize: TSize; + MarginsInfo: TSpTBXMenuItemMarginsInfo; + EditBoxHeight: Integer; +begin + if Item.CustomWidth > -1 then + AWidth := Item.CustomWidth; + + if not IsToolbarStyle then begin + TextSize := MeasureEditCaption; + CurrentSkin.GetMenuItemMargins(StockBitmap.Canvas, 0, MarginsInfo); + Inc(AWidth, MarginsInfo.GutterSize + MarginsInfo.ImageTextSpace); + if Length(Item.EditCaption) > 0 then + Inc(AWidth, MarginsInfo.LeftCaptionMargin + TextSize.cx + MarginsInfo.RightCaptionMargin + 2); + end + else begin + TextSize.cx := 0; + TextSize.cy := 0; + end; + + EditBoxHeight := MeasureTextHeight + 1; + Inc(EditBoxHeight, 2 + 4); + AHeight := Max(EditBoxHeight, TextSize.cy); + if not IsToolbarStyle then + AHeight := AHeight + else + AHeight := AHeight or $01; + + if (Item.CustomHeight > -1) and IsToolbarStyle then + AHeight := Item.CustomHeight; +end; + +function TSpTBXEditItemViewer.CaptionShown: Boolean; +begin + Result := not IsToolbarStyle and inherited CaptionShown; +end; + +function TSpTBXEditItemViewer.GetCaptionText: WideString; +begin + Result := TSpTBXEditItem(Item).EditCaption; +end; + +procedure TSpTBXEditItemViewer.InternalDrawFrame(ACanvas: TCanvas; + ARect: TRect; ItemInfo: TSpTBXMenuItemInfo); +begin + if not (ItemInfo.HotTrack or ItemInfo.Pushed) and (SkinManager.CurrentSkinName = 'Default') then + SpFillRect(ACanvas, ARect, clWindow, clBtnFace) + else begin + SpDrawXPEditFrame(ACanvas, ARect, ItemInfo.Enabled, ItemInfo.HotTrack, sknSkin); + InflateRect(ARect, -2, -2); + SpFillRect(ACanvas, ARect, clWindow); + end; +end; + +procedure TSpTBXEditItemViewer.InternalEditControlChange(Sender: TObject); +begin + // Used by descendants + Item.DoChange(GetEditControlText); +end; + +procedure TSpTBXEditItemViewer.InternalEditControlExit; +begin + // Used by descendants +end; + +procedure TSpTBXEditItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); +const + Alignments: array [TAlignment] of Integer = (DT_LEFT, DT_RIGHT, DT_CENTER); +var + DC: HDC; + S: WideString; + R, ImageRect: TRect; + ImgList: TCustomImageList; + TextSize: TSize; + ItemInfo: TSpTBXMenuItemInfo; + MarginsInfo: TSpTBXMenuItemMarginsInfo; +begin + DC := Canvas.Handle; + R := ClientAreaRect; + SpFillItemInfo(Canvas, Self, ItemInfo); + + Canvas.Font.Assign(View.GetFont); + Item.FontSettings.Apply(Canvas.Font); + + { Item Caption, only on MenuItems } + if not IsToolbarStyle then begin + S := Item.EditCaption; + CurrentSkin.GetMenuItemMargins(Canvas, 0, MarginsInfo); + TextSize := SpGetTextSize(DC, S, True); + + if Length(S) > 0 then + R.Right := MarginsInfo.GutterSize + MarginsInfo.ImageTextSpace + TextSize.cx + MarginsInfo.LeftCaptionMargin + MarginsInfo.RightCaptionMargin + else + R.Right := MarginsInfo.GutterSize + MarginsInfo.ImageTextSpace - 1; + SpDrawXPMenuItem(Canvas, R, ItemInfo); + + R.Right := ClientAreaRect.Right; + Inc(R.Left, MarginsInfo.GutterSize + MarginsInfo.ImageTextSpace); + + if Length(S) > 0 then begin + if Canvas.Font.Color = clNone then + Canvas.Font.Color := CurrentSkin.GetTextColor(skncMenuItem, ItemInfo.State); + Inc(R.Left, MarginsInfo.LeftCaptionMargin); + SpDrawXPText(Canvas, S, R, DT_SINGLELINE or DT_LEFT or DT_VCENTER); + Inc(R.Left, TextSize.cx + MarginsInfo.RightCaptionMargin + 1); + end; + + ImageRect := ClientAreaRect; + ImageRect.Right := ImageRect.Left + ItemInfo.MenuMargins.GutterSize; + if ItemInfo.ImageShown then begin + ImageRect.Left := ImageRect.Left + ((ImageRect.Right - ImageRect.Left) - ItemInfo.ImageSize.cx) div 2; + ImageRect.Top := ImageRect.Top + ((ImageRect.Bottom - ImageRect.Top) - ItemInfo.ImageSize.cy) div 2; + ImageRect.Right := ImageRect.Left + ItemInfo.ImageSize.cx; + ImageRect.Bottom := ImageRect.Top + ItemInfo.ImageSize.cy; + DrawItemImage(Canvas, ImageRect, ItemInfo, Item.EditImageIndex); + end; + end; + + { Edit Frame } + InternalDrawFrame(Canvas, R, ItemInfo); + InflateRect(R, 1, 0); + + { Editor Image } + if ShowImage then begin + ImgList := GetImageList; + if Assigned(ImgList) and (Item.ImageIndex >= 0) and (Item.ImageIndex <= ImgList.Count - 1) then begin + ImageRect.Left := R.Left + 4; + ImageRect.Right := R.Left + ImgList.Width; + ImageRect.Top := (R.Top + R.Bottom + 1 - ImgList.Height) div 2; + ImageRect.Bottom := ImageRect.Top + ImgList.Height; + + SpDrawImageList(Canvas, ImageRect, ImgList, Item.ImageIndex, Item.Enabled, True); + end; + end; + + { Editor text } + if Length(Item.Text) > 0 then begin + if Item.PasswordChar <> #0 then + S := StringOfChar(Item.PasswordChar, Length(S)) + else + S := Item.Text; + + Canvas.Font.Assign(View.GetFont); + Item.EditorFontSettings.Apply(Canvas.Font); + if Canvas.Font.Color = clNone then + if Item.Enabled then + Canvas.Font.Color := clBtnText + else + Canvas.Font.Color := clGrayText; + InflateRect(R, -2, -1); + if not IsToolbarStyle then + Inc(R.Left, GetIndentBefore + 1) + else + Inc(R.Left, GetIndentBefore + 2); + Dec(R.Right, GetIndentAfter + 1); + Dec(R.Top, 1); + if IsToolbarStyle then + Inc(R.Left, -1); + SpDrawXPText(Canvas, S, R, DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX or Alignments[Item.Alignment]); + end; +end; + +function TSpTBXEditItemViewer.ShowImage: Boolean; +begin + Result := Item.ShowImage; +end; + +procedure TSpTBXEditItemViewer.GetCursor(const Pt: TPoint; var ACursor: HCURSOR); +var + R: TRect; +begin + if not Item.Enabled then + Exit; + GetEditRect(R); + OffsetRect(R, -BoundsRect.Left, -BoundsRect.Top); + InflateRect(R, -2, -2); + if PtInRect(R, Pt) then + ACursor := LoadCursor(0, IDC_IBEAM); +end; + +function TSpTBXEditItemViewer.EditLoop(const CapHandle: HWND): Boolean; + + procedure ControlMessageLoop; + + function PointInWindow(const Wnd: HWND; const P: TPoint): Boolean; + var + W: HWND; + begin + Result := False; + W := WindowFromPoint(P); + if W = 0 then Exit; + if W = Wnd then + Result := True + else + if IsChild(Wnd, W) then + Result := True; + end; + + function ContinueLoop: Boolean; + begin + Result := (ecsContinueLoop in FEditControlStatus) and + not View.IsModalEnding and FEditControl.Focused and Item.Enabled; + { Note: View.IsModalEnding is checked since TTBView.CancelMode doesn't + destroy popup windows; it merely hides them and calls EndModal. So if + IsModalEnding returns True we can infer that CancelMode was likely + called. } + end; + + var + Msg: TMsg; + IsKeypadDigit: Boolean; + V: Integer; + begin + try + while ContinueLoop do begin + { Examine the next message before popping it out of the queue } + if not PeekMessage(Msg, 0, 0, 0, PM_NOREMOVE) then begin + WaitMessage; + Continue; + end; + case Msg.message of + WM_SYSKEYDOWN: begin + { Exit immediately if Alt+[key] or F10 are pressed, but not + Alt+Shift, Alt+`, or Alt+[keypad digit] } + if (Msg.wParam <> VK_MENU) and (Msg.wParam <> VK_SHIFT) and + (Msg.wParam <> VK_HANJA) then begin + IsKeypadDigit := False; + { This detect digits regardless of whether Num Lock is on: } + if Lo(LongRec(Msg.lParam).Hi) <> 0 then + for V := VK_NUMPAD0 to VK_NUMPAD9 do + if MapVirtualKey(V, 0) = Lo(LongRec(Msg.lParam).Hi) then begin + IsKeypadDigit := True; + Break; + end; + if not IsKeypadDigit then begin + FEditControlStatus := [ecsClose]; + Exit; + end; + end; + end; + WM_SYSKEYUP: begin + { Exit when Alt is released by itself } + if Msg.wParam = VK_MENU then begin + FEditControlStatus := [ecsClose]; + Exit; + end; + end; + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, + WM_RBUTTONDOWN, WM_RBUTTONDBLCLK, + WM_MBUTTONDOWN, WM_MBUTTONDBLCLK, + WM_NCLBUTTONDOWN, WM_NCLBUTTONDBLCLK, + WM_NCRBUTTONDOWN, WM_NCRBUTTONDBLCLK, + WM_NCMBUTTONDOWN, WM_NCMBUTTONDBLCLK: begin + { If a mouse click outside the edit control is in the queue, + exit and let the upstream message loop deal with it } + if Msg.hwnd <> FEditControl.Handle then + Exit; + end; + WM_MOUSEMOVE, WM_NCMOUSEMOVE: begin + if GetCapture = CapHandle then begin + if PointInWindow(FEditControl.Handle, Msg.pt) then + ReleaseCapture; + end + else if GetCapture = 0 then begin + if not PointInWindow(FEditControl.Handle, Msg.pt) then + SetCapture(CapHandle); + end; + if GetCapture = CapHandle then + SetCursor(LoadCursor(0, IDC_ARROW)); + end; + end; + { Now pop the message out of the queue } + if not PeekMessage(Msg, 0, Msg.message, Msg.message, PM_REMOVE or PM_NOYIELD) then + Continue; + if ((Msg.message >= WM_MOUSEFIRST) and (Msg.message <= WM_MOUSELAST)) and + (Msg.hwnd = CapHandle) then + { discard, so that the selection doesn't get changed } + else begin + TranslateMessage(Msg); + DispatchMessage(Msg); + end; + end; + finally + { Make sure there are no outstanding WM_*CHAR messages } + RemoveMessages(WM_CHAR, WM_DEADCHAR); + RemoveMessages(WM_SYSCHAR, WM_SYSDEADCHAR); + end; + end; + +var + R: TRect; + ActiveWnd, FocusWnd: HWND; + S: WideString; +begin + GetEditRect(R); + if IsRectEmpty(R) then begin + Result := False; + Exit; + end; + + ActiveWnd := GetActiveWindow; + FocusWnd := GetFocus; + + { Create the edit control } + InflateRect(R, -3, -3); + FEditControl := GetEditControlClass.Create(nil); + try + FEditControl.Name := Format('%s_edit_control_%p', [ClassName, Pointer(FEditControl)]); + FEditControl.Visible := False; + TCustomEditAccess(FEditControl).ReadOnly := Item.ReadOnly; + TCustomEditAccess(FEditControl).BorderStyle := bsNone; + TCustomEditAccess(FEditControl).AutoSize := False; + TCustomEditAccess(FEditControl).Font.Assign(View.GetFont); + Item.EditorFontSettings.Apply(TCustomEditAccess(FEditControl).Font); + if FEditControl is TSpTBXUnicodeEdit then begin + TSpTBXUnicodeEdit(FEditControl).Alignment := Item.Alignment; + TSpTBXUnicodeEdit(FEditControl).PasswordChar := Item.PasswordChar; + TSpTBXUnicodeEdit(FEditControl).Text := Item.Text + end + else + TCustomEditAccess(FEditControl).Text := Item.Text; + TCustomEditAccess(FEditControl).CharCase := Item.FCharCase; + TCustomEditAccess(FEditControl).MaxLength := Item.FMaxLength; + FEditControl.BoundsRect := R; + FEditControl.WindowProc := EditWndProc; + FEditControl.ParentWindow := View.Window.Handle; + TCustomEditAccess(FEditControl).OnChange := InternalEditControlChange; + FEditControl.SelectAll; + DoBeginEdit; + FEditControl.Visible := True; + FEditControl.SetFocus; + if GetActiveWindow <> ActiveWnd then + SendMessage(ActiveWnd, WM_NCACTIVATE, 1, 0) // Don't gray out title bar of old active window + else + ActiveWnd := 0; + + FEditControlStatus := [ecsContinueLoop]; + ControlMessageLoop; + finally + if FEditControlStatus = [ecsContinueLoop] then + InternalEditControlExit; + S := GetEditControlText; + FreeAndNil(FEditControl); + end; + + if (FEditControlStatus = [ecsContinueLoop]) and Item.ExtendedAccept then + if Item.DoAcceptText(S) then Item.SetTextEx(S, tcrEditControl); + + { ensure the area underneath the edit control is repainted immediately } + View.Window.Update; + { If app is still active, set focus to previous control and restore capture + to CapHandle if another control hasn't taken it } + if GetActiveWindow <> 0 then begin + SetFocus(FocusWnd); + if GetCapture = 0 then + SetCapture(CapHandle); + end; + if ActiveWnd <> 0 then + SendMessage(ActiveWnd, WM_NCACTIVATE, Ord(GetActiveWindow = ActiveWnd), 0); + { The SetFocus call above can change the Z order of windows. If the parent + window is a popup window, reassert its topmostness. } + if View.Window is TTBPopupWindow then + SetWindowPos(View.Window.Handle, HWND_TOPMOST, 0, 0, 0, 0, + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); + { Send an MSAA "focus" event now that we're returning to the regular modal loop } + View.NotifyFocusEvent; + + Result := ecsClose in FEditControlStatus; + if not Result and (GetCapture = CapHandle) then begin + if ecsAccept in FEditControlStatus then + { if we are accepting but not closing, Tab must have been pressed } + View.Selected := View.NextSelectable(View.Selected, + GetKeyState(VK_SHIFT) >= 0); + end; +end; + +procedure TSpTBXEditItemViewer.DoBeginEdit; +begin + Item.DoBeginEdit(Self); +end; + +function TSpTBXEditItemViewer.DoExecute: Boolean; +begin + // Close any delay-close popup menus before entering the edit loop + View.CancelChildPopups; + Result := False; + if EditLoop(View.GetCaptureWnd) then begin + View.EndModal; + if ecsAccept in FEditControlStatus then + Result := True; + end; +end; + +function TSpTBXEditItemViewer.MeasureEditCaption: TSize; +begin + StockBitmap.Canvas.Font.Assign(View.GetFont); + Item.FontSettings.Apply(StockBitmap.Canvas.Font); + Result := SpGetTextSize(StockBitmap.Canvas.Handle, Item.EditCaption, True); +end; + +function TSpTBXEditItemViewer.MeasureTextHeight: Integer; +var + I: Integer; +begin + StockBitmap.Canvas.Font.Assign(View.GetFont); + Item.EditorFontSettings.Apply(StockBitmap.Canvas.Font); + GetEditHeight(StockBitmap.Canvas.Handle, Result, I); + Inc(Result, I); +end; + +procedure TSpTBXEditItemViewer.MouseBeginEdit; +begin + if Item.Enabled then + Execute(True) + else begin + if (View.ParentView = nil) and not View.IsPopup then + View.EndModal; + end; +end; + +procedure TSpTBXEditItemViewer.MouseDown(Shift: TShiftState; X, Y: Integer; + var MouseDownOnMenu: Boolean); +begin + if IsPtInButtonPart(X, Y) then + MouseBeginEdit + else + inherited; +end; + +procedure TSpTBXEditItemViewer.MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); +begin + if IsPtInButtonPart(X, Y) then + MouseBeginEdit + else + inherited; +end; + +function TSpTBXEditItemViewer.UsesSameWidth: Boolean; +begin + Result := False; +end; + +function TSpTBXEditItemViewer.GetAccRole: Integer; +const + ROLE_SYSTEM_TEXT = $2a; // from OleAcc.h +begin + Result := ROLE_SYSTEM_TEXT; +end; + +function TSpTBXEditItemViewer.GetAccValue(var Value: WideString): Boolean; +begin + Value := Item.Text; + Result := True; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSpinEditItem } + +constructor TSpTBXSpinEditItem.Create(AOwner: TComponent); +begin + inherited; + FSpinOptions := TSpTBXSpinEditOptions.Create; + FSpinOptions.OnGetText := SpinOptionsGetText; + FSpinOptions.OnSetText := SpinOptionsSetText; + + Alignment := taRightJustify; + Text := '0'; +end; + +destructor TSpTBXSpinEditItem.Destroy; +begin + FreeAndNil(FSpinOptions); + inherited; +end; + +function TSpTBXSpinEditItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + if not FAllowVerticalEditor and (AView.Orientation = tbvoVertical) then + Result := inherited GetItemViewerClass(AView) + else + Result := TSpTBXSpinEditViewer; +end; + +function TSpTBXSpinEditItem.GetValue: Extended; +begin + Result := SpinOptions.Value; +end; + +procedure TSpTBXSpinEditItem.SetValue(const Value: Extended); +begin + SpinOptions.Value := Value; +end; + +function TSpTBXSpinEditItem.GetValueChanged: TNotifyEvent; +begin + Result := SpinOptions.OnValueChanged; +end; + +procedure TSpTBXSpinEditItem.SetValueChanged(const ValueChangedEvent: TNotifyEvent); +begin + SpinOptions.OnValueChanged := ValueChangedEvent; +end; + +procedure TSpTBXSpinEditItem.SpinOptionsGetText(Sender: TObject; + var NewText: WideString; var Accept: Boolean); +begin + // Event used by SpinOptions to get the text from the edit control + NewText := Text; +end; + +procedure TSpTBXSpinEditItem.SpinOptionsSetText(Sender: TObject; + const AText: WideString); +begin + // Event used by SpinOptions to set the edit control text + Text := AText; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSpinEditViewer } + +destructor TSpTBXSpinEditViewer.Destroy; +begin + FreeAndNil(FTimer); + inherited; +end; + +function TSpTBXSpinEditViewer.GetAccRole: Integer; +const + ROLE_SYSTEM_SPINBUTTON = $34; +begin + Result := ROLE_SYSTEM_SPINBUTTON; +end; + +function TSpTBXSpinEditViewer.GetIndentAfter: Integer; +begin + if IsToolbarStyle then + Result := DefaultSpinButtonSize + 1 + else + Result := GetSystemMetrics(SM_CXMENUCHECK) + 1; +end; + +function TSpTBXSpinEditViewer.GetItem: TSpTBXSpinEditItem; +begin + Result := (inherited Item) as TSpTBXSpinEditItem; +end; + +function TSpTBXSpinEditViewer.HandleEditMessage(var Message: TMessage): Boolean; +begin + if Message.Msg = WM_CHAR then + case TWMChar(Message).CharCode of + VK_TAB, VK_RETURN: + begin + Item.Text := EditControl.Text; + Item.SpinOptions.UpdateValueFromText; + EditControl.Text := Item.Text; + end; + end + else + if Message.Msg = WM_KEYDOWN then + case TWMKeyDown(Message).CharCode of + VK_UP: + begin + Item.SpinOptions.ValueInc; + EditControl.Text := Item.Text; + EditControl.SelectAll; + Result := True; + Exit; + end; + VK_DOWN: + begin + Item.SpinOptions.ValueDec; + EditControl.Text := Item.Text; + EditControl.SelectAll; + Result := True; + Exit; + end; + end; + + Result := inherited HandleEditMessage(Message); +end; + +procedure TSpTBXSpinEditViewer.InternalDrawFrame(ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo); +var + IsHotTrack: Boolean; + R: TRect; +begin + inherited; + R := ARect; + InflateRect(R, -2, -2); + R.Left := ARect.Right - GetIndentAfter; + + IsHotTrack := ItemInfo.HotTrack; + SpDrawXPSpinButton(ACanvas, R, ItemInfo.Enabled, IsHotTrack, IsHotTrack, IsHotTrack, FUpPushed, FDownPushed, True, sknSkin); +end; + +procedure TSpTBXSpinEditViewer.InternalEditControlChange(Sender: TObject); +begin + if Item.ExtendedAccept then begin + Item.Text := EditControl.Text; + Item.SpinOptions.UpdateValueFromText(False); // Don't revert when an invalid text is entered + EditControl.Text := Item.Text; + end + else + inherited; +end; + +procedure TSpTBXSpinEditViewer.InternalEditControlExit; +begin + if Item.ExtendedAccept then begin + Item.Text := EditControl.Text; + Item.SpinOptions.UpdateValueFromText; + EditControl.Text := Item.Text; + end; +end; + +procedure TSpTBXSpinEditViewer.InvalidateButtons; +var + R: TRect; +begin + if Show and not IsRectEmpty(BoundsRect) then begin + R := BoundsRect; + R.Left := R.Right - GetIndentAfter; + InvalidateRect(View.Window.Handle, @R, False); + Include(State, tbisInvalidated); + end; +end; + +function TSpTBXSpinEditViewer.IsPtInButtonPart(X, Y: Integer): Boolean; +begin + Result := X <= (BoundsRect.Right - BoundsRect.Left) - GetIndentAfter; +end; + +procedure TSpTBXSpinEditViewer.LosingCapture; +begin + FUpPushed := False; + FDownPushed := False; + FreeAndNil(FTimer); + inherited; +end; + +procedure TSpTBXSpinEditViewer.MouseDown(Shift: TShiftState; X, Y: Integer; + var MouseDownOnMenu: Boolean); +begin + if not Item.Enabled then Exit; + + FUpPushed := False; + FDownPushed := False; + + if X >= BoundsRect.Right - BoundsRect.Left - GetIndentAfter then begin + if Y < (BoundsRect.Bottom - BoundsRect.Top) div 2 then begin + FUpPushed := True; + Item.SpinOptions.ValueInc; + end + else begin + FDownPushed := True; + Item.SpinOptions.ValueDec; + end; + + if not Assigned(FTimer) then begin + FTimer := TTimer.Create(nil); + FTimer.OnTimer := TimerHandler; + end; + FTimer.Interval := 400; + FTimer.Enabled := True; + end; + + if FUpPushed or FDownPushed then begin + InvalidateButtons; + inherited; + View.SetCapture; + end + else + inherited; +end; + +procedure TSpTBXSpinEditViewer.MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); +begin + if FUpPushed or FDownPushed then begin + FUpPushed := False; + FDownPushed := False; + FreeAndNil(FTimer); + InvalidateButtons; + end; + inherited; +end; + +procedure TSpTBXSpinEditViewer.TimerHandler(Sender: TObject); +begin + FTimer.Interval := 100; + if FUpPushed then Item.SpinOptions.ValueInc + else + if FDownPushed then Item.SpinOptions.ValueDec + else FreeAndNil(FTimer); +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.dcu new file mode 100644 index 0000000..f09965c Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.hpp new file mode 100644 index 0000000..d04ea9d --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.hpp @@ -0,0 +1,236 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxexteditors.pas' rev: 20.00 + +#ifndef SptbxexteditorsHPP +#define SptbxexteditorsHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxexteditors +{ +//-- type declarations ------------------------------------------------------- +#pragma option push -b- +enum TSpTBXColorListBoxStyle { clbsStandardColors, clbsSystemColors, clbsIncludeNone, clbsIncludeDefault, clbsCustomColor, clbsPrettyNames, clbsNoneAsTransparent }; +#pragma option pop + +typedef Set TSpTBXColorListBoxStyles; + +class DELPHICLASS TSpTBXColorEditButton; +class PASCALIMPLEMENTATION TSpTBXColorEditButton : public Sptbxeditors::TSpTBXEditButton +{ + typedef Sptbxeditors::TSpTBXEditButton inherited; + +private: + Graphics::TColor FSelectedColor; + void __fastcall SetSelectedColor(const Graphics::TColor Value); + +protected: + virtual bool __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage); + virtual Menus::TPopupMenu* __fastcall GetInternalDropDownMenu(void); + +public: + __property Graphics::TColor SelectedColor = {read=FSelectedColor, write=SetSelectedColor, nodefault}; +public: + /* TSpTBXEditButton.Create */ inline __fastcall virtual TSpTBXColorEditButton(Classes::TComponent* AOwner) : Sptbxeditors::TSpTBXEditButton(AOwner) { } + +public: + /* TSpTBXCustomButton.Destroy */ inline __fastcall virtual ~TSpTBXColorEditButton(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXColorEditButton(HWND ParentWindow) : Sptbxeditors::TSpTBXEditButton(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXColorEdit; +class PASCALIMPLEMENTATION TSpTBXColorEdit : public Sptbxeditors::TSpTBXEdit +{ + typedef Sptbxeditors::TSpTBXEdit inherited; + +private: + TSpTBXColorEditButton* FColorButton; + Sptbxskins::TSpTBXColorTextType FSelectedFormat; + Classes::TNotifyEvent FOnSelectedColorChanged; + Graphics::TColor __fastcall GetSelectedColor(void); + void __fastcall SetSelectedColor(const Graphics::TColor Value); + void __fastcall SetSelectedFormat(const Sptbxskins::TSpTBXColorTextType Value); + HIDESBASE MESSAGE void __fastcall CMExit(Messages::TWMNoParams &Message); + +protected: + DYNAMIC void __fastcall KeyPress(System::WideChar &Key); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + virtual void __fastcall DoSelectedColorChanged(void); + void __fastcall UpdateTextFromValue(void); + void __fastcall UpdateValueFromText(bool RevertWhenInvalid = true); + +public: + __fastcall virtual TSpTBXColorEdit(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXColorEdit(void); + __property TSpTBXColorEditButton* ColorButton = {read=FColorButton}; + +__published: + __property Text = {stored=false}; + __property Graphics::TColor SelectedColor = {read=GetSelectedColor, write=SetSelectedColor, nodefault}; + __property Sptbxskins::TSpTBXColorTextType SelectedFormat = {read=FSelectedFormat, write=SetSelectedFormat, default=2}; + __property Classes::TNotifyEvent OnSelectedColorChanged = {read=FOnSelectedColorChanged, write=FOnSelectedColorChanged}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXColorEdit(HWND ParentWindow) : Sptbxeditors::TSpTBXEdit(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXFontComboBoxPreview; +class PASCALIMPLEMENTATION TSpTBXFontComboBoxPreview : public Controls::TCustomControl +{ + typedef Controls::TCustomControl inherited; + +private: + Extctrls::TPanel* FPreviewPanel; + +protected: + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + +public: + __fastcall virtual TSpTBXFontComboBoxPreview(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXFontComboBoxPreview(void); + __property Extctrls::TPanel* PreviewPanel = {read=FPreviewPanel}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXFontComboBoxPreview(HWND ParentWindow) : Controls::TCustomControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXFontComboBox; +class PASCALIMPLEMENTATION TSpTBXFontComboBox : public Sptbxeditors::TSpTBXComboBox +{ + typedef Sptbxeditors::TSpTBXComboBox inherited; + +private: + bool FFontPreview; + bool FFontNamePreview; + int FMaxMRUItems; + int FMRUCount; + TSpTBXFontComboBoxPreview* FPreviewWindow; + Graphics::TFontName FSelectedFont; + Sptbxeditors::TSpTBXEditGetTextEvent FOnFontPreview; + void __fastcall UpdateSelectedFont(bool AddMRU); + void __fastcall SetFontNamePreview(const bool Value); + void __fastcall SetSelectedFont(const Graphics::TFontName Value); + void __fastcall SetMaxMRUItems(int Value); + void __fastcall SetFontPreview(const bool Value); + +protected: + DYNAMIC void __fastcall Click(void); + DYNAMIC void __fastcall CloseUp(void); + virtual void __fastcall DoCalcMaxDropDownWidth(void); + virtual void __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + DYNAMIC void __fastcall DropDown(void); + +public: + __fastcall virtual TSpTBXFontComboBox(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXFontComboBox(void); + void __fastcall MRUAdd(Graphics::TFontName AFontName); + bool __fastcall MRUDelete(Graphics::TFontName AFontName); + __property int MRUCount = {read=FMRUCount, nodefault}; + +__published: + __property Items = {stored=false}; + __property AutoDropDownWidth = {default=1}; + __property AutoItemHeight = {default=0}; + __property bool FontPreview = {read=FFontPreview, write=SetFontPreview, default=1}; + __property bool FontNamePreview = {read=FFontNamePreview, write=SetFontNamePreview, default=1}; + __property int MaxMRUItems = {read=FMaxMRUItems, write=SetMaxMRUItems, default=5}; + __property Graphics::TFontName SelectedFont = {read=FSelectedFont, write=SetSelectedFont}; + __property Sptbxeditors::TSpTBXEditGetTextEvent OnFontPreview = {read=FOnFontPreview, write=FOnFontPreview}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXFontComboBox(HWND ParentWindow) : Sptbxeditors::TSpTBXComboBox(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXColorListBox; +class PASCALIMPLEMENTATION TSpTBXColorListBox : public Sptbxeditors::TSpTBXListBox +{ + typedef Sptbxeditors::TSpTBXListBox inherited; + +private: + bool FItems; + bool FNeedToPopulate; + Graphics::TColor FSelectedColor; + TSpTBXColorListBoxStyles FStyle; + void __fastcall ColorCallBack(const System::UnicodeString AName); + System::UnicodeString __fastcall GetColorName(int Index); + Graphics::TColor __fastcall GetColor(int Index); + HIDESBASE Graphics::TColor __fastcall GetSelected(void); + HIDESBASE void __fastcall SetSelected(const Graphics::TColor Value); + HIDESBASE void __fastcall SetStyle(const TSpTBXColorListBoxStyles Value); + +protected: + virtual void __fastcall CreateWnd(void); + virtual void __fastcall Loaded(void); + DYNAMIC void __fastcall DblClick(void); + DYNAMIC void __fastcall KeyPress(System::WideChar &Key); + virtual void __fastcall DoDrawItem(Graphics::TCanvas* ACanvas, Types::TRect &ARect, int Index, const Windows::TOwnerDrawState State, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + bool __fastcall PickCustomColor(void); + void __fastcall PopulateList(void); + +public: + __fastcall virtual TSpTBXColorListBox(Classes::TComponent* AOwner); + void __fastcall AddColor(Graphics::TColor AColor, System::UnicodeString AColorName); + int __fastcall ColorCount(void); + __property Graphics::TColor Colors[int Index] = {read=GetColor}; + __property System::UnicodeString ColorNames[int Index] = {read=GetColorName}; + +__published: + __property bool Items = {read=FItems, nodefault}; + __property Graphics::TColor Selected = {read=GetSelected, write=SetSelected, default=0}; + __property TSpTBXColorListBoxStyles Style = {read=FStyle, write=SetStyle, default=67}; +public: + /* TSpTBXListBox.Destroy */ inline __fastcall virtual ~TSpTBXColorListBox(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXColorListBox(HWND ParentWindow) : Sptbxeditors::TSpTBXListBox(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +extern PACKAGE Controls::TImageList* FontGlyphImgList; +extern PACKAGE void __fastcall SpFillFontNames(Classes::TStrings* ADest); +extern PACKAGE void __fastcall SpDrawCheckeredBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); +extern PACKAGE void __fastcall SpDrawColorDropDownButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Pushed, Graphics::TColor AColor, bool CheckeredBkgndWhenTransparent = true); + +} /* namespace Sptbxexteditors */ +using namespace Sptbxexteditors; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxexteditorsHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.pas new file mode 100644 index 0000000..e92918c --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXExtEditors.pas @@ -0,0 +1,1068 @@ +unit SpTBXExtEditors; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development notes: + - All the Windows and Delphi bugs fixes are marked with '[Bugfix]'. + - All the theme changes and adjustments are marked with '[Theme-Change]'. + +To Do: + - Rotated caption painting. + +Known Issues: + - + +History: +8 May 2009 - version 2.4.2 + - No changes. + +15 March 2009 - version 2.4.1 + - No changes. + +17 January 2009 - version 2.4 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, Classes, SysUtils, Controls, Graphics, ImgList, Forms, + Menus, StdCtrls, ExtCtrls, + SpTBXSkins, SpTBXItem, SpTBXEditors; + +type + TSpTBXColorListBoxStyle = ( + clbsStandardColors, // First 16 RGBI colors + 4 additional extended colors + clbsSystemColors, // System colors + clbsIncludeNone, // Include clNone color + clbsIncludeDefault, // Include clDefault color + clbsCustomColor, // First color is customizable + clbsPrettyNames, // Draw text with pretty names + clbsNoneAsTransparent // Draw clNone as transparent color + ); + TSpTBXColorListBoxStyles = set of TSpTBXColorListBoxStyle; + + { TSpTBXColorEditButton } + + TSpTBXColorEditButton = class(TSpTBXEditButton) + private + FSelectedColor: TColor; + procedure SetSelectedColor(const Value: TColor); + protected + function DoDrawItem(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage): Boolean; override; + function GetInternalDropDownMenu: TPopupMenu; override; + public + property SelectedColor: TColor read FSelectedColor write SetSelectedColor; + end; + + { TSpTBXColorEdit } + + TSpTBXColorEdit = class(TSpTBXEdit) + private + FColorButton: TSpTBXColorEditButton; + FSelectedFormat: TSpTBXColorTextType; + FOnSelectedColorChanged: TNotifyEvent; + function GetSelectedColor: TColor; + procedure SetSelectedColor(const Value: TColor); + procedure SetSelectedFormat(const Value: TSpTBXColorTextType); + procedure CMExit(var Message: TCMExit); message CM_EXIT; + protected + procedure KeyPress(var Key: Char); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure DoSelectedColorChanged; virtual; + procedure UpdateTextFromValue; + procedure UpdateValueFromText(RevertWhenInvalid: Boolean = True); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property ColorButton: TSpTBXColorEditButton read FColorButton; + published + property Text stored False; + property SelectedColor: TColor read GetSelectedColor write SetSelectedColor; + property SelectedFormat: TSpTBXColorTextType read FSelectedFormat write SetSelectedFormat default cttIdentAndHTML; + property OnSelectedColorChanged: TNotifyEvent read FOnSelectedColorChanged write FOnSelectedColorChanged; + end; + + { TSpTBXFontComboBox } + + TSpTBXFontComboBoxPreview = class(TCustomControl) + private + FPreviewPanel: TPanel; + protected + procedure CreateParams(var Params: TCreateParams); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property PreviewPanel: TPanel read FPreviewPanel; + end; + + TSpTBXFontComboBox = class(TSpTBXComboBox) + private + FFontPreview: Boolean; + FFontNamePreview: Boolean; + FMaxMRUItems: Integer; + FMRUCount: Integer; + FPreviewWindow: TSpTBXFontComboBoxPreview; + FSelectedFont: TFontName; + FOnFontPreview: TSpTBXEditGetTextEvent; + procedure UpdateSelectedFont(AddMRU: Boolean); + procedure SetFontNamePreview(const Value: Boolean); + procedure SetSelectedFont(const Value: TFontName); + procedure SetMaxMRUItems(Value: Integer); + procedure SetFontPreview(const Value: Boolean); + protected + procedure Click; override; + procedure CloseUp; override; + procedure DoCalcMaxDropDownWidth; override; + procedure DoDrawItem(ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); override; + procedure DropDown; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure MRUAdd(AFontName: TFontName); + function MRUDelete(AFontName: TFontName): Boolean; + property MRUCount: Integer read FMRUCount; + published + property Items stored False; + property AutoDropDownWidth default True; + property AutoItemHeight default False; + property FontPreview: Boolean read FFontPreview write SetFontPreview default True; + property FontNamePreview: Boolean read FFontNamePreview write SetFontNamePreview default True; + property MaxMRUItems: Integer read FMaxMRUItems write SetMaxMRUItems default 5; + property SelectedFont: TFontName read FSelectedFont write SetSelectedFont; + property OnFontPreview: TSpTBXEditGetTextEvent read FOnFontPreview write FOnFontPreview; + end; + + { TSpTBXColorListBox } + + TSpTBXColorListBox = class(TSpTBXListBox) + private + FItems: Boolean; + FNeedToPopulate: Boolean; + FSelectedColor: TColor; + FStyle: TSpTBXColorListBoxStyles; + procedure ColorCallBack(const AName: string); + function GetColorName(Index: Integer): string; + function GetColor(Index: Integer): TColor; + function GetSelected: TColor; + procedure SetSelected(const Value: TColor); + procedure SetStyle(const Value: TSpTBXColorListBoxStyles); + protected + procedure CreateWnd; override; + procedure Loaded; override; + procedure DblClick; override; + procedure KeyPress(var Key: Char); override; + procedure DoDrawItem(ACanvas: TCanvas; var ARect: TRect; Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); override; + function PickCustomColor: Boolean; + procedure PopulateList; + public + constructor Create(AOwner: TComponent); override; + procedure AddColor(AColor: TColor; AColorName: string); + function ColorCount: Integer; + property Colors[Index: Integer]: TColor read GetColor; + property ColorNames[Index: Integer]: string read GetColorName; + published + property Items: Boolean read FItems; // Hides inherited Items property + property Selected: TColor read GetSelected write SetSelected default clBlack; + property Style: TSpTBXColorListBoxStyles read FStyle write SetStyle default [clbsStandardColors, clbsSystemColors, clbsNoneAsTransparent]; // Hides inherited Style property + end; + +{ Helpers } +procedure SpFillFontNames(ADest: TStrings); + +{ Painting helpers } +procedure SpDrawCheckeredBackground(ACanvas: TCanvas; ARect: TRect); +procedure SpDrawColorDropDownButton(ACanvas: TCanvas; ARect: TRect; Pushed: Boolean; AColor: TColor; CheckeredBkgndWhenTransparent: Boolean = True); + +var + FontGlyphImgList: TImageList = nil; + +implementation + +uses + Dialogs, TB2Common, SpTBXFormPopupMenu, SpTBXColorPickerForm; + +var + DefaultColorPickerDropDownMenu: TSpTBXColorEditPopupMenu = nil; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +procedure SpFillFontNames(ADest: TStrings); +// This will only work on Windows 2000 and above, more info on: +// http://www.delphipraxis.net/post712587.html&sid=945c12fa9fb826d76e51c80b42109a21#712587 + + function EnumFontsProcWin9x(EnumLogFontEx: PEnumLogFontEx; NewTextMetric: PNewTextMetric; + FontType: DWORD; LParam: LPARAM): Integer; stdcall; + var + S: string; + GlyphIndex: Integer; + L: TStrings; + const + NTM_PS_OPENTYPE = $00020000; + NTM_TT_OPENTYPE = $00040000; + begin + L := TStrings(LParam); + if FontType = TRUETYPE_FONTTYPE then + GlyphIndex := 1 + else + GlyphIndex := 0; + + S := EnumLogFontEx.elfLogFont.lfFaceName; + + if (S[1] <> '@') then + if (L.Count = 0) or not SameText(S, L[L.Count - 1]) then + L.AddObject(S, Pointer(GlyphIndex)); + + Result := 1; + end; + + function EnumFontsProc(EnumLogFontExDV: PEnumLogFontExDV; EnumTextMetric: PEnumTextMetric; + FontType: DWORD; LParam: LPARAM): Integer; stdcall; + var + S: string; + GlyphIndex: Integer; + L: TStrings; + const + NTM_PS_OPENTYPE = $00020000; + NTM_TT_OPENTYPE = $00040000; + begin + L := TStrings(LParam); + GlyphIndex := 0; + if ((EnumTextMetric.etmNewTextMetricEx.ntmTm.ntmFlags and NTM_TT_OPENTYPE) = NTM_TT_OPENTYPE) or + ((EnumTextMetric.etmNewTextMetricEx.ntmTm.ntmFlags and NTM_PS_OPENTYPE) = NTM_PS_OPENTYPE) then + GlyphIndex := 2 + else + if FontType = TRUETYPE_FONTTYPE then + GlyphIndex := 1; + + S := EnumLogFontExDV.elfEnumLogfontEx.elfLogFont.lfFaceName; + + if (S[1] <> '@') then + if (L.Count = 0) or not SameText(S, L[L.Count - 1]) then + L.AddObject(S, Pointer(GlyphIndex)); + + Result := 1; + end; + +var + DC: HDC; + LFont: TLogFont; + L: TStringList; +begin + L := TStringList.Create; + DC := GetDC(0); + try + FillChar(LFont, SizeOf(LFont), 0); + LFont.lfCharset := DEFAULT_CHARSET; + if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then + EnumFontFamiliesEx(DC, LFont, @EnumFontsProcWin9x, LongInt(L), 0) + else + EnumFontFamiliesEx(DC, LFont, @EnumFontsProc, LongInt(L), 0); + L.Sort; + ADest.Assign(L); + finally + ReleaseDC(0, DC); + L.Free; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Painting helpers } + +procedure SpDrawCheckeredBackground(ACanvas: TCanvas; ARect: TRect); +// Draws a 2x2 white and silver checkered background +var + R: TRect; + I, J, HCount, WCount: Integer; +const + Size = 2; +begin + WCount := (ARect.Right - ARect.Left) div Size; + HCount := (ARect.Bottom - ARect.Top) div Size; + for J := 0 to HCount do + for I := 0 to WCount do begin + R := Bounds(ARect.Left + (I * Size), ARect.Top + (J * Size), Size, Size); + if R.Right > ARect.Right then + R.Right := ARect.Right; + if R.Bottom > ARect.Bottom then + R.Bottom := ARect.Bottom; + if (I + J) mod 2 = 0 then + ACanvas.Brush.Color := clWhite + else + ACanvas.Brush.Color := clSilver; + ACanvas.FillRect(R); + end; +end; + +procedure SpDrawColorDropDownButton(ACanvas: TCanvas; ARect: TRect; + Pushed: Boolean; AColor: TColor; CheckeredBkgndWhenTransparent: Boolean); +// Draws a button used for color editboxes +var + R: TRect; +begin + R := ARect; + + ACanvas.Brush.Color := clBtnFace; + ACanvas.FillRect(R); + if not Pushed then + SpDrawRectangle(ACanvas, R, 0, clBtnHighlight, clBtnShadow); + + InflateRect(R, -2, -2); + if (AColor = clNone) and CheckeredBkgndWhenTransparent then begin + // Draw a checkered background when clNone is used + SpDrawCheckeredBackground(ACanvas, R); + end + else begin + ACanvas.Brush.Color := AColor; + ACanvas.FillRect(R); + end; + SpDrawRectangle(ACanvas, R, 0, clBtnShadow, clBtnHighlight); + + R := ARect; + R.Left := R.Right - 9; + R.Top := R.Bottom - 7; + ACanvas.Brush.Color := clBtnFace; + ACanvas.FillRect(R); + if Pushed then + SpDrawRectangle(ACanvas, R, 0, clBtnHighlight, clBtnFace) + else + SpDrawRectangle(ACanvas, R, 0, clBtnHighlight, clBtnShadow); + SpDrawArrow(ACanvas, R.Left + (R.Right - R.Left) div 2, R.Top + (R.Bottom - R.Top) div 2 - 1, clBlack, True, False, 2); + + R := ARect; + InflateRect(R, -1, -1); + SpDrawRectangle(ACanvas, R, 0, clBtnFace, clBtnFace); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorEditButton } + +function TSpTBXColorEditButton.DoDrawItem(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage): Boolean; +begin + if (PaintStage = pstPrePaint) and not BitmapValid then begin + Result := True; + if Assigned(OnDraw) then OnDraw(Self, ACanvas, ARect, PaintStage, Result); + if Result then + SpDrawColorDropDownButton(ACanvas, ARect, Pushed, FSelectedColor); + end + else + Result := inherited DoDrawItem(ACanvas, ARect, PaintStage); +end; + +function TSpTBXColorEditButton.GetInternalDropDownMenu: TPopupMenu; +begin + if Assigned(DropDownMenu) then + Result := DropDownMenu + else + Result := DefaultColorPickerDropDownMenu; +end; + +procedure TSpTBXColorEditButton.SetSelectedColor(const Value: TColor); +begin + if FSelectedColor <> Value then begin + FSelectedColor := Value; + Invalidate; + if Owner is TSpTBXColorEdit then begin + TSpTBXColorEdit(Owner).UpdateTextFromValue; + TSpTBXColorEdit(Owner).DoSelectedColorChanged; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorEdit } + +constructor TSpTBXColorEdit.Create(AOwner: TComponent); +begin + inherited; + + FSelectedFormat := cttIdentAndHTML; + + FColorButton := TSpTBXColorEditButton.Create(Self); + FColorButton.Parent := Self; + FColorButton.FreeNotification(Self); + FColorButton.Align := alRight; + FColorButton.Width := 19; + UpdateEditRect; + + Text := 'clBlack'; +end; + +destructor TSpTBXColorEdit.Destroy; +begin + FreeAndNil(FColorButton); + inherited; +end; + +procedure TSpTBXColorEdit.DoSelectedColorChanged; +begin + if Assigned(FOnSelectedColorChanged) then FOnSelectedColorChanged(Self); +end; + +procedure TSpTBXColorEdit.KeyPress(var Key: Char); +begin + inherited; + if Key = #13 then begin + Key := #0; + UpdateValueFromText; + if FColorButton.IsDroppedDown and Assigned(ActiveFormPopupMenu) then + ActiveFormPopupMenu.ClosePopup(False); + end; +end; + +procedure TSpTBXColorEdit.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (AComponent = FColorButton) and (Operation = opRemove) then + FColorButton := nil; +end; + +function TSpTBXColorEdit.GetSelectedColor: TColor; +begin + Result := FColorButton.SelectedColor; +end; + +procedure TSpTBXColorEdit.SetSelectedColor(const Value: TColor); +begin + FColorButton.SelectedColor := Value; +end; + +procedure TSpTBXColorEdit.SetSelectedFormat(const Value: TSpTBXColorTextType); +begin + if FSelectedFormat <> Value then begin + FSelectedFormat := Value; + UpdateTextFromValue; + end; +end; + +procedure TSpTBXColorEdit.UpdateTextFromValue; +begin + if (SelectedColor = clNone) or (SelectedColor = clDefault) then + Text := ColorToString(SelectedColor) + else + Text := SpColorToString(SelectedColor, FSelectedFormat); + SelStart := Length(Text); +end; + +procedure TSpTBXColorEdit.UpdateValueFromText(RevertWhenInvalid: Boolean = True); +var + WS: WideString; + PrevValue, NewValue, C: TColor; +begin + PrevValue := SelectedColor; + NewValue := SelectedColor; + WS := Text; + + // Try to parse the text to get the value + WS := Trim(WS); + if SpStringToColor(WS, C) then + NewValue := C; + + if RevertWhenInvalid or (NewValue <> PrevValue) then begin + SetSelectedColor(NewValue); + UpdateTextFromValue; + end; +end; + +procedure TSpTBXColorEdit.CMExit(var Message: TCMExit); +begin + inherited; + UpdateValueFromText; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXFontComboBoxPreview } + +constructor TSpTBXFontComboBoxPreview.Create(AOwner: TComponent); +begin + inherited; + + Visible := False; + SetBounds(0, 0, 0, 0); + Color := clWindow; + FPreviewPanel := TPanel.Create(Self); + FPreviewPanel.Parent := Self; + FPreviewPanel.Color := clWindow; + FPreviewPanel.BevelOuter := bvNone; + FPreviewPanel.Align := alClient; +end; + +procedure TSpTBXFontComboBoxPreview.CreateParams(var Params: TCreateParams); +const + CS_DROPSHADOW = $00020000; +begin + inherited; + with Params do begin + Style := (Style and not (WS_CHILD or WS_GROUP or WS_TABSTOP)) or WS_POPUP; + ExStyle := ExStyle or WS_EX_TOPMOST or WS_EX_TOOLWINDOW; + WindowClass.Style := WindowClass.Style or CS_SAVEBITS; + if IsWindowsXP then + WindowClass.Style := WindowClass.Style or CS_DROPSHADOW; + end; +end; + +destructor TSpTBXFontComboBoxPreview.Destroy; +begin + FreeAndNil(FPreviewPanel); + + inherited; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXFontComboBox } + +constructor TSpTBXFontComboBox.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FAutoDropDownWidthRightMargin := 60; + FFontNamePreview := True; + FFontPreview := True; + FMaxMRUItems := 5; + FMRUCount := 0; + AutoItemHeight := False; + AutoDropDownWidth := True; + ItemHeight := 23; +end; + +destructor TSpTBXFontComboBox.Destroy; +begin + FreeAndNil(FPreviewWindow); + inherited; +end; + +procedure TSpTBXFontComboBox.Click; +begin + UpdateSelectedFont(False); + inherited; +end; + +procedure TSpTBXFontComboBox.CloseUp; +begin + UpdateSelectedFont(True); + inherited; + FreeAndNil(FPreviewWindow); +end; + +procedure TSpTBXFontComboBox.DropDown; +var + W: Integer; + P: TPoint; + Sz: TSize; + WS: WideString; +begin + inherited; + + if FFontPreview then begin + WS := 'AaBbYyZz'; + FPreviewWindow := TSpTBXFontComboBoxPreview.Create(Self); + FPreviewWindow.ParentWindow := Application.Handle; + FPreviewWindow.PreviewPanel.Font.Size := 14; + + if Assigned(FOnFontPreview) then FOnFontPreview(Self, WS); + + FPreviewWindow.PreviewPanel.Caption := WS; + Sz := SpGetControlTextSize(FPreviewWindow.PreviewPanel, FPreviewWindow.PreviewPanel.Font, WS); + Inc(Sz.cx, 100); + Inc(Sz.cy, 20); + + W := SendMessage(Handle, CB_GETDROPPEDWIDTH, 0, 0); + P := Parent.ClientToScreen(Point(Left, Top)); + + if P.X + W + Sz.cx > Screen.Width then + Dec(P.X, Sz.cx) + else + Inc(P.X, W); + if P.Y + Height + Sz.cy > Screen.Height then + Dec(P.Y, Sz.cy) + else + Inc(P.Y, Height); + FPreviewWindow.SetBounds(P.X, P.Y, Sz.cx, Sz.cy); + FPreviewWindow.Visible := True; + ShowWindow(FPreviewWindow.Handle, SW_SHOWNA); + end; +end; + +procedure TSpTBXFontComboBox.DoCalcMaxDropDownWidth; +begin + if Items.Count <= 0 then begin + {$IFNDEF UNICODE} + SpFillFontNames(Items.AnsiStrings); + {$ELSE} + SpFillFontNames(Items); + {$ENDIF} + end; + + inherited; +end; + +procedure TSpTBXFontComboBox.DoDrawItem(ACanvas: TCanvas; var ARect: TRect; + Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +var + Flags, ImageIndex: Integer; + R: TRect; +const + Spacing = 4; +begin + inherited DoDrawItem(ACanvas, ARect, Index, State, PaintStage, PaintDefault); + if (PaintStage = pstPrePaint) and PaintDefault then begin + PaintDefault := False; // Override the default painting + // Draw the item glyph if the font is TrueType/OpenType + R := ARect; + R.Left := Spacing; + R.Top := R.Top + ((R.Bottom - R.Top) - FontGlyphImgList.Height) div 2; + ImageIndex := Integer(Items.Objects[Index]) - 1; + if ImageIndex > -1 then + FontGlyphImgList.Draw(ACanvas, R.Left, R.Top, ImageIndex); + + // Draw the item text + R := ARect; + R.Left := Spacing + FontGlyphImgList.Width + Spacing; + if FFontNamePreview then + ACanvas.Font.Name := Items[Index]; + Flags := DrawTextBiDiModeFlags(DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX); + SpDrawXPText(ACanvas, Items[Index], R, Flags); + + // Draw the MRU separator line + if FMaxMRUItems > 0 then begin + if Index = MRUCount - 1 then + SpDrawLine(ACanvas, ARect.Left, ARect.Bottom - 1, ARect.Right, ARect.Bottom - 1, $C0C0C0); + if Index = MRUCount then + SpDrawLine(ACanvas, ARect.Left, ARect.Top, ARect.Right, ARect.Top, $C0C0C0); + end; + + // Update the Font of the PreviewWindow + if Assigned(FPreviewWindow) and (odSelected in State) then + FPreviewWindow.PreviewPanel.Font.Name := Items[Index]; + end; +end; + +procedure TSpTBXFontComboBox.MRUAdd(AFontName: TFontName); +var + I, AFontNameIndex: Integer; +begin + AFontNameIndex := Items.IndexOf(AFontName); + if (AFontNameIndex > -1) and (FMRUCount < Items.Count) and (FMaxMRUItems > 0) then begin + // Exit if it's already on the list + for I := 0 to FMRUCount - 1 do + if SameText(AFontName, Items[I]) then Exit; + + // Add the font to the top and delete the last MRU item if necessary + Items.InsertObject(0, Items[AFontNameIndex], Items.Objects[AFontNameIndex]); + if FMRUCount >= FMaxMRUItems then + Items.Delete(FMRUCount) + else + Inc(FMRUCount); + end; +end; + +function TSpTBXFontComboBox.MRUDelete(AFontName: TFontName): Boolean; +var + I: Integer; +begin + Result := False; + for I := 0 to FMRUCount - 1 do + if SameText(AFontName, Items[I]) then begin + Items.Delete(I); + Result := True; + Break; + end; +end; + +procedure TSpTBXFontComboBox.SetMaxMRUItems(Value: Integer); +begin + if Value < 0 then Value := 0; + if FMaxMRUItems <> Value then begin + FMaxMRUItems := Value; + while FMRUCount > FMaxMRUItems do begin + Items.Delete(FMRUCount); + Dec(FMRUCount); + end; + end; +end; + +procedure TSpTBXFontComboBox.SetFontNamePreview(const Value: Boolean); +begin + if FFontNamePreview <> Value then begin + FFontNamePreview := Value; + Invalidate; + end; +end; + +procedure TSpTBXFontComboBox.SetFontPreview(const Value: Boolean); +begin + FFontPreview := Value; +end; + +procedure TSpTBXFontComboBox.SetSelectedFont(const Value: TFontName); +var + I: Integer; +begin + I := Items.IndexOf(Value); + if ItemIndex <> I then + ItemIndex := I; + UpdateSelectedFont(True); + + // If the Value is not valid clear the text and call the click events + if I = -1 then begin + Click; + Select; + end; +end; + +procedure TSpTBXFontComboBox.UpdateSelectedFont(AddMRU: Boolean); +var + I: Integer; +begin + I := ItemIndex; + if I > -1 then begin + FSelectedFont := Items[I]; + if AddMRU then + MRUAdd(FSelectedFont); + end + else + FSelectedFont := ''; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorListBox } + +constructor TSpTBXColorListBox.Create(AOwner: TComponent); +begin + inherited; + FStyle := [clbsStandardColors, clbsSystemColors, clbsNoneAsTransparent]; + FSelectedColor := clBlack; + PopulateList; +end; + +procedure TSpTBXColorListBox.CreateWnd; +begin + inherited CreateWnd; + if FNeedToPopulate then + PopulateList; +end; + +procedure TSpTBXColorListBox.DblClick; +begin + inherited; + if ItemIndex = 0 then + PickCustomColor; +end; + +procedure TSpTBXColorListBox.Loaded; +begin + inherited; + Selected := FSelectedColor; + if FNeedToPopulate then + PopulateList; +end; + +procedure TSpTBXColorListBox.AddColor(AColor: TColor; AColorName: string); +begin + (inherited Items).AddObject(AColorName, TObject(AColor)); +end; + +procedure TSpTBXColorListBox.ColorCallBack(const AName: string); +var + I, LStart: Integer; + LColor: TColor; + LName: string; +begin + LColor := StringToColor(AName); + if clbsPrettyNames in Style then begin + if AName = 'clBtnFace' then LName := 'Button Face' + else if AName = 'clBtnHighlight' then LName := 'Button Highlight' + else if AName = 'clBtnShadow' then LName := 'Button Shadow' + else if AName = 'clBtnText' then LName := 'Button Text' + else if AName = 'clMedGray' then LName := 'Medium Gray' + else if AName = 'clInfoBk' then LName := 'Info Background' + else if AName = 'cl3DDkShadow' then LName := '3D Dark Shadow' + else if AName = 'cl3DLight' then LName := '3D Light' + else begin + // Remove the 'cl' prefix and separate the words with a space + if Copy(AName, 1, 2) = 'cl' then + LStart := 3 + else + LStart := 1; + LName := ''; + for I := LStart to Length(AName) do begin + case AName[I] of + 'A'..'Z': + if LName <> '' then + LName := LName + ' '; + end; + LName := LName + AName[I]; + end; + end; + end + else + LName := AName; + + AddColor(LColor, LName); +end; + +function TSpTBXColorListBox.ColorCount: Integer; +begin + Result := (inherited Items).Count; +end; + +procedure TSpTBXColorListBox.DoDrawItem(ACanvas: TCanvas; var ARect: TRect; + Index: Integer; const State: TOwnerDrawState; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +var + R: TRect; + SavedBrushColor: TColor; +begin + if PaintStage = pstPrePaint then begin + // Paint the color glyphs + R := ARect; + R.Right := R.Left + 16 + 5; + ARect.Left := R.Right + 1; + inherited DoDrawItem(ACanvas, ARect, Index, State, PaintStage, PaintDefault); + if PaintDefault then begin + SavedBrushColor := ACanvas.Brush.Color; + try + InflateRect(R, -1, -1); + + ACanvas.Brush.Color := Colors[Index]; + if (ACanvas.Brush.Color = clNone) and (clbsNoneAsTransparent in Style) then + SpDrawCheckeredBackground(ACanvas, R) + else + ACanvas.FillRect(R); + + if odSelected in State then + ACanvas.Brush.Color := clWhite + else + ACanvas.Brush.Color := clBlack; + ACanvas.FrameRect(R); + finally + ACanvas.Brush.Color := SavedBrushColor; + end; + end; + end + else + inherited DoDrawItem(ACanvas, ARect, Index, State, PaintStage, PaintDefault); +end; + +function TSpTBXColorListBox.GetColor(Index: Integer): TColor; +begin + Result := TColor((inherited Items).Objects[Index]); +end; + +function TSpTBXColorListBox.GetColorName(Index: Integer): string; +begin + Result := (inherited Items)[Index]; +end; + +function TSpTBXColorListBox.GetSelected: TColor; +begin + if HandleAllocated then + if ItemIndex <> -1 then + Result := Colors[ItemIndex] + else + Result := clNone + else + Result := FSelectedColor; +end; + +procedure TSpTBXColorListBox.KeyPress(var Key: Char); +begin + inherited KeyPress(Key); + if (clbsCustomColor in Style) and (Key = #13) and (ItemIndex = 0) then begin + Key := #0; + PickCustomColor; + end; +end; + +function TSpTBXColorListBox.PickCustomColor: Boolean; +var + LColor: TColor; + CD: TColorDialog; +begin + Result := False; + if not (clbsCustomColor in Style) then Exit; + + CD := TColorDialog.Create(nil); + try + LColor := ColorToRGB(Colors[0]); + CD.Color := LColor; + CD.CustomColors.Text := Format('ColorA=%.8x', [LColor]); + CD.Options := CD.Options + [cdFullOpen]; + Result := CD.Execute; + if Result then begin + (inherited Items).Objects[0] := TObject(CD.Color); + Invalidate; + end; + finally + CD.Free; + end; +end; + +procedure TSpTBXColorListBox.PopulateList; + + procedure DeleteRange(const AMin, AMax: Integer); + var + I: Integer; + begin + for I := AMax downto AMin do + (inherited Items).Delete(I); + end; + + procedure DeleteColor(const AColor: TColor); + var + I: Integer; + begin + I := (inherited Items).IndexOfObject(TObject(AColor)); + if I <> -1 then + (inherited Items).Delete(I); + end; + +var + LSelectedColor, LCustomColor: TColor; +begin + if HandleAllocated and not (csLoading in ComponentState) then begin + (inherited Items).BeginUpdate; + try + // Get the custom color + LCustomColor := clBlack; + if (clbsCustomColor in Style) and ((inherited Items).Count > 0) then + LCustomColor := TColor((inherited Items).Objects[0]); + + LSelectedColor := FSelectedColor; + (inherited Items).Clear; + + GetColorValues(ColorCallBack); + if not (clbsIncludeNone in Style) then + DeleteColor(clNone); + if not (clbsIncludeDefault in Style) then + DeleteColor(clDefault); + if not (clbsSystemColors in Style) then + DeleteRange(StandardColorsCount + ExtendedColorsCount, (inherited Items).Count - 1); + if not (clbsStandardColors in Style) then + DeleteRange(0, StandardColorsCount + ExtendedColorsCount - 1); + + if clbsCustomColor in Style then + (inherited Items).InsertObject(0, '...', TObject(LCustomColor)); + + Selected := LSelectedColor; + finally + (inherited Items).EndUpdate; + FNeedToPopulate := False; + end; + end + else + FNeedToPopulate := True; +end; + +procedure TSpTBXColorListBox.SetSelected(const Value: TColor); +var + I, J: Integer; +begin + if HandleAllocated then begin + I := (inherited Items).IndexOfObject(TObject(Value)); + if (I = -1) and (clbsCustomColor in Style) then begin + // If the color is not on the list add it and select it + (inherited Items).Objects[0] := TObject(Value); + I := 0; + end + else + if (clbsCustomColor in Style) and (I = 0) then begin + // Try to find the color on the list before selecting the 1st custom color + for J := 1 to (inherited Items).Count - 1 do + if (inherited Items).Objects[J] = TObject(Value) then begin + I := J; + Break; + end; + end; + + if (ItemIndex = 0) and (I = 0) then + Invalidate + else + ItemIndex := I; + end; + + FSelectedColor := Value; +end; + +procedure TSpTBXColorListBox.SetStyle(const Value: TSpTBXColorListBoxStyles); +begin + if Style <> Value then begin + FStyle := Value; + Enabled := ([clbsStandardColors, clbsSystemColors, clbsCustomColor] * FStyle) <> []; + PopulateList; + if (ColorCount > 0) and (ItemIndex = -1) then + ItemIndex := 0; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Stock Objects } + +procedure InitializeStock; +begin + Screen.Cursors[crSpTBXEyeDropper] := LoadCursor(HInstance, 'CZEYEDROPPER'); + + FontGlyphImgList := TImageList.CreateSize(12, 12); + FontGlyphImgList.ResInstLoad(HInstance, rtBitmap, 'SPTBXTRUETYPE', clFuchsia); + FontGlyphImgList.ResInstLoad(HInstance, rtBitmap, 'SPTBXOPENTYPE', clFuchsia); + + DefaultColorPickerDropDownMenu := TSpTBXColorEditPopupMenu.Create(nil); +end; + +procedure FinalizeStock; +begin + FreeAndNil(FontGlyphImgList); + FreeAndNil(DefaultColorPickerDropDownMenu); +end; + +initialization + InitializeStock; + +finalization + FinalizeStock; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.dcu new file mode 100644 index 0000000..f425177 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.hpp new file mode 100644 index 0000000..cb420f8 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.hpp @@ -0,0 +1,275 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxformpopupmenu.pas' rev: 20.00 + +#ifndef SptbxformpopupmenuHPP +#define SptbxformpopupmenuHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxformpopupmenu +{ +//-- type declarations ------------------------------------------------------- +#pragma option push -b- +enum TSpTBXPopupAnimationType { patNone, patSlide, patFade }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXPopupBorderStyleType { pbsFrame, pbsSizeable, pbsSizeableBottom, pbsSizeableRightBottom }; +#pragma option pop + +struct TSpTBXPopupFormState +{ + +public: + Forms::TCustomForm* PopupForm; + Forms::TFormBorderStyle BorderStyle; + Types::TRect BoundsRect; +}; + + +typedef void __fastcall (__closure *TSpTBXRollDownEvent)(System::TObject* Sender, int &FormWidth, int &FormHeight); + +typedef void __fastcall (__closure *TSpTBXRollUpEvent)(System::TObject* Sender, bool Selected); + +typedef void __fastcall (__closure *TSpTBXGetFormClassEvent)(System::TObject* Sender, Forms::TCustomFormClass &AFormClass); + +class DELPHICLASS TSpTBXPopupSizeGrip; +class DELPHICLASS TSpTBXCustomWrapperPopupForm; +class PASCALIMPLEMENTATION TSpTBXPopupSizeGrip : public Controls::TWinControl +{ + typedef Controls::TWinControl inherited; + +private: + Sptbxskins::TSpTBXSkinType FSkinType; + Sptbxitem::TSpTBXDrawEvent FOnDrawBackground; + HIDESBASE MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + +protected: + TSpTBXCustomWrapperPopupForm* FPopupForm; + void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + +public: + __fastcall virtual TSpTBXPopupSizeGrip(Classes::TComponent* AOwner); + Types::TRect __fastcall GetGripRect(); + Types::TRect __fastcall GetGripSizerRect(); + bool __fastcall IsScreenPointInGrip(const Types::TPoint &P); + +__published: + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=FSkinType, default=2}; + __property Sptbxitem::TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXPopupSizeGrip(HWND ParentWindow) : Controls::TWinControl(ParentWindow) { } + /* TWinControl.Destroy */ inline __fastcall virtual ~TSpTBXPopupSizeGrip(void) { } + +}; + + +class DELPHICLASS TSpTBXFormPopupMenu; +class PASCALIMPLEMENTATION TSpTBXCustomWrapperPopupForm : public Forms::TCustomForm +{ + typedef Forms::TCustomForm inherited; + +private: + bool FHooksInstalled; + Forms::TMessageEvent FOldAppOnMessage; + Classes::TWndMethod FOldPopupControlWndProc; + bool FShowShadows; + TSpTBXPopupAnimationType FAnimation; + Tb2anim::TTBAnimationDirection FAnimationDirection; + TSpTBXPopupBorderStyleType FBorderStyle; + Classes::TNotifyEvent FOnRollDown; + TSpTBXRollUpEvent FOnRollUp; + HIDESBASE void __fastcall SetBorderStyle(const TSpTBXPopupBorderStyleType Value); + void __fastcall InstallHooks(void); + void __fastcall UninstallHooks(void); + HIDESBASE MESSAGE void __fastcall CMChildKey(Controls::TCMChildKey &Message); + MESSAGE void __fastcall CMCancelMode(Controls::TCMCancelMode &Message); + HIDESBASE MESSAGE void __fastcall WMActivate(Messages::TWMActivate &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + HIDESBASE MESSAGE void __fastcall WMNCCalcSize(Messages::TWMNCCalcSize &Message); + HIDESBASE MESSAGE void __fastcall WMNCHitTest(Messages::TWMNCHitTest &Message); + HIDESBASE MESSAGE void __fastcall WMNCPaint(Messages::TMessage &Message); + MESSAGE void __fastcall WMPrint(Messages::TMessage &Message); + MESSAGE void __fastcall WMSpTBXPopupInvalidate(Messages::TMessage &Message); + MESSAGE void __fastcall WMSpTBXPopupRollUp(Messages::TMessage &Message); + +protected: + Controls::TControl* FPopupControl; + TSpTBXFormPopupMenu* FFormPopupMenu; + bool FPaintingClientArea; + TSpTBXPopupSizeGrip* FSizeGrip; + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual void __fastcall PaintBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect) = 0 ; + TSpTBXPopupAnimationType __fastcall GetSysAnimation(void); + virtual void __fastcall AppOnMessageHook(tagMSG &Msg, bool &Handled); + virtual void __fastcall PopupControlWindowProc(Messages::TMessage &Message); + virtual void __fastcall DoRollDown(void); + virtual void __fastcall DoRollUp(bool Selected); + __property TSpTBXPopupAnimationType Animation = {read=FAnimation, write=FAnimation, nodefault}; + __property Tb2anim::TTBAnimationDirection AnimationDirection = {read=FAnimationDirection, write=FAnimationDirection, default=0}; + __property TSpTBXPopupBorderStyleType BorderStyle = {read=FBorderStyle, write=SetBorderStyle, default=0}; + __property bool ShowShadows = {read=FShowShadows, write=FShowShadows, default=1}; + __property Classes::TNotifyEvent OnRollDown = {read=FOnRollDown, write=FOnRollDown}; + __property TSpTBXRollUpEvent OnRollUp = {read=FOnRollUp, write=FOnRollUp}; + +public: + __fastcall virtual TSpTBXCustomWrapperPopupForm(TSpTBXFormPopupMenu* AFormPopupMenu); + __fastcall virtual ~TSpTBXCustomWrapperPopupForm(void); + virtual void __fastcall RollDown(int X, int Y, int AWidth, int AHeight, bool FocusPopup = true)/* overload */; + virtual void __fastcall RollDown(Controls::TControl* APopupControl, int AWidth, int AHeight, bool IsVertical = false, bool FocusPopup = true)/* overload */; + virtual void __fastcall RollUp(bool Selected, bool FocusParentControl = true); + __property TSpTBXFormPopupMenu* FormPopupMenu = {read=FFormPopupMenu}; +public: + /* TCustomForm.CreateNew */ inline __fastcall virtual TSpTBXCustomWrapperPopupForm(Classes::TComponent* AOwner, int Dummy) : Forms::TCustomForm(AOwner, Dummy) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomWrapperPopupForm(HWND ParentWindow) : Forms::TCustomForm(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXWrapperPopupForm; +class PASCALIMPLEMENTATION TSpTBXWrapperPopupForm : public TSpTBXCustomWrapperPopupForm +{ + typedef TSpTBXCustomWrapperPopupForm inherited; + +private: + Sptbxskins::TSpTBXSkinType FSkinType; + HIDESBASE MESSAGE void __fastcall CMShowingChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + +protected: + virtual void __fastcall DestroyWindowHandle(void); + virtual void __fastcall PaintBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + +public: + __fastcall virtual TSpTBXWrapperPopupForm(TSpTBXFormPopupMenu* AFormPopupMenu); + __fastcall virtual ~TSpTBXWrapperPopupForm(void); + +__published: + __property Height; + __property Width; + __property BorderStyle = {default=0}; + __property ShowShadows = {default=1}; + __property OnRollDown; + __property OnRollUp; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; +public: + /* TCustomForm.CreateNew */ inline __fastcall virtual TSpTBXWrapperPopupForm(Classes::TComponent* AOwner, int Dummy) : TSpTBXCustomWrapperPopupForm(AOwner, Dummy) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXWrapperPopupForm(HWND ParentWindow) : TSpTBXCustomWrapperPopupForm(ParentWindow) { } + +}; + + +class PASCALIMPLEMENTATION TSpTBXFormPopupMenu : public Menus::TPopupMenu +{ + typedef Menus::TPopupMenu inherited; + +private: + Sptbxskins::TSpTBXSkinType FSkinType; + Classes::TList* FNotifies; + bool FItems; + bool FPopupFocus; + TSpTBXPopupFormState FPopupFormState; + TSpTBXRollUpEvent FClosePopup; + TSpTBXRollUpEvent FOnBeforeClosePopup; + TSpTBXRollDownEvent FOnBeforePopup; + TSpTBXGetFormClassEvent FOnGetPopupFormClass; + TSpTBXPopupBorderStyleType __fastcall GetBorderStyle(void); + bool __fastcall GetShowShadows(void); + void __fastcall SetBorderStyle(const TSpTBXPopupBorderStyleType Value); + void __fastcall SetShowShadows(const bool Value); + void __fastcall SetPopupForm(const Forms::TCustomForm* Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + +protected: + Forms::TCustomForm* FPopupForm; + TSpTBXWrapperPopupForm* FWrapperForm; + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + void __fastcall BroadcastCloseMessage(bool Selected); + virtual void __fastcall DoGetPopupFormClass(Forms::TCustomFormClass &AFormClass); + virtual bool __fastcall InternalPopup(int X, int Y, bool ForceFocus, Controls::TControl* PopupControl = (Controls::TControl*)(0x0)); + virtual void __fastcall InternalClosePopup(System::TObject* Sender, bool Selected); + +public: + __fastcall virtual TSpTBXFormPopupMenu(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXFormPopupMenu(void); + virtual void __fastcall Popup(int X, int Y); + void __fastcall PopupEx(int X, int Y, bool ForceFocus)/* overload */; + void __fastcall PopupEx(Controls::TControl* PopupControl, bool ForceFocus)/* overload */; + void __fastcall AddCloseNotification(System::TObject* AObject); + void __fastcall RemoveCloseNotification(System::TObject* AObject); + void __fastcall ClosePopup(bool Selected); + __property Forms::TCustomForm* PopupForm = {read=FPopupForm, write=SetPopupForm}; + +__published: + __property bool Items = {read=FItems, nodefault}; + __property TSpTBXPopupBorderStyleType BorderStyle = {read=GetBorderStyle, write=SetBorderStyle, default=0}; + __property bool PopupFocus = {read=FPopupFocus, write=FPopupFocus, default=0}; + __property bool ShowShadows = {read=GetShowShadows, write=SetShowShadows, default=1}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; + __property TSpTBXRollUpEvent OnClosePopup = {read=FClosePopup, write=FClosePopup}; + __property TSpTBXRollUpEvent OnBeforeClosePopup = {read=FOnBeforeClosePopup, write=FOnBeforeClosePopup}; + __property TSpTBXRollDownEvent OnBeforePopup = {read=FOnBeforePopup, write=FOnBeforePopup}; + __property TSpTBXGetFormClassEvent OnGetPopupFormClass = {read=FOnGetPopupFormClass, write=FOnGetPopupFormClass}; +private: + void *__ISpTBXPopupMenu; /* Sptbxitem::ISpTBXPopupMenu */ + +public: + #if defined(MANAGED_INTERFACE_OPERATORS) + operator Sptbxitem::_di_ISpTBXPopupMenu() + { + Sptbxitem::_di_ISpTBXPopupMenu intf; + GetInterface(intf); + return intf; + } + #else + operator ISpTBXPopupMenu*(void) { return (ISpTBXPopupMenu*)&__ISpTBXPopupMenu; } + #endif + +}; + + +//-- var, const, procedure --------------------------------------------------- +static const Word WM_SPTBX_POPUPINVALIDATE = 0x777; +static const Word WM_SPTBX_POPUPROLLUP = 0x778; +extern PACKAGE TSpTBXFormPopupMenu* ActiveFormPopupMenu; + +} /* namespace Sptbxformpopupmenu */ +using namespace Sptbxformpopupmenu; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxformpopupmenuHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.pas new file mode 100644 index 0000000..9bf524d --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXFormPopupMenu.pas @@ -0,0 +1,1172 @@ +unit SpTBXFormPopupMenu; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +History: +8 May 2009 - version 2.4.2 + - No changes. + +15 March 2009 - version 2.4.1 + - No changes. + +17 January 2009 - version 2.4 + - Fixed incorrect focus handling on TSpTBXFormPopupMenu, + when a dialog is showed on top of a TSpTBXFormPopupMenu and + the app is deactivated the Popup is closed but the dialog + stays, thanks to Sertac Akyuz for reporting this. + +26 September 2008 - version 2.3 + - No changes. + +29 July 2008 - version 2.2 + - No changes. + +26 June 2008 - version 2.1 + - No changes. + +3 May 2008 - version 2.0 + - No changes. + +2 April 2008 - version 1.9.5 + - No changes. + +3 February 2008 - version 1.9.4 + - No changes. + +19 January 2008 - version 1.9.3 + - No changes. + +26 December 2007 - version 1.9.2 + - Fixed incorrect focus handling on TSpTBXFormPopupMenu, + thanks to Costas Stergiou for reporting this. + +1 December 2007 - version 1.9.1 + - Removed TBX dependency. + +20 November 2007 - version 1.9 + - Removed TBX dependency. + +8 February 2007 - version 1.8.3 + - No changes. + +17 December 2006 - version 1.8.2 + - No changes. + +24 November 2006 - version 1.8.1 + - Fixed TSpTBXFormPopupMenu resizing flicker. + +27 August 2006 - version 1.8 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation +{$I TB2Ver.inc} + +uses + Windows, Messages, Classes, SysUtils, Controls, Graphics, ImgList, Forms, + Menus, StdCtrls, TB2Item, TB2Anim, SpTBXSkins, SpTBXItem; + +const + WM_SPTBX_POPUPINVALIDATE = WM_USER + 887; + WM_SPTBX_POPUPROLLUP = WM_USER + 888; + +type + TSpTBXFormPopupMenu = class; + TSpTBXCustomWrapperPopupForm = class; + + TSpTBXPopupAnimationType = ( + patNone, + patSlide, + patFade + ); + + TSpTBXPopupBorderStyleType = ( + pbsFrame, + pbsSizeable, + pbsSizeableBottom, + pbsSizeableRightBottom + ); + + TSpTBXPopupFormState = record + PopupForm: TCustomForm; + BorderStyle: TFormBorderStyle; + BoundsRect: TRect; + end; + + TSpTBXRollDownEvent = procedure(Sender: TObject; var FormWidth, FormHeight: Integer) of object; + TSpTBXRollUpEvent = procedure(Sender: TObject; Selected: Boolean) of object; + TSpTBXGetFormClassEvent = procedure(Sender: TObject; var AFormClass: TCustomFormClass) of object; + + { TSpTBXPopupSizeGrip } + + TSpTBXPopupSizeGrip = class(TWinControl) + private + FSkinType: TSpTBXSkinType; + FOnDrawBackground: TSpTBXDrawEvent; + procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + protected + FPopupForm: TSpTBXCustomWrapperPopupForm; + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer); override; + public + constructor Create(AOwner: TComponent); override; + function GetGripRect: TRect; + function GetGripSizerRect: TRect; + function IsScreenPointInGrip(P: TPoint): Boolean; + published + property SkinType: TSpTBXSkinType read FSkinType write FSkinType default sknSkin; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + end; + + { TSpTBXWrapperPopupForm } + + TSpTBXCustomWrapperPopupForm = class(TCustomForm) + private + FHooksInstalled: Boolean; + FOldAppOnMessage: TMessageEvent; + FOldPopupControlWndProc: TWndMethod; + FShowShadows: Boolean; + FAnimation: TSpTBXPopupAnimationType; + FAnimationDirection: TTBAnimationDirection; + FBorderStyle: TSpTBXPopupBorderStyleType; + FOnRollDown: TNotifyEvent; + FOnRollUp: TSpTBXRollUpEvent; + procedure SetBorderStyle(const Value: TSpTBXPopupBorderStyleType); + procedure InstallHooks; + procedure UninstallHooks; + procedure CMChildKey(var Message: TCMChildKey); message CM_CHILDKEY; + procedure CMCancelMode(var Message: TCMCancelMode); message CM_CANCELMODE; + procedure WMActivate(var Message: TWMActivate); message WM_ACTIVATE; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE; + procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; + procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT; + procedure WMPrint(var Message: TMessage); message WM_PRINT; + procedure WMSpTBXPopupInvalidate(var Message: TMessage); message WM_SPTBX_POPUPINVALIDATE; + procedure WMSpTBXPopupRollUp(var Message: TMessage); message WM_SPTBX_POPUPROLLUP; + protected + FPopupControl: TControl; + FFormPopupMenu: TSpTBXFormPopupMenu; + FPaintingClientArea: Boolean; + FSizeGrip: TSpTBXPopupSizeGrip; + procedure CreateParams(var Params: TCreateParams); override; + procedure PaintBackground(ACanvas: TCanvas; ARect: TRect); virtual; abstract; + function GetSysAnimation: TSpTBXPopupAnimationType; + procedure AppOnMessageHook(var Msg: TMsg; var Handled: Boolean); virtual; + procedure PopupControlWindowProc(var Message: TMessage); virtual; + procedure DoRollDown; virtual; + procedure DoRollUp(Selected: Boolean); virtual; + property Animation: TSpTBXPopupAnimationType read FAnimation write FAnimation; + property AnimationDirection: TTBAnimationDirection read FAnimationDirection write FAnimationDirection default []; + property BorderStyle: TSpTBXPopupBorderStyleType read FBorderStyle write SetBorderStyle default pbsFrame; + property ShowShadows: Boolean read FShowShadows write FShowShadows default True; + property OnRollDown: TNotifyEvent read FOnRollDown write FOnRollDown; + property OnRollUp: TSpTBXRollUpEvent read FOnRollUp write FOnRollUp; + public + constructor Create(AFormPopupMenu: TSpTBXFormPopupMenu); reintroduce; virtual; + destructor Destroy; override; + procedure RollDown(X, Y, AWidth, AHeight: Integer; FocusPopup: Boolean = True); overload; virtual; + procedure RollDown(APopupControl: TControl; AWidth, AHeight: Integer; IsVertical: Boolean = False; FocusPopup: Boolean = True); overload; virtual; + procedure RollUp(Selected: Boolean; FocusParentControl: Boolean = True); virtual; + property FormPopupMenu: TSpTBXFormPopupMenu read FFormPopupMenu; + end; + + TSpTBXWrapperPopupForm = class(TSpTBXCustomWrapperPopupForm) + private + FSkinType: TSpTBXSkinType; + procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure SetSkinType(const Value: TSpTBXSkinType); + protected + procedure DestroyWindowHandle; override; + procedure PaintBackground(ACanvas: TCanvas; ARect: TRect); override; + public + constructor Create(AFormPopupMenu: TSpTBXFormPopupMenu); override; + destructor Destroy; override; + published + property Height; + property Width; + property BorderStyle; + property ShowShadows; + property OnRollDown; + property OnRollUp; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + end; + + { TSpTBXFormPopupMenu } + + TSpTBXFormPopupMenu = class(TPopupMenu, ISpTBXPopupMenu) + private + FSkinType: TSpTBXSkinType; + FNotifies: TList; + FItems: Boolean; + FPopupFocus: Boolean; + FPopupFormState: TSpTBXPopupFormState; + FClosePopup: TSpTBXRollUpEvent; + FOnBeforeClosePopup: TSpTBXRollUpEvent; + FOnBeforePopup: TSpTBXRollDownEvent; + FOnGetPopupFormClass: TSpTBXGetFormClassEvent; + function GetBorderStyle: TSpTBXPopupBorderStyleType; + function GetShowShadows: Boolean; + procedure SetBorderStyle(const Value: TSpTBXPopupBorderStyleType); + procedure SetShowShadows(const Value: Boolean); + procedure SetPopupForm(const Value: TCustomForm); + procedure SetSkinType(const Value: TSpTBXSkinType); + protected + FPopupForm: TCustomForm; + FWrapperForm: TSpTBXWrapperPopupForm; // Container of FPopupForm + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure BroadcastCloseMessage(Selected: Boolean); + procedure DoGetPopupFormClass(var AFormClass: TCustomFormClass); virtual; + function InternalPopup(X, Y: Integer; ForceFocus: Boolean; PopupControl: TControl = nil): Boolean; virtual; + procedure InternalClosePopup(Sender: TObject; Selected: Boolean); virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Popup(X: Integer; Y: Integer); override; + procedure PopupEx(X, Y: Integer; ForceFocus: Boolean); overload; + procedure PopupEx(PopupControl: TControl; ForceFocus: Boolean); overload; + procedure AddCloseNotification(AObject: TObject); + procedure RemoveCloseNotification(AObject: TObject); + procedure ClosePopup(Selected: Boolean); + property PopupForm: TCustomForm read FPopupForm write SetPopupForm; + published + property Items: Boolean read FItems; // Hide the Items property + property BorderStyle: TSpTBXPopupBorderStyleType read GetBorderStyle write SetBorderStyle default pbsFrame; + property PopupFocus: Boolean read FPopupFocus write FPopupFocus default False; + property ShowShadows: Boolean read GetShowShadows write SetShowShadows default True; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + property OnClosePopup: TSpTBXRollUpEvent read FClosePopup write FClosePopup; + property OnBeforeClosePopup: TSpTBXRollUpEvent read FOnBeforeClosePopup write FOnBeforeClosePopup; + property OnBeforePopup: TSpTBXRollDownEvent read FOnBeforePopup write FOnBeforePopup; + property OnGetPopupFormClass: TSpTBXGetFormClassEvent read FOnGetPopupFormClass write FOnGetPopupFormClass; + end; + +var + ActiveFormPopupMenu: TSpTBXFormPopupMenu = nil; + +implementation + +uses + Themes, UxTheme, Types, TB2Common, TB2Acc; + +const + DefaultBorderSize = 2; + +type + TCustomFormAccess = class(TCustomForm); + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXPopupSizeGrip } + +constructor TSpTBXPopupSizeGrip.Create(AOwner: TComponent); +begin + inherited; + if Assigned(AOwner) and (AOwner is TSpTBXCustomWrapperPopupForm) then + FPopupForm := AOwner as TSpTBXCustomWrapperPopupForm; + FSkinType := sknSkin; + Align := alBottom; + Height := 10; +end; + +procedure TSpTBXPopupSizeGrip.DoDrawBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, PaintStage, PaintDefault); +end; + +function TSpTBXPopupSizeGrip.GetGripRect: TRect; +begin + // Return the rect of the area that is sizeable. + // If BorderStyle = pbsSizeableRightBottom the sizeable area is the + // bottom right corner, when BorderStyle = pbsSizeableRightBottom the + // sizeable area is the client rect of the SizeGrip + Result := Rect(0, 0, 0, 0); + if not (csDestroying in ComponentState) and Assigned(FPopupForm) and + (FPopupForm.FBorderStyle in [pbsSizeableBottom, pbsSizeableRightBottom]) then + begin + Result := ClientRect; + if FPopupForm.BorderStyle = pbsSizeableRightBottom then + Result := GetGripSizerRect + else + Result := ClientRect; + end; +end; + +function TSpTBXPopupSizeGrip.GetGripSizerRect: TRect; +begin + // Return the rect of the grip sizer, the area that has the + // dots on the sizer. + Result := Rect(0, 0, 0, 0); + if not (csDestroying in ComponentState) and Assigned(FPopupForm) then begin + case FPopupForm.BorderStyle of + pbsSizeableBottom: + begin + Result := ClientRect; + Result.Left := (Result.Right + Result.Left - 20) div 2; + Result.Right := Result.Left + 20; + end; + pbsSizeableRightBottom: + begin + Result := ClientRect; + Result.Left := Result.Right - 14; + end; + end; + end; +end; + +function TSpTBXPopupSizeGrip.IsScreenPointInGrip(P: TPoint): Boolean; +var + GR: TRect; +begin + Result := False; + P := ScreenToClient(P); + GR := GetGripRect; + if not IsRectEmpty(GR) and PtInRect(GR, P) then + Result := True; +end; + +procedure TSpTBXPopupSizeGrip.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + P: TPoint; +const + SC_SizeDown = $F006; + SC_SizeDownRight = $F008; +begin + // Resize the StatusBar if the parent is TSpTBXTitleBar + if not (csDesigning in ComponentState) and (Button = mbLeft) and Assigned(FPopupForm) then begin + P := ClientToScreen(Point(X, Y)); + if IsScreenPointInGrip(P) then begin + ReleaseCapture; + case FPopupForm.BorderStyle of + pbsSizeableBottom: + SendMessage(FPopupForm.Handle, WM_SYSCOMMAND, SC_SizeDown, 0); + pbsSizeableRightBottom: + SendMessage(FPopupForm.Handle, WM_SYSCOMMAND, SC_SizeDownRight, 0); + end; + Exit; + end; + end; + + inherited; +end; + +procedure TSpTBXPopupSizeGrip.WMEraseBkgnd(var Message: TWMEraseBkgnd); +var + ACanvas: TCanvas; + PaintDefault: Boolean; + R, GR, CellR: TRect; + C1, C2: TColor; + T: TSpTBXSkinType; +begin + Message.Result := 1; + if (csDestroying in ComponentState) then Exit; + + ACanvas := TCanvas.Create; + ACanvas.Handle := Message.DC; + try + R := ClientRect; + T := SpTBXSkinType(FSkinType); + + // Draw the background + PaintDefault := True; + DoDrawBackground(ACanvas, R, pstPrePaint, PaintDefault); + if PaintDefault then begin + GR := Rect(0, 0, 0, 0); + SpDrawXPStatusBar(ACanvas, R, GR, T, False); + end; + + // Draw the grip + PaintDefault := True; + DoDrawBackground(ACanvas, R, pstPostPaint, PaintDefault); + if PaintDefault then begin + C1 := SkinManager.CurrentSkin.Options(skncStatusBarGrip).Body.Color1; + if (C1 = clNone) or (T <> sknSkin) then C1 := clBtnShadow; + C2 := SkinManager.CurrentSkin.Options(skncStatusBarGrip).Body.Color2; + if (C2 = clNone) or (T <> sknSkin) then C2 := clBtnHighlight; + // Grip cells are 4x4 pixels + case FPopupForm.BorderStyle of + pbsSizeableBottom: + begin + GR := GetGripSizerRect; + CellR := GR; + CellR.Top := (CellR.Top + CellR.Bottom - 4) div 2 + 1; + CellR.Bottom := CellR.Top + 3; + SpDrawXPGrip(ACanvas, CellR, C1, C2); + end; + pbsSizeableRightBottom: + begin + GR := GetGripSizerRect; + CellR := GR; + // Draw 2 cells at the bottom + CellR.Left := GR.Right - 8; + CellR.Top := CellR.Bottom - 4; + SpDrawXPGrip(ACanvas, CellR, C1, C2); + // Draw 1 cell at the top + CellR.Bottom := CellR.Top; + CellR.Top := CellR.Bottom - 4; + CellR.Left := CellR.Left + 4; + SpDrawXPGrip(ACanvas, CellR, C1, C2); + end; + end; + end; + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; +end; + +procedure TSpTBXPopupSizeGrip.WMSetCursor(var Message: TWMSetCursor); +var + P: TPoint; +begin + if not (csDesigning in ComponentState) and (Message.CursorWnd = Handle) and + (Screen.Cursor = crDefault) and Assigned(FPopupForm) then + begin + GetCursorPos(P); + if IsScreenPointInGrip(P) then begin + case FPopupForm.BorderStyle of + pbsSizeableBottom: + Windows.SetCursor(Screen.Cursors[-7]); + pbsSizeableRightBottom: + Windows.SetCursor(Screen.Cursors[-8]); + end; + Message.Result := 1; + Exit; + end; + end; + + inherited; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomWrapperPopupForm } + +constructor TSpTBXCustomWrapperPopupForm.Create(AFormPopupMenu: TSpTBXFormPopupMenu); +begin + // Form doesn't have DFM info + inherited CreateNew(nil); + + Visible := False; + SetBounds(0, 0, 0, 0); + FFormPopupMenu := AFormPopupMenu; + FAnimation := GetSysAnimation; + FAnimationDirection := []; + FShowShadows := True; + FSizeGrip := TSpTBXPopupSizeGrip.Create(Self); + FSizeGrip.Parent := Self; +end; + +procedure TSpTBXCustomWrapperPopupForm.CreateParams(var Params: TCreateParams); +begin + inherited; + if not (csDesigning in ComponentState) then + with Params do begin + Style := WS_POPUP or WS_CLIPCHILDREN; + + // Add the thickframe on all the BorderStyles + // We should handle the NC HitTest + Style := Style or WS_THICKFRAME; + + ExStyle := WS_EX_TOPMOST or WS_EX_TOOLWINDOW; + WindowClass.Style := WindowClass.Style or CS_SAVEBITS; + if IsWindowsXP then + WindowClass.Style := WindowClass.Style or CS_DROPSHADOW; + end; +end; + +destructor TSpTBXCustomWrapperPopupForm.Destroy; +begin + FreeAndNil(FSizeGrip); + inherited; +end; + +procedure TSpTBXCustomWrapperPopupForm.DoRollDown; +begin + if Assigned(FOnRollDown) then FOnRollDown(Self); +end; + +procedure TSpTBXCustomWrapperPopupForm.DoRollUp(Selected: Boolean); +begin + if Assigned(FOnRollUp) then FOnRollUp(Self, Selected); +end; + +function TSpTBXCustomWrapperPopupForm.GetSysAnimation: TSpTBXPopupAnimationType; +const + SPI_GETMENUFADE = $1012; +var + Animate: BOOL; +begin + Result := patNone; + if SystemParametersInfo(SPI_GETMENUANIMATION, 0, @Animate, 0) and Animate then + if SystemParametersInfo(SPI_GETMENUFADE, 0, @Animate, 0) and Animate then + Result := patFade + else + Result := patSlide; +end; + +procedure TSpTBXCustomWrapperPopupForm.RollDown(X, Y, AWidth, + AHeight: Integer; FocusPopup: Boolean = True); +begin + if not Visible then begin + ActiveFormPopupMenu := FFormPopupMenu; // Set global variable used by RollUp + // If FPopupControl is nil we should use the ActiveForm to set focus on RollUp + if not Assigned(FPopupControl) then + FPopupControl := Screen.ActiveForm; + // Increase the size of the form if the size grip is visible + if FBorderStyle in [pbsSizeableBottom, pbsSizeableRightBottom] then begin + FSizeGrip.Visible := True; + AHeight := AHeight + FSizeGrip.Height; + end + else + FSizeGrip.Visible := False; + + InstallHooks; + HandleNeeded; // We need the handle to set the Bounds and deactivate Vista form thick borders + SetBounds(X, Y, AWidth, AHeight); + SpActivateDwmNC(Self, False); + // Make sure it will be showed on top of all the forms/dialogs + SetWindowPos(WindowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE); + Visible := True; + if FocusPopup then + SetFocus; + DoRollDown; + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.RollDown(APopupControl: TControl; + AWidth, AHeight: Integer; IsVertical: Boolean = False; + FocusPopup: Boolean = True); +var + P, Size: TPoint; +begin + if Assigned(APopupControl) and Assigned(APopupControl.Parent) then begin + FPopupControl := APopupControl; + // Increase the size of the form if the size grip is visible + Size.X := AWidth; + Size.Y := AHeight; + if FBorderStyle in [pbsSizeableBottom, pbsSizeableRightBottom] then + Size.Y := Size.Y + FSizeGrip.Height; + + P := SpCalcPopupPosition(0, 0, Size.X, Size.Y, APopupControl, IsVertical); + RollDown(P.X, P.Y, AWidth, AHeight, FocusPopup); + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.RollUp(Selected: Boolean; FocusParentControl: Boolean = True); +var + W: TWinControl; + Msg: TMessage; +begin + // Instead of checking for Self.Visible check if the actual wrapped form + // is visible. + if FFormPopupMenu.PopupForm.Visible then begin + UninstallHooks; + + if Assigned(FPopupControl) and (FPopupControl is TWinControl) then begin + W := FPopupControl as TWinControl; + if FocusParentControl and W.CanFocus then + W.SetFocus; + // Send a message to the PopupControl and it's children controls + // to inform that the Popup was closed. + Msg.Msg := CM_SPPOPUPCLOSE; + Msg.WParam := Integer(Self); + if Selected then + Msg.LParam := 1 + else + Msg.LParam := 0; + Msg.Result := 0; + PostMessage(W.Handle, Msg.Msg, Msg.WParam, Msg.LParam); + W.Broadcast(Msg); + end; + + Visible := False; + + // Broadcast the close message to all the notifies + if Assigned(ActiveFormPopupMenu) then + ActiveFormPopupMenu.BroadcastCloseMessage(Selected); + ActiveFormPopupMenu := nil; // Reset global variable + FPopupControl := nil; + DoRollUp(Selected); + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.SetBorderStyle(const Value: TSpTBXPopupBorderStyleType); +begin + if FBorderStyle <> Value then + FBorderStyle := Value; +end; + +procedure TSpTBXCustomWrapperPopupForm.InstallHooks; +begin + if not FHooksInstalled then begin + FHooksInstalled := True; + + // Needed to handle main form mouse clicks when the popup is visible + FOldAppOnMessage := Application.OnMessage; + Application.OnMessage := AppOnMessageHook; + + if Assigned(FPopupControl) then begin + // Needed to handle focus changes when the popup is visible but the + // ParentControl has the focus, like the Comboboxes + FOldPopupControlWndProc := FPopupControl.WindowProc; + FPopupControl.WindowProc := PopupControlWindowProc; + end; + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.UninstallHooks; +begin + if FHooksInstalled then begin + FHooksInstalled := False; + + Application.OnMessage := FOldAppOnMessage; + FOldAppOnMessage := nil; + + if Assigned(FPopupControl) then begin + FPopupControl.WindowProc := FOldPopupControlWndProc; + FOldPopupControlWndProc := nil; + end; + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.AppOnMessageHook(var Msg: TMsg; var Handled: Boolean); +begin + if Assigned(FOldAppOnMessage) then FOldAppOnMessage(Msg, Handled); + + if not IsWindowEnabled(Handle) then begin + Handled := False; + Exit; + end; + + case Msg.message of + CM_DEACTIVATE: + begin + // Rollup when the popup is deactivated + // Instead of calling Rollup post a message so the + // Application.OnMessage is processed before + // the popup is closed, this is needed to handle + // the mouse clicks on the main form + PostMessage(Handle, WM_SPTBX_POPUPROLLUP, 0, 0); // Set FocusParentControl param to False + end; + WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN: + // If the click was not on the popup, rollup and Handle the message + if (GetCapture = 0) and (Msg.hwnd <> Handle) and not Windows.IsChild(Handle, Msg.hwnd) then + if Assigned(FPopupControl) and not (FPopupControl is TCustomForm) and (FPopupControl is TWinControl) then begin + if (Msg.hwnd <> TWinControl(FPopupControl).Handle) and not Windows.IsChild(TWinControl(FPopupControl).Handle, Msg.hwnd) then begin + Handled := True; + RollUp(False); + end; + end + else begin + Handled := True; + RollUp(False); + end; + WM_NCLBUTTONDOWN..WM_NCMBUTTONDBLCLK: + // If the click was not on the popup, rollup and Handle the message + if (Msg.hwnd <> Handle) and not Windows.IsChild(Handle, Msg.hwnd) then begin + Handled := True; + RollUp(False); + end; + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.PopupControlWindowProc(var Message: TMessage); +begin + if Assigned(FOldPopupControlWndProc) then FOldPopupControlWndProc(Message); + + if Visible then + case Message.Msg of + CM_FOCUSCHANGED: + // Rollup when the popup is deactivated + // Instead of calling Rollup post a message so the + // Application.OnMessage is processed before + // the popup is closed, this is needed to handle + // the focus change on the main form + PostMessage(Handle, WM_SPTBX_POPUPROLLUP, 0, 0); // Set FocusParentControl param to False + CM_CHILDKEY: + if Message.WParam = VK_ESCAPE then + RollUp(False); +// CM_CANCELMODE: +// RollUp(False); + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.CMCancelMode(var Message: TCMCancelMode); +begin + inherited; + RollUp(False); +end; + +procedure TSpTBXCustomWrapperPopupForm.CMChildKey(var Message: TCMChildKey); +begin + inherited; + if Message.CharCode = VK_ESCAPE then + RollUp(False); +end; + +procedure TSpTBXCustomWrapperPopupForm.WMActivate(var Message: TWMActivate); +begin + inherited; + if Message.Active = WA_INACTIVE then begin + // Rollup when the popup is deactivated + // Instead of calling Rollup post a message so the + // Application.OnMessage is processed before + // the popup is closed, this is needed to handle + // the mouse clicks on the main form +// PostMessage(Handle, WM_SPTBX_POPUPROLLUP, 0, 1); + end + else begin + // When the popup is activated redraw the caption bar of the Main Form + // And invalidate the client and non client area + SendMessage(Message.ActiveWindow, WM_NCACTIVATE, 1, 0); + PostMessage(Handle, WM_SPTBX_POPUPINVALIDATE, 0, 0); // Post the invalidate message to avoid flicker + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.WMNCCalcSize(var Message: TWMNCCalcSize); +begin + Message.Result := 0; + InflateRect(Message.CalcSize_Params^.rgrc[0], -DefaultBorderSize, -DefaultBorderSize); +end; + +procedure TSpTBXCustomWrapperPopupForm.WMNCHitTest(var Message: TWMNCHitTest); +var + P: TPoint; + GR: TRect; + HitOnBorder: Boolean; +begin + inherited; + + HitOnBorder := Message.Result in [HTLEFT, HTTOP, HTTOPLEFT, HTTOPRIGHT, HTRIGHT, HTBOTTOM, HTBOTTOMLEFT, HTBOTTOMRIGHT]; + + if HitOnBorder then + case FBorderStyle of + pbsFrame: + Message.Result := HTNOWHERE; + pbsSizeableBottom: + begin + // Make the NC area resizeable + Message.Result := HTNOWHERE; + P := FSizeGrip.ScreenToClient(SmallPointToPoint(Message.Pos)); + GR := FSizeGrip.GetGripRect; + if P.Y >= GR.Top then + Message.Result := HTBOTTOM; + end; + pbsSizeableRightBottom: + begin + // Make the NC area resizeable + Message.Result := HTNOWHERE; + P := FSizeGrip.ScreenToClient(SmallPointToPoint(Message.Pos)); + GR := FSizeGrip.GetGripRect; + if P.Y >= GR.Top then + if P.X >= GR.Left then + Message.Result := HTBOTTOMRIGHT; + end; + end; +end; + +procedure PopupWindowNCPaintProc(Wnd: HWND; DC: HDC; AppData: TObject); +// Paints the NC area and the client background, used by WMEraseBkgnd, WMNCPaint, WMPrint +var + ACanvas: TCanvas; + R: TRect; + PopupWindow: TSpTBXCustomWrapperPopupForm; +begin + ACanvas := TCanvas.Create; + try + ACanvas.Handle := DC; + GetWindowRect(Wnd, R); + OffsetRect(R, -R.Left, -R.Top); + + // If it's used by WM_ERASEBKGND offset the rect + PopupWindow := TSpTBXCustomWrapperPopupForm(AppData); + if PopupWindow.FPaintingClientArea then begin + PopupWindow.FPaintingClientArea := False; + OffsetRect(R, -DefaultBorderSize, -DefaultBorderSize); + end; + + PopupWindow.PaintBackground(ACanvas, R); + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.WMEraseBkgnd(var Message: TWMEraseBkgnd); +begin + // There's no need to call PopupWindowNCPaintProc here, because the + // ClientArea is filled with the child Form + Message.Result := 1; +end; + +procedure TSpTBXCustomWrapperPopupForm.WMNCPaint(var Message: TMessage); +var + DC: HDC; +begin + DC := GetWindowDC(Handle); + try + FPaintingClientArea := False; + SelectNCUpdateRgn(Handle, DC, HRGN(Message.WParam)); + PopupWindowNCPaintProc(Handle, DC, Self); + finally + ReleaseDC(Handle, DC); + end; +end; + +procedure TSpTBXCustomWrapperPopupForm.WMPrint(var Message: TMessage); +begin + FPaintingClientArea := False; + HandleWMPrint(Handle, Message, PopupWindowNCPaintProc, Self); +end; + +procedure TSpTBXCustomWrapperPopupForm.WMSpTBXPopupInvalidate(var Message: TMessage); +begin + if HandleAllocated then + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); +end; + +procedure TSpTBXCustomWrapperPopupForm.WMSpTBXPopupRollUp(var Message: TMessage); +var + Selected, FocusParentControl: Boolean; +begin + Selected := Message.WParam <> 0; + FocusParentControl := Message.LParam <> 0; + RollUp(Selected, FocusParentControl); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXWrapperPopupForm } + +constructor TSpTBXWrapperPopupForm.Create(AFormPopupMenu: TSpTBXFormPopupMenu); +begin + inherited; + FSkinType := sknSkin; +end; + +destructor TSpTBXWrapperPopupForm.Destroy; +begin + Destroying; + if HandleAllocated then + DestroyWindowHandle; + inherited; +end; + +procedure TSpTBXWrapperPopupForm.DestroyWindowHandle; +begin + { Cleanly destroy any timers before the window handle is destroyed } + CallNotifyWinEvent(EVENT_SYSTEM_MENUPOPUPEND, WindowHandle, OBJID_CLIENT, CHILDID_SELF); + inherited; +end; + +procedure TSpTBXWrapperPopupForm.CMShowingChanged(var Message: TMessage); +const + ShowFlags: array[Boolean] of UINT = ( + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_HIDEWINDOW, + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_SHOWWINDOW); +var + Blend: Boolean; +begin + { Must override TCustomForm/TForm's CM_SHOWINGCHANGED handler so that the + form doesn't get activated when Visible is set to True. } + + { Handle animation } + if Showing and not IsWindowVisible(WindowHandle) and (Animation <> patNone) then + begin + Blend := Animation = patFade; + if Assigned(AnimateWindowProc) and (Blend or (FAnimationDirection <> [])) then begin + AnimateWindowProc(Handle, 150, AW_BLEND); + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN); + Exit; + end; + end; + + { No animation... } + SetWindowPos(WindowHandle, 0, 0, 0, 0, 0, ShowFlags[Showing]); + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN); +end; + +procedure TSpTBXWrapperPopupForm.PaintBackground(ACanvas: TCanvas; ARect: TRect); +begin + SpDrawXPMenuPopupWindow(ACanvas, ARect, Rect(0, 0, 0, 0), False, 0, FSkinType); +end; + +procedure TSpTBXWrapperPopupForm.SetSkinType(const Value: TSpTBXSkinType); +begin + if FSkinType <> Value then begin + FSkinType := Value; + FSizeGrip.SkinType := Value; + end; +end; + +procedure TSpTBXWrapperPopupForm.WMEraseBkgnd(var Message: TWMEraseBkgnd); +begin + Message.Result := 1; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXFormPopupMenu } + +constructor TSpTBXFormPopupMenu.Create(AOwner: TComponent); +begin + inherited; + FSkinType := sknSkin; + FNotifies := TList.Create; + FWrapperForm := TSpTBXWrapperPopupForm.Create(Self); + FWrapperForm.OnRollUp := InternalClosePopup; +end; + +destructor TSpTBXFormPopupMenu.Destroy; +var + FC: TCustomFormClass; +begin + if Assigned(FPopupForm) then + FPopupForm.Parent := nil; + // Free the PopupForm if the OnGetPopupFormClass event returns + // a valid form class. + FC := nil; + DoGetPopupFormClass(FC); + if Assigned(FC) then + FreeAndNil(FPopupForm); + + FreeAndNil(FNotifies); + FreeAndNil(FWrapperForm); + inherited; +end; + +procedure TSpTBXFormPopupMenu.DoGetPopupFormClass(var AFormClass: TCustomFormClass); +begin + if Assigned(FOnGetPopupFormClass) then FOnGetPopupFormClass(Self, AFormClass); +end; + +procedure TSpTBXFormPopupMenu.AddCloseNotification(AObject: TObject); +begin + if Assigned(AObject) then + if FNotifies.IndexOf(AObject) < 0 then FNotifies.Add(AObject); +end; + +procedure TSpTBXFormPopupMenu.RemoveCloseNotification(AObject: TObject); +begin + FNotifies.Remove(AObject); +end; + +procedure TSpTBXFormPopupMenu.BroadcastCloseMessage(Selected: Boolean); +var + Msg: TMessage; + I: Integer; +begin + if FNotifies.Count > 0 then begin + Msg.Msg := CM_SPPOPUPCLOSE; + Msg.WParam := Integer(FWrapperForm); + if Selected then + Msg.LParam := 1 + else + Msg.LParam := 0; + Msg.Result := 0; + for I := 0 to FNotifies.Count - 1 do + TObject(FNotifies[I]).Dispatch(Msg); + end; +end; + +procedure TSpTBXFormPopupMenu.ClosePopup(Selected: Boolean); +begin + // Instead of calling Rollup post a message so the Application.OnMessage is + // processed before the popup is closed, this is needed to handle the mouse + // clicks on the main form. + PostMessage(FWrapperForm.Handle, WM_SPTBX_POPUPROLLUP, Integer(Selected), 1); +end; + +procedure TSpTBXFormPopupMenu.InternalClosePopup(Sender: TObject; Selected: Boolean); +var + FC: TCustomFormClass; +begin + if Assigned(FOnBeforeClosePopup) then FOnBeforeClosePopup(Self, Selected); + + if Assigned(FPopupForm) then begin + FPopupForm.Visible := False; + FPopupForm.Parent := nil; + FPopupForm.Align := alNone; + if FPopupFormState.PopupForm = FPopupForm then begin + FPopupForm.BorderStyle := FPopupFormState.BorderStyle; + FPopupForm.BoundsRect := FPopupFormState.BoundsRect; + end; + end; + + if Assigned(FClosePopup) then FClosePopup(Self, Selected); + + // Free the PopupForm if the OnGetPopupFormClass event returns + // a valid form class. + FC := nil; + DoGetPopupFormClass(FC); + if Assigned(FC) then + FreeAndNil(FPopupForm); +end; + +function TSpTBXFormPopupMenu.InternalPopup(X, Y: Integer; ForceFocus: Boolean; + PopupControl: TControl = nil): Boolean; +var + ClientR: TRect; + FC: TCustomFormClass; +begin + Result := False; + + {$IFDEF JR_D9} + SetPopupPoint(Point(X, Y)); + {$ELSE} + PPoint(@PopupPoint)^ := Point(X, Y); + {$ENDIF} + + // Create the PopupForm if the OnGetPopupFormClass event returns + // a valid form class. + // Otherwise try to use the assigned PopupForm property. + FC := nil; + DoGetPopupFormClass(FC); + if Assigned(FC) then + FPopupForm := FC.Create(nil); + + // Use the WrapperForm to show the PopupForm + if Assigned(FPopupForm) then begin + FPopupFormState.PopupForm := FPopupForm; + FPopupFormState.BorderStyle := FPopupForm.BorderStyle; + FPopupFormState.BoundsRect := FPopupForm.BoundsRect; + + ClientR := FPopupForm.ClientRect; + + FPopupForm.Parent := FWrapperForm; + FPopupForm.Align := alClient; + FPopupForm.BorderStyle := bsNone; + FPopupForm.Visible := True; + + if Assigned(FOnBeforePopup) then FOnBeforePopup(Self, ClientR.Right, ClientR.Bottom); + + if Assigned(PopupControl) then + FWrapperForm.RollDown(PopupControl, ClientR.Right + DefaultBorderSize * 2, ClientR.Bottom + DefaultBorderSize * 2, False, ForceFocus) + else + FWrapperForm.RollDown(X, Y, ClientR.Right + DefaultBorderSize * 2, ClientR.Bottom + DefaultBorderSize * 2, ForceFocus); + + if Assigned(OnPopup) then OnPopup(Self); + Result := True; + end; +end; + +procedure TSpTBXFormPopupMenu.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if Operation = opRemove then + if AComponent = PopupForm then begin + // Weird Delphi IDE bug at design time. + // When a Form is closed at design time it will fire the + // FreeNotification, setting PopupForm to nil and not + // saving it to the dfm + + SetPopupForm(nil); + + { TODO : Delphi IDE bug } + // This line doesn't seem to fix it, it raises AVs in the IDE + // PopupForm shouldn't be published. + // if not (csDesigning in ComponentState) then + // SetPopupForm(nil); + end; +end; + +procedure TSpTBXFormPopupMenu.Popup(X, Y: Integer); +begin + InternalPopup(X, Y, FPopupFocus); +end; + +procedure TSpTBXFormPopupMenu.PopupEx(X, Y: Integer; ForceFocus: Boolean); +begin + InternalPopup(X, Y, ForceFocus); +end; + +procedure TSpTBXFormPopupMenu.PopupEx(PopupControl: TControl; ForceFocus: Boolean); +begin + InternalPopup(0, 0, ForceFocus, PopupControl); +end; + +function TSpTBXFormPopupMenu.GetBorderStyle: TSpTBXPopupBorderStyleType; +begin + Result := FWrapperForm.BorderStyle; +end; + +function TSpTBXFormPopupMenu.GetShowShadows: Boolean; +begin + Result := FWrapperForm.ShowShadows; +end; + +procedure TSpTBXFormPopupMenu.SetBorderStyle(const Value: TSpTBXPopupBorderStyleType); +begin + FWrapperForm.BorderStyle := Value; +end; + +procedure TSpTBXFormPopupMenu.SetPopupForm(const Value: TCustomForm); +begin + if FPopupForm <> Value then begin + if FWrapperForm.Visible then + ClosePopup(False); + + if Assigned(FPopupForm) then + FPopupForm.RemoveFreeNotification(Self); + + FPopupForm := Value; + if Assigned(FPopupForm) then + FPopupForm.FreeNotification(Self); + end; +end; + +procedure TSpTBXFormPopupMenu.SetShowShadows(const Value: Boolean); +begin + FWrapperForm.ShowShadows := Value; +end; + +procedure TSpTBXFormPopupMenu.SetSkinType(const Value: TSpTBXSkinType); +begin + if FSkinType <> Value then begin + FSkinType := Value; + FWrapperForm.SkinType := Value; + end; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXGlyphs.res b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXGlyphs.res new file mode 100644 index 0000000..ce753b7 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXGlyphs.res differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.dcu new file mode 100644 index 0000000..8f93997 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.hpp new file mode 100644 index 0000000..8fbed5f --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.hpp @@ -0,0 +1,2061 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxitem.pas' rev: 20.00 + +#ifndef SptbxitemHPP +#define SptbxitemHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxitem +{ +//-- type declarations ------------------------------------------------------- +typedef Classes::TStringList* TTntStringList; + +#pragma option push -b- +enum TSpTBXPaintStage { pstPrePaint, pstPostPaint }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXToolbarDisplayMode { tbdmSelectiveCaption, tbdmImageOnly, tbdmImageAboveCaption, tbdmTextOnly }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXToolbarState { tstResizing, tstRightAligning, tstAnchoring }; +#pragma option pop + +typedef Set TSpTBXToolbarStates; + +#pragma option push -b- +enum TSpBorderIcon { briSystemMenu, briMinimize, briMaximize, briClose }; +#pragma option pop + +typedef Set TSpBorderIcons; + +#pragma option push -b- +enum TTextWrapping { twNone, twEndEllipsis, twPathEllipsis, twWrap }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXSearchItemViewerType { sivtNormal, sivtInmediate, sivtInmediateSkipNonVisible }; +#pragma option pop + +typedef void __fastcall (__closure *TSpTBXGetImageIndexEvent)(System::TObject* Sender, Imglist::TCustomImageList* &AImageList, int &AItemIndex); + +typedef void __fastcall (__closure *TSpTBXDrawEvent)(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + +typedef void __fastcall (__closure *TSpTBXDrawImageEvent)(System::TObject* Sender, Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, const TSpTBXPaintStage PaintStage, Imglist::TCustomImageList* &AImageList, int &AImageIndex, Types::TRect &ARect, bool &PaintDefault); + +typedef void __fastcall (__closure *TSpTBXDrawItemEvent)(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + +typedef void __fastcall (__closure *TSpTBXDrawPosEvent)(System::TObject* Sender, Graphics::TCanvas* ACanvas, int X, int Y, bool &PaintDefault); + +typedef void __fastcall (__closure *TSpTBXDrawTextEvent)(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ClientAreaRect, Sptbxskins::TSpTBXSkinStatesType State, System::WideString &ACaption, Types::TRect &CaptionRect, unsigned &CaptionFormat, bool IsTextRotated, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + +typedef void __fastcall (__closure *TSpTBXDrawHintEvent)(System::TObject* Sender, Graphics::TBitmap* AHintBitmap, System::WideString &AHint, bool &PaintDefault); + +typedef void __fastcall (__closure *TSpTBXItemNotificationEvent)(System::TObject* Sender, Tb2item::TTBCustomItem* Ancestor, bool Relayed, Tb2item::TTBItemChangedAction Action, int Index, Tb2item::TTBCustomItem* Item); + +typedef void __fastcall (__closure *TSpTBXRadioGroupFillStringsEvent)(System::TObject* Sender, Classes::TStringList* Strings); + +typedef void __fastcall (__closure *TSpTBXPopupEvent)(System::TObject* Sender, Tb2item::TTBView* PopupView); + +typedef Word TSpTBXFontSize; + +class DELPHICLASS TSpTBXFontSettings; +class PASCALIMPLEMENTATION TSpTBXFontSettings : public Classes::TPersistent +{ + typedef Classes::TPersistent inherited; + +private: + Graphics::TColor FColor; + Graphics::TFontName FName; + TSpTBXFontSize FSize; + Graphics::TFontStyles FStyle; + Classes::TNotifyEvent FOnChange; + void __fastcall SetColor(Graphics::TColor Value); + void __fastcall SetName(const Graphics::TFontName Value); + void __fastcall SetSize(TSpTBXFontSize Value); + void __fastcall SetStyle(const Graphics::TFontStyles Value); + +protected: + void __fastcall Modified(void); + __property Classes::TNotifyEvent OnChange = {read=FOnChange, write=FOnChange}; + +public: + __fastcall TSpTBXFontSettings(void); + void __fastcall Apply(Graphics::TFont* AFont); + virtual void __fastcall Assign(Classes::TPersistent* Src); + +__published: + __property Graphics::TColor Color = {read=FColor, write=SetColor, default=536870911}; + __property Graphics::TFontName Name = {read=FName, write=SetName}; + __property TSpTBXFontSize Size = {read=FSize, write=SetSize, default=100}; + __property Graphics::TFontStyles Style = {read=FStyle, write=SetStyle, default=0}; +public: + /* TPersistent.Destroy */ inline __fastcall virtual ~TSpTBXFontSettings(void) { } + +}; + + +class DELPHICLASS TSpTBXCustomDragObject; +class PASCALIMPLEMENTATION TSpTBXCustomDragObject : public Controls::TDragObjectEx +{ + typedef Controls::TDragObjectEx inherited; + +private: + Controls::TCursor FDragCursorAccept; + Controls::TCursor FDragCursorCancel; + Controls::TControl* FSourceControl; + Tb2item::TTBCustomItem* FSourceItem; + +protected: + virtual Controls::TCursor __fastcall GetDragCursor(bool Accepted, int X, int Y); + virtual void __fastcall Finished(System::TObject* Target, int X, int Y, bool Accepted); + +public: + __fastcall virtual TSpTBXCustomDragObject(Controls::TControl* ASourceControl, Tb2item::TTBCustomItem* AItem); + __property Controls::TCursor DragCursorAccept = {read=FDragCursorAccept, write=FDragCursorAccept, nodefault}; + __property Controls::TCursor DragCursorCancel = {read=FDragCursorCancel, write=FDragCursorCancel, nodefault}; + __property Tb2item::TTBCustomItem* SouceItem = {read=FSourceItem}; + __property Controls::TControl* SourceControl = {read=FSourceControl}; +public: + /* TObject.Destroy */ inline __fastcall virtual ~TSpTBXCustomDragObject(void) { } + +}; + + +class DELPHICLASS TSpTBXItemDragObject; +class PASCALIMPLEMENTATION TSpTBXItemDragObject : public TSpTBXCustomDragObject +{ + typedef TSpTBXCustomDragObject inherited; + +public: + /* TSpTBXCustomDragObject.Create */ inline __fastcall virtual TSpTBXItemDragObject(Controls::TControl* ASourceControl, Tb2item::TTBCustomItem* AItem) : TSpTBXCustomDragObject(ASourceControl, AItem) { } + +public: + /* TObject.Destroy */ inline __fastcall virtual ~TSpTBXItemDragObject(void) { } + +}; + + +class DELPHICLASS TSpTBXCustomItemActionLink; +class PASCALIMPLEMENTATION TSpTBXCustomItemActionLink : public Tb2item::TTBCustomItemActionLink +{ + typedef Tb2item::TTBCustomItemActionLink inherited; + +public: + /* TBasicActionLink.Create */ inline __fastcall virtual TSpTBXCustomItemActionLink(System::TObject* AClient) : Tb2item::TTBCustomItemActionLink(AClient) { } + /* TBasicActionLink.Destroy */ inline __fastcall virtual ~TSpTBXCustomItemActionLink(void) { } + +}; + + +class DELPHICLASS TSpTBXCustomControl; +class PASCALIMPLEMENTATION TSpTBXCustomControl : public Controls::TCustomControl +{ + typedef Controls::TCustomControl inherited; + +public: + /* TCustomControl.Create */ inline __fastcall virtual TSpTBXCustomControl(Classes::TComponent* AOwner) : Controls::TCustomControl(AOwner) { } + /* TCustomControl.Destroy */ inline __fastcall virtual ~TSpTBXCustomControl(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomControl(HWND ParentWindow) : Controls::TCustomControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomItem; +class PASCALIMPLEMENTATION TSpTBXCustomItem : public Tb2item::TTBCustomItem +{ + typedef Tb2item::TTBCustomItem inherited; + +private: + Sptbxskins::TSpGlowDirection FCaptionGlow; + Graphics::TColor FCaptionGlowColor; + Classes::TAlignment FAlignment; + bool FAnchored; + Controls::TControl* FControl; + int FCustomWidth; + int FCustomHeight; + TSpTBXFontSettings* FFontSettings; + int FMargins; + int FMinHeight; + int FMinWidth; + bool FStretch; + bool FToolbarStylePopup; + bool FToolBoxPopup; + TTextWrapping FWrapping; + Classes::TNotifyEvent FOnClosePopup; + TSpTBXPopupEvent FOnInitPopup; + TSpTBXDrawTextEvent FOnDrawCaption; + TSpTBXDrawHintEvent FOnDrawHint; + TSpTBXDrawItemEvent FOnDrawItem; + TSpTBXDrawImageEvent FOnDrawImage; + void __fastcall FontSettingsChanged(System::TObject* Sender); + void __fastcall SetAlignment(const Classes::TAlignment Value); + void __fastcall SetAnchored(const bool Value); + void __fastcall SetCaptionGlow(const Sptbxskins::TSpGlowDirection Value); + void __fastcall SetCaptionGlowColor(const Graphics::TColor Value); + void __fastcall SetControl(const Controls::TControl* Value); + void __fastcall SetCustomWidth(int Value); + void __fastcall SetCustomHeight(int Value); + void __fastcall SetFontSettings(const TSpTBXFontSettings* Value); + void __fastcall SetMargins(int Value); + void __fastcall SetMinHeight(const int Value); + void __fastcall SetMinWidth(const int Value); + void __fastcall SetStretch(const bool Value); + void __fastcall SetToolBoxPopup(const bool Value); + void __fastcall SetWrapping(const TTextWrapping Value); + +protected: + DYNAMIC void __fastcall ActionChange(System::TObject* Sender, bool CheckDefaults); + virtual bool __fastcall DialogChar(System::Word CharCode); + virtual void __fastcall DefineProperties(Classes::TFiler* Filer); + virtual void __fastcall DoDrawAdjustFont(Graphics::TFont* AFont, Sptbxskins::TSpTBXSkinStatesType State); + virtual void __fastcall DoDrawHint(Graphics::TBitmap* AHintBitmap, System::WideString &AHint, bool &PaintDefault); + virtual void __fastcall DoDrawButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawCaption(Graphics::TCanvas* ACanvas, const Types::TRect &ClientAreaRect, Sptbxskins::TSpTBXSkinStatesType State, System::WideString &ACaption, Types::TRect &CaptionRect, unsigned &CaptionFormat, bool IsTextRotated, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawImage(Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, const TSpTBXPaintStage PaintStage, Imglist::TCustomImageList* &AImageList, int &AImageIndex, Types::TRect &ARect, bool &PaintDefault); + virtual void __fastcall DoPopupShowingChanged(Tb2item::TTBPopupWindow* APopupWindow, bool IsVisible); + DYNAMIC Tb2item::TTBCustomItemActionLinkClass __fastcall GetActionLinkClass(void); + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); + virtual Tb2item::TTBPopupWindowClass __fastcall GetPopupWindowClass(void); + virtual void __fastcall ToggleControl(void); + virtual void __fastcall UpdateProps(void); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + __property Classes::TAlignment Alignment = {read=FAlignment, write=SetAlignment, default=2}; + __property bool Anchored = {read=FAnchored, write=SetAnchored, default=0}; + __property Sptbxskins::TSpGlowDirection CaptionGlow = {read=FCaptionGlow, write=SetCaptionGlow, default=0}; + __property Graphics::TColor CaptionGlowColor = {read=FCaptionGlowColor, write=SetCaptionGlowColor, default=65535}; + __property Controls::TControl* Control = {read=FControl, write=SetControl}; + __property int CustomWidth = {read=FCustomWidth, write=SetCustomWidth, default=-1}; + __property int CustomHeight = {read=FCustomHeight, write=SetCustomHeight, default=-1}; + __property TSpTBXFontSettings* FontSettings = {read=FFontSettings, write=SetFontSettings}; + __property int Margins = {read=FMargins, write=SetMargins, default=0}; + __property int MinHeight = {read=FMinHeight, write=SetMinHeight, default=0}; + __property int MinWidth = {read=FMinWidth, write=SetMinWidth, default=0}; + __property bool ToolbarStylePopup = {read=FToolbarStylePopup, write=FToolbarStylePopup, default=0}; + __property bool ToolBoxPopup = {read=FToolBoxPopup, write=SetToolBoxPopup, default=0}; + __property bool Stretch = {read=FStretch, write=SetStretch, default=1}; + __property Classes::TNotifyEvent OnClosePopup = {read=FOnClosePopup, write=FOnClosePopup}; + __property TSpTBXPopupEvent OnInitPopup = {read=FOnInitPopup, write=FOnInitPopup}; + __property TSpTBXDrawTextEvent OnDrawCaption = {read=FOnDrawCaption, write=FOnDrawCaption}; + __property TSpTBXDrawHintEvent OnDrawHint = {read=FOnDrawHint, write=FOnDrawHint}; + __property TSpTBXDrawImageEvent OnDrawImage = {read=FOnDrawImage, write=FOnDrawImage}; + __property TSpTBXDrawItemEvent OnDrawItem = {read=FOnDrawItem, write=FOnDrawItem}; + +public: + __fastcall virtual TSpTBXCustomItem(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomItem(void); + virtual void __fastcall Click(void); + HIDESBASE System::WideString __fastcall GetShortCutText(); + virtual void __fastcall InitiateAction(void); + void __fastcall Invalidate(void); + +__published: + __property Caption; + __property Hint; + __property TTextWrapping Wrapping = {read=FWrapping, write=SetWrapping, default=3}; +}; + + +class DELPHICLASS TSpTBXItemViewer; +class PASCALIMPLEMENTATION TSpTBXItemViewer : public Tb2item::TTBItemViewer +{ + typedef Tb2item::TTBItemViewer inherited; + +private: + TSpTBXCustomItem* __fastcall GetItem(void); + MESSAGE void __fastcall CMHintShow(Messages::TMessage &Message); + void __fastcall InternalCalcSize(const Graphics::TCanvas* Canvas, bool CalcStretch, int &AWidth, int &AHeight); + +protected: + Types::TPoint FAnchorSize; + int FAnchorDelta; + virtual void __fastcall DoDrawAdjustFont(Graphics::TFont* AFont, Sptbxskins::TSpTBXSkinStatesType State); + virtual void __fastcall DoDrawButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawCaption(Graphics::TCanvas* ACanvas, const Types::TRect &ClientAreaRect, Sptbxskins::TSpTBXSkinStatesType State, System::WideString &ACaption, Types::TRect &CaptionRect, unsigned &CaptionFormat, bool IsTextRotated, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawImage(Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, const TSpTBXPaintStage PaintStage, Imglist::TCustomImageList* &AImageList, int &AImageIndex, Types::TRect &ARect, bool &PaintDefault); + virtual void __fastcall DoDrawHint(Graphics::TBitmap* AHintBitmap, const Types::TPoint &CursorPos, Types::TRect &CursorRect, System::WideString &AHint, bool &PaintDefault); + DYNAMIC bool __fastcall CaptionShown(void); + virtual bool __fastcall GetImageShown(void); + virtual tagSIZE __fastcall GetImageSize(); + virtual tagSIZE __fastcall GetRightImageSize(); + virtual Graphics::TColor __fastcall GetTextColor(Sptbxskins::TSpTBXSkinStatesType State); + virtual void __fastcall DrawItemImage(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, int ImgIndex); + virtual void __fastcall DrawItemRightImage(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); + virtual void __fastcall CalcSize(const Graphics::TCanvas* Canvas, int &AWidth, int &AHeight); + void __fastcall GetTextInfo(Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, /* out */ Sptbxskins::TSpTBXTextInfo &TextInfo); + virtual void __fastcall Paint(const Graphics::TCanvas* Canvas, const Types::TRect &ClientAreaRect, bool IsSelected, bool IsPushed, bool UseDisabledShadow); + virtual void __fastcall Entering(void); + virtual void __fastcall InternalMouseMove(Classes::TShiftState Shift, int X, int Y); + +public: + HIDESBASE virtual System::WideString __fastcall GetCaptionText(); + HIDESBASE virtual System::WideString __fastcall GetHintText(); + __property TSpTBXCustomItem* Item = {read=GetItem}; +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXItemViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : Tb2item::TTBItemViewer(AView, AItem, AGroupLevel) { } + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXItemViewer(void) { } + +}; + + +class DELPHICLASS TSpTBXItem; +class PASCALIMPLEMENTATION TSpTBXItem : public TSpTBXCustomItem +{ + typedef TSpTBXCustomItem inherited; + +__published: + __property Action; + __property AutoCheck = {default=0}; + __property Checked = {default=0}; + __property DisplayMode = {default=0}; + __property Enabled = {default=1}; + __property GroupIndex = {default=0}; + __property HelpContext = {default=0}; + __property ImageIndex = {default=-1}; + __property Images; + __property InheritOptions = {default=1}; + __property MaskOptions = {default=0}; + __property Options = {default=0}; + __property RadioItem = {default=0}; + __property ShortCut = {default=0}; + __property Visible = {default=1}; + __property OnClick; + __property OnSelect; + __property Alignment = {default=2}; + __property Anchored = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property Control; + __property CustomWidth = {default=-1}; + __property CustomHeight = {default=-1}; + __property FontSettings; + __property Margins = {default=0}; + __property MinHeight = {default=0}; + __property MinWidth = {default=0}; + __property OnDrawCaption; + __property OnDrawHint; + __property OnDrawImage; + __property OnDrawItem; +public: + /* TSpTBXCustomItem.Create */ inline __fastcall virtual TSpTBXItem(Classes::TComponent* AOwner) : TSpTBXCustomItem(AOwner) { } + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXItem(void) { } + +}; + + +class DELPHICLASS TSpTBXRootItem; +class PASCALIMPLEMENTATION TSpTBXRootItem : public Tb2item::TTBRootItem +{ + typedef Tb2item::TTBRootItem inherited; + +private: + bool FToolBoxPopup; + TSpTBXPopupEvent FOnInitPopup; + Classes::TNotifyEvent FOnClosePopup; + void __fastcall SetToolBoxPopup(const bool Value); + +protected: + virtual void __fastcall DoPopupShowingChanged(Tb2item::TTBPopupWindow* APopupWindow, bool IsVisible); + virtual Tb2item::TTBPopupWindowClass __fastcall GetPopupWindowClass(void); + __property bool ToolBoxPopup = {read=FToolBoxPopup, write=SetToolBoxPopup, default=0}; + +public: + __property TSpTBXPopupEvent OnInitPopup = {read=FOnInitPopup, write=FOnInitPopup}; + __property Classes::TNotifyEvent OnClosePopup = {read=FOnClosePopup, write=FOnClosePopup}; +public: + /* TTBCustomItem.Create */ inline __fastcall virtual TSpTBXRootItem(Classes::TComponent* AOwner) : Tb2item::TTBRootItem(AOwner) { } + /* TTBCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXRootItem(void) { } + +}; + + +class DELPHICLASS TSpTBXSubmenuItem; +class PASCALIMPLEMENTATION TSpTBXSubmenuItem : public TSpTBXItem +{ + typedef TSpTBXItem inherited; + +private: + bool FHideEmptyPopup; + bool __fastcall GetDropdownCombo(void); + void __fastcall SetDropdownCombo(bool Value); + +public: + __fastcall virtual TSpTBXSubmenuItem(Classes::TComponent* AOwner); + +__published: + __property bool DropdownCombo = {read=GetDropdownCombo, write=SetDropdownCombo, default=0}; + __property bool HideEmptyPopup = {read=FHideEmptyPopup, write=FHideEmptyPopup, default=0}; + __property LinkSubitems; + __property SubMenuImages; + __property ToolbarStylePopup = {default=0}; + __property ToolBoxPopup = {default=0}; + __property OnPopup; + __property OnClosePopup; + __property OnInitPopup; +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXSubmenuItem(void) { } + +}; + + +class DELPHICLASS TSpTBXColorItem; +class PASCALIMPLEMENTATION TSpTBXColorItem : public TSpTBXCustomItem +{ + typedef TSpTBXCustomItem inherited; + +private: + Graphics::TColor FColor; + void __fastcall SetColor(Graphics::TColor Value); + +protected: + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); + +public: + __fastcall virtual TSpTBXColorItem(Classes::TComponent* AOwner); + +__published: + __property Action; + __property AutoCheck = {default=0}; + __property Checked = {default=0}; + __property DisplayMode = {default=0}; + __property Enabled = {default=1}; + __property GroupIndex = {default=0}; + __property HelpContext = {default=0}; + __property InheritOptions = {default=1}; + __property MaskOptions = {default=0}; + __property Options = {default=0}; + __property ShortCut = {default=0}; + __property Visible = {default=1}; + __property OnClick; + __property OnSelect; + __property Alignment = {default=2}; + __property Anchored = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property Control; + __property CustomWidth = {default=-1}; + __property CustomHeight = {default=-1}; + __property FontSettings; + __property Margins = {default=0}; + __property MinHeight = {default=0}; + __property MinWidth = {default=0}; + __property OnDrawCaption; + __property OnDrawHint; + __property OnDrawImage; + __property OnDrawItem; + __property Graphics::TColor Color = {read=FColor, write=SetColor, default=16777215}; +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXColorItem(void) { } + +}; + + +class DELPHICLASS TSpTBXColorItemViewer; +class PASCALIMPLEMENTATION TSpTBXColorItemViewer : public TSpTBXItemViewer +{ + typedef TSpTBXItemViewer inherited; + +protected: + virtual void __fastcall DoDrawImage(Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, const TSpTBXPaintStage PaintStage, Imglist::TCustomImageList* &AImageList, int &AImageIndex, Types::TRect &ARect, bool &PaintDefault); + virtual bool __fastcall GetImageShown(void); + virtual tagSIZE __fastcall GetImageSize(); +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXColorItemViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : TSpTBXItemViewer(AView, AItem, AGroupLevel) { } + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXColorItemViewer(void) { } + +}; + + +class DELPHICLASS TSpTBXCustomLabelItem; +class PASCALIMPLEMENTATION TSpTBXCustomLabelItem : public TSpTBXCustomItem +{ + typedef TSpTBXCustomItem inherited; + +protected: + virtual bool __fastcall DialogChar(System::Word CharCode); + virtual void __fastcall DoDrawButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); + virtual void __fastcall ToggleControl(void); + virtual void __fastcall UpdateProps(void); + __property Alignment = {default=0}; + +public: + __fastcall virtual TSpTBXCustomLabelItem(Classes::TComponent* AOwner); +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXCustomLabelItem(void) { } + +}; + + +class DELPHICLASS TSpTBXLabelItemViewer; +class PASCALIMPLEMENTATION TSpTBXLabelItemViewer : public TSpTBXItemViewer +{ + typedef TSpTBXItemViewer inherited; + +protected: + virtual void __fastcall CalcSize(const Graphics::TCanvas* Canvas, int &AWidth, int &AHeight); + virtual bool __fastcall DoExecute(void); +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXLabelItemViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : TSpTBXItemViewer(AView, AItem, AGroupLevel) { } + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXLabelItemViewer(void) { } + +}; + + +class DELPHICLASS TSpTBXLabelItem; +class PASCALIMPLEMENTATION TSpTBXLabelItem : public TSpTBXCustomLabelItem +{ + typedef TSpTBXCustomLabelItem inherited; + +__published: + __property Enabled = {default=1}; + __property ImageIndex = {default=-1}; + __property Images; + __property InheritOptions = {default=1}; + __property MaskOptions = {default=0}; + __property Options = {default=0}; + __property Visible = {default=1}; + __property OnClick; + __property Alignment = {default=0}; + __property Anchored = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property Control; + __property CustomWidth = {default=-1}; + __property CustomHeight = {default=-1}; + __property FontSettings; + __property Margins = {default=0}; + __property MinHeight = {default=0}; + __property MinWidth = {default=0}; + __property OnDrawCaption; + __property OnDrawHint; + __property OnDrawImage; + __property OnDrawItem; +public: + /* TSpTBXCustomLabelItem.Create */ inline __fastcall virtual TSpTBXLabelItem(Classes::TComponent* AOwner) : TSpTBXCustomLabelItem(AOwner) { } + +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXLabelItem(void) { } + +}; + + +class DELPHICLASS TSpTBXSeparatorItem; +class PASCALIMPLEMENTATION TSpTBXSeparatorItem : public Tb2item::TTBSeparatorItem +{ + typedef Tb2item::TTBSeparatorItem inherited; + +protected: + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); +public: + /* TTBSeparatorItem.Create */ inline __fastcall virtual TSpTBXSeparatorItem(Classes::TComponent* AOwner) : Tb2item::TTBSeparatorItem(AOwner) { } + +public: + /* TTBCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXSeparatorItem(void) { } + +}; + + +class DELPHICLASS TSpTBXSeparatorItemViewer; +class PASCALIMPLEMENTATION TSpTBXSeparatorItemViewer : public Tb2item::TTBSeparatorItemViewer +{ + typedef Tb2item::TTBSeparatorItemViewer inherited; + +protected: + virtual void __fastcall CalcSize(const Graphics::TCanvas* Canvas, int &AWidth, int &AHeight); + bool __fastcall IsStatusBarSeparator(void); + virtual void __fastcall Paint(const Graphics::TCanvas* Canvas, const Types::TRect &ClientAreaRect, bool IsSelected, bool IsPushed, bool UseDisabledShadow); +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXSeparatorItemViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : Tb2item::TTBSeparatorItemViewer(AView, AItem, AGroupLevel) { } + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXSeparatorItemViewer(void) { } + +}; + + +class DELPHICLASS TSpTBXRightAlignSpacerItem; +class PASCALIMPLEMENTATION TSpTBXRightAlignSpacerItem : public TSpTBXCustomLabelItem +{ + typedef TSpTBXCustomLabelItem inherited; + +__published: + __property ImageIndex = {default=-1}; + __property Images; + __property MaskOptions = {default=0}; + __property Options = {default=0}; + __property OnClick; + __property Alignment = {default=0}; + __property CaptionGlow = {default=0}; + __property CaptionGlowColor = {default=65535}; + __property CustomWidth = {default=-1}; + __property CustomHeight = {default=-1}; + __property FontSettings; + __property OnDrawCaption; + __property OnDrawHint; + __property OnDrawImage; + __property OnDrawItem; +public: + /* TSpTBXCustomLabelItem.Create */ inline __fastcall virtual TSpTBXRightAlignSpacerItem(Classes::TComponent* AOwner) : TSpTBXCustomLabelItem(AOwner) { } + +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXRightAlignSpacerItem(void) { } + +}; + + +class DELPHICLASS TSpTBXRadioGroupItem; +class PASCALIMPLEMENTATION TSpTBXRadioGroupItem : public Tb2item::TTBGroupItem +{ + typedef Tb2item::TTBGroupItem inherited; + +private: + int FDefaultIndex; + int FLastClickedIndex; + Classes::TNotifyEvent FOnClick; + TSpTBXRadioGroupFillStringsEvent FOnFillStrings; + Classes::TNotifyEvent FOnUpdate; + +protected: + Classes::TStringList* FStrings; + virtual void __fastcall Loaded(void); + virtual void __fastcall ItemClickEvent(System::TObject* Sender); + virtual void __fastcall DoClick(TSpTBXItem* AItem); + virtual void __fastcall DoFillStrings(void); + +public: + __fastcall virtual TSpTBXRadioGroupItem(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXRadioGroupItem(void); + void __fastcall Recreate(void); + __property int DefaultIndex = {read=FDefaultIndex, write=FDefaultIndex, nodefault}; + __property int LastClickedIndex = {read=FLastClickedIndex, nodefault}; + +__published: + __property Classes::TNotifyEvent OnClick = {read=FOnClick, write=FOnClick}; + __property TSpTBXRadioGroupFillStringsEvent OnFillStrings = {read=FOnFillStrings, write=FOnFillStrings}; + __property Classes::TNotifyEvent OnUpdate = {read=FOnUpdate, write=FOnUpdate}; +}; + + +class DELPHICLASS TSpTBXSkinGroupItem; +class PASCALIMPLEMENTATION TSpTBXSkinGroupItem : public TSpTBXRadioGroupItem +{ + typedef TSpTBXRadioGroupItem inherited; + +private: + Classes::TNotifyEvent FOnSkinChange; + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + virtual void __fastcall DoClick(TSpTBXItem* AItem); + virtual void __fastcall DoSkinChange(void); + virtual void __fastcall DoFillStrings(void); + +public: + __fastcall virtual TSpTBXSkinGroupItem(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXSkinGroupItem(void); + +__published: + __property Classes::TNotifyEvent OnSkinChange = {read=FOnSkinChange, write=FOnSkinChange}; +}; + + +class DELPHICLASS TSpTBXSystemMenuItem; +class PASCALIMPLEMENTATION TSpTBXSystemMenuItem : public TSpTBXCustomItem +{ + typedef TSpTBXCustomItem inherited; + +private: + bool FMDISystemMenu; + bool FShowSize; + void __fastcall CommandClick(System::TObject* Sender); + +protected: + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); + Forms::TCustomForm* __fastcall GetSystemMenuParentForm(void); + +public: + __fastcall virtual TSpTBXSystemMenuItem(Classes::TComponent* AOwner); + virtual void __fastcall Click(void); + +__published: + __property bool MDISystemMenu = {read=FMDISystemMenu, write=FMDISystemMenu, default=0}; + __property bool ShowSize = {read=FShowSize, write=FShowSize, default=1}; +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXSystemMenuItem(void) { } + +}; + + +class DELPHICLASS TSpTBXSystemMenuItemViewer; +class PASCALIMPLEMENTATION TSpTBXSystemMenuItemViewer : public TSpTBXItemViewer +{ + typedef TSpTBXItemViewer inherited; + +protected: + virtual void __fastcall CalcSize(const Graphics::TCanvas* Canvas, int &AWidth, int &AHeight); + virtual void __fastcall Paint(const Graphics::TCanvas* Canvas, const Types::TRect &ClientAreaRect, bool IsSelected, bool IsPushed, bool UseDisabledShadow); +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXSystemMenuItemViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : TSpTBXItemViewer(AView, AItem, AGroupLevel) { } + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXSystemMenuItemViewer(void) { } + +}; + + +typedef ShortInt TSpTBXRowColCount; + +typedef void __fastcall (__closure *TSpTBXTPGetCellHint)(System::TObject* Sender, int ACol, int ARow, System::WideString &AHint); + +typedef void __fastcall (__closure *TSpTBXTPDrawCellImage)(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int ACol, int ARow, bool Selected, bool HotTrack, bool Enabled); + +typedef void __fastcall (__closure *TSpTBXTPCellClick)(System::TObject* Sender, int ACol, int ARow, bool &Allow); + +typedef void __fastcall (__closure *TSpTBXCPGetColorInfo)(System::TObject* Sender, int ACol, int ARow, Graphics::TColor &Color, System::WideString &Name); + +class DELPHICLASS TSpTBXCustomToolPalette; +class PASCALIMPLEMENTATION TSpTBXCustomToolPalette : public TSpTBXCustomItem +{ + typedef TSpTBXCustomItem inherited; + +private: + bool FCustomImages; + TSpTBXRowColCount FColCount; + TSpTBXRowColCount FRowCount; + Types::TPoint FSelectedCell; + Classes::TNotifyEvent FOnChange; + TSpTBXTPCellClick FOnCellClick; + TSpTBXTPDrawCellImage FOnDrawCellImage; + TSpTBXTPGetCellHint FOnGetCellHint; + void __fastcall SetSelectedCell(const Types::TPoint &Value); + +protected: + virtual bool __fastcall DoCellClick(int ACol, int ARow); + virtual void __fastcall DoChange(void); + virtual void __fastcall DoDrawCellImage(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int ACol, int ARow, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); + virtual void __fastcall DoGetCellHint(int ACol, int ARow, System::WideString &AHint); + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); + virtual void __fastcall HandleClickCell(int ACol, int ARow); + virtual void __fastcall SetColCount(TSpTBXRowColCount Value); + virtual void __fastcall SetRowCount(TSpTBXRowColCount Value); + __property bool CustomImages = {read=FCustomImages, write=FCustomImages, nodefault}; + __property TSpTBXRowColCount ColCount = {read=FColCount, write=SetColCount, default=1}; + __property TSpTBXRowColCount RowCount = {read=FRowCount, write=SetRowCount, default=1}; + __property Types::TPoint SelectedCell = {read=FSelectedCell, write=SetSelectedCell}; + __property Classes::TNotifyEvent OnChange = {read=FOnChange, write=FOnChange}; + __property TSpTBXTPCellClick OnCellClick = {read=FOnCellClick, write=FOnCellClick}; + __property TSpTBXTPDrawCellImage OnDrawCellImage = {read=FOnDrawCellImage, write=FOnDrawCellImage}; + __property TSpTBXTPGetCellHint OnGetCellHint = {read=FOnGetCellHint, write=FOnGetCellHint}; + +public: + __fastcall virtual TSpTBXCustomToolPalette(Classes::TComponent* AOwner); +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXCustomToolPalette(void) { } + +}; + + +class DELPHICLASS TSpTBXToolPalette; +class PASCALIMPLEMENTATION TSpTBXToolPalette : public TSpTBXCustomToolPalette +{ + typedef TSpTBXCustomToolPalette inherited; + +public: + __property SelectedCell; + +__published: + __property ColCount = {default=1}; + __property HelpContext = {default=0}; + __property Images; + __property Options = {default=0}; + __property RowCount = {default=1}; + __property Visible = {default=1}; + __property OnChange; + __property OnCellClick; + __property OnDrawCellImage; + __property OnGetCellHint; +public: + /* TSpTBXCustomToolPalette.Create */ inline __fastcall virtual TSpTBXToolPalette(Classes::TComponent* AOwner) : TSpTBXCustomToolPalette(AOwner) { } + +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXToolPalette(void) { } + +}; + + +class DELPHICLASS TSpTBXToolViewer; +class PASCALIMPLEMENTATION TSpTBXToolViewer : public TSpTBXItemViewer +{ + typedef TSpTBXItemViewer inherited; + +private: + int FCellHeight; + int FCellWidth; + int FColCount; + int FRowCount; + Types::TPoint FHotCell; + HIDESBASE TSpTBXCustomToolPalette* __fastcall GetItem(void); + +protected: + int FIndent; + bool FMouseIsDown; + virtual void __fastcall CalcCellSize(Graphics::TCanvas* ACanvas, int &AWidth, int &AHeight); + virtual void __fastcall CalcSize(const Graphics::TCanvas* Canvas, int &AWidth, int &AHeight); + int __fastcall GetImageIndex(int Col, int Row); + virtual tagSIZE __fastcall GetImageSize(); + virtual bool __fastcall GetImageShown(void); + bool __fastcall GetCellAt(int X, int Y, /* out */ int &Col, /* out */ int &Row); + virtual Types::TRect __fastcall GetCellRect(const Types::TRect &ClientAreaRect, int Col, int Row); + System::WideString __fastcall GetCellHint(int Col, int Row); + virtual void __fastcall DoDrawHint(Graphics::TBitmap* AHintBitmap, const Types::TPoint &CursorPos, Types::TRect &CursorRect, System::WideString &AHint, bool &PaintDefault); + virtual void __fastcall DrawCellImage(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int Col, int Row, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); + virtual void __fastcall Entering(void); + void __fastcall InvalidateCell(int ACol, int ARow); + virtual bool __fastcall IsCellVisible(const Types::TPoint &Cell); + virtual void __fastcall KeyDown(System::Word &Key, Classes::TShiftState Shift); + virtual void __fastcall MouseDown(Classes::TShiftState Shift, int X, int Y, bool &MouseDownOnMenu); + virtual void __fastcall MouseMove(int X, int Y); + virtual void __fastcall MouseUp(int X, int Y, bool MouseWasDownOnMenu); + virtual void __fastcall Paint(const Graphics::TCanvas* Canvas, const Types::TRect &ClientAreaRect, bool IsSelected, bool IsPushed, bool UseDisabledShadow); + +public: + __fastcall virtual TSpTBXToolViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel); + __property TSpTBXCustomToolPalette* Item = {read=GetItem}; +public: + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXToolViewer(void) { } + +}; + + +class DELPHICLASS TSpTBXColorPalette; +class PASCALIMPLEMENTATION TSpTBXColorPalette : public TSpTBXCustomToolPalette +{ + typedef TSpTBXCustomToolPalette inherited; + +private: + Graphics::TColor FColor; + bool FCustomColors; + TSpTBXCPGetColorInfo FOnGetColor; + void __fastcall SetColor(Graphics::TColor Value); + void __fastcall SetCustomColors(const bool Value); + +protected: + virtual void __fastcall DoChange(void); + virtual void __fastcall DoGetCellHint(int ACol, int ARow, System::WideString &AHint); + virtual void __fastcall DoDrawCellImage(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int ACol, int ARow, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); + Graphics::TColor __fastcall GetCellColor(int ACol, int ARow); + void __fastcall GetCellInfo(int ACol, int ARow, /* out */ Graphics::TColor &AColor, /* out */ System::WideString &AName); + virtual void __fastcall SetColCount(TSpTBXRowColCount Value); + virtual void __fastcall SetRowCount(TSpTBXRowColCount Value); + +public: + __fastcall virtual TSpTBXColorPalette(Classes::TComponent* AOwner); + Types::TPoint __fastcall FindCell(Graphics::TColor AColor); + +__published: + __property bool CustomColors = {read=FCustomColors, write=SetCustomColors, default=0}; + __property ColCount = {default=8}; + __property Graphics::TColor Color = {read=FColor, write=SetColor, default=536870911}; + __property HelpContext = {default=0}; + __property InheritOptions = {default=1}; + __property MaskOptions = {default=0}; + __property Options = {default=128}; + __property RowCount = {default=5}; + __property Visible = {default=1}; + __property OnChange; + __property OnCellClick; + __property OnGetCellHint; + __property TSpTBXCPGetColorInfo OnGetColor = {read=FOnGetColor, write=FOnGetColor}; +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXColorPalette(void) { } + +}; + + +class DELPHICLASS TSpTBXItemCache; +class PASCALIMPLEMENTATION TSpTBXItemCache : public Classes::TCollectionItem +{ + typedef Classes::TCollectionItem inherited; + +private: + Tb2dock::TTBDock* FDock; + Classes::TComponentName FName; + Tb2item::TTBCustomItem* FItem; + int FWidth; + int FHeight; + int FParentWidth; + int FParentHeight; + Classes::TComponentName __fastcall GetName(); + +public: + virtual void __fastcall Assign(Classes::TPersistent* Source); + __property Tb2item::TTBCustomItem* Item = {read=FItem, write=FItem}; + +__published: + __property Tb2dock::TTBDock* Dock = {read=FDock, write=FDock}; + __property Classes::TComponentName Name = {read=GetName, write=FName}; + __property int Width = {read=FWidth, write=FWidth, default=0}; + __property int Height = {read=FHeight, write=FHeight, default=0}; + __property int ParentWidth = {read=FParentWidth, write=FParentWidth, default=0}; + __property int ParentHeight = {read=FParentHeight, write=FParentHeight, default=0}; +public: + /* TCollectionItem.Create */ inline __fastcall virtual TSpTBXItemCache(Classes::TCollection* Collection) : Classes::TCollectionItem(Collection) { } + /* TCollectionItem.Destroy */ inline __fastcall virtual ~TSpTBXItemCache(void) { } + +}; + + +class DELPHICLASS TSpTBXItemCacheCollection; +class PASCALIMPLEMENTATION TSpTBXItemCacheCollection : public Classes::TCollection +{ + typedef Classes::TCollection inherited; + +public: + TSpTBXItemCache* operator[](int Index) { return Items[Index]; } + +private: + HIDESBASE TSpTBXItemCache* __fastcall GetItem(int Index); + HIDESBASE void __fastcall SetItem(int Index, const TSpTBXItemCache* Value); + +public: + HIDESBASE virtual int __fastcall Add(Tb2item::TTBCustomItem* AItem); + int __fastcall IndexOf(Tb2item::TTBCustomItem* AItem); + __property TSpTBXItemCache* Items[int Index] = {read=GetItem, write=SetItem/*, default*/}; +public: + /* TCollection.Create */ inline __fastcall TSpTBXItemCacheCollection(Classes::TCollectionItemClass ItemClass) : Classes::TCollection(ItemClass) { } + /* TCollection.Destroy */ inline __fastcall virtual ~TSpTBXItemCacheCollection(void) { } + +}; + + +class DELPHICLASS TSpTBXDock; +class PASCALIMPLEMENTATION TSpTBXDock : public Tb2dock::TTBDock +{ + typedef Tb2dock::TTBDock inherited; + +private: + bool FMoving; + bool FResizing; + int FPrevWidth; + int FPrevHeight; + TSpTBXDrawEvent FOnDrawBackground; + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + HIDESBASE MESSAGE void __fastcall WMMove(Messages::TWMMove &Message); + HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + virtual bool __fastcall CanResize(int &NewWidth, int &NewHeight); + virtual void __fastcall DrawBackground(HDC DC, const Types::TRect &DrawRect); + virtual void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + void __fastcall InternalDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + DYNAMIC void __fastcall Resize(void); + virtual bool __fastcall UsingBackground(void); + bool __fastcall UsingBitmap(void); + +public: + __fastcall virtual TSpTBXDock(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXDock(void); + __property int PrevWidth = {read=FPrevWidth, nodefault}; + __property int PrevHeight = {read=FPrevHeight, nodefault}; + +__published: + __property Color = {default=536870911}; + __property OnCanResize; + __property TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXDock(HWND ParentWindow) : Tb2dock::TTBDock(ParentWindow) { } + +}; + + +typedef TMetaClass* TSpTBXDockClass; + +class DELPHICLASS TSpTBXToolbarView; +class PASCALIMPLEMENTATION TSpTBXToolbarView : public Tb2toolbar::TTBToolbarView +{ + typedef Tb2toolbar::TTBToolbarView inherited; + +private: + int FMaxSize; + void __fastcall SetMaxSize(const int Value); + +protected: + int FTallestItemSize; + virtual void __fastcall DoUpdatePositions(Types::TPoint &ASize); + +public: + __fastcall virtual TSpTBXToolbarView(Classes::TComponent* AOwner, Tb2item::TTBView* AParentView, Tb2item::TTBCustomItem* AParentItem, Controls::TWinControl* AWindow, bool AIsToolbar, bool ACustomizing, bool AUsePriorityList); + __property int MaxSize = {read=FMaxSize, write=SetMaxSize, nodefault}; +public: + /* TTBView.Destroy */ inline __fastcall virtual ~TSpTBXToolbarView(void) { } + +}; + + +class DELPHICLASS TSpTBXToolbar; +class PASCALIMPLEMENTATION TSpTBXToolbar : public Tb2toolbar::TTBCustomToolbar +{ + typedef Tb2toolbar::TTBCustomToolbar inherited; + +private: + bool FChevronVertical; + bool FCompoundToolbar; + bool FCustomizable; + int FCustomizingCount; + int FItemMovingCount; + TSpTBXToolbarDisplayMode FDisplayMode; + Types::TRect FLastDropMark; + int FLastSelectableWidth; + TSpTBXDrawEvent FOnDrawBackground; + TSpTBXItemNotificationEvent FOnItemNotification; + void __fastcall SetDisplayMode(const TSpTBXToolbarDisplayMode Value); + int __fastcall GetMaxSize(void); + void __fastcall SetMaxSize(const int Value); + HIDESBASE Tb2item::TTBControlItem* __fastcall CreateWrapper(int Index, Controls::TControl* Ctl); + Tb2item::TTBControlItem* __fastcall IsAnchoredControlItem(Tb2item::TTBCustomItem* Item); + HIDESBASE MESSAGE void __fastcall CMControlChange(Controls::TCMControlChange &Message); + HIDESBASE MESSAGE void __fastcall CMDialogChar(Messages::TWMKey &Message); + HIDESBASE MESSAGE void __fastcall CMMouseleave(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall CMHintShow(Controls::TCMHintShow &Message); + HIDESBASE MESSAGE void __fastcall CMTextChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + Tb2item::TTBItemViewer* FBeginDragIV; + TSpTBXItemCacheCollection* FAnchoredControlItems; + TSpTBXToolbarStates FState; + virtual void __fastcall CreateWindowHandle(const Controls::TCreateParams &Params); + virtual void __fastcall DefineProperties(Classes::TFiler* Filer); + DYNAMIC void __fastcall Resize(void); + virtual void __fastcall AnchorItems(bool UpdateControlItems = true); + virtual void __fastcall RightAlignItems(void); + virtual void __fastcall DrawNCArea(const bool DrawToDC, const HDC ADC, const HRGN Clip); + virtual Graphics::TColor __fastcall GetItemsTextColor(Sptbxskins::TSpTBXSkinStatesType State); + virtual void __fastcall InternalDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool PaintOnNCArea, bool PaintBorders = true); + virtual void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + DYNAMIC Tb2toolbar::TTBChevronItemClass __fastcall GetChevronItemClass(void); + DYNAMIC Tb2dock::TTBFloatingWindowParentClass __fastcall GetFloatingWindowParentClass(void); + virtual int __fastcall GetRightAlignMargin(void); + DYNAMIC Tb2toolbar::TTBToolbarViewClass __fastcall GetViewClass(void); + DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + virtual bool __fastcall CanDragCustomize(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall DoStartDrag(Controls::TDragObject* &DragObject); + DYNAMIC void __fastcall DragOver(System::TObject* Source, int X, int Y, Controls::TDragState State, bool &Accept); + virtual bool __fastcall CanItemClick(Tb2item::TTBCustomItem* Item, Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + virtual void __fastcall DoItemClick(Tb2item::TTBCustomItem* Item, Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + virtual void __fastcall DoItemNotification(Tb2item::TTBCustomItem* Ancestor, bool Relayed, Tb2item::TTBItemChangedAction Action, int Index, Tb2item::TTBCustomItem* Item); + __property bool CompoundToolbar = {read=FCompoundToolbar, write=FCompoundToolbar, nodefault}; + +public: + __fastcall virtual TSpTBXToolbar(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXToolbar(void); + DYNAMIC void __fastcall DragDrop(System::TObject* Source, int X, int Y); + DYNAMIC void __fastcall ReadPositionData(const Tb2dock::TTBReadPositionData &Data); + DYNAMIC void __fastcall WritePositionData(const Tb2dock::TTBWritePositionData &Data); + void __fastcall BeginCustomize(void); + void __fastcall EndCustomize(void); + void __fastcall BeginItemMove(void); + void __fastcall EndItemMove(void); + virtual Types::TPoint __fastcall GetFloatingBorderSize(); + bool __fastcall IsCustomizing(void); + bool __fastcall IsItemMoving(void); + bool __fastcall IsVertical(void); + __property int MaxSize = {read=GetMaxSize, write=SetMaxSize, default=-1}; + +__published: + __property ActivateParent = {default=1}; + __property Align = {default=0}; + __property AutoResize = {default=1}; + __property BorderStyle = {default=1}; + __property ChevronHint; + __property ChevronMoveItems = {default=1}; + __property ChevronPriorityForNewItems = {default=0}; + __property CloseButton = {default=1}; + __property CloseButtonWhenDocked = {default=0}; + __property CurrentDock; + __property DefaultDock; + __property DockableTo = {default=15}; + __property DockMode = {default=0}; + __property DockPos = {default=-1}; + __property DockRow = {default=0}; + __property DragHandleStyle = {default=2}; + __property FloatingMode = {default=0}; + __property Font; + __property FullSize = {default=0}; + __property HideWhenInactive = {default=1}; + __property Images; + __property Items; + __property LastDock; + __property LinkSubitems; + __property MenuBar = {default=0}; + __property Options = {default=0}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ProcessShortCuts = {default=0}; + __property Resizable = {default=1}; + __property ShowCaption = {default=1}; + __property ShowHint; + __property ShrinkMode = {default=2}; + __property SmoothDrag = {default=1}; + __property Stretch = {default=0}; + __property SystemFont = {default=1}; + __property TabOrder = {default=-1}; + __property TabStop = {default=0}; + __property UpdateActions = {default=1}; + __property UseLastDock = {default=1}; + __property Visible = {default=1}; + __property Color = {default=536870911}; + __property OnClose; + __property OnCloseQuery; + __property OnContextPopup; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnMove; + __property OnRecreated; + __property OnRecreating; + __property OnDockChanged; + __property OnDockChanging; + __property OnDockChangingHidden; + __property OnResize; + __property OnShortCut; + __property OnVisibleChanged; + __property Caption; + __property Hint; + __property bool ChevronVertical = {read=FChevronVertical, write=FChevronVertical, default=1}; + __property bool Customizable = {read=FCustomizable, write=FCustomizable, default=1}; + __property TSpTBXToolbarDisplayMode DisplayMode = {read=FDisplayMode, write=SetDisplayMode, default=0}; + __property TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; + __property TSpTBXItemNotificationEvent OnItemNotification = {read=FOnItemNotification, write=FOnItemNotification}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXToolbar(HWND ParentWindow) : Tb2toolbar::TTBCustomToolbar(ParentWindow) { } + +}; + + +typedef TMetaClass* TSpTBXToolbarClass; + +class DELPHICLASS TSpTBXCustomToolWindow; +class PASCALIMPLEMENTATION TSpTBXCustomToolWindow : public Tb2dock::TTBCustomDockableWindow +{ + typedef Tb2dock::TTBCustomDockableWindow inherited; + +private: + int FMinClientWidth; + int FMinClientHeight; + int FMaxClientWidth; + int FMaxClientHeight; + TSpTBXDrawEvent FOnDrawBackground; + int __fastcall GetClientAreaWidth(void); + void __fastcall SetClientAreaWidth(int Value); + int __fastcall GetClientAreaHeight(void); + void __fastcall SetClientAreaHeight(int Value); + HIDESBASE MESSAGE void __fastcall CMTextChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMWindowPosChanged(Messages::TWMWindowPosMsg &Message); + +protected: + tagSIZE FBarSize; + virtual void __fastcall CreateWindowHandle(const Controls::TCreateParams &Params); + virtual void __fastcall DefineProperties(Classes::TFiler* Filer); + DYNAMIC Tb2dock::TTBFloatingWindowParentClass __fastcall GetFloatingWindowParentClass(void); + virtual Types::TPoint __fastcall CalcSize(Tb2dock::TTBDock* ADock); + virtual Types::TPoint __fastcall DoArrange(bool CanMoveControls, Tb2dock::TTBDockType PreviousDockType, bool NewFloating, Tb2dock::TTBDock* NewDock); + virtual void __fastcall GetBaseSize(Types::TPoint &ASize); + virtual void __fastcall GetMinMaxSize(int &AMinClientWidth, int &AMinClientHeight, int &AMaxClientWidth, int &AMaxClientHeight); + virtual void __fastcall SetClientAreaSize(int AWidth, int AHeight); + virtual void __fastcall SizeChanging(const int AWidth, const int AHeight); + virtual void __fastcall Paint(void); + virtual void __fastcall DrawNCArea(const bool DrawToDC, const HDC ADC, const HRGN Clip); + virtual void __fastcall InternalDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool PaintOnNCArea, bool PaintBorders = true); + virtual void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + __property int ClientAreaHeight = {read=GetClientAreaHeight, write=SetClientAreaHeight, nodefault}; + __property int ClientAreaWidth = {read=GetClientAreaWidth, write=SetClientAreaWidth, nodefault}; + __property int MaxClientHeight = {read=FMaxClientHeight, write=FMaxClientHeight, default=0}; + __property int MaxClientWidth = {read=FMaxClientWidth, write=FMaxClientWidth, default=0}; + __property int MinClientHeight = {read=FMinClientHeight, write=FMinClientHeight, default=32}; + __property int MinClientWidth = {read=FMinClientWidth, write=FMinClientWidth, default=32}; + __property TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; + +public: + __fastcall virtual TSpTBXCustomToolWindow(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomToolWindow(void); + virtual Types::TPoint __fastcall GetFloatingBorderSize(); + virtual void __fastcall InvalidateBackground(bool InvalidateChildren = true); + bool __fastcall IsVertical(void); + DYNAMIC void __fastcall ReadPositionData(const Tb2dock::TTBReadPositionData &Data); + DYNAMIC void __fastcall WritePositionData(const Tb2dock::TTBWritePositionData &Data); + +__published: + __property Caption; + __property Color = {default=536870911}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomToolWindow(HWND ParentWindow) : Tb2dock::TTBCustomDockableWindow(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXToolWindow; +class PASCALIMPLEMENTATION TSpTBXToolWindow : public TSpTBXCustomToolWindow +{ + typedef TSpTBXCustomToolWindow inherited; + +__published: + __property ActivateParent = {default=1}; + __property Align = {default=0}; + __property Anchors = {default=3}; + __property BorderStyle = {default=1}; + __property Caption; + __property Color = {default=536870911}; + __property CloseButton = {default=1}; + __property CloseButtonWhenDocked = {default=0}; + __property CurrentDock; + __property DefaultDock; + __property DockableTo = {default=15}; + __property DockMode = {default=0}; + __property DockPos = {default=-1}; + __property DockRow = {default=0}; + __property DragHandleStyle = {default=2}; + __property FloatingMode = {default=0}; + __property Font; + __property FullSize = {default=0}; + __property HideWhenInactive = {default=1}; + __property LastDock; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property Resizable = {default=1}; + __property ShowCaption = {default=1}; + __property ShowHint; + __property Stretch = {default=0}; + __property SmoothDrag = {default=1}; + __property TabOrder = {default=-1}; + __property UseLastDock = {default=1}; + __property Visible = {default=1}; + __property OnClose; + __property OnCloseQuery; + __property OnContextPopup; + __property OnDblClick; + __property OnDragDrop; + __property OnDragOver; + __property OnDockChanged; + __property OnDockChanging; + __property OnDockChangingHidden; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnMove; + __property OnRecreated; + __property OnRecreating; + __property OnResize; + __property OnVisibleChanged; + __property ClientAreaHeight; + __property ClientAreaWidth; + __property MaxClientHeight = {default=0}; + __property MaxClientWidth = {default=0}; + __property MinClientHeight = {default=32}; + __property MinClientWidth = {default=32}; + __property OnDrawBackground; +public: + /* TSpTBXCustomToolWindow.Create */ inline __fastcall virtual TSpTBXToolWindow(Classes::TComponent* AOwner) : TSpTBXCustomToolWindow(AOwner) { } + /* TSpTBXCustomToolWindow.Destroy */ inline __fastcall virtual ~TSpTBXToolWindow(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXToolWindow(HWND ParentWindow) : TSpTBXCustomToolWindow(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXFloatingWindowParent; +class PASCALIMPLEMENTATION TSpTBXFloatingWindowParent : public Tb2dock::TTBFloatingWindowParent +{ + typedef Tb2dock::TTBFloatingWindowParent inherited; + +private: + bool FCloseButtonHover; + bool FCloseOnAltF4; + void __fastcall UpdateDwmNCSize(void); + HIDESBASE MESSAGE void __fastcall CMMouseLeave(Messages::TMessage &Message); + MESSAGE void __fastcall WMActivateApp(Messages::TWMActivateApp &Message); + HIDESBASE MESSAGE void __fastcall WMClose(Messages::TWMNoParams &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TMessage &Message); + MESSAGE void __fastcall WMNCMouseLeave(Messages::TMessage &Message); + MESSAGE void __fastcall WMNCMouseMove(Messages::TWMNCHitMessage &Message); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + void __fastcall CancelNCHover(void); + virtual void __fastcall CreateWnd(void); + DYNAMIC void __fastcall DrawNCArea(const bool DrawToDC, const HDC ADC, const HRGN Clip, Tb2dock::TTBToolWindowNCRedrawWhat RedrawWhat); + void __fastcall RedrawCloseButton(void); + DYNAMIC void __fastcall VisibleChanging(void); + __property bool CloseButtonHover = {read=FCloseButtonHover, nodefault}; + +public: + __fastcall virtual TSpTBXFloatingWindowParent(Classes::TComponent* AOwner, int Dummy); + __fastcall virtual ~TSpTBXFloatingWindowParent(void); + __property bool CloseOnAltF4 = {read=FCloseOnAltF4, write=FCloseOnAltF4, nodefault}; +public: + /* TCustomForm.Create */ inline __fastcall virtual TSpTBXFloatingWindowParent(Classes::TComponent* AOwner) : Tb2dock::TTBFloatingWindowParent(AOwner) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXFloatingWindowParent(HWND ParentWindow) : Tb2dock::TTBFloatingWindowParent(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXPopupWindow; +class PASCALIMPLEMENTATION TSpTBXPopupWindow : public Tb2item::TTBPopupWindow +{ + typedef Tb2item::TTBPopupWindow inherited; + +private: + bool FPaintingClientArea; + tagSIZE FMaximumImageSize; + bool __fastcall CanDrawGutter(void); + HIDESBASE MESSAGE void __fastcall CMHintShow(Controls::TCMHintShow &Message); + HIDESBASE MESSAGE void __fastcall CMShowingchanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + HIDESBASE MESSAGE void __fastcall WMNCPaint(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMPrint(Messages::TMessage &Message); + +protected: + DYNAMIC Tb2item::TTBViewClass __fastcall GetViewClass(void); + virtual void __fastcall DoPopupShowingChanged(bool IsVisible); + virtual void __fastcall PaintBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + +public: + __fastcall virtual TSpTBXPopupWindow(Classes::TComponent* AOwner, const Tb2item::TTBView* AParentView, const Tb2item::TTBCustomItem* AItem, const bool ACustomizing); + __fastcall virtual ~TSpTBXPopupWindow(void); + __property tagSIZE MaximumImageSize = {read=FMaximumImageSize}; +public: + /* TCustomControl.Create */ inline __fastcall virtual TSpTBXPopupWindow(Classes::TComponent* AOwner) : Tb2item::TTBPopupWindow(AOwner) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXPopupWindow(HWND ParentWindow) : Tb2item::TTBPopupWindow(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXPopupWindowView; +class PASCALIMPLEMENTATION TSpTBXPopupWindowView : public Tb2item::TTBPopupView +{ + typedef Tb2item::TTBPopupView inherited; + +protected: + virtual void __fastcall AutoSize(int AWidth, int AHeight); + +public: + void __fastcall SetIsToolbar(const bool Value); + +__published: + __property IsToolbar; +public: + /* TTBView.Create */ inline __fastcall virtual TSpTBXPopupWindowView(Classes::TComponent* AOwner, Tb2item::TTBView* AParentView, Tb2item::TTBCustomItem* AParentItem, Controls::TWinControl* AWindow, bool AIsToolbar, bool ACustomizing, bool AUsePriorityList) : Tb2item::TTBPopupView(AOwner, AParentView, AParentItem, AWindow, AIsToolbar, ACustomizing, AUsePriorityList) { } + /* TTBView.Destroy */ inline __fastcall virtual ~TSpTBXPopupWindowView(void) { } + +}; + + +class DELPHICLASS TSpTBXChevronItem; +class PASCALIMPLEMENTATION TSpTBXChevronItem : public Tb2toolbar::TTBChevronItem +{ + typedef Tb2toolbar::TTBChevronItem inherited; + +protected: + virtual Tb2item::TTBPopupWindowClass __fastcall GetPopupWindowClass(void); + +public: + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); +public: + /* TTBChevronItem.Create */ inline __fastcall virtual TSpTBXChevronItem(Classes::TComponent* AOwner) : Tb2toolbar::TTBChevronItem(AOwner) { } + +public: + /* TTBCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXChevronItem(void) { } + +}; + + +class DELPHICLASS TSpTBXChevronItemViewer; +class PASCALIMPLEMENTATION TSpTBXChevronItemViewer : public Tb2item::TTBItemViewer +{ + typedef Tb2item::TTBItemViewer inherited; + +protected: + virtual void __fastcall Paint(const Graphics::TCanvas* Canvas, const Types::TRect &ClientAreaRect, bool IsSelected, bool IsPushed, bool UseDisabledShadow); + +public: + virtual Graphics::TColor __fastcall GetTextColor(Sptbxskins::TSpTBXSkinStatesType State); +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXChevronItemViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : Tb2item::TTBItemViewer(AView, AItem, AGroupLevel) { } + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXChevronItemViewer(void) { } + +}; + + +class DELPHICLASS TSpTBXChevronPopupWindow; +class PASCALIMPLEMENTATION TSpTBXChevronPopupWindow : public TSpTBXPopupWindow +{ + typedef TSpTBXPopupWindow inherited; + +private: + HIDESBASE MESSAGE void __fastcall CMColorChanged(Messages::TMessage &Message); +public: + /* TSpTBXPopupWindow.CreatePopupWindow */ inline __fastcall virtual TSpTBXChevronPopupWindow(Classes::TComponent* AOwner, const Tb2item::TTBView* AParentView, const Tb2item::TTBCustomItem* AItem, const bool ACustomizing) : TSpTBXPopupWindow(AOwner, AParentView, AItem, ACustomizing) { } + /* TSpTBXPopupWindow.Destroy */ inline __fastcall virtual ~TSpTBXChevronPopupWindow(void) { } + +public: + /* TCustomControl.Create */ inline __fastcall virtual TSpTBXChevronPopupWindow(Classes::TComponent* AOwner) : TSpTBXPopupWindow(AOwner) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXChevronPopupWindow(HWND ParentWindow) : TSpTBXPopupWindow(ParentWindow) { } + +}; + + +__interface ISpTBXPopupMenu; +typedef System::DelphiInterface _di_ISpTBXPopupMenu; +__interface INTERFACE_UUID("{C576A225-6E42-49F6-96E5-712510C5D85C}") ISpTBXPopupMenu : public System::IInterface +{ + +public: + virtual bool __fastcall InternalPopup(int X, int Y, bool ForceFocus, Controls::TControl* PopupControl = (Controls::TControl*)(0x0)) = 0 ; +}; + +class DELPHICLASS TSpTBXPopupMenu; +class PASCALIMPLEMENTATION TSpTBXPopupMenu : public Tb2item::TTBPopupMenu +{ + typedef Tb2item::TTBPopupMenu inherited; + +private: + Tb2item::TTBCustomItem* FClickedItem; + bool FReturnClickedItemOnly; + bool FToolBoxPopup; + TSpTBXPopupEvent __fastcall GetOnInitPopup(); + void __fastcall SetOnInitPopup(const TSpTBXPopupEvent Value); + Classes::TNotifyEvent __fastcall GetOnClosePopup(); + void __fastcall SetOnClosePopup(const Classes::TNotifyEvent Value); + +protected: + virtual bool __fastcall InternalPopup(int X, int Y, bool ForceFocus, Controls::TControl* PopupControl = (Controls::TControl*)(0x0)); + DYNAMIC Tb2item::TTBRootItemClass __fastcall GetRootItemClass(void); + +public: + virtual void __fastcall Popup(int X, int Y); + HIDESBASE virtual Tb2item::TTBCustomItem* __fastcall PopupEx(int X, int Y, Controls::TControl* PopupControl = (Controls::TControl*)(0x0), bool ReturnClickedItemOnly = false); + +__published: + __property bool ToolBoxPopup = {read=FToolBoxPopup, write=FToolBoxPopup, default=0}; + __property TSpTBXPopupEvent OnInitPopup = {read=GetOnInitPopup, write=SetOnInitPopup}; + __property Classes::TNotifyEvent OnClosePopup = {read=GetOnClosePopup, write=SetOnClosePopup}; +public: + /* TTBPopupMenu.Create */ inline __fastcall virtual TSpTBXPopupMenu(Classes::TComponent* AOwner) : Tb2item::TTBPopupMenu(AOwner) { } + /* TTBPopupMenu.Destroy */ inline __fastcall virtual ~TSpTBXPopupMenu(void) { } + +private: + void *__ISpTBXPopupMenu; /* ISpTBXPopupMenu */ + +public: + #if defined(MANAGED_INTERFACE_OPERATORS) + operator _di_ISpTBXPopupMenu() + { + _di_ISpTBXPopupMenu intf; + GetInterface(intf); + return intf; + } + #else + operator ISpTBXPopupMenu*(void) { return (ISpTBXPopupMenu*)&__ISpTBXPopupMenu; } + #endif + +}; + + +class DELPHICLASS TSpTBXCompoundItemsControl; +class PASCALIMPLEMENTATION TSpTBXCompoundItemsControl : public TSpTBXCustomControl +{ + typedef TSpTBXCustomControl inherited; + +private: + Sptbxskins::TSpTBXSkinType FSkinType; + void __fastcall DockRequestDock(System::TObject* Sender, Tb2dock::TTBCustomDockableWindow* Bar, bool &Accept); + Tb2item::TTBRootItem* __fastcall GetRootItems(void); + TSpTBXToolbarView* __fastcall GetView(void); + Imglist::TCustomImageList* __fastcall GetImages(void); + void __fastcall SetImages(const Imglist::TCustomImageList* Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + TSpTBXDock* FDock; + TSpTBXToolbar* FToolbar; + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual TSpTBXDockClass __fastcall GetDockClass(void); + virtual TSpTBXToolbarClass __fastcall GetToolbarClass(void); + virtual Tb2item::TTBCustomItem* __fastcall GetItems(void); + virtual void __fastcall Loaded(void); + virtual void __fastcall SetName(const Classes::TComponentName Value); + __property Imglist::TCustomImageList* Images = {read=GetImages, write=SetImages}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; + +public: + __fastcall virtual TSpTBXCompoundItemsControl(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCompoundItemsControl(void); + DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root); + virtual void __fastcall InvalidateBackground(bool InvalidateChildren = true); + __property TSpTBXToolbarView* View = {read=GetView}; + +__published: + __property Tb2item::TTBRootItem* Items = {read=GetRootItems}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCompoundItemsControl(HWND ParentWindow) : TSpTBXCustomControl(ParentWindow) { } + +private: + void *__ITBItems; /* Tb2item::ITBItems */ + +public: + #if defined(MANAGED_INTERFACE_OPERATORS) + operator Tb2item::_di_ITBItems() + { + Tb2item::_di_ITBItems intf; + GetInterface(intf); + return intf; + } + #else + operator ITBItems*(void) { return (ITBItems*)&__ITBItems; } + #endif + +}; + + +class DELPHICLASS TSpTBXCompoundBar; +class PASCALIMPLEMENTATION TSpTBXCompoundBar : public TSpTBXCompoundItemsControl +{ + typedef TSpTBXCompoundItemsControl inherited; + +private: + TSpTBXDrawEvent FOnDrawDockBackground; + void __fastcall DrawDockBackground(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + void __fastcall DrawToolbarBackground(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + void __fastcall DockResize(System::TObject* Sender); + +protected: + virtual void __fastcall DoDrawDockBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + __property TSpTBXDrawEvent OnDrawDockBackground = {read=FOnDrawDockBackground, write=FOnDrawDockBackground}; + +public: + __fastcall virtual TSpTBXCompoundBar(Classes::TComponent* AOwner); +public: + /* TSpTBXCompoundItemsControl.Destroy */ inline __fastcall virtual ~TSpTBXCompoundBar(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCompoundBar(HWND ParentWindow) : TSpTBXCompoundItemsControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXButtonOptions; +class PASCALIMPLEMENTATION TSpTBXButtonOptions : public Classes::TPersistent +{ + typedef Classes::TPersistent inherited; + +private: + Tb2item::TTBGroupItem* FEditableItems; + TSpTBXItem* FCloseButton; + TSpTBXItem* FMinimizeButton; + TSpTBXItem* FMaximizeButton; + TSpTBXRightAlignSpacerItem* FRightAlignSpacer; + int FCaptionImageIndex; + int FCloseImageIndex; + int FMinimizeImageIndex; + int FMaximizeImageIndex; + int FRestoreImageIndex; + System::WideString FCaptionLabel; + bool FCaption; + bool FClose; + bool FMinimize; + bool FMaximize; + bool FButtonBorders; + int FTitleBarMaxSize; + void __fastcall SetCaptionImageIndex(int Value); + void __fastcall SetCloseImageIndex(int Value); + void __fastcall SetCaptionLabel(const System::WideString Value); + void __fastcall SetMaximizeImageIndex(int Value); + void __fastcall SetRestoreImageIndex(int Value); + void __fastcall SetMinimizeImageIndex(int Value); + void __fastcall SetCaption(const bool Value); + void __fastcall SetClose(const bool Value); + void __fastcall SetMaximize(const bool Value); + void __fastcall SetMinimize(const bool Value); + void __fastcall SetTitleBarMaxSize(const int Value); + +protected: + Controls::TWinControl* FParentControl; + TSpTBXToolbar* FToolbar; + virtual void __fastcall ButtonsDrawImage(System::TObject* Sender, Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, const TSpTBXPaintStage PaintStage, Imglist::TCustomImageList* &AImageList, int &AImageIndex, Types::TRect &ARect, bool &PaintDefault); + virtual void __fastcall ButtonsDrawItem(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall ButtonsClick(System::TObject* Sender) = 0 ; + virtual void __fastcall CreateButtons(void); + virtual void __fastcall UpdateButtonsVisibility(void); + virtual void __fastcall SetupButton(TSpTBXCustomItem* B); + virtual bool __fastcall Restoring(TSpTBXCustomItem* B) = 0 ; + +public: + __fastcall virtual TSpTBXButtonOptions(Controls::TWinControl* AParent); + virtual void __fastcall SetupButtonIcon(TSpTBXCustomItem* B); + void __fastcall MoveItemToTheLeft(Tb2item::TTBCustomItem* B); + __property Tb2item::TTBGroupItem* EditableItems = {read=FEditableItems}; + __property TSpTBXRightAlignSpacerItem* RightAlignSpacer = {read=FRightAlignSpacer}; + __property TSpTBXItem* MinimizeButton = {read=FMinimizeButton}; + __property TSpTBXItem* MaximizeButton = {read=FMaximizeButton}; + __property TSpTBXItem* CloseButton = {read=FCloseButton}; + __property System::WideString CaptionLabel = {read=FCaptionLabel, write=SetCaptionLabel}; + +__published: + __property bool ButtonBorders = {read=FButtonBorders, write=FButtonBorders, default=1}; + __property bool Caption = {read=FCaption, write=SetCaption, default=1}; + __property bool Close = {read=FClose, write=SetClose, default=1}; + __property bool Minimize = {read=FMinimize, write=SetMinimize, default=1}; + __property bool Maximize = {read=FMaximize, write=SetMaximize, default=1}; + __property int CaptionImageIndex = {read=FCaptionImageIndex, write=SetCaptionImageIndex, default=-1}; + __property int CloseImageIndex = {read=FCloseImageIndex, write=SetCloseImageIndex, default=-1}; + __property int MinimizeImageIndex = {read=FMinimizeImageIndex, write=SetMinimizeImageIndex, default=-1}; + __property int MaximizeImageIndex = {read=FMaximizeImageIndex, write=SetMaximizeImageIndex, default=-1}; + __property int RestoreImageIndex = {read=FRestoreImageIndex, write=SetRestoreImageIndex, default=-1}; + __property int TitleBarMaxSize = {read=FTitleBarMaxSize, write=SetTitleBarMaxSize, default=21}; +public: + /* TPersistent.Destroy */ inline __fastcall virtual ~TSpTBXButtonOptions(void) { } + +}; + + +class DELPHICLASS TSpTBXStatusToolbar; +class PASCALIMPLEMENTATION TSpTBXStatusToolbar : public TSpTBXToolbar +{ + typedef TSpTBXToolbar inherited; + +private: + bool FSizeGrip; + Sptbxskins::TSpTBXSkinType FSkinType; + void __fastcall SetSizeGrip(const bool Value); + HIDESBASE MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &Message); + +protected: + Forms::TCustomForm* FParentForm; + bool __fastcall IsPointInGrip(const Types::TPoint &P); + virtual Graphics::TColor __fastcall GetItemsTextColor(Sptbxskins::TSpTBXSkinStatesType State); + virtual int __fastcall GetRightAlignMargin(void); + Forms::TWindowState __fastcall GetParentFormWindowState(void); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + HIDESBASE MESSAGE void __fastcall WMNCLButtonDown(Messages::TWMNCHitMessage &Message); + +public: + __fastcall virtual TSpTBXStatusToolbar(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXStatusToolbar(void); + Types::TRect __fastcall GetGripRect(); + bool __fastcall NeedsSeparatorRepaint(void); + +__published: + __property bool SizeGrip = {read=FSizeGrip, write=SetSizeGrip, default=1}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXStatusToolbar(HWND ParentWindow) : TSpTBXToolbar(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXCustomStatusBar; +class PASCALIMPLEMENTATION TSpTBXCustomStatusBar : public TSpTBXCompoundBar +{ + typedef TSpTBXCompoundBar inherited; + +private: + bool __fastcall GetSizeGrip(void); + void __fastcall SetSizeGrip(const bool Value); + TSpTBXStatusToolbar* __fastcall GetStatusToolbar(void); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + +protected: + Forms::TWindowState FPrevState; + virtual bool __fastcall CanResize(int &NewWidth, int &NewHeight); + virtual void __fastcall DoDrawDockBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DrawSeparators(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Types::TRect &AGripRect); + virtual TSpTBXToolbarClass __fastcall GetToolbarClass(void); + __property Align = {default=2}; + __property bool SizeGrip = {read=GetSizeGrip, write=SetSizeGrip, default=1}; + +public: + __fastcall virtual TSpTBXCustomStatusBar(Classes::TComponent* AOwner); + __property TSpTBXStatusToolbar* Toolbar = {read=GetStatusToolbar}; +public: + /* TSpTBXCompoundItemsControl.Destroy */ inline __fastcall virtual ~TSpTBXCustomStatusBar(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomStatusBar(HWND ParentWindow) : TSpTBXCompoundBar(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXStatusBar; +class PASCALIMPLEMENTATION TSpTBXStatusBar : public TSpTBXCustomStatusBar +{ + typedef TSpTBXCustomStatusBar inherited; + +__published: + __property Align = {default=2}; + __property Anchors = {default=3}; + __property BiDiMode; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentColor = {default=1}; + __property ParentBiDiMode = {default=1}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowHint; + __property Visible = {default=1}; + __property OnCanResize; + __property OnContextPopup; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnResize; + __property OnStartDock; + __property OnStartDrag; + __property Images; + __property SizeGrip = {default=1}; + __property SkinType = {default=2}; + __property OnDrawDockBackground; +public: + /* TSpTBXCustomStatusBar.Create */ inline __fastcall virtual TSpTBXStatusBar(Classes::TComponent* AOwner) : TSpTBXCustomStatusBar(AOwner) { } + +public: + /* TSpTBXCompoundItemsControl.Destroy */ inline __fastcall virtual ~TSpTBXStatusBar(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXStatusBar(HWND ParentWindow) : TSpTBXCustomStatusBar(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXTitleToolbar; +class DELPHICLASS TSpTBXCustomTitleBar; +class PASCALIMPLEMENTATION TSpTBXTitleToolbar : public TSpTBXToolbar +{ + typedef TSpTBXToolbar inherited; + +protected: + virtual Graphics::TColor __fastcall GetItemsTextColor(Sptbxskins::TSpTBXSkinStatesType State); + TSpTBXCustomTitleBar* __fastcall GetTitleBar(void); + virtual int __fastcall GetRightAlignMargin(void); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); +public: + /* TSpTBXToolbar.Create */ inline __fastcall virtual TSpTBXTitleToolbar(Classes::TComponent* AOwner) : TSpTBXToolbar(AOwner) { } + /* TSpTBXToolbar.Destroy */ inline __fastcall virtual ~TSpTBXTitleToolbar(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXTitleToolbar(HWND ParentWindow) : TSpTBXToolbar(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXTitleBarButtonOptions; +class PASCALIMPLEMENTATION TSpTBXTitleBarButtonOptions : public TSpTBXButtonOptions +{ + typedef TSpTBXButtonOptions inherited; + +private: + bool FSystemMenu; + TSpTBXSystemMenuItem* FSystemButton; + void __fastcall SetSystemMenu(const bool Value); + +protected: + TSpTBXCustomTitleBar* FTitleBar; + virtual void __fastcall ButtonsDrawItem(System::TObject* Sender, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall ButtonsClick(System::TObject* Sender); + virtual void __fastcall CreateButtons(void); + virtual bool __fastcall Restoring(TSpTBXCustomItem* B); + +public: + __fastcall virtual TSpTBXTitleBarButtonOptions(Controls::TWinControl* AParent); + __property TSpTBXSystemMenuItem* SystemButton = {read=FSystemButton}; + +__published: + __property bool SystemMenu = {read=FSystemMenu, write=SetSystemMenu, default=1}; +public: + /* TPersistent.Destroy */ inline __fastcall virtual ~TSpTBXTitleBarButtonOptions(void) { } + +}; + + +class PASCALIMPLEMENTATION TSpTBXCustomTitleBar : public TSpTBXCompoundBar +{ + typedef TSpTBXCompoundBar inherited; + +private: + bool FActive; + bool FFixedSize; + bool FFullScreenMaximize; + bool FMouseActive; + TSpTBXTitleBarButtonOptions* FOptions; + void *FOldAppWndProc; + void *FNewAppWndProc; + TSpTBXDrawEvent FOnDrawBackground; + TSpTBXPopupEvent FOnSystemMenuPopup; + Classes::TWndMethod FOldParentFormWndProc; + void __fastcall AppWndProc(Messages::TMessage &Msg); + void __fastcall NewParentFormWndProc(Messages::TMessage &Message); + void __fastcall SetActive(const bool Value); + void __fastcall SetMouseActive(const bool Value); + void __fastcall SetFullScreenMaximize(const bool Value); + Forms::TWindowState __fastcall GetWindowState(void); + void __fastcall SetWindowState(const Forms::TWindowState Value); + HIDESBASE MESSAGE void __fastcall CMTextChanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &Message); + HIDESBASE MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMWindowPosChanged(Messages::TWMWindowPosMsg &Message); + +protected: + Forms::TCustomForm* FParentForm; + virtual void __fastcall Loaded(void); + Types::TPoint __fastcall GetFloatingBorderSize(); + virtual Tb2item::TTBCustomItem* __fastcall GetItems(void); + virtual TSpTBXToolbarClass __fastcall GetToolbarClass(void); + void __fastcall ChangeTitleBarState(bool Activate); + void __fastcall UpdateSkinMetrics(void); + virtual void __fastcall DoDrawDockBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall AdjustClientRect(Types::TRect &Rect); + void __fastcall GetSizeCursor(const Types::TPoint &MousePos, int &SizeCursor, int &SizeCode); + DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + __property bool Active = {read=FActive, write=SetActive, default=1}; + __property Align = {default=5}; + __property bool FixedSize = {read=FFixedSize, write=FFixedSize, default=0}; + __property bool FullScreenMaximize = {read=FFullScreenMaximize, write=SetFullScreenMaximize, default=0}; + __property TSpTBXTitleBarButtonOptions* Options = {read=FOptions, write=FOptions}; + __property Forms::TWindowState WindowState = {read=GetWindowState, write=SetWindowState, nodefault}; + __property TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; + __property TSpTBXPopupEvent OnSystemMenuPopup = {read=FOnSystemMenuPopup, write=FOnSystemMenuPopup}; + +public: + __fastcall virtual TSpTBXCustomTitleBar(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomTitleBar(void); + Types::TRect __fastcall GetClientAreaRect(); + bool __fastcall IsActive(void); + __property bool MouseActive = {read=FMouseActive, write=SetMouseActive, default=1}; + __property TSpTBXToolbar* Toolbar = {read=FToolbar}; + +__published: + __property Caption; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomTitleBar(HWND ParentWindow) : TSpTBXCompoundBar(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXTitleBar; +class PASCALIMPLEMENTATION TSpTBXTitleBar : public TSpTBXCustomTitleBar +{ + typedef TSpTBXCustomTitleBar inherited; + +__published: + __property Align = {default=5}; + __property Anchors = {default=3}; + __property Color = {default=-16777211}; + __property BiDiMode; + __property Constraints; + __property DockSite = {default=0}; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentColor = {default=1}; + __property ParentBiDiMode = {default=1}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowHint; + __property Visible = {default=1}; + __property OnCanResize; + __property OnContextPopup; + __property OnDockDrop; + __property OnDockOver; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnEnter; + __property OnExit; + __property OnGetSiteInfo; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnResize; + __property OnStartDock; + __property OnStartDrag; + __property OnUnDock; + __property Active = {default=1}; + __property FixedSize = {default=0}; + __property FullScreenMaximize = {default=0}; + __property Images; + __property Options; + __property OnDrawBackground; + __property OnDrawDockBackground; + __property OnSystemMenuPopup; +public: + /* TSpTBXCustomTitleBar.Create */ inline __fastcall virtual TSpTBXTitleBar(Classes::TComponent* AOwner) : TSpTBXCustomTitleBar(AOwner) { } + /* TSpTBXCustomTitleBar.Destroy */ inline __fastcall virtual ~TSpTBXTitleBar(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXTitleBar(HWND ParentWindow) : TSpTBXCustomTitleBar(ParentWindow) { } + +}; + + +class DELPHICLASS TBitmapHint; +class PASCALIMPLEMENTATION TBitmapHint : public Controls::THintWindow +{ + typedef Controls::THintWindow inherited; + +private: + Graphics::TBitmap* FHintBitmap; + bool FActivating; + HIDESBASE MESSAGE void __fastcall CMTextChanged(Messages::TMessage &Message); + +protected: + virtual void __fastcall Paint(void); + +public: + __property bool Activating = {read=FActivating, nodefault}; + virtual void __fastcall ActivateHint(const Types::TRect &Rect, const System::UnicodeString AHint); + virtual void __fastcall ActivateHintData(const Types::TRect &Rect, const System::UnicodeString AHint, void * AData); +public: + /* THintWindow.Create */ inline __fastcall virtual TBitmapHint(Classes::TComponent* AOwner) : Controls::THintWindow(AOwner) { } + +public: + /* TCustomControl.Destroy */ inline __fastcall virtual ~TBitmapHint(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TBitmapHint(HWND ParentWindow) : Controls::THintWindow(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +static const Word C_SpTBXRadioGroupIndex = 0x22b8; +static const Word CM_SPPOPUPCLOSE = 0xb457; +#define rvSpTBXDisplayMode L"DisplayMode" +static const ShortInt CPDefaultCols = 0x8; +static const ShortInt CPDefaultRows = 0x5; +extern PACKAGE Graphics::TFont* SmCaptionFont; +extern PACKAGE Graphics::TBitmap* SpStockHintBitmap; +extern PACKAGE Controls::TImageList* MDIButtonsImgList; +extern PACKAGE Controls::THintWindowClass SpTBXHintWindowClass; +static const ShortInt DefaultToolbarBorderSize = 0x2; +static const ShortInt crSpTBXNewHandPoint = 0x64; +static const ShortInt crSpTBXCustomization = 0x65; +static const ShortInt crSpTBXCustomizationCancel = 0x66; +extern PACKAGE void __fastcall SpFillItemInfo(Graphics::TCanvas* ACanvas, Tb2item::TTBItemViewer* IV, /* out */ Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); +extern PACKAGE Types::TRect __fastcall SpGetBoundsRect(Tb2item::TTBItemViewer* IV, Tb2item::TTBRootItem* Root); +extern PACKAGE void __fastcall SpGetAllItems(Tb2item::TTBCustomItem* AParentItem, Classes::TStringList* ItemsList, bool ClearFirst = true); +extern PACKAGE tagSIZE __fastcall SpGetMenuMaximumImageSize(Tb2item::TTBView* View); +extern PACKAGE Tb2item::TTBItemViewer* __fastcall SpGetItemViewerFromPoint(Tb2item::TTBRootItem* Root, Tb2item::TTBView* View, const Types::TPoint &P, bool ProcessGroupItems = true); +extern PACKAGE Tb2item::TTBItemViewer* __fastcall SpGetNextItemSameEdge(Tb2item::TTBView* View, Tb2item::TTBItemViewer* IV, bool GoForward, TSpTBXSearchItemViewerType SearchType); +extern PACKAGE TSpTBXItemViewer* __fastcall SpGetFirstRightAlignSpacer(Tb2item::TTBView* View); +extern PACKAGE TSpTBXItemViewer* __fastcall SpGetRightAlignedItems(Tb2item::TTBView* View, Classes::TList* RightAlignedList, bool IsRotated, /* out */ int &VisibleTotalWidth, /* out */ int &RightAlignedTotalWidth); +extern PACKAGE void __fastcall SpInvalidateItem(Tb2item::TTBView* View, Tb2item::TTBCustomItem* Item); +extern PACKAGE Tb2item::TTBItemViewer* __fastcall SpFindItemViewer(Tb2item::TTBView* View, Tb2item::TTBCustomItem* Item); +extern PACKAGE Tb2item::TTBControlItem* __fastcall SpFindControlItem(Tb2item::TTBCustomItem* Item, Controls::TControl* Ctl, bool Recurse = true); +extern PACKAGE void __fastcall SpGetDropPosItemViewer(Tb2item::TTBRootItem* Root, Tb2item::TTBView* View, const Types::TPoint &P, /* out */ Tb2item::TTBItemViewer* &DestIV, /* out */ int &DestItemPos, /* out */ Types::TRect &DropMark)/* overload */; +extern PACKAGE void __fastcall SpGetDropPosItemViewer(Tb2item::TTBRootItem* Root, Tb2item::TTBView* View, const Types::TPoint &P, int SourceItemPos, /* out */ Tb2item::TTBItemViewer* &DestIV, /* out */ int &DestItemPos)/* overload */; +extern PACKAGE int __fastcall SpGetDragHandleSize(Tb2dock::TTBCustomDockableWindow* Toolbar); +extern PACKAGE bool __fastcall SpIsVerticalToolbar(Tb2dock::TTBCustomDockableWindow* Toolbar); +extern PACKAGE bool __fastcall SpIsDockUsingBitmap(Tb2dock::TTBDock* Dock); +extern PACKAGE void __fastcall SpDrawXPMenuItem(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); +extern PACKAGE void __fastcall SpDrawXPMenuSeparator(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool MenuItemStyle, bool Vertical); +extern PACKAGE void __fastcall SpDrawXPMenuItemImage(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, Imglist::TCustomImageList* ImageList, int ImageIndex); +extern PACKAGE void __fastcall SpDrawXPMenuGutter(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Sptbxskins::TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPMenuPopupWindow(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Types::TRect &OpenIVRect, bool DrawGutter, int ImageSize, Sptbxskins::TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPStatusBar(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Types::TRect &AGripRect, Sptbxskins::TSpTBXSkinType SkinType, bool UsingOfficeTheme); +extern PACKAGE void __fastcall SpDrawXPTitleBar(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool IsActive, bool DrawBorders = true); +extern PACKAGE void __fastcall SpDrawXPTitleBarBody(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool IsActive, const Types::TPoint &BorderSize, bool DrawBody = true); +extern PACKAGE void __fastcall SpDrawXPDock(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Sptbxskins::TSpTBXSkinType SkinType, bool Vertical = false); +extern PACKAGE void __fastcall SpDrawXPToolbar(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Sptbxskins::TSpTBXSkinType SkinType, bool Docked, bool Floating, bool Vertical, bool PaintSkinBackground, bool PaintBorders, Sptbxskins::TSpTBXSkinComponentsType SkinComponent = (Sptbxskins::TSpTBXSkinComponentsType)(0xe))/* overload */; +extern PACKAGE void __fastcall SpDrawXPToolbar(Tb2dock::TTBCustomDockableWindow* W, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool PaintOnNCArea, bool PaintBorders = true, Sptbxskins::TSpTBXSkinComponentsType SkinComponent = (Sptbxskins::TSpTBXSkinComponentsType)(0xe))/* overload */; +extern PACKAGE void __fastcall SpDrawXPToolbarGrip(Tb2dock::TTBCustomDockableWindow* W, Graphics::TCanvas* ACanvas, const Types::TRect &ARect); +extern PACKAGE void __fastcall SpDrawXPTooltipBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); +extern PACKAGE Types::TPoint __fastcall SpCalcPopupPosition(const int X, const int Y, const int Width, const int Height, Controls::TControl* PopupControl = (Controls::TControl*)(0x0), bool IsVertical = false); +extern PACKAGE System::WideString __fastcall SpHMenuGetCaption(HMENU Menu, int Index); +extern PACKAGE bool __fastcall SpHMenuToTBMenuItem(HMENU Menu, Tb2item::TTBCustomItem* ParentItem); +extern PACKAGE int __fastcall SpShowSystemPopupMenu(Forms::TCustomForm* ParentForm, const Types::TPoint &ScreenPos, bool DoDefault = true); +extern PACKAGE bool __fastcall SpFillSystemSpTBXPopup(Forms::TCustomForm* ParentForm, Tb2item::TTBCustomItem* ParentItem, bool ShowSize, bool ShowMinimize, bool ShowMaximize, bool ShowClose, Classes::TNotifyEvent ClickEvent = 0x0); +extern PACKAGE int __fastcall SpShowSystemSpTBXPopupMenu(Forms::TCustomForm* ParentForm, const Types::TPoint &ScreenPos, bool ShowSize, bool ShowMinimize, bool ShowMaximize, bool ShowClose, TSpTBXPopupEvent PopupEvent, bool DoDefault = true); +extern PACKAGE void __fastcall SpActivateDwmNC(Controls::TWinControl* WinControl, bool Activate); +extern PACKAGE bool __fastcall SpIsDwmCompositionEnabled(void); +extern PACKAGE bool __fastcall SpCanFocus(Controls::TWinControl* WinControl); +extern PACKAGE bool __fastcall SpIsFocused(Controls::TWinControl* WinControl, /* out */ Controls::TWinControl* &FocusedChild); +extern PACKAGE Controls::TWinControl* __fastcall SpFocusFirstChild(Controls::TWinControl* WinControl); +extern PACKAGE int __fastcall SpFindControl(Controls::TWinControl* Parent, Controls::TControl* Child); +extern PACKAGE Controls::TWinControl* __fastcall SpFindParent(Controls::TControl* Control, System::TClass ParentClass); +extern PACKAGE bool __fastcall SpHasBorders(Controls::TWinControl* WinControl); +extern PACKAGE Forms::TWindowState __fastcall SpGetFormWindowState(Forms::TCustomForm* F, /* out */ Types::TRect &RestoreBoundsRect); +extern PACKAGE void __fastcall SpSetFormWindowState(Forms::TCustomForm* F, Forms::TWindowState WindowState, const Types::TRect &RestoreBoundsRect); +extern PACKAGE bool __fastcall SpGetTaskBar(/* out */ unsigned &State, /* out */ unsigned &Edge, /* out */ Types::TRect &Bounds); +extern PACKAGE void __fastcall SpRecalcNCArea(Controls::TWinControl* WinControl); +extern PACKAGE void __fastcall SpCustomizeAllToolbars(Classes::TComponent* AParentComponent, bool Reset); +extern PACKAGE void __fastcall SpBeginUpdateAllToolbars(Classes::TComponent* AParentComponent); +extern PACKAGE void __fastcall SpEndUpdateAllToolbars(Classes::TComponent* AParentComponent); +extern PACKAGE void __fastcall SpPersistent_AfterInherited_DefineProperties(Classes::TFiler* Filer, Classes::TPersistent* Instance); + +} /* namespace Sptbxitem */ +using namespace Sptbxitem; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxitemHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.pas new file mode 100644 index 0000000..a5e0a28 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXItem.pas @@ -0,0 +1,9857 @@ +unit SpTBXItem; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Wish list for TB2K: + - tboSameHeight option for toolbar items, used to stretch the item + to the highest possible size. + - It would be nice to have a way to get the TTBItemViewer width and height + even when the Item is not visible (TTBItemViewer.BoundsRect is not valid + when the item is not visible). + As a workaround we should use TTBItemViewer.CalcSize method. + - It would be nice to allow component writers to override + TTBCustomToolbar.CreateWrapper so they can create custom TTBControlItem + items descendants as the dropped control wrappers. + - It would be nice to have access to the TTBPopupMenu Viewer before the + popup is showed to initialize the items, for example to set the focus + on a TTBEditItem. + +Development notes: + - All the Windows and Delphi bugs fixes are marked with '[Bugfix]'. + - All the theme changes and adjustments are marked with '[Theme-Change]'. + - All the compatibility changes are marked with '[Backward-Compatibility]'. + - TSpTBXCompoundItemsControl is used as the base class for TB2K items enabled + Controls, it uses the ITBItems interface and streams the items to the DFM. + - When a control is dropped on the toolbar a TTBControlItem is created by + TTBCustomToolbar.CreateWrapper, unfortunately it is created with the + Toolbar.Owner instead of the Form (Owner.Owner for TSpTBXCompoundItemsControl + like the TSpTBXTabSet or TSpTBXStatusBar). The workaround is to handle the + CM_CONTROLCHANGE message in the compound toolbar, stream all the + TTBControlItem.Control to the DFM (the TSpTBXCompoundItemsControl must be + the parent in the DFM), and finally reset the TTBControlItem.Control + parentship to the Toolbar in TSpTBXCompoundItemsControl.Loaded. + +To Do: + - + +History: +8 May 2009 - version 2.4.2 + - Added Dutch translation for the Customizer demo, thanks to + Alfred Vink. + - Added Tooltips Vista theming. + +15 March 2009 - version 2.4.1 + - Fixed incorrect TntAction checking, thanks to Costas Stergiou + for reporting this. + +17 January 2009 - version 2.4 + - Replaced the default Windows taskbar PopupMenu with a skninned + PopupMenu when TSpTBXTitleBar is used on the Main form. + - Fixed incorrect menu separator painting when it was used on + a ToolBoxPopup submenu, thanks to Yury Plashenkov for + reporting this. + - Fixed incorrect menu item margins, thanks to Eduardo Mauro + for reporting this. + +26 September 2008 - version 2.3 + - New Toolbar item added, TSpTBXColorItem. + - Fixed incorrect Alt-Space handling on TSpTBXTitleBar, the + System PopupMenu was still showed even when SystemMenu was + setted to False, thanks to Ilya Zaytsev for reporting this. + - Fixed incorrect items text sizing when SystemFont was setted + to False, thanks to Minoru Yoshida for reporting this. + - Fixed a Delphi 7 bug, D7 hints didn't support multi-monitors, + thanks to Costas Stergiou for reporting this. + +29 July 2008 - version 2.2 + - Fixed AV raised when Screen.MonitorFromWindow failed, thanks + to Andrew Denton for reporting this. + - Added OnClosePopup event to TSpTBXPopupMenu. + +26 June 2008 - version 2.1 + - Added Turkish translation for the Customizer demo, thanks to + Zylar. + - Fixed incorrect keyboard handling on TSpTBXTitleBar, Alt+Space + didn't popup the system menu, thanks to Costas Stergiou for + reporting this. + +3 May 2008 - version 2.0 + - SpTBXLib is now decoupled from TBX and uses the latest version + of TB2K, with NO PATCHES REQUIRED. + - Added HideEmptyPopup property to TSpTBXSubmenuItem, when + the submenu has no items and this property is set the + popup window will not be showed. + - Added Swedish translation for the Customizer demo, thanks to + Mattias Andersson. + +2 April 2008 - version 1.9.5 + - Fixed incorrect item stretching when the toolbar was + vertical and tboImageAboveCaption was set, thanks to + John for reporting this. + - Fixed incorrect item painting when no themes were + used, thanks to Denis for reporting this. + - Fixed incorrect TSpTBXToolPalette.Images handling, thanks + to Minoru Yoshida for reporting this. + - Fixed incorrect menu gutter painting when hints were showed, + thanks to Michele and Beta Xiong for reporting this. + - Fixed incorrect floating border painting when the default + size was changed thanks to Costas Stergiou and Serge + for reporting this. + - Fixed incorrect floating border painting on Vista, + the borders should not be transparent, thanks to + Costas Stergiou for reporting this. + +3 February 2008 - version 1.9.4 + - No changes. + +19 January 2008 - version 1.9.3 + - Completed the Brazilian Portuguese translation of the Customizer + demo, thanks to Mauricio Magnani. + - Added TSpTBXToolWindow component. + - Fixed incorrect gutter painting on the popup menus. + - Fixed item stretching problems + +26 December 2007 - version 1.9.2 + - New component added: TSpTBXToolWindow, a fully customizable + ToolWindow with unicode support. + - Added State parameter to the toolbar items OnDrawCaption event. + - Fixed AV on Delphi 2005, Margins and Paddings were introduced + on Delphi 2006, thanks to Stefan for reporting this. + - Minor bug fixes. + +1 December 2007 - version 1.9.1 + - Added Invalidate method to TSpTBXItem. + - Added OnClosePopup event to TSpTBXSubmenuItem. + - Fixed tboNoRotation use on vertical toolbar items, when + tboImageAboveCaption is not set the glyph should appear + aligned with the caption. + +20 November 2007 - version 1.9 + - New theme engine. + - Added SpTBXHintWindowClass global variable, it specifies which + THintWindow class is used to show the hints. + - Added TSpTBXToolPalette and TSpTBXColorPalette items. + - Added TSpTBXToolWindow component. + - Removed TSpTBXComboBoxItem, TSpTBXDropDownItem, TSpTBXStringList + and TSpTBXUndoList. + +8 February 2007 - version 1.8.3 + - No changes. + +17 December 2006 - version 1.8.2 + - Added Toolbar public property to TSpTBXStatusBar. + +24 November 2006 - version 1.8.1 + - Added properties to TSpTBXRightAlignSpacer: ImageIndex, Images, + OnAdjustFont, OnClick, OnDrawHint, OnDrawImage, OnDrawItem. + - Added unicode shortcut-text support for menu items, thanks + Steve for reporting this. + - Fixed incorrect TSpTBXTitleBar positioning when the + taskbar is moved around the screen, thanks to + Costas Stergiou for reporting this. + - Fixed incorrect TSpTBXStatusBar size grip painting when + Windows XP themes are disabled, thanks to Alexey Naumov + for reporting this. + +27 August 2006 - version 1.8 + - Fixed incorrect DropdownCombo item painting, thanks to + François Rivierre for reporting this. + - Fixed incorrect TSpTBXTitleBar SystemMenu painting, + GetMenuStringW doesn't work correctly on Win2K/WinXP, + when a DBCS code page is active (e.g. Japanese), thanks + to Jordan Russell for reporting this. + http://news.jrsoftware.org/read/article.php?id=12268&group=jrsoftware.toolbar2000.thirdparty + - Fixed bug in TSpTBXLabelItem, clicking a TSpTBXLabelItem + on a popup menu causes the menu to close, thanks to + Piotr Janus for reporting this. + +15 June 2006 - version 1.7 + - Added vertical caption painting to toolbar items. + - Added CaptionGlow and CaptionGlowColor properties to + toolbar Items. + - Added Margins property to toolbar items. + - Fixed incorrect TSpTBXTitleBar resizing when the form is + maximized and the titlebar is activated and deactivated + multiple times, thanks to Costas Stergiou for reporting this. + +4 May 2006 - version 1.6 + - Fixed incorrect TSpTBXStatusBar behavior, the size grip + disappeared when the parent was a TSpTBXTitleBar, thanks to + Costas Stergiou for reporting this. + - Fixed incorrect TSpTBXStatusBar's size grip painting when the + Default theme was used. + - Fixed incorrect TSpTBXLabelItem painting when the label was used + in a submenu, thanks to Costas Stergiou for reporting this. + - Added OnSystemMenuPopup event to TSpTBXTitleBar. + +12 April 2006 - version 1.5 + - Fixed incorrect TSpTBXStatusBar behavior, it didn't resized + the form if the mouse click was on the non-client area of the + status bar, thanks to Frank de Groot for reporting this. + - Fixed incorrect mouse handling in TSpTBXTitlebar, thanks to + Marten Pape for reporting this. + - Fixed incorrect TSpTBXLabelItem alignment on menus, thanks to + Costas Stergiou for reporting this. + - Added ClickedItem parameter to TSpTBXSubmenuItem.OnClosePopup + event. + +27 February 2006 - version 1.4 + - Added SizeGrip property to TSpTBXStatusBar. + - Added FullScreenMaximize property to TSpTBXTitleBar. + +10 February 2006 - version 1.3 + - Fixed AV in TSpTBXTitleBar at designtime, thanks to + Alexey Naumov for reporting this. + - Fixed incorrect system popupmenu visibility in TSpTBXTitleBar. + - Added Active property to TSpTBXTitleBar. + - Added OnDrawBackground event to TSpTBXTitleBar. + - Added OnClosePopup event to TSpTBXSubmenuItem. + +28 December 2005 - version 1.2 + - Fixed incorrect items anchoring. + - Fixed range check errrors. + +18 October 2005 - version 1.1 + - Fixed incorrect TSpTBXStatusBar margins when the form is + maximazed. + - Fixed incorrect accel char handling in TSpTBXToolbar. + - Fixed incorrect TntAction support, the previous version of + TntActions didn't supported unicode enabled ActionLinks. + - Fixed incorrect tab stop chars handling in TSpTBXItem. + - Added MaxSize property to TSpTBXToolbar, determines + the maximum height the toolbar can have. + - Added TBX themes support to TSpTBXTitleBar's system menu. + - Added radio item painting support. + +18 August 2005 - version 1.0 + - Added DisplayOptions property to TSpTBXToolbar, determines + whether the item's image is to be displayed. + - Added Customizable property to TSpTBXToolbar, determines + whether the toolbar is customizable or not. + - Added TitleBarSize property to the Options of the + TSpTBXTitlebar. + +10 June 2005 - version 0.9 + - SpTBXLib may now alternatively, at your option, be used and/or + distributed under the terms of the SpTBXLib License. + Please see the updated LICENSE.TXT file for more information. + +20 May 2005 - version 0.8 + - Fixed incorrect caption centering in TSpTBXItem. + - Fixed incorrect TSpTBXItem hint when accessing TntApplication, + thanks to Erik Maly for reporting this. + - Changed the Options property of TSpTBXTitleBar to use a base class + for default buttons. + - Added ChevronVertical property to TSpTBXToolbar, it changes the + layout of the chevron popup to be vertical. + - Added Wrapping property to TSpTBXItem, it determines the wrapping + type of the item's caption. + - Added FixedSize property to TSpTBXTitleBar, it determines if + the TitleBar can be resized. + +16 February 2005 - version 0.7 + - Fixed TSpTBXThemeGroupItem theme sync bug, it now correctly selects + the current TBX theme. + - Fixed unicode support in W9x. + - Fixed TSpTBXTitleBar painting flicker. + - Fixed TSpTBXStatusBar right align margin. + - Added TBXStyleBackground property to TSpTBXTitleBar, when setted to + true it paints a TBX style background. + - Added AutoCheck property to TSpTBXItem. + +23 December 2004 - version 0.6 + - Fixed hint bug, ampersands were not removed in auto-generated hints. + - Fixed incorrect caption painting when the font is italic, this bug + is present in TBX items, TLabel, TBitBtn, TSpeedButton, TGroupBox, + TRadioGroup, and any other control that uses DrawText to draw the + caption. To reproduce this, drop a TBitBtn, change the caption to + 'WWW' and the font to italic, the last W is cropped. + - Fixed incorrect caption painting when the Default theme is used, + the caption was not painted in a down state when the toolbarstyle + item was pushed, thanks Daniel Rikowski for reporting this. + - Changed the default value of DisplayMode to nbdmDefault. + - New component added, TSpTBXTitleBar: a fully customizable + TitleBar with Unicode text and TBX themes support. + - New component added, TSpTBXPopupMenu: a TTBXPopupMenu descendant + with an OnPopupMenuInit event to setup the items before the popup + is showed, it could be used for example to set the focus to an + EditItem. + - Added SpChangeThemeType utility function, this makes it easier to + switch the theme type of any given control and its children. + +30 August 2004 - version 0.5 + - Reworked the hint show event of the items. + +21 July 2004 - version 0.4 + - Fixed TTBControlItem.Control streaming bug on TSpTBXStatusBar. + - Fixed bad sync of the items unicode caption and hint properties + when an Action was assigned. + +12 July 2004 - version 0.3.1 + - Unchanged. + +9 July 2004 - version 0.3 + - Fixed incorrect TSpTBXItem caption painting when DisplayMode + was nbdmDefault, thanks to Cyril for reporting this. + - Added anchors support for TTBControlItem items, if the associated + Control is client aligned or has akRight in its Anchors property. + - The theme items in TSpTBXThemeGroupItem are now sorted. + - Added OnUpdate event to TSpTBXThemeGroupItem, this event is fired + every time the theme items list is recreated, use this event + to sort or change the items properties. + +27 June 2004 - version 0.2 + - Fixed Toolbar custom painting event. + - Fixed incorrect Shortcut painting in submenus. + - Fixed incorrect Shortcut hint painting. + - Removed thtBitmapSkin from TSpTBXThemeType. + - Published more properties for TSpTBXLabelItem. + - New Toolbar item added, TSpTBXSeparator. + - New component added, TSpTBXStatusBar: a fully customizable + StatusBar with Unicode text and TBX themes support. + +22 June 2004 - version 0.1 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation +{$I TB2Ver.inc} + +uses + Windows, Messages, Classes, SysUtils, Forms, Controls, Graphics, ImgList, + Menus, StdCtrls, ActnList, + {$IFNDEF UNICODE} + TntClasses, TntControls, + {$ENDIF} + TB2Item, TB2Dock, TB2Toolbar, TB2ToolWindow, + SpTBXSkins; + +{$IFDEF UNICODE} +type + TTntStringList = TStringList; +{$ENDIF} + +const + C_SpTBXRadioGroupIndex = 8888; // Default GroupItem of TSpTBXRadioGroupItem + CM_SPPOPUPCLOSE = CM_BASE + 1111; // Message sent to the PopupControl to update its state after the Popup is closed + rvSpTBXDisplayMode = 'DisplayMode'; // Constant used to save the Toolbar DisplayMode with the Customizer. Do not localize! + CPDefaultCols = 8; // ColorPalette constant + CPDefaultRows = 5; // ColorPalette constant + +type + TSpTBXCustomItem = class; + TSpTBXToolbar = class; + TSpTBXStatusToolbar = class; + TSpTBXPopupMenu = class; + + TSpTBXPaintStage = ( + pstPrePaint, // Pre paint stage + pstPostPaint // Post paint stage + ); + + TSpTBXToolbarDisplayMode = ( + tbdmSelectiveCaption, // The caption is displayed if the Item.DisplayMode = nbdmImageAndText + tbdmImageOnly, // Only the images are displayed + tbdmImageAboveCaption, // The images are displayed above the caption + tbdmTextOnly // Show the caption only + ); + + TSpTBXToolbarState = ( + tstResizing, // The toolbar is being resized + tstRightAligning, // The toolbar items are being right aligned + tstAnchoring // The toolbar items are being anchored + ); + + TSpTBXToolbarStates = set of TSpTBXToolbarState; + + TSpBorderIcon = ( + briSystemMenu, // SystemMenu item on the title bar + briMinimize, // Minimize item on the title bar + briMaximize, // Maximize item on the title bar + briClose // Close item on the title bar + ); + + TSpBorderIcons = set of TSpBorderIcon; + + TTextWrapping = ( + twNone, // No wrapping + twEndEllipsis, // End ellipsis '...' + twPathEllipsis, // Path ellipsis '\..\..' + twWrap // Word wrap + ); + + TSpTBXSearchItemViewerType = ( + sivtNormal, // Normal search + sivtInmediate, // Search for the inmediate ItemViewer + sivtInmediateSkipNonVisible// Search for the next inmediate ItemViewer, skipping non visible ones + ); + + TSpTBXGetImageIndexEvent = procedure(Sender: TObject; + var AImageList: TCustomImageList; var AItemIndex: Integer) of object; + + TSpTBXDrawEvent = procedure(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean) of object; + + TSpTBXDrawImageEvent = procedure(Sender: TObject; ACanvas: TCanvas; + State: TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; + var AImageList: TCustomImageList; var AImageIndex: Integer; + var ARect: TRect; var PaintDefault: Boolean) of object; + + TSpTBXDrawItemEvent = procedure(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean) of object; + + TSpTBXDrawPosEvent = procedure(Sender: TObject; ACanvas: TCanvas; + X, Y: Integer; var PaintDefault: Boolean) of object; + + TSpTBXDrawTextEvent = procedure(Sender: TObject; ACanvas: TCanvas; + ClientAreaRect: TRect; State: TSpTBXSkinStatesType; var ACaption: WideString; + var CaptionRect: TRect; var CaptionFormat: Cardinal; IsTextRotated: Boolean; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean) of object; + + TSpTBXDrawHintEvent = procedure(Sender: TObject; AHintBitmap: TBitmap; + var AHint: WideString; var PaintDefault: Boolean) of object; + + TSpTBXItemNotificationEvent = procedure(Sender: TObject; + Ancestor: TTBCustomItem; Relayed: Boolean; Action: TTBItemChangedAction; + Index: Integer; Item: TTBCustomItem) of object; + + TSpTBXRadioGroupFillStringsEvent = procedure(Sender: TObject; + Strings: TTntStringList) of object; + + TSpTBXPopupEvent = procedure(Sender: TObject; PopupView: TTBView) of object; + + { TSpTBXFontSettings } + + TSpTBXFontSize = 25..1000; + + TSpTBXFontSettings = class(TPersistent) + private + FColor: TColor; + FName: TFontName; + FSize: TSpTBXFontSize; + FStyle: TFontStyles; + FOnChange: TNotifyEvent; + procedure SetColor(Value: TColor); + procedure SetName(const Value: TFontName); + procedure SetSize(Value: TSpTBXFontSize); + procedure SetStyle(const Value: TFontStyles); + protected + procedure Modified; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + public + constructor Create; + procedure Apply(AFont: TFont); + procedure Assign(Src: TPersistent); override; + published + property Color: TColor read FColor write SetColor default clNone; + property Name: TFontName read FName write SetName; // default '' + property Size: TSpTBXFontSize read FSize write SetSize default 100; // Size Percent + property Style: TFontStyles read FStyle write SetStyle default []; + end; + + { TSpTBXCustomDragObject } + + TSpTBXCustomDragObject = class(TDragObjectEx) + private + FDragCursorAccept: TCursor; + FDragCursorCancel: TCursor; + FSourceControl: TControl; + FSourceItem: TTBCustomItem; + protected + function GetDragCursor(Accepted: Boolean; X: Integer; Y: Integer): TCursor; override; + procedure Finished(Target: TObject; X, Y: Integer; Accepted: Boolean); override; + public + constructor Create(ASourceControl: TControl; AItem: TTBCustomItem); virtual; + property DragCursorAccept: TCursor read FDragCursorAccept write FDragCursorAccept; + property DragCursorCancel: TCursor read FDragCursorCancel write FDragCursorCancel; + property SouceItem: TTBCustomItem read FSourceItem; + property SourceControl: TControl read FSourceControl; + end; + + { TSpTBXItemDragObject } + + TSpTBXItemDragObject = class(TSpTBXCustomDragObject); + + { TSpTBXCustomItemActionLink } + + {$IFNDEF UNICODE} + TSpTBXCustomItemActionLink = class(TTBCustomItemActionLink) + protected + FUnicodeClient: TSpTBXCustomItem; + procedure AssignClient(AClient: TObject); override; + function IsCaptionLinked: Boolean; override; + function IsHintLinked: Boolean; override; + procedure SetCaption(const Value: string); override; + procedure SetHint(const Value: string); override; + end; + {$ELSE} + TSpTBXCustomItemActionLink = class(TTBCustomItemActionLink); + {$ENDIF} + + { TSpTBXCustomControl } + + {$IFNDEF UNICODE} + TSpTBXCustomControl = class(TCustomControl) + private + function IsCaptionStored: Boolean; + function IsHintStored: Boolean; + function GetCaption: TWideCaption; + function GetHint: WideString; + procedure SetCaption(const Value: TWideCaption); + procedure SetHint(const Value: WideString); + protected + procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; + procedure CreateWindowHandle(const Params: TCreateParams); override; + procedure DefineProperties(Filer: TFiler); override; + // Don't let the streaming system store the WideStrings, use DefineProperties instead + property Caption: TWideCaption read GetCaption write SetCaption stored IsCaptionStored; // Hides the inherited Caption + property Hint: WideString read GetHint write SetHint stored IsHintStored; // Hides the inherited Hint + end; + {$ELSE} + TSpTBXCustomControl = class(TCustomControl); + {$ENDIF} + + { TSpTBXItem } + + TSpTBXCustomItem = class(TTBCustomItem) + private + {$IFNDEF UNICODE} + FCaption: WideString; + FHint: WideString; + {$ENDIF} + FCaptionGlow: TSpGlowDirection; + FCaptionGlowColor: TColor; + FAlignment: TAlignment; + FAnchored: Boolean; + FControl: TControl; + FCustomWidth: Integer; + FCustomHeight: Integer; + FFontSettings: TSpTBXFontSettings; + FMargins: Integer; + FMinHeight: Integer; + FMinWidth: Integer; + FStretch: Boolean; + FToolbarStylePopup: Boolean; + FToolBoxPopup: Boolean; + FWrapping: TTextWrapping; + FOnClosePopup: TNotifyEvent; + FOnInitPopup: TSpTBXPopupEvent; + FOnDrawCaption: TSpTBXDrawTextEvent; + FOnDrawHint: TSpTBXDrawHintEvent; + FOnDrawItem: TSpTBXDrawItemEvent; + FOnDrawImage: TSpTBXDrawImageEvent; + {$IFNDEF UNICODE} + function IsCaptionStored: Boolean; + function IsHintStored: Boolean; + procedure SetCaption(const Value: WideString); + procedure SetHint(const Value: WideString); + {$ENDIF} + procedure FontSettingsChanged(Sender: TObject); + procedure SetAlignment(const Value: TAlignment); + procedure SetAnchored(const Value: Boolean); + procedure SetCaptionGlow(const Value: TSpGlowDirection); + procedure SetCaptionGlowColor(const Value: TColor); + procedure SetControl(const Value: TControl); + procedure SetCustomWidth(Value: Integer); + procedure SetCustomHeight(Value: Integer); + procedure SetFontSettings(const Value: TSpTBXFontSettings); + procedure SetMargins(Value: Integer); + procedure SetMinHeight(const Value: Integer); + procedure SetMinWidth(const Value: Integer); + procedure SetStretch(const Value: Boolean); + procedure SetToolBoxPopup(const Value: Boolean); + procedure SetWrapping(const Value: TTextWrapping); + protected + procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; + function DialogChar(CharCode: Word): Boolean; virtual; + procedure DefineProperties(Filer: TFiler); override; + procedure DoDrawAdjustFont(AFont: TFont; State: TSpTBXSkinStatesType); virtual; + procedure DoDrawHint(AHintBitmap: TBitmap; var AHint: Widestring; var PaintDefault: Boolean); virtual; + procedure DoDrawButton(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DoDrawCaption(ACanvas: TCanvas; ClientAreaRect: TRect; State: TSpTBXSkinStatesType; + var ACaption: WideString; var CaptionRect: TRect; var CaptionFormat: Cardinal; + IsTextRotated: Boolean; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DoDrawImage(ACanvas: TCanvas; State: TSpTBXSkinStatesType; + const PaintStage: TSpTBXPaintStage; var AImageList: TCustomImageList; + var AImageIndex: Integer; var ARect: TRect; var PaintDefault: Boolean); virtual; + procedure DoPopupShowingChanged(APopupWindow: TTBPopupWindow; IsVisible: Boolean); virtual; + function GetActionLinkClass: TTBCustomItemActionLinkClass; override; + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + function GetPopupWindowClass: TTBPopupWindowClass; override; + procedure ToggleControl; virtual; + procedure UpdateProps; virtual; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + + property Alignment: TAlignment read FAlignment write SetAlignment default taCenter; + property Anchored: Boolean read FAnchored write SetAnchored default False; + property CaptionGlow: TSpGlowDirection read FCaptionGlow write SetCaptionGlow default gldNone; + property CaptionGlowColor: TColor read FCaptionGlowColor write SetCaptionGlowColor default clYellow; + property Control: TControl read FControl write SetControl; + property CustomWidth: Integer read FCustomWidth write SetCustomWidth default -1; + property CustomHeight: Integer read FCustomHeight write SetCustomHeight default -1; + property FontSettings: TSpTBXFontSettings read FFontSettings write SetFontSettings; + property Margins: Integer read FMargins write SetMargins default 0; + property MinHeight: Integer read FMinHeight write SetMinHeight default 0; + property MinWidth: Integer read FMinWidth write SetMinWidth default 0; + property ToolbarStylePopup: Boolean read FToolbarStylePopup write FToolbarStylePopup default False; // Used on submenus + property ToolBoxPopup: Boolean read FToolBoxPopup write SetToolBoxPopup default False; // Used on submenus + property Stretch: Boolean read FStretch write SetStretch default True; // Hidden, all items are stretched by default + property OnClosePopup: TNotifyEvent read FOnClosePopup write FOnClosePopup; + property OnInitPopup: TSpTBXPopupEvent read FOnInitPopup write FOnInitPopup; + property OnDrawCaption: TSpTBXDrawTextEvent read FOnDrawCaption write FOnDrawCaption; + property OnDrawHint: TSpTBXDrawHintEvent read FOnDrawHint write FOnDrawHint; + property OnDrawImage: TSpTBXDrawImageEvent read FOnDrawImage write FOnDrawImage; + property OnDrawItem: TSpTBXDrawItemEvent read FOnDrawItem write FOnDrawItem; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Click; override; + function GetShortCutText: WideString; // Reintroduce to support unicode shortcut text + procedure InitiateAction; override; + procedure Invalidate; + published + {$IFNDEF UNICODE} + // Don't let the streaming system store the WideStrings, use DefineProperties instead + property Caption: WideString read FCaption write SetCaption stored IsCaptionStored; // Hides the inherited Caption + property Hint: WideString read FHint write SetHint stored IsHintStored; // Hides the inherited Hint + {$ELSE} + property Caption; + property Hint; + {$ENDIF} + property Wrapping: TTextWrapping read FWrapping write SetWrapping default twWrap; + end; + + TSpTBXItemViewer = class(TTBItemViewer) + private + function GetItem: TSpTBXCustomItem; + procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW; + procedure InternalCalcSize(const Canvas: TCanvas; CalcStretch: Boolean; var AWidth, AHeight: Integer); + protected + FAnchorSize: TPoint; + FAnchorDelta: Integer; + + // Custom Painting methods + procedure DoDrawAdjustFont(AFont: TFont; State: TSpTBXSkinStatesType); virtual; + procedure DoDrawButton(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure DoDrawCaption(ACanvas: TCanvas; ClientAreaRect: TRect; + State: TSpTBXSkinStatesType; var ACaption: WideString; var CaptionRect: TRect; + var CaptionFormat: Cardinal; IsTextRotated: Boolean; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); virtual; + procedure DoDrawImage(ACanvas: TCanvas; State: TSpTBXSkinStatesType; + const PaintStage: TSpTBXPaintStage; var AImageList: TCustomImageList; + var AImageIndex: Integer; var ARect: TRect; var PaintDefault: Boolean); virtual; + procedure DoDrawHint(AHintBitmap: TBitmap; CursorPos: TPoint; var CursorRect: TRect; var AHint: Widestring; var PaintDefault: Boolean); virtual; + + // Painting methods + function CaptionShown: Boolean; override; + function GetImageShown: Boolean; virtual; + function GetImageSize: TSize; virtual; + function GetRightImageSize: TSize; virtual; + function GetTextColor(State: TSpTBXSkinStatesType): TColor; virtual; + procedure DrawItemImage(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; ImgIndex: Integer); virtual; + procedure DrawItemRightImage(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo); virtual; + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); override; + procedure GetTextInfo(ACanvas: TCanvas; State: TSpTBXSkinStatesType; out TextInfo: TSpTBXTextInfo); + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + + // Hints + procedure Entering; override; + procedure InternalMouseMove(Shift: TShiftState; X, Y: Integer); virtual; + public + function GetCaptionText: WideString; reintroduce; virtual; // Hides the inherited TB2K GetCaptionText function + function GetHintText: Widestring; reintroduce; virtual; // Hides the inherited TB2K GetHintText function + property Item: TSpTBXCustomItem read GetItem; // Hides the inherited TB2K Item property + end; + + TSpTBXItem = class(TSpTBXCustomItem) + published + property Action; + property AutoCheck; + property Checked; + property DisplayMode; + property Enabled; + property GroupIndex; + property HelpContext; + property ImageIndex; + property Images; + property InheritOptions; + property MaskOptions; + property Options; + property RadioItem; + property ShortCut; + property Visible; + // property OnDrawImage; use custom OnDrawImage + property OnClick; + property OnSelect; + // TSpTBXCustomItem properties + property Alignment; + property Anchored; + property CaptionGlow; + property CaptionGlowColor; + property Control; + property CustomWidth; + property CustomHeight; + property FontSettings; + property Margins; + property MinHeight; + property MinWidth; + property OnDrawCaption; + property OnDrawHint; + property OnDrawImage; + property OnDrawItem; + end; + + { TSpTBXRootItem } + + TSpTBXRootItem = class(TTBRootItem) + private + FToolBoxPopup: Boolean; + FOnInitPopup: TSpTBXPopupEvent; + FOnClosePopup: TNotifyEvent; + procedure SetToolBoxPopup(const Value: Boolean); + protected + procedure DoPopupShowingChanged(APopupWindow: TTBPopupWindow; IsVisible: Boolean); virtual; + function GetPopupWindowClass: TTBPopupWindowClass; override; + property ToolBoxPopup: Boolean read FToolBoxPopup write SetToolBoxPopup default False; + public + property OnInitPopup: TSpTBXPopupEvent read FOnInitPopup write FOnInitPopup; + property OnClosePopup: TNotifyEvent read FOnClosePopup write FOnClosePopup; + end; + + { TSpTBXSubmenuItem } + + TSpTBXSubmenuItem = class(TSpTBXItem) + private + FHideEmptyPopup: Boolean; + function GetDropdownCombo: Boolean; + procedure SetDropdownCombo(Value: Boolean); + public + constructor Create(AOwner: TComponent); override; + published + property DropdownCombo: Boolean read GetDropdownCombo write SetDropdownCombo default False; + property HideEmptyPopup: Boolean read FHideEmptyPopup write FHideEmptyPopup default False; + property LinkSubitems; + property SubMenuImages; + property ToolbarStylePopup; + property ToolBoxPopup; + property OnPopup; + property OnClosePopup; + property OnInitPopup; + end; + + { TSpTBXColorItem } + + TSpTBXColorItem = class(TSpTBXCustomItem) + private + FColor: TColor; + procedure SetColor(Value: TColor); + protected + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + public + constructor Create(AOwner: TComponent); override; + published + property Action; + property AutoCheck; + property Checked; + property DisplayMode; + property Enabled; + property GroupIndex; + property HelpContext; + property InheritOptions; + property MaskOptions; + property Options; + property ShortCut; + property Visible; + property OnClick; + property OnSelect; + // TSpTBXCustomItem properties + property Alignment; + property Anchored; + property CaptionGlow; + property CaptionGlowColor; + property Control; + property CustomWidth; + property CustomHeight; + property FontSettings; + property Margins; + property MinHeight; + property MinWidth; + property OnDrawCaption; + property OnDrawHint; + property OnDrawImage; + property OnDrawItem; + // TSpTBXColorItem properties + property Color: TColor read FColor write SetColor default clWhite; + end; + + TSpTBXColorItemViewer = class(TSpTBXItemViewer) + protected + procedure DoDrawImage(ACanvas: TCanvas; State: TSpTBXSkinStatesType; + const PaintStage: TSpTBXPaintStage; var AImageList: TCustomImageList; + var AImageIndex: Integer; var ARect: TRect; var PaintDefault: Boolean); override; + function GetImageShown: Boolean; override; + function GetImageSize: TSize; override; + end; + + { TSpTBXLabelItem } + + TSpTBXCustomLabelItem = class(TSpTBXCustomItem) + protected + function DialogChar(CharCode: Word): Boolean; override; + procedure DoDrawButton(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); override; + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + procedure ToggleControl; override; + procedure UpdateProps; override; + property Alignment default taLeftJustify; + public + constructor Create(AOwner: TComponent); override; + end; + + TSpTBXLabelItemViewer = class(TSpTBXItemViewer) + protected + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); override; + function DoExecute: Boolean; override; + end; + + TSpTBXLabelItem = class(TSpTBXCustomLabelItem) + published + property Enabled; + property ImageIndex; + property Images; + property InheritOptions; + property MaskOptions; + property Options; + property Visible; + property OnClick; + // TSpTBXCustomItem properties + property Alignment; + property Anchored; + property CaptionGlow; + property CaptionGlowColor; + property Control; + property CustomWidth; + property CustomHeight; + property FontSettings; + property Margins; + property MinHeight; + property MinWidth; + property OnDrawCaption; + property OnDrawHint; + property OnDrawImage; + property OnDrawItem; + end; + + { TSpTBXSeparatorItem } + + TSpTBXSeparatorItem = class(TTBSeparatorItem) + protected + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + end; + + TSpTBXSeparatorItemViewer = class(TTBSeparatorItemViewer) + protected + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); override; + function IsStatusBarSeparator: Boolean; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + end; + + { TSpTBXRightAlignSpacerItem } + + TSpTBXRightAlignSpacerItem = class(TSpTBXCustomLabelItem) + published + property ImageIndex; + property Images; + property MaskOptions; + property Options; + property OnClick; + // TSpTBXCustomItem properties + property Alignment; + property CaptionGlow; + property CaptionGlowColor; + property CustomWidth; + property CustomHeight; + property FontSettings; + property OnDrawCaption; + property OnDrawHint; + property OnDrawImage; + property OnDrawItem; + end; + + { TSpTBXRadioGroupItem } + + TSpTBXRadioGroupItem = class(TTBGroupItem) + private + FDefaultIndex: Integer; + FLastClickedIndex: Integer; + FOnClick: TNotifyEvent; + FOnFillStrings: TSpTBXRadioGroupFillStringsEvent; + FOnUpdate: TNotifyEvent; + protected + FStrings: TTntStringList; + procedure Loaded; override; + procedure ItemClickEvent(Sender: TObject); virtual; + procedure DoClick(AItem: TSpTBXItem); virtual; + procedure DoFillStrings; virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Recreate; + property DefaultIndex: Integer read FDefaultIndex write FDefaultIndex; + property LastClickedIndex: Integer read FLastClickedIndex; + published + property OnClick: TNotifyEvent read FOnClick write FOnClick; + property OnFillStrings: TSpTBXRadioGroupFillStringsEvent read FOnFillStrings write FOnFillStrings; + property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate; + end; + + { TSpTBXSkinGroupItem } + + TSpTBXSkinGroupItem = class(TSpTBXRadioGroupItem) + private + FOnSkinChange: TNotifyEvent; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + procedure DoClick(AItem: TSpTBXItem); override; + procedure DoSkinChange; virtual; + procedure DoFillStrings; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property OnSkinChange: TNotifyEvent read FOnSkinChange write FOnSkinChange; + end; + + { TSpTBXSystemMenuItem } + + TSpTBXSystemMenuItem = class(TSpTBXCustomItem) + private + FMDISystemMenu: Boolean; + FShowSize: Boolean; + procedure CommandClick(Sender: TObject); + protected + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + function GetSystemMenuParentForm: TCustomForm; + public + constructor Create(AOwner: TComponent); override; + procedure Click; override; + published + property MDISystemMenu: Boolean read FMDISystemMenu write FMDISystemMenu default False; + property ShowSize: Boolean read FShowSize write FShowSize default True; + end; + + TSpTBXSystemMenuItemViewer = class(TSpTBXItemViewer) + protected + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); override; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + end; + + { TSpTBXToolPalette } + + TSpTBXRowColCount = 1..100; + + TSpTBXTPGetCellHint = procedure(Sender: TObject; ACol, ARow: Integer; var AHint: WideString) of object; + + TSpTBXTPDrawCellImage = procedure(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; ACol, ARow: Integer; Selected, HotTrack, Enabled: Boolean) of object; + + TSpTBXTPCellClick = procedure(Sender: TObject; ACol, ARow: Integer; var Allow: Boolean) of object; + + TSpTBXCPGetColorInfo = procedure(Sender: TObject; ACol, ARow: Integer; var Color: TColor; var Name: WideString) of object; + + TSpTBXCustomToolPalette = class(TSpTBXCustomItem) + private + FCustomImages: Boolean; + FColCount: TSpTBXRowColCount; + FRowCount: TSpTBXRowColCount; + FSelectedCell: TPoint; + FOnChange: TNotifyEvent; + FOnCellClick: TSpTBXTPCellClick; + FOnDrawCellImage: TSpTBXTPDrawCellImage; + FOnGetCellHint: TSpTBXTPGetCellHint; + procedure SetSelectedCell(Value: TPoint); + protected + function DoCellClick(ACol, ARow: Integer): Boolean; virtual; + procedure DoChange; virtual; + procedure DoDrawCellImage(ACanvas: TCanvas; const ARect: TRect; ACol, ARow: Integer; ItemInfo: TSpTBXMenuItemInfo); virtual; + procedure DoGetCellHint(ACol, ARow: Integer; var AHint: WideString); virtual; + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + procedure HandleClickCell(ACol, ARow: Integer); virtual; + procedure SetColCount(Value: TSpTBXRowColCount); virtual; + procedure SetRowCount(Value: TSpTBXRowColCount); virtual; + property CustomImages: Boolean read FCustomImages write FCustomImages; + property ColCount: TSpTBXRowColCount read FColCount write SetColCount default 1; + property RowCount: TSpTBXRowColCount read FRowCount write SetRowCount default 1; + property SelectedCell: TPoint read FSelectedCell write SetSelectedCell; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + property OnCellClick: TSpTBXTPCellClick read FOnCellClick write FOnCellClick; + property OnDrawCellImage: TSpTBXTPDrawCellImage read FOnDrawCellImage write FOnDrawCellImage; + property OnGetCellHint: TSpTBXTPGetCellHint read FOnGetCellHint write FOnGetCellHint; + public + constructor Create(AOwner: TComponent); override; + end; + + TSpTBXToolPalette = class(TSpTBXCustomToolPalette) + public + property SelectedCell; + published + property ColCount; + property HelpContext; + property Images; + property Options; + property RowCount; + property Visible; + property OnChange; + property OnCellClick; + property OnDrawCellImage; + property OnGetCellHint; + end; + + TSpTBXToolViewer = class(TSpTBXItemViewer) + private + FCellHeight: Integer; + FCellWidth: Integer; + FColCount: Integer; + FRowCount: Integer; + FHotCell: TPoint; + function GetItem: TSpTBXCustomToolPalette; + protected + FIndent: Integer; + FMouseIsDown: Boolean; + procedure CalcCellSize(ACanvas: TCanvas; var AWidth, AHeight: Integer); virtual; + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); override; + function GetImageIndex(Col, Row: Integer): Integer; + function GetImageSize: TSize; override; + function GetImageShown: Boolean; override; + function GetCellAt(X, Y: Integer; out Col, Row: Integer): Boolean; + function GetCellRect(ClientAreaRect: TRect; Col, Row: Integer): TRect; virtual; + function GetCellHint(Col, Row: Integer): WideString; + procedure DoDrawHint(AHintBitmap: TBitmap; CursorPos: TPoint; var CursorRect: TRect; var AHint: Widestring; var PaintDefault: Boolean); override; + procedure DrawCellImage(ACanvas: TCanvas; const ARect: TRect; Col, Row: Integer; ItemInfo: TSpTBXMenuItemInfo); virtual; + procedure Entering; override; + procedure InvalidateCell(ACol, ARow: Integer); + function IsCellVisible(Cell: TPoint): Boolean; virtual; + procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure MouseDown(Shift: TShiftState; X, Y: Integer;var MouseDownOnMenu: Boolean); override; + procedure MouseMove(X, Y: Integer); override; + procedure MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); override; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + public + constructor Create(AView: TTBView; AItem: TTBCustomItem; AGroupLevel: Integer); override; + property Item: TSpTBXCustomToolPalette read GetItem; // Hides the inherited TB2K Item property + end; + + { TSpTBXColorPalette } + + TSpTBXColorPalette = class(TSpTBXCustomToolPalette) + private + FColor: TColor; + FCustomColors: Boolean; + FOnGetColor: TSpTBXCPGetColorInfo; + procedure SetColor(Value: TColor); + procedure SetCustomColors(const Value: Boolean); + protected + procedure DoChange; override; + procedure DoGetCellHint(ACol, ARow: Integer; var AHint: WideString); override; + procedure DoDrawCellImage(ACanvas: TCanvas; const ARect: TRect; ACol, ARow: Integer; ItemInfo: TSpTBXMenuItemInfo); override; + function GetCellColor(ACol, ARow: Integer): TColor; + procedure GetCellInfo(ACol, ARow: Integer; out AColor: TColor; out AName: WideString); + procedure SetColCount(Value: TSpTBXRowColCount); override; + procedure SetRowCount(Value: TSpTBXRowColCount); override; + public + constructor Create(AOwner: TComponent); override; + function FindCell(AColor: TColor): TPoint; + published + property CustomColors: Boolean read FCustomColors write SetCustomColors default False; // Must be published before ColCount + property ColCount default CPDefaultCols; + property Color: TColor read FColor write SetColor default clNone; + property HelpContext; + property InheritOptions; + property MaskOptions; + property Options default [tboShowHint]; + property RowCount default CPDefaultRows; + property Visible; + property OnChange; + property OnCellClick; + property OnGetCellHint; + property OnGetColor: TSpTBXCPGetColorInfo read FOnGetColor write FOnGetColor; + end; + + { TSpTBXItemCacheList } + + TSpTBXItemCache = class(TCollectionItem) + private + FDock: TTBDock; + FName: TComponentName; + FItem: TTBCustomItem; + FWidth, FHeight: Integer; + FParentWidth, FParentHeight: Integer; + function GetName: TComponentName; + public + procedure Assign(Source: TPersistent); override; + property Item: TTBCustomItem read FItem write FItem; + published + property Dock: TTBDock read FDock write FDock; + property Name: TComponentName read GetName write FName; + property Width: Integer read FWidth write FWidth default 0; + property Height: Integer read FHeight write FHeight default 0; + property ParentWidth: Integer read FParentWidth write FParentWidth default 0; + property ParentHeight: Integer read FParentHeight write FParentHeight default 0; + end; + + TSpTBXItemCacheCollection = class(TCollection) + private + function GetItem(Index: Integer): TSpTBXItemCache; + procedure SetItem(Index: Integer; const Value: TSpTBXItemCache); + public + function Add(AItem: TTBCustomItem): Integer; virtual; + function IndexOf(AItem: TTBCustomItem): Integer; + property Items[Index: Integer]: TSpTBXItemCache read GetItem write SetItem; default; + end; + + { TSpTBXDock } + + TSpTBXDock = class(TTBDock) + private + FMoving: Boolean; + FResizing: Boolean; + FPrevWidth: Integer; + FPrevHeight: Integer; + FOnDrawBackground: TSpTBXDrawEvent; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMMove(var Message: TWMMove); message WM_MOVE; + procedure WMSize(var Message: TWMSize); message WM_SIZE; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + function CanResize(var NewWidth: Integer; var NewHeight: Integer): Boolean; override; + procedure DrawBackground(DC: HDC; const DrawRect: TRect); override; + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + procedure InternalDrawBackground(ACanvas: TCanvas; ARect: TRect); + procedure Resize; override; + function UsingBackground: Boolean; override; + function UsingBitmap: Boolean; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property PrevWidth: Integer read FPrevWidth; + property PrevHeight: Integer read FPrevHeight; + published + property Color default clNone; + property OnCanResize; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + end; + + TSpTBXDockClass = class of TSpTBXDock; + + { TSpTBXToolbar } + + TSpTBXToolbarView = class(TTBToolbarView) + private + FMaxSize: Integer; + procedure SetMaxSize(const Value: Integer); + protected + FTallestItemSize: Integer; + procedure DoUpdatePositions(var ASize: TPoint); override; + public + constructor Create(AOwner: TComponent; AParentView: TTBView; + AParentItem: TTBCustomItem; AWindow: TWinControl; + AIsToolbar, ACustomizing, AUsePriorityList: Boolean); override; + property MaxSize: Integer read FMaxSize write SetMaxSize; + end; + + TSpTBXToolbar = class(TTBCustomToolbar) + private + FChevronVertical: Boolean; + FCompoundToolbar: Boolean; + FCustomizable: Boolean; + FCustomizingCount: Integer; + FItemMovingCount: Integer; + FDisplayMode: TSpTBXToolbarDisplayMode; + FLastDropMark: TRect; + FLastSelectableWidth: Integer; + FOnDrawBackground: TSpTBXDrawEvent; + FOnItemNotification: TSpTBXItemNotificationEvent; + {$IFNDEF UNICODE} + function IsCaptionStored: Boolean; + function GetCaption: TWideCaption; + procedure SetCaption(const Value: TWideCaption); + function GetHint: WideString; + procedure SetHint(const Value: WideString); + {$ENDIF} + procedure SetDisplayMode(const Value: TSpTBXToolbarDisplayMode); + function GetMaxSize: Integer; + procedure SetMaxSize(const Value: Integer); + function CreateWrapper(Index: Integer; Ctl: TControl): TTBControlItem; + function IsAnchoredControlItem(Item: TTBCustomItem): TTBControlItem; + procedure CMControlChange(var Message: TCMControlChange); message CM_CONTROLCHANGE; + procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR; + procedure CMMouseleave(var Message: TMessage); message CM_MOUSELEAVE; + procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW; + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMSize(var Message: TWMSize); message WM_SIZE; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + FBeginDragIV: TTBItemViewer; + FAnchoredControlItems: TSpTBXItemCacheCollection; + FState: TSpTBXToolbarStates; + + // Component + procedure CreateWindowHandle(const Params: TCreateParams); override; + procedure DefineProperties(Filer: TFiler); override; + procedure Resize; override; + procedure AnchorItems(UpdateControlItems: Boolean = True); virtual; + procedure RightAlignItems; virtual; + + // Painting + procedure DrawNCArea(const DrawToDC: Boolean; const ADC: HDC; const Clip: HRGN); override; + function GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; virtual; + procedure InternalDrawBackground(ACanvas: TCanvas; ARect: TRect; PaintOnNCArea: Boolean; PaintBorders: Boolean = True); virtual; + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + + // Get class + function GetChevronItemClass: TTBChevronItemClass; override; + function GetFloatingWindowParentClass: TTBFloatingWindowParentClass; override; + function GetRightAlignMargin: Integer; virtual; + function GetViewClass: TTBToolbarViewClass; override; + + // Hints + procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + + // Customizer + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer); override; + function CanDragCustomize(Button: TMouseButton; Shift: TShiftState; X, Y: Integer): Boolean; virtual; + procedure DoStartDrag(var DragObject: TDragObject); override; + procedure DragOver(Source: TObject; X: Integer; Y: Integer; State: TDragState; var Accept: Boolean); override; + + // Misc + function CanItemClick(Item: TTBCustomItem; Button: TMouseButton; Shift: TShiftState; X, Y: Integer): Boolean; virtual; + procedure DoItemClick(Item: TTBCustomItem; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); virtual; + procedure DoItemNotification(Ancestor: TTBCustomItem; Relayed: Boolean; Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); virtual; + + property CompoundToolbar: Boolean read FCompoundToolbar write FCompoundToolbar; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure DragDrop(Source: TObject; X: Integer; Y: Integer); override; + procedure ReadPositionData(const Data: TTBReadPositionData); override; + procedure WritePositionData(const Data: TTBWritePositionData); override; + procedure BeginCustomize; + procedure EndCustomize; + procedure BeginItemMove; + procedure EndItemMove; + function GetFloatingBorderSize: TPoint; override; + function IsCustomizing: Boolean; + function IsItemMoving: Boolean; + function IsVertical: Boolean; + property MaxSize: Integer read GetMaxSize write SetMaxSize default -1; + published + property ActivateParent; + property Align; + property AutoResize; + property BorderStyle; + property ChevronHint; + property ChevronMoveItems; + property ChevronPriorityForNewItems; + property CloseButton; + property CloseButtonWhenDocked; + property CurrentDock; + property DefaultDock; + property DockableTo; + property DockMode; + property DockPos; + property DockRow; + property DragHandleStyle; + property FloatingMode; + property Font; + property FullSize; + property HideWhenInactive; + property Images; + property Items; + property LastDock; + property LinkSubitems; + property MenuBar; + property Options; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ProcessShortCuts; + property Resizable; + property ShowCaption; + property ShowHint; + property ShrinkMode; + property SmoothDrag; + property Stretch; + property SystemFont; + property TabOrder; + property TabStop; + property UpdateActions; + property UseLastDock; + property Visible; + property Color default clNone; + property OnClose; + property OnCloseQuery; + property OnContextPopup; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnMove; + property OnRecreated; + property OnRecreating; + property OnDockChanged; + property OnDockChanging; + property OnDockChangingHidden; + property OnResize; + property OnShortCut; + property OnVisibleChanged; + {$IFNDEF UNICODE} + // Don't let the streaming system store the WideStrings, use DefineProperties instead + property Caption: TWideCaption read GetCaption write SetCaption stored IsCaptionStored; // Hides the inherited Caption + property Hint: WideString read GetHint write SetHint stored False; // Hint is set dynamically in MouseMove, don't save it + {$ELSE} + property Caption; + property Hint; + {$ENDIF} + property ChevronVertical: Boolean read FChevronVertical write FChevronVertical default True; + property Customizable: Boolean read FCustomizable write FCustomizable default True; + property DisplayMode: TSpTBXToolbarDisplayMode read FDisplayMode write SetDisplayMode default tbdmSelectiveCaption; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + property OnItemNotification: TSpTBXItemNotificationEvent read FOnItemNotification write FOnItemNotification; + end; + + TSpTBXToolbarClass = class of TSpTBXToolbar; + + { TSpTBXToolWindow } + + TSpTBXCustomToolWindow = class(TTBCustomDockableWindow) + private + FMinClientWidth, FMinClientHeight, FMaxClientWidth, FMaxClientHeight: Integer; + FOnDrawBackground: TSpTBXDrawEvent; + {$IFNDEF UNICODE} + function IsCaptionStored: Boolean; + function GetCaption: TWideCaption; + procedure SetCaption(const Value: TWideCaption); + {$ENDIF} + function GetClientAreaWidth: Integer; + procedure SetClientAreaWidth(Value: Integer); + function GetClientAreaHeight: Integer; + procedure SetClientAreaHeight(Value: Integer); + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + procedure WMWindowPosChanged(var Message: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED; + protected + FBarSize: TSize; + procedure CreateWindowHandle(const Params: TCreateParams); override; + procedure DefineProperties(Filer: TFiler); override; + function GetFloatingWindowParentClass: TTBFloatingWindowParentClass; override; + + // Sizing + function CalcSize(ADock: TTBDock): TPoint; virtual; + function DoArrange(CanMoveControls: Boolean; PreviousDockType: TTBDockType; NewFloating: Boolean; NewDock: TTBDock): TPoint; override; + procedure GetBaseSize(var ASize: TPoint); override; + procedure GetMinMaxSize(var AMinClientWidth, AMinClientHeight, AMaxClientWidth, AMaxClientHeight: Integer); override; + procedure SetClientAreaSize(AWidth, AHeight: Integer); virtual; + procedure SizeChanging(const AWidth, AHeight: Integer); override; + + // Painting + procedure Paint; override; + procedure DrawNCArea(const DrawToDC: Boolean; const ADC: HDC; const Clip: HRGN); override; + procedure InternalDrawBackground(ACanvas: TCanvas; ARect: TRect; PaintOnNCArea: Boolean; PaintBorders: Boolean = True); virtual; + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + + property ClientAreaHeight: Integer read GetClientAreaHeight write SetClientAreaHeight; + property ClientAreaWidth: Integer read GetClientAreaWidth write SetClientAreaWidth; + property MaxClientHeight: Integer read FMaxClientHeight write FMaxClientHeight default 0; + property MaxClientWidth: Integer read FMaxClientWidth write FMaxClientWidth default 0; + property MinClientHeight: Integer read FMinClientHeight write FMinClientHeight default 32; + property MinClientWidth: Integer read FMinClientWidth write FMinClientWidth default 32; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetFloatingBorderSize: TPoint; override; + procedure InvalidateBackground(InvalidateChildren: Boolean = True); virtual; + function IsVertical: Boolean; + procedure ReadPositionData(const Data: TTBReadPositionData); override; + procedure WritePositionData(const Data: TTBWritePositionData); override; + published + {$IFNDEF UNICODE} + // Don't let the streaming system store the WideStrings, use DefineProperties instead + property Caption: TWideCaption read GetCaption write SetCaption stored IsCaptionStored; // Hides the inherited Caption + {$ELSE} + property Caption; + {$ENDIF} + property Color default clNone; + end; + + TSpTBXToolWindow = class(TSpTBXCustomToolWindow) + published + property ActivateParent; + property Align; + property Anchors; + property BorderStyle; + property Caption; + property Color; + property CloseButton; + property CloseButtonWhenDocked; + property CurrentDock; + property DefaultDock; + property DockableTo; + property DockMode; + property DockPos; + property DockRow; + property DragHandleStyle; + property FloatingMode; + property Font; + property FullSize; + property HideWhenInactive; + property LastDock; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property Resizable; + property ShowCaption; + property ShowHint; + property Stretch; + property SmoothDrag; + property TabOrder; + property UseLastDock; + property Visible; + property OnClose; + property OnCloseQuery; + property OnContextPopup; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + property OnDockChanged; + property OnDockChanging; + property OnDockChangingHidden; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnMove; + property OnRecreated; + property OnRecreating; + property OnResize; + property OnVisibleChanged; + // TSpTBXCustomToolWindow properties + property ClientAreaHeight; + property ClientAreaWidth; + property MaxClientHeight; + property MaxClientWidth; + property MinClientHeight; + property MinClientWidth; + property OnDrawBackground; + end; + + { TSpTBXFloatingWindowParent } + + TSpTBXFloatingWindowParent = class(TTBFloatingWindowParent) + private + FCloseButtonHover: Boolean; + FCloseOnAltF4: Boolean; + procedure UpdateDwmNCSize; + procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; + procedure WMActivateApp(var Message: TWMActivateApp); message WM_ACTIVATEAPP; + procedure WMClose(var Message: TWMClose); message WM_CLOSE; + procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND; + procedure WMNCMouseLeave(var Message: TMessage); message WM_NCMOUSELEAVE; + procedure WMNCMouseMove(var Message: TWMNCMouseMove); message WM_NCMOUSEMOVE; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + procedure CancelNCHover; + procedure CreateWnd; override; + procedure DrawNCArea(const DrawToDC: Boolean; const ADC: HDC; const Clip: HRGN; RedrawWhat: TTBToolWindowNCRedrawWhat); override; + procedure RedrawCloseButton; + procedure VisibleChanging; override; + property CloseButtonHover: Boolean read FCloseButtonHover; + public + constructor CreateNew(AOwner: TComponent; Dummy: Integer = 0); override; + destructor Destroy; override; + property CloseOnAltF4: Boolean read FCloseOnAltF4 write FCloseOnAltF4; + end; + + { TSpTBXPopupWindow } + + TSpTBXPopupWindow = class(TTBPopupWindow) + private + FPaintingClientArea: Boolean; + FMaximumImageSize: TSize; + function CanDrawGutter: Boolean; + procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW; + procedure CMShowingchanged(var Message: TMessage); message CM_SHOWINGCHANGED; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT; + procedure WMPrint(var Message: TMessage); message WM_PRINT; + protected + function GetViewClass: TTBViewClass; override; + procedure DoPopupShowingChanged(IsVisible: Boolean); virtual; + procedure PaintBackground(ACanvas: TCanvas; ARect: TRect); virtual; + public + constructor CreatePopupWindow(AOwner: TComponent; const AParentView: TTBView; + const AItem: TTBCustomItem; const ACustomizing: Boolean); override; + destructor Destroy; override; + property MaximumImageSize: TSize read FMaximumImageSize; + end; + + TSpTBXPopupWindowView = class(TTBPopupView) + protected + procedure AutoSize(AWidth, AHeight: Integer); override; + public + procedure SetIsToolbar(const Value: Boolean); + published + property IsToolbar; + end; + + { TSpTBXChevronItem } + + TSpTBXChevronItem = class(TTBChevronItem) + protected + function GetPopupWindowClass: TTBPopupWindowClass; override; + public + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + end; + + TSpTBXChevronItemViewer = class(TTBItemViewer) + protected + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + public + function GetTextColor(State: TSpTBXSkinStatesType): TColor; virtual; + end; + + TSpTBXChevronPopupWindow = class(TSpTBXPopupWindow) + private + procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED; + end; + + { TSpTBXPopupMenu } + + ISpTBXPopupMenu = interface + ['{C576A225-6E42-49F6-96E5-712510C5D85C}'] + function InternalPopup(X, Y: Integer; ForceFocus: Boolean; PopupControl: TControl = nil): Boolean; + end; + + TSpTBXPopupMenu = class(TTBPopupMenu, ISpTBXPopupMenu) + private + FClickedItem: TTBCustomItem; + FReturnClickedItemOnly: Boolean; + FToolBoxPopup: Boolean; + function GetOnInitPopup: TSpTBXPopupEvent; + procedure SetOnInitPopup(const Value: TSpTBXPopupEvent); + function GetOnClosePopup: TNotifyEvent; + procedure SetOnClosePopup(const Value: TNotifyEvent); + protected + function InternalPopup(X, Y: Integer; ForceFocus: Boolean; PopupControl: TControl = nil): Boolean; virtual; + function GetRootItemClass: TTBRootItemClass; override; + public + procedure Popup(X: Integer; Y: Integer); override; + function PopupEx(X, Y: Integer; PopupControl: TControl = nil; ReturnClickedItemOnly: Boolean = False): TTBCustomItem; virtual; + published + property ToolBoxPopup: Boolean read FToolBoxPopup write FToolBoxPopup default False; + property OnInitPopup: TSpTBXPopupEvent read GetOnInitPopup write SetOnInitPopup; + property OnClosePopup: TNotifyEvent read GetOnClosePopup write SetOnClosePopup; + end; + + { TSpTBXCompoundItemsControl } + + TSpTBXCompoundItemsControl = class(TSpTBXCustomControl, ITBItems) + private + FSkinType: TSpTBXSkinType; + procedure DockRequestDock(Sender: TObject; Bar: TTBCustomDockableWindow; var Accept: Boolean); + function GetRootItems: TTBRootItem; + function GetView: TSpTBXToolbarView; + function GetImages: TCustomImageList; + procedure SetImages(const Value: TCustomImageList); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + FDock: TSpTBXDock; + FToolbar: TSpTBXToolbar; + procedure CreateParams(var Params: TCreateParams); override; + function GetDockClass: TSpTBXDockClass; virtual; + function GetToolbarClass: TSpTBXToolbarClass; virtual; + function GetItems: TTBCustomItem; virtual; // For ITBItems interface + procedure Loaded; override; + procedure SetName(const Value: TComponentName); override; + property Images: TCustomImageList read GetImages write SetImages; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; // For ITBItems interface + procedure InvalidateBackground(InvalidateChildren: Boolean = True); virtual; + property View: TSpTBXToolbarView read GetView; + published + property Items: TTBRootItem read GetRootItems; + end; + + { TSpTBXCompoundBar } + + TSpTBXCompoundBar = class(TSpTBXCompoundItemsControl) + private + FOnDrawDockBackground: TSpTBXDrawEvent; + procedure DrawDockBackground(Sender: TObject; ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); + procedure DrawToolbarBackground(Sender: TObject; ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); + procedure DockResize(Sender: TObject); + protected + procedure DoDrawDockBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + property OnDrawDockBackground: TSpTBXDrawEvent read FOnDrawDockBackground write FOnDrawDockBackground; + public + constructor Create(AOwner: TComponent); override; + end; + + { TSpTBXButtonOptions } + + TSpTBXButtonOptions = class(TPersistent) + private + FEditableItems: TTBGroupItem; + FCloseButton: TSpTBXItem; + FMinimizeButton: TSpTBXItem; + FMaximizeButton: TSpTBXItem; + FRightAlignSpacer: TSpTBXRightAlignSpacerItem; + FCaptionImageIndex: Integer; + FCloseImageIndex: Integer; + FMinimizeImageIndex: Integer; + FMaximizeImageIndex: Integer; + FRestoreImageIndex: Integer; + FCaptionLabel: WideString; + FCaption: Boolean; + FClose: Boolean; + FMinimize: Boolean; + FMaximize: Boolean; + FButtonBorders: Boolean; + FTitleBarMaxSize: Integer; + procedure SetCaptionImageIndex(Value: Integer); + procedure SetCloseImageIndex(Value: Integer); + procedure SetCaptionLabel(const Value: WideString); + procedure SetMaximizeImageIndex(Value: Integer); + procedure SetRestoreImageIndex(Value: Integer); + procedure SetMinimizeImageIndex(Value: Integer); + procedure SetCaption(const Value: Boolean); + procedure SetClose(const Value: Boolean); + procedure SetMaximize(const Value: Boolean); + procedure SetMinimize(const Value: Boolean); + procedure SetTitleBarMaxSize(const Value: Integer); + protected + FParentControl: TWinControl; + FToolbar: TSpTBXToolbar; + procedure ButtonsDrawImage(Sender: TObject; ACanvas: TCanvas; + State: TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; + var AImageList: TCustomImageList; var AImageIndex: Integer; var ARect: + TRect; var PaintDefault: Boolean); virtual; + procedure ButtonsDrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); virtual; + procedure ButtonsClick(Sender: TObject); virtual; abstract; + procedure CreateButtons; virtual; + procedure UpdateButtonsVisibility; virtual; + procedure SetupButton(B: TSpTBXCustomItem); virtual; + function Restoring(B: TSpTBXCustomItem): Boolean; virtual; abstract; + public + constructor Create(AParent: TWinControl); virtual; + procedure SetupButtonIcon(B: TSpTBXCustomItem); virtual; + procedure MoveItemToTheLeft(B: TTBCustomItem); + property EditableItems: TTBGroupItem read FEditableItems; + property RightAlignSpacer: TSpTBXRightAlignSpacerItem read FRightAlignSpacer; + property MinimizeButton: TSpTBXItem read FMinimizeButton; + property MaximizeButton: TSpTBXItem read FMaximizeButton; + property CloseButton: TSpTBXItem read FCloseButton; + property CaptionLabel: WideString read FCaptionLabel write SetCaptionLabel; + published + property ButtonBorders: Boolean read FButtonBorders write FButtonBorders default True; + property Caption: Boolean read FCaption write SetCaption default True; + property Close: Boolean read FClose write SetClose default True; + property Minimize: Boolean read FMinimize write SetMinimize default True; + property Maximize: Boolean read FMaximize write SetMaximize default True; + property CaptionImageIndex: Integer read FCaptionImageIndex write SetCaptionImageIndex default -1; + property CloseImageIndex: Integer read FCloseImageIndex write SetCloseImageIndex default -1; + property MinimizeImageIndex: Integer read FMinimizeImageIndex write SetMinimizeImageIndex default -1; + property MaximizeImageIndex: Integer read FMaximizeImageIndex write SetMaximizeImageIndex default -1; + property RestoreImageIndex: Integer read FRestoreImageIndex write SetRestoreImageIndex default -1; + property TitleBarMaxSize: Integer read FTitleBarMaxSize write SetTitleBarMaxSize default 21; + end; + + { TSpTBXStatusBar } + + TSpTBXStatusToolbar = class(TSpTBXToolbar) + private + FSizeGrip: Boolean; + FSkinType: TSpTBXSkinType; + procedure SetSizeGrip(const Value: Boolean); + procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR; + protected + FParentForm: TCustomForm; + function IsPointInGrip(P: TPoint): Boolean; + function GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; override; + function GetRightAlignMargin: Integer; override; + function GetParentFormWindowState: TWindowState; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer); override; + procedure WMNCLButtonDown(var Message: TWMNCLButtonDown); message WM_NCLBUTTONDOWN; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetGripRect: TRect; + function NeedsSeparatorRepaint: Boolean; + published + property SizeGrip: Boolean read FSizeGrip write SetSizeGrip default True; + end; + + TSpTBXCustomStatusBar = class(TSpTBXCompoundBar) + private + function GetSizeGrip: Boolean; + procedure SetSizeGrip(const Value: Boolean); + function GetStatusToolbar: TSpTBXStatusToolbar; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + protected + FPrevState: TWindowState; + function CanResize(var NewWidth: Integer; var NewHeight: Integer): Boolean; override; + procedure DoDrawDockBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); override; + procedure DrawSeparators(ACanvas: TCanvas; ARect, AGripRect: TRect); virtual; + function GetToolbarClass: TSpTBXToolbarClass; override; + property Align default alBottom; + property SizeGrip: Boolean read GetSizeGrip write SetSizeGrip default True; + public + constructor Create(AOwner: TComponent); override; + property Toolbar: TSpTBXStatusToolbar read GetStatusToolbar; + end; + + TSpTBXStatusBar = class(TSpTBXCustomStatusBar) + published + property Align; + property Anchors; + property BiDiMode; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentColor; + property ParentBiDiMode; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property Visible; + property OnCanResize; + property OnContextPopup; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnResize; + property OnStartDock; + property OnStartDrag; + // TSpTBXCustomStatusBar properties + property Images; + property SizeGrip; + property SkinType; + property OnDrawDockBackground; + end; + + { TSpTBXTitleBar } + + TSpTBXCustomTitleBar = class; + + TSpTBXTitleToolbar = class(TSpTBXToolbar) + protected + function GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; override; + function GetTitleBar: TSpTBXCustomTitleBar; + function GetRightAlignMargin: Integer; override; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer); override; + end; + + TSpTBXTitleBarButtonOptions = class(TSpTBXButtonOptions) + private + FSystemMenu: Boolean; + FSystemButton: TSpTBXSystemMenuItem; + procedure SetSystemMenu(const Value: Boolean); + protected + FTitleBar: TSpTBXCustomTitleBar; + procedure ButtonsDrawItem(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); override; + procedure ButtonsClick(Sender: TObject); override; + procedure CreateButtons; override; + function Restoring(B: TSpTBXCustomItem): Boolean; override; + public + constructor Create(AParent: TWinControl); override; + property SystemButton: TSpTBXSystemMenuItem read FSystemButton; + published + property SystemMenu: Boolean read FSystemMenu write SetSystemMenu default True; + end; + + TSpTBXCustomTitleBar = class(TSpTBXCompoundBar) + private + FActive: Boolean; + FFixedSize: Boolean; + FFullScreenMaximize: Boolean; + FMouseActive: Boolean; + FOptions: TSpTBXTitleBarButtonOptions; + FOldAppWndProc: Pointer; + FNewAppWndProc: Pointer; + FOnDrawBackground: TSpTBXDrawEvent; + FOnSystemMenuPopup: TSpTBXPopupEvent; + FOldParentFormWndProc: TWndMethod; + procedure AppWndProc(var Msg: TMessage); + procedure NewParentFormWndProc(var Message: TMessage); + procedure SetActive(const Value: Boolean); + procedure SetMouseActive(const Value: Boolean); + procedure SetFullScreenMaximize(const Value: Boolean); + function GetWindowState: TWindowState; + procedure SetWindowState(const Value: TWindowState); + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND; + procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + procedure WMWindowPosChanged(var Message: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED; + protected + FParentForm: TCustomForm; + // Component + procedure Loaded; override; + function GetFloatingBorderSize: TPoint; + function GetItems: TTBCustomItem; override; // For ITBItems interface + function GetToolbarClass: TSpTBXToolbarClass; override; + procedure ChangeTitleBarState(Activate: Boolean); + procedure UpdateSkinMetrics; + + // Painting + procedure DoDrawDockBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); override; + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + + // Sizing + procedure AdjustClientRect(var Rect: TRect); override; + procedure GetSizeCursor(MousePos: TPoint; var SizeCursor, SizeCode: Integer); + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer); override; + + property Active: Boolean read FActive write SetActive default True; + property Align default alClient; + property FixedSize: Boolean read FFixedSize write FFixedSize default False; + property FullScreenMaximize: Boolean read FFullScreenMaximize write SetFullScreenMaximize default False; + property Options: TSpTBXTitleBarButtonOptions read FOptions write FOptions; + property WindowState: TWindowState read GetWindowState write SetWindowState; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + property OnSystemMenuPopup: TSpTBXPopupEvent read FOnSystemMenuPopup write FOnSystemMenuPopup; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetClientAreaRect: TRect; + function IsActive: Boolean; + property MouseActive: Boolean read FMouseActive write SetMouseActive default True; + property Toolbar: TSpTBXToolbar read FToolbar; + published + property Caption; + end; + + TSpTBXTitleBar = class(TSpTBXCustomTitleBar) + published + property Align; + property Anchors; + property Color; + property BiDiMode; + property Constraints; + property DockSite; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentColor; + property ParentBiDiMode; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property Visible; + property OnCanResize; + property OnContextPopup; + property OnDockDrop; + property OnDockOver; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnEnter; + property OnExit; + property OnGetSiteInfo; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnResize; + property OnStartDock; + property OnStartDrag; + property OnUnDock; + // TSpTBXCustomTitleBar properties + property Active; + property FixedSize; + property FullScreenMaximize; + property Images; + property Options; + property OnDrawBackground; + property OnDrawDockBackground; + property OnSystemMenuPopup; + end; + + { TBitmapHint } + + TBitmapHint = class(THintWindow) + private + FHintBitmap: TBitmap; + FActivating: Boolean; + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + protected + procedure Paint; override; + public + property Activating: Boolean read FActivating; + procedure ActivateHint(Rect: TRect; const AHint: string); override; + procedure ActivateHintData(Rect: TRect; const AHint: string; AData: Pointer); override; + end; + +{ Item helpers } +procedure SpFillItemInfo(ACanvas: TCanvas; IV: TTBItemViewer; out ItemInfo: TSpTBXMenuItemInfo); +function SpGetBoundsRect(IV: TTBItemViewer; Root: TTBRootItem): TRect; +procedure SpGetAllItems(AParentItem: TTBCustomItem; ItemsList: TTntStringList; ClearFirst: Boolean = True); +function SpGetMenuMaximumImageSize(View: TTBView): TSize; +function SpGetItemViewerFromPoint(Root: TTBRootItem; View: TTBView; P: TPoint; ProcessGroupItems: Boolean = True): TTBItemViewer; +function SpGetNextItemSameEdge(View: TTBView; IV: TTBItemViewer; GoForward: Boolean; SearchType: TSpTBXSearchItemViewerType): TTBItemViewer; +function SpGetFirstRightAlignSpacer(View: TTBView): TSpTBXItemViewer; +function SpGetRightAlignedItems(View: TTBView; RightAlignedList: TList; IsRotated: Boolean; out VisibleTotalWidth, RightAlignedTotalWidth: Integer): TSpTBXItemViewer; +procedure SpInvalidateItem(View: TTBView; Item: TTBCustomItem); +function SpFindItemViewer(View: TTBView; Item: TTBCustomItem): TTBItemViewer; +function SpFindControlItem(Item: TTBCustomItem; Ctl: TControl; Recurse: Boolean = True): TTBControlItem; +procedure SpGetDropPosItemViewer(Root: TTBRootItem; View: TTBView; P: TPoint; out DestIV: TTBItemViewer; out DestItemPos: Integer; out DropMark: TRect); overload; +procedure SpGetDropPosItemViewer(Root: TTBRootItem; View: TTBView; P: TPoint; SourceItemPos: Integer; out DestIV: TTBItemViewer; out DestItemPos: Integer); overload; +function SpGetDragHandleSize(Toolbar: TTBCustomDockableWindow): Integer; +function SpIsVerticalToolbar(Toolbar: TTBCustomDockableWindow): Boolean; +function SpIsDockUsingBitmap(Dock: TTBDock): Boolean; + +{ Painting helpers } +procedure SpDrawXPMenuItem(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo); +procedure SpDrawXPMenuSeparator(ACanvas: TCanvas; ARect: TRect; MenuItemStyle, Vertical: Boolean); +procedure SpDrawXPMenuItemImage(ACanvas: TCanvas; ARect: TRect; const ItemInfo: TSpTBXMenuItemInfo; ImageList: TCustomImageList; ImageIndex: Integer); +procedure SpDrawXPMenuGutter(ACanvas: TCanvas; ARect: TRect; SkinType: TSpTBXSkinType); +procedure SpDrawXPMenuPopupWindow(ACanvas: TCanvas; ARect, OpenIVRect: TRect; DrawGutter: Boolean; ImageSize: Integer; SkinType: TSpTBXSkinType); +procedure SpDrawXPStatusBar(ACanvas: TCanvas; ARect, AGripRect: TRect; SkinType: TSpTBXSkinType; UsingOfficeTheme: Boolean); +procedure SpDrawXPTitleBar(ACanvas: TCanvas; ARect: TRect; IsActive: Boolean; DrawBorders: Boolean = True); +procedure SpDrawXPTitleBarBody(ACanvas: TCanvas; ARect: TRect; IsActive: Boolean; BorderSize: TPoint; DrawBody: Boolean = True); +procedure SpDrawXPDock(ACanvas: TCanvas; ARect: TRect; SkinType: TSpTBXSkinType; Vertical: Boolean = False); +procedure SpDrawXPToolbar(ACanvas: TCanvas; ARect: TRect; SkinType: TSpTBXSkinType; Docked, Floating, Vertical, PaintSkinBackground, PaintBorders: Boolean; SkinComponent: TSpTBXSkinComponentsType = skncToolbar); overload; +procedure SpDrawXPToolbar(W: TTBCustomDockableWindow; ACanvas: TCanvas; ARect: TRect; PaintOnNCArea: Boolean; PaintBorders: Boolean = True; SkinComponent: TSpTBXSkinComponentsType = skncToolbar); overload; +procedure SpDrawXPToolbarGrip(W: TTBCustomDockableWindow; ACanvas: TCanvas; ARect: TRect); +procedure SpDrawXPTooltipBackground(ACanvas: TCanvas; ARect: TRect); + +{ Menu helpers } +function SpCalcPopupPosition(const X, Y, Width, Height: Integer; PopupControl: TControl = nil; IsVertical: Boolean = False): TPoint; +function SpHMenuGetCaption(Menu: HMenu; Index: Integer): WideString; +function SpHMenuToTBMenuItem(Menu: HMenu; ParentItem: TTBCustomItem): Boolean; +function SpShowSystemPopupMenu(ParentForm: TCustomForm; ScreenPos: TPoint; DoDefault: Boolean = True): Integer; +function SpFillSystemSpTBXPopup(ParentForm: TCustomForm; ParentItem: TTBCustomItem; ShowSize, ShowMinimize, ShowMaximize, ShowClose: Boolean; ClickEvent: TNotifyEvent = nil): Boolean; +function SpShowSystemSpTBXPopupMenu(ParentForm: TCustomForm; ScreenPos: TPoint; ShowSize, ShowMinimize, ShowMaximize, ShowClose: Boolean; PopupEvent: TSpTBXPopupEvent; DoDefault: Boolean = True): Integer; + +{ Misc helpers } +procedure SpActivateDwmNC(WinControl: TWinControl; Activate: Boolean); +function SpIsDwmCompositionEnabled: Boolean; +function SpCanFocus(WinControl: TWinControl): Boolean; +function SpIsFocused(WinControl: TWinControl; out FocusedChild: TWinControl): Boolean; +function SpFocusFirstChild(WinControl: TWinControl): TWinControl; +function SpFindControl(Parent: TWinControl; Child: TControl): Integer; +function SpFindParent(Control: TControl; ParentClass: TClass): TWinControl; +function SpHasBorders(WinControl: TWinControl): Boolean; +function SpGetFormWindowState(F: TCustomForm; out RestoreBoundsRect: TRect): TWindowState; +procedure SpSetFormWindowState(F: TCustomForm; WindowState: TWindowState; RestoreBoundsRect: TRect); +function SpGetTaskBar(out State, Edge: Cardinal; out Bounds: TRect): Boolean; +procedure SpRecalcNCArea(WinControl: TWinControl); + +{ Customizer helpers } +procedure SpCustomizeAllToolbars(AParentComponent: TComponent; Reset: Boolean); +procedure SpBeginUpdateAllToolbars(AParentComponent: TComponent); +procedure SpEndUpdateAllToolbars(AParentComponent: TComponent); + +{ Unicode helpers } +procedure SpPersistent_AfterInherited_DefineProperties(Filer: TFiler; Instance: TPersistent); + +var + SmCaptionFont: TFont; + SpStockHintBitmap: TBitmap; + MDIButtonsImgList: TImageList = nil; + SpTBXHintWindowClass: THintWindowClass = TBitmapHint; + +const + DefaultToolbarBorderSize = 2; // Default size of Floating Toolbar borders + crSpTBXNewHandPoint = 100; // Cursor ID to replace crHandPoint for IDC_HAND + crSpTBXCustomization = 101; // Cursor ID used for item D&D customization accepted + crSpTBXCustomizationCancel = 102; // Cursor ID used for item D&D customization cancelled + +implementation + +{$R SpTBXGlyphs.res} + +uses + Themes, UxTheme, + TypInfo, Types, ComCtrls, CommCtrl, ShellApi, + {$IFDEF JR_D11} DwmApi, {$ENDIF} + {$IFNDEF UNICODE} TntWindows, TntSysUtils, TntActnList, TntForms, {$ENDIF} + TB2Anim, TB2Common; + +const + ROP_DSPDxax = $00E20746; + // Constants for TSpTBXToolWindow registry values. Do not localize! + rvClientWidth = 'ClientWidth'; + rvClientHeight = 'ClientHeight'; + // ColorPalette constants: + CPDefaultColors: array[0..CPDefaultCols * CPDefaultRows - 1] of TIdentMapEntry = ( + (Value: $000000; Name: 'Black'), + (Value: $003399; Name: 'Brown'), + (Value: $003333; Name: 'Olive Green'), + (Value: $003300; Name: 'Dark Green'), + (Value: $663300; Name: 'Dark Teal'), + (Value: $800000; Name: 'Dark blue'), + (Value: $993333; Name: 'Indigo'), + (Value: $333333; Name: 'Gray-80%'), + + (Value: $000080; Name: 'Dark Red'), + (Value: $0066FF; Name: 'Orange'), + (Value: $008080; Name: 'Dark Yellow'), + (Value: $008000; Name: 'Green'), + (Value: $808000; Name: 'Teal'), + (Value: $FF0000; Name: 'Blue'), + (Value: $996666; Name: 'Blue-Gray'), + (Value: $808080; Name: 'Gray-50%'), + + (Value: $0000FF; Name: 'Red'), + (Value: $0099FF; Name: 'Light Orange'), + (Value: $00CC99; Name: 'Lime'), + (Value: $669933; Name: 'Sea Green'), + (Value: $CCCC33; Name: 'Aqua'), + (Value: $FF6633; Name: 'Light Blue'), + (Value: $800080; Name: 'Violet'), + (Value: $969696; Name: 'Gray-40%'), + + (Value: $FF00FF; Name: 'Pink'), + (Value: $00CCFF; Name: 'Gold'), + (Value: $00FFFF; Name: 'Yellow'), + (Value: $00FF00; Name: 'Bright Green'), + (Value: $FFFF00; Name: 'Turquoise'), + (Value: $FFCC00; Name: 'Sky Blue'), + (Value: $663399; Name: 'Plum'), + (Value: $C0C0C0; Name: 'Gray-25%'), + + (Value: $CC99FF; Name: 'Rose'), + (Value: $99CCFF; Name: 'Tan'), + (Value: $99FFFF; Name: 'Light Yellow'), + (Value: $CCFFCC; Name: 'Light Green'), + (Value: $FFFFCC; Name: 'Light Turquoise'), + (Value: $FFCC99; Name: 'Pale Blue'), + (Value: $FF99CC; Name: 'Lavender'), + (Value: $FFFFFF; Name: 'White')); + +type + TTBCustomItemAccess = class(TTBCustomItem); + TTBItemViewerAccess = class(TTBItemViewer); + TTBViewAccess = class(TTBView); + TTBDockAccess = class(TTBDock); + TTBCustomDockableWindowAccess = class(TTBCustomDockableWindow); + TTBBasicBackgroundAccess = class(TTBBasicBackground); + TControlAccess = class(TControl); + TWinControlAccess = class(TWinControl); + TCustomFormAccess = class(TCustomForm); + TActionLinkAccess = class(TActionLink); + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Item Helpers } + +procedure SpFillItemInfo(ACanvas: TCanvas; IV: TTBItemViewer; out ItemInfo: TSpTBXMenuItemInfo); +var + Item: TTBCustomItemAccess; + View: TTBViewAccess; + + IsHoverItem, IsOpen, IsPushed: Boolean; + IsSplit: Boolean; + ImageIsShown: Boolean; + ImgSize, RightImageSize: TSize; + IsComboPushed: Boolean; +begin + Item := TTBCustomItemAccess(IV.Item); + View := TTBViewAccess(IV.View); + + IsOpen := IV = View.OpenViewer; + IsHoverItem := IV = View.Selected; + IsPushed := IsHoverItem and (IsOpen or (View.MouseOverSelected and View.Capture and IV.IsToolbarStyle)); + IsSplit := tbisCombo in Item.ItemStyle; + IsComboPushed := IsSplit and IsPushed and not View.Capture; + if IsComboPushed then IsPushed := False; + + ImgSize.cx := 0; + ImgSize.cy := 0; + RightImageSize.cx := 0; + RightImageSize.cy := 0; + ImageIsShown := False; + if IV is TSpTBXItemViewer then begin + if TSpTBXItemViewer(IV).GetImageShown then begin + ImgSize := TSpTBXItemViewer(IV).GetImageSize; + if (ImgSize.cx > 0) and (ImgSize.cy > 0) then + ImageIsShown := True; + end; + RightImageSize := TSpTBXItemViewer(IV).GetRightImageSize; + end; + + FillChar(ItemInfo, SizeOf(ItemInfo), 0); + ItemInfo.Enabled := Item.Enabled or View.Customizing; + ItemInfo.Pushed := IsPushed; + ItemInfo.Checked := Item.Checked; + ItemInfo.HotTrack := IsHoverItem; + ItemInfo.ImageShown := ImageIsShown; + ItemInfo.ImageOrCheckShown := ImageIsShown or (not IV.IsToolbarStyle and Item.Checked); + ItemInfo.ImageSize := ImgSize; + ItemInfo.RightImageSize := RightImageSize; + ItemInfo.IsDesigning := csDesigning in View.ComponentState; + ItemInfo.IsOnMenuBar := vsMenuBar in View.Style; + ItemInfo.IsVertical := (View.Orientation = tbvoVertical) and not IsSplit; + ItemInfo.IsOnToolbox := False; + if Assigned(View.ParentItem) then begin + if View.ParentItem is TSpTBXCustomItem then + ItemInfo.IsOnToolbox := TSpTBXCustomItem(View.ParentItem).ToolBoxPopup + else + if View.ParentItem is TSpTBXRootItem then + ItemInfo.IsOnToolbox := TSpTBXRootItem(View.ParentItem).ToolBoxPopup; + end; + ItemInfo.IsOpen := IsOpen; + ItemInfo.IsSplit := IsSplit; + ItemInfo.ComboRect := Rect(0, 0, 0, 0); + // HasArrow = tboDropdownArrow or (Submenu and Combo) + ItemInfo.HasArrow := (tboDropdownArrow in Item.Options) or + ((tbisSubmenu in Item.ItemStyle) and (tbisCombo in Item.ItemStyle)); + ItemInfo.ToolbarStyle := IV.IsToolbarStyle; + + if ItemInfo.ToolbarStyle then + begin + if ItemInfo.HasArrow then + ItemInfo.ComboPart := cpCombo; + if ItemInfo.IsSplit then + ItemInfo.ComboPart := cpSplitLeft; + end + else begin + // Only for menu items + if View.Window is TSpTBXPopupWindow then + CurrentSkin.GetMenuItemMargins(ACanvas, TSpTBXPopupWindow(View.Window).MaximumImageSize.cx, ItemInfo.MenuMargins) + else + CurrentSkin.GetMenuItemMargins(ACanvas, ImgSize.cx, ItemInfo.MenuMargins); + end; + + ItemInfo.State := CurrentSkin.GetState(ItemInfo.Enabled, ItemInfo.Pushed, ItemInfo.HotTrack, ItemInfo.Checked); + ItemInfo.ComboState := sknsNormal; + if IsSplit then begin + ItemInfo.ComboState := ItemInfo.State; + if IsComboPushed then + ItemInfo.ComboState := sknsPushed + else + case ItemInfo.State of + sknsPushed: ItemInfo.ComboState := sknsHotTrack; + sknsChecked: ItemInfo.ComboState := sknsNormal; + sknsCheckedAndHotTrack: ItemInfo.ComboState := sknsHotTrack; + end; + end; + + ItemInfo.SkinType := SkinManager.GetSkinType; + + // [Theme-Change] + // The Default theme paints the caption of the pushed button in a down + // state, this only happens when the Item is on a toolbar and: + // 1) Windows themes are enabled and the item is not on a menubar + // 2) Windows themes are disabled + ItemInfo.IsSunkenCaption := False; + if (ItemInfo.Pushed or ItemInfo.Checked) and ItemInfo.ToolbarStyle then + ItemInfo.IsSunkenCaption := (not ItemInfo.IsOnMenuBar and (ItemInfo.SkinType = sknWindows)) or + (ItemInfo.SkinType = sknNone); +end; + +function SpGetBoundsRect(IV: TTBItemViewer; Root: TTBRootItem): TRect; +// Returns the Bounds Rect of an ItemViewer. +// If the ItemViewer is a GroupItemViewer then it returns the sum +// of all the ItemViewers inside it. +var + G: TTBItemViewer; + V: TTBView; + I, J: Integer; + R: TRect; + FirstItemFound: Boolean; +begin + Result := Rect(0, 0, 0, 0); + if Assigned(IV) then + if IV.Item is TTBGroupItem then begin + // Sum all the ItemViewers of the GroupItem + V := IV.View; + J := IV.Index + 1; + FirstItemFound := False; + for I := J to V.ViewerCount - 1 do begin + G := V.Viewers[I]; + if (G.Item.Parent = Root) then + Break + else + if G.Item.Visible and not (G.Item is TTBGroupItem) then + if not FirstItemFound then begin + FirstItemFound := True; + Result := G.BoundsRect; + end + else begin + R := G.BoundsRect; + Result.Left := Min(Result.Left, R.Left); + Result.Top := Min(Result.Top, R.Top); + Result.Right := Max(Result.Right, R.Right); + Result.Bottom := Max(Result.Bottom, R.Bottom); + end; + end; + end + else + Result := IV.BoundsRect; +end; + +procedure SpGetAllItems(AParentItem: TTBCustomItem; ItemsList: TTntStringList; ClearFirst: Boolean = True); +// Returns a StringList with all the items, subitems and linked items from AParentItem. +// The ItemsList.Strings[] contains the items name +// The ItemsList.Objects[] contains the items reference + + procedure Iterate(AParentItem: TTBCustomItem; LinkDepth: Integer); + var + I: Integer; + NewParentItem, Item: TTBCustomItem; + begin + NewParentItem := AParentItem; + if Assigned(NewParentItem.LinkSubitems) then begin + NewParentItem := NewParentItem.LinkSubitems; + Inc(LinkDepth); + if LinkDepth > 25 then + Exit; { prevent infinite link recursion } + end; + for I := 0 to NewParentItem.Count - 1 do begin + Item := NewParentItem.Items[I]; + ItemsList.AddObject(Item.Name, Item); + Iterate(Item, LinkDepth); + end; + end; + +begin + if ClearFirst then + ItemsList.Clear; + Iterate(AParentItem, 0); +end; + +function SpGetMenuMaximumImageSize(View: TTBView): TSize; +// Iterates the viewers and returns the maximum image size +var + I: Integer; + IV: TTBItemViewer; + IL: TCustomImageList; + ImageShown: Boolean; +begin + Result.cx := 0; + Result.cy := 0; + for I := 0 to View.ViewerCount - 1 do begin + IV := View.Viewers[I]; + if IV is TSpTBXItemViewer then + ImageShown := TSpTBXItemViewer(IV).GetImageShown + else + ImageShown := TTBItemViewerAccess(IV).ImageShown; + + if ImageShown then begin + IL := TTBItemViewerAccess(IV).GetImageList; + if Assigned(IL) then begin + if IL.Width > Result.cx then + Result.cx := IL.Width; + if IL.Height > Result.cy then + Result.cy := IL.Height; + end; + end; + end; +end; + +function SpGetItemViewerFromPoint(Root: TTBRootItem; View: TTBView; P: TPoint; + ProcessGroupItems: Boolean = True): TTBItemViewer; +// Returns the ItemViewer at the given position +// If ProcessGroupItems is true and the ItemViewer is on a GroupItem return +// the GroupItem's ItemViewer instead. +var + IV: TTBItemViewer; + I, X: Integer; + G: TTBItemViewer; +begin + Result := nil; + if Assigned(Root) and Assigned(View) then begin + IV := View.ViewerFromPoint(P); + + // If the Item is not on the Root it must be part of a GroupItem + if ProcessGroupItems and Assigned(IV) and not (IV.Item is TTBChevronItem) and (IV.Item.Parent <> Root) then begin + // Get the parent GroupItem ItemViewer + X := IV.Index; + for I := X downto 0 do begin + G := IV.View.Viewers[I]; + if G.Item is TTBGroupItem then begin + Result := G; + Break; + end; + end; + end + else + Result := IV; + end; +end; + +function SpGetNextItemSameEdge(View: TTBView; IV: TTBItemViewer; GoForward: Boolean; + SearchType: TSpTBXSearchItemViewerType): TTBItemViewer; +// Returns the left or right Tab item depending on GoForward +// SearchType can be: +// sivtNormal: Normal search +// sivtInmediate: Search for the inmediate ItemViewer +// sivtInmediateSkipNonVisible: Search for the next inmediate ItemViewer, skipping non visible ones +var + Temp: TTBItemViewer; + I: Integer; +begin + Result := nil; + if IV = nil then + Result := View.NextSelectable(nil, GoForward) + else begin + View.ValidatePositions; + I := View.IndexOf(IV); + while not Assigned(Result) do begin + if GoForward then Inc(I) + else Dec(I); + + if (I > View.ViewerCount - 1) or (I < 0) then + Break + else begin + Temp := View.Viewers[I]; + // Skip non visible items, search for same edge items + if Temp.Item.Visible and (Temp.OffEdge = IV.OffEdge) and (Temp.BoundsRect.Top = IV.BoundsRect.Top) then begin + Result := Temp; // Found IV + Break; + end + else begin + case SearchType of + sivtInmediate: + Break; // Inmediate not found, exit + sivtInmediateSkipNonVisible: + if Temp.Item.Visible then Break; // Inmediate not found and visible, exit + end; + end; + end; + end; + end; +end; + +function SpGetFirstRightAlignSpacer(View: TTBView): TSpTBXItemViewer; +var + I: Integer; + IV: TTBItemViewer; +begin + Result := nil; + for I := 0 to View.ViewerCount - 1 do begin + IV := View.Viewers[I]; + if IV.Item.Visible and (IV.Item is TSpTBXRightAlignSpacerItem) then + Result := IV as TSpTBXItemViewer; + end; +end; + +function SpGetRightAlignedItems(View: TTBView; RightAlignedList: TList; + IsRotated: Boolean; out VisibleTotalWidth, RightAlignedTotalWidth: Integer): TSpTBXItemViewer; + + function GetWidth(R: TRect): Integer; + begin + if IsRotated then + Result := R.Bottom - R.Top + else + Result := R.Right - R.Left; + end; + +var + I: Integer; + IV: TTBItemViewer; +begin + Result := nil; + + if Assigned(RightAlignedList) then + RightAlignedList.Clear; + VisibleTotalWidth := 0; + RightAlignedTotalWidth := 0; + + for I := 0 to View.ViewerCount - 1 do begin + IV := View.Viewers[I]; + if IV.Item.Visible then + VisibleTotalWidth := VisibleTotalWidth + GetWidth(IV.BoundsRect); + if not Assigned(Result) and (IV.Item.Visible) and (IV.Item is TSpTBXRightAlignSpacerItem) then + Result := IV as TSpTBXItemViewer; + if Assigned(Result) then begin + if Assigned(RightAlignedList) then + RightAlignedList.Add(IV); + RightAlignedTotalWidth := RightAlignedTotalWidth + GetWidth(IV.BoundsRect); + end; + end; +end; + +procedure SpInvalidateItem(View: TTBView; Item: TTBCustomItem); +var + IV: TTBItemViewer; +begin + IV := View.Find(Item); + if Assigned(IV) then View.Invalidate(IV); +end; + +function SpFindItemViewer(View: TTBView; Item: TTBCustomItem): TTBItemViewer; +var + I: Integer; +begin + Result := nil; + if Assigned(Item) then + for I := 0 to View.ViewerCount - 1 do + if View.Viewers[I].Item = Item then begin + Result := View.Viewers[I]; + Exit; + end; +end; + +function SpFindControlItem(Item: TTBCustomItem; Ctl: TControl; Recurse: Boolean): TTBControlItem; +var + I: Integer; +begin + Result := nil; + for I := 0 to Item.Count - 1 do begin + if Recurse and (Item[I] is TTBGroupItem) then begin + Result := SpFindControlItem(Item[I], Ctl, True); + if Assigned(Result) then + Break; + end; + if (Item[I] is TTBControlItem) and (TTBControlItem(Item[I]).Control = Ctl) then begin + Result := TTBControlItem(Item[I]); + Break; + end; + end; +end; + +procedure SpGetDropPosItemViewer(Root: TTBRootItem; View: TTBView; P: TPoint; + out DestIV: TTBItemViewer; out DestItemPos: Integer; out DropMark: TRect); +// Returns the ItemViewer and Item index at the given position for Drag & Drop +// operations that needs a DropMark rect. +// Use this when the items are dropped when the drag operation is finished. +var + DestR: TRect; +const + DropMarkSize = 4; +begin + DestItemPos := -1; + DestIV := SpGetItemViewerFromPoint(Root, View, P); + DropMark := Rect(0, 0, 0, 0); + if Assigned(DestIV) then begin + // Get the destination item position + DestItemPos := Root.IndexOf(DestIV.Item); + DestR := SpGetBoundsRect(DestIV, Root); + if View.Orientation = tbvoVertical then begin + if P.Y > ((DestR.Bottom - DestR.Top) div 2) + DestR.Top then begin + Inc(DestItemPos); + DropMark := Rect(0, DestR.Bottom, View.BaseSize.X, DestR.Bottom + DropMarkSize); + end + else + DropMark := Rect(0, DestR.Top, View.BaseSize.X, DestR.Top + DropMarkSize); + end + else + if P.X > ((DestR.Right - DestR.Left) div 2) + DestR.Left then begin + Inc(DestItemPos); + DropMark := Rect(DestR.Right, 0, DestR.Right + DropMarkSize, View.BaseSize.Y); + end + else + DropMark := Rect(DestR.Left, 0, DestR.Left + DropMarkSize, View.BaseSize.Y); + end; +end; + +procedure SpGetDropPosItemViewer(Root: TTBRootItem; View: TTBView; P: TPoint; + SourceItemPos: Integer; out DestIV: TTBItemViewer; out DestItemPos: Integer); +// Returns the ItemViewer and Item index at the given position for inmediate +// Drag & Drop operations without a DropMark. +// Use this when the items are moved while the mouse is being dragged. +var + DestR: TRect; +begin + DestItemPos := -1; + DestIV := SpGetItemViewerFromPoint(Root, View, P); + if Assigned(DestIV) then begin + // Get the destination item position + DestItemPos := Root.IndexOf(DestIV.Item); + DestR := SpGetBoundsRect(DestIV, Root); + + if View.Orientation = tbvoVertical then begin + if P.Y > ((DestR.Bottom - DestR.Top) div 2) + DestR.Top then begin + if DestItemPos - 1 <> SourceItemPos then Inc(DestItemPos); + end + else begin + if DestItemPos - 1 = SourceItemPos then Dec(DestItemPos); + end; + end + else + if P.X > ((DestR.Right - DestR.Left) div 2) + DestR.Left then begin + if DestItemPos - 1 <> SourceItemPos then Inc(DestItemPos); + end + else begin + if DestItemPos - 1 = SourceItemPos then Dec(DestItemPos); + end; + end; +end; + +function SpGetDragHandleSize(Toolbar: TTBCustomDockableWindow): Integer; +const + DragHandleSizes: array [Boolean, 0..2] of Integer = ((9, 0, 6), (14, 14, 14)); +var + T: TTBCustomDockableWindowAccess; +begin + Result := 0; + if Assigned(Toolbar.CurrentDock) then + if Toolbar.CurrentDock.AllowDrag then begin + T := TTBCustomDockableWindowAccess(Toolbar); + Result := DragHandleSizes[T.CloseButtonWhenDocked, Ord(T.DragHandleStyle)] + end; +end; + +function SpIsVerticalToolbar(Toolbar: TTBCustomDockableWindow): Boolean; +begin + if Assigned(Toolbar.CurrentDock) then + Result := Toolbar.CurrentDock.Position in [dpLeft, dpRight] + else + Result := False; +end; + +function SpIsDockUsingBitmap(Dock: TTBDock): Boolean; +var + Background: TTBBasicBackgroundAccess; +begin + Background := TTBBasicBackgroundAccess(Dock.Background); + Result := Assigned(Background) and Background.UsingBackground; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Painting helpers } + +procedure SpDrawXPMenuItem(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo); + + procedure ToolbarItemDraw(ARect: TRect); + var + Flags: Integer; + ForceRectBorders: TAnchors; + const + XPPart: array [TSpTBXComboPart] of Integer = (TP_BUTTON, TP_DROPDOWNBUTTON, + TP_SPLITBUTTON, TP_SPLITBUTTONDROPDOWN); + begin + ForceRectBorders := []; + if ItemInfo.IsSplit then + if ItemInfo.ComboPart = cpSplitLeft then + ForceRectBorders := [akRight] + else + ForceRectBorders := [akLeft]; + + case ItemInfo.SkinType of + sknNone: + if ItemInfo.Checked then begin + if not ItemInfo.HotTrack or (not ItemInfo.Enabled and ItemInfo.ToolbarStyle) then begin + ACanvas.Brush.Bitmap := AllocPatternBitmap(clBtnFace, clBtnHighlight);; + ACanvas.Brush.Bitmap.HandleType := bmDDB; { needed for Win95, or else brush is solid white } + ACanvas.FillRect(ARect); + ACanvas.Brush.Style := bsClear; + end; + Windows.DrawEdge(ACanvas.Handle, ARect, BDR_SUNKENOUTER, BF_RECT); + end + else begin + case ItemInfo.State of + sknsNormal: + if ItemInfo.IsDesigning then + Windows.DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_RECT); + sknsHotTrack: + Windows.DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_RECT); + sknsPushed: + Windows.DrawEdge(ACanvas.Handle, ARect, BDR_SUNKENOUTER, BF_RECT); + end; + end; + sknWindows: + if ItemInfo.IsDesigning then + SpDrawRectangle(ACanvas, ARect, 2, clBtnShadow, clBtnShadow, clNone, clNone, ForceRectBorders) + else + if ItemInfo.IsOnMenuBar then begin + if ItemInfo.State in [sknsHotTrack, sknsPushed, sknsChecked, sknsCheckedAndHotTrack] then + SpFillRect(ACanvas, ARect, clHighlight); + end + else begin + Flags := 0; + case ItemInfo.State of + sknsNormal: Flags := TS_NORMAL; + sknsDisabled: Flags := TS_DISABLED; + sknsHotTrack: Flags := TS_HOT; + sknsPushed: Flags := TS_PRESSED; + sknsChecked: Flags := TS_CHECKED; + sknsCheckedAndHotTrack: Flags := TS_HOTCHECKED; + end; + DrawThemeBackground(ThemeServices.Theme[teToolBar], ACanvas.Handle, XPPart[ItemInfo.ComboPart], Flags, ARect, nil); + end; + sknSkin: + if ItemInfo.IsOpen and CurrentSkin.OfficePopup then begin + // Paints skncOpenToolbarItem skin, hide the bottom border + ARect.Bottom := ARect.Bottom + 2; + CurrentSkin.PaintBackground(ACanvas, ARect, skncOpenToolbarItem, sknsNormal, True, True) + end + else + if ItemInfo.IsDesigning then + SpDrawRectangle(ACanvas, ARect, 2, clBtnShadow, clBtnShadow, clNone, clNone, ForceRectBorders) + else + if ItemInfo.IsOnMenuBar then + CurrentSkin.PaintBackground(ACanvas, ARect, skncMenuBarItem, ItemInfo.State, True, True, False, ForceRectBorders) + else + CurrentSkin.PaintBackground(ACanvas, ARect, skncToolbarItem, ItemInfo.State, True, True, False, ForceRectBorders); + end; + end; + + procedure MenuItemDraw(ARect: TRect); + var + MenuState: TSpTBXSkinStatesType; + begin + MenuState := sknsHotTrack; // other states are not painted + + case ItemInfo.SkinType of + sknNone: + SpFillRect(ACanvas, ARect, clHighlight); + sknWindows: + if SpIsWinVistaOrUp then begin + // Use the new API on Windows Vista + DrawThemeBackground(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPITEM, MPI_HOT, ARect, nil); + end + else + SpFillRect(ACanvas, ARect, clHighlight); + sknSkin: + CurrentSkin.PaintBackground(ACanvas, ARect, skncMenuItem, MenuState, True, True); + end; + end; + +var + R: TRect; + DrawCheckBoxFrame: Boolean; + C: TColor; + SelectionDelta: Integer; + Flags: Integer; +begin + if ItemInfo.ToolbarStyle then begin // Toolbar Item + if ItemInfo.IsSplit then begin + if ItemInfo.IsOpen and CurrentSkin.OfficePopup then begin + // If it's Split, Open and OfficePopup paint the skncOpenToolbarItem skin + ARect.Right := ItemInfo.ComboRect.Right; + ToolbarItemDraw(ARect); + end + else begin + // Draw the left side button + if (ItemInfo.SkinType = sknSkin) or ItemInfo.IsDesigning then + Inc(ARect.Right, 2); + ItemInfo.ComboPart := cpSplitLeft; + ToolbarItemDraw(ARect); + + // Draw the right side button + ItemInfo.ComboPart := cpSplitRight; + ItemInfo.State := ItemInfo.ComboState; + ToolbarItemDraw(ItemInfo.ComboRect); + end; + end + else + ToolbarItemDraw(ARect); + end + else begin // Menu item + // DrawCheckBoxFrame is true when the item is checked + if (ItemInfo.SkinType = sknSkin) or (SpIsWinVistaOrUp and (ItemInfo.SkinType = sknWindows)) then + DrawCheckBoxFrame := ItemInfo.Enabled and ItemInfo.Checked + else begin + if ItemInfo.SkinType = sknNone then + DrawCheckBoxFrame := ItemInfo.Checked or ItemInfo.ImageOrCheckShown + else + DrawCheckBoxFrame := ItemInfo.Enabled and (ItemInfo.Checked or ItemInfo.ImageOrCheckShown); + end; + + R := ARect; + + // Draw the item selection rectangle + if ItemInfo.HotTrack then begin + if DrawCheckBoxFrame then begin + SelectionDelta := 0; + case ItemInfo.SkinType of + sknNone: + SelectionDelta := ItemInfo.MenuMargins.GutterSize + 1; // Don't draw the hottrack selection behind the checkbox + sknWindows: + if not SpIsWinVistaOrUp then + SelectionDelta := ItemInfo.MenuMargins.GutterSize + 1; // Don't draw the hottrack selection behind the checkbox + sknSkin: + SelectionDelta := 3; // Don't draw the hottrack selection behind the checkbox left borders + end; + Inc(R.Left, SelectionDelta); + end; + MenuItemDraw(R); + end; + + // Draw the checkbox frame (the checkbox glyph is painted in the ItemViewer.Paint method) + if DrawCheckBoxFrame then begin + R := ARect; + R.Right := R.Left + ItemInfo.MenuMargins.GutterSize; + if SpIsWinVistaOrUp and (ItemInfo.SkinType = sknWindows) then begin + // Use the new API on Windows Vista + // The checkbox frame is not painted + if ItemInfo.State = sknsDisabled then Flags := MCB_DISABLED + else if ItemInfo.ImageShown then Flags := MCB_BITMAP + else Flags := MCB_NORMAL; + DrawThemeBackground(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPCHECKBACKGROUND, Flags, R, nil); + end + else + if ItemInfo.SkinType = sknSkin then + CurrentSkin.PaintBackground(ACanvas, R, skncMenuItem, ItemInfo.State, True, True) + else + ToolbarItemDraw(R); + end; + + // Draw the combo item separator + if ItemInfo.IsSplit then begin + if ItemInfo.SkinType = sknSkin then begin + C := SkinManager.CurrentSkin.Options(skncMenuItem, ItemInfo.State).Borders.Color1; + if C = clNone then + C := clBtnShadow; + end + else + C := clBtnShadow; + R := ARect; + R.Left := ARect.Right - 10 - 4; + SpDrawLine(ACanvas, R.Left, R.Top + 1, R.Left, R.Bottom - 1, C); + end; + end; +end; + +procedure SpDrawXPMenuSeparator(ACanvas: TCanvas; ARect: TRect; MenuItemStyle, Vertical: Boolean); +const + ToolbarXPFlags: array [Boolean] of Integer = (TP_SEPARATORVERT, TP_SEPARATOR); +var + R: TRect; + C: TColor; + D: Integer; + VistaSeparatorSize: tagSize; +begin + R := ARect; + case SkinManager.GetSkinType of + sknNone: + if not Vertical then begin + R.Top := (R.Top + R.Bottom) div 2 - 1; + DrawEdge(ACanvas.Handle, R, EDGE_ETCHED, BF_TOP); + end + else begin + R.Left := (R.Left + R.Right) div 2 - 1; + DrawEdge(ACanvas.Handle, R, EDGE_ETCHED, BF_LEFT); + end; + sknWindows: + if MenuItemStyle and SpIsWinVistaOrUp then begin + // Use the new API in Windows Vista + GetThemePartSize(ThemeServices.Theme[teMenu], 0, MENU_POPUPSEPARATOR, 0, nil, TS_TRUE, VistaSeparatorSize); + R := SpCenterRectVert(R, VistaSeparatorSize.cy); + DrawThemeBackground(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPSEPARATOR, 0, R, nil); + end + else begin + if MenuItemStyle then begin + D := 0; + if Vertical then begin + R.Left := (R.Left + R.Right) div 2 - 1; + Inc(R.Top, D); Dec(R.Bottom, D); + Windows.DrawEdge(ACanvas.Handle, R, EDGE_ETCHED, BF_LEFT); + end + else begin + R.Top := (R.Top + R.Bottom) div 2 - 1; + Inc(R.Left, D); Dec(R.Right, D); + Windows.DrawEdge(ACanvas.Handle, R, EDGE_ETCHED, BF_TOP); + end; + end + else + DrawThemeBackground(ThemeServices.Theme[teToolbar], ACanvas.Handle, ToolbarXPFlags[Vertical], TS_NORMAL, R, nil); + end; + sknSkin: + if not Vertical then begin + // ??? what happens when 2 items have different imagelist sizes? how is the gutter measured? + R.Top := (R.Bottom + R.Top) div 2 - 1; + R.Bottom := R.Top; + C := SkinManager.CurrentSkin.Options(skncSeparator, sknsNormal).Body.Color1; + SpDrawLine(ACanvas, R.Left, R.Top, R.Right, R.Bottom, C); + OffsetRect(R, 0, 1); + C := SkinManager.CurrentSkin.Options(skncSeparator, sknsNormal).Body.Color2; + SpDrawLine(ACanvas, R.Left, R.Top, R.Right, R.Bottom, C); + end + else begin + R.Left := (R.Right + R.Left) div 2 - 1; + R.Right := R.Left; + InflateRect(R, 0, -3); + C := SkinManager.CurrentSkin.Options(skncSeparator, sknsNormal).Body.Color1; + SpDrawLine(ACanvas, R.Left, R.Top, R.Right, R.Bottom, C); + OffsetRect(R, 1, 0); + C := SkinManager.CurrentSkin.Options(skncSeparator, sknsNormal).Body.Color2; + SpDrawLine(ACanvas, R.Left, R.Top, R.Right, R.Bottom, C); + end; + end; +end; + +procedure SpDrawXPMenuItemImage(ACanvas: TCanvas; ARect: TRect; + const ItemInfo: TSpTBXMenuItemInfo; ImageList: TCustomImageList; ImageIndex: Integer); +begin + if ImageList is TTBCustomImageList then begin + if ItemInfo.IsSunkenCaption then + OffsetRect(ARect, 1, 1); + TTBCustomImageList(ImageList).DrawState(ACanvas, ARect.Left, ARect.Top, + ImageIndex, ItemInfo.Enabled, ItemInfo.HotTrack, ItemInfo.Checked); + Exit; + end; + + if ItemInfo.Enabled and SkinManager.CurrentSkin.OfficeIcons then begin + // Draw icon shadow + if ItemInfo.HotTrack and not ItemInfo.Pushed then begin + OffsetRect(ARect, 1, 1); + SpDrawIconShadow(ACanvas, ARect, ImageList, ImageIndex); + OffsetRect(ARect, -2, -2); + end; + SpDrawImageList(ACanvas, ARect, ImageList, ImageIndex, ItemInfo.Enabled, True); + end + else begin + if ItemInfo.IsSunkenCaption then + OffsetRect(ARect, 1, 1); + SpDrawImageList(ACanvas, ARect, ImageList, ImageIndex, ItemInfo.Enabled, True); + end; +end; + +procedure SpDrawXPMenuGutter(ACanvas: TCanvas; ARect: TRect; SkinType: TSpTBXSkinType); +var + Op: TSpTBXSkinOptionCategory; + C: TColor; +begin + SkinType := SpTBXSkinType(SkinType); + // If it's Windows theme and we're not on Vista do default painting + if (SkinType = sknWindows) and not SpIsWinVistaOrUp then + SkinType := sknNone; + + case SkinType of + sknNone:; // No gutter on Windows 9x, 2000 + sknWindows: + begin + // Only Windows Vista painting, XP just fills the background + if SpIsWinVistaOrUp then + DrawThemeBackground(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPGUTTER, 0, ARect, nil); + end; + sknSkin: + begin + Op := CurrentSkin.Options(skncGutter, sknsNormal); + if not Op.Body.IsEmpty then + SpPaintSkinBackground(ACanvas, ARect, Op, False); + + // Paint only the right side border, like a Separator line + ARect.Left := ARect.Right; + C := Op.Borders.Color2; + if C <> clNone then begin + SpDrawLine(ACanvas, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, C); + OffsetRect(ARect, -1, 0); + end; + C := Op.Borders.Color1; + if C <> clNone then + SpDrawLine(ACanvas, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, C); + end; + end; +end; + +procedure SpDrawXPMenuPopupWindow(ACanvas: TCanvas; ARect, OpenIVRect: TRect; + DrawGutter: Boolean; ImageSize: Integer; SkinType: TSpTBXSkinType); +var + GutterR: TRect; + MarginsInfo: TSpTBXMenuItemMarginsInfo; + SaveIndex: Integer; +begin + SkinType := SpTBXSkinType(SkinType); + // If it's Windows theme and we're not on Vista do default painting + if (SkinType = sknWindows) and not SpIsWinVistaOrUp then + SkinType := sknNone; + + case SkinType of + sknNone: // Windows 9x, 2000 and XP + if not AreFlatMenusEnabled then begin + DrawEdge(ACanvas.Handle, ARect, EDGE_RAISED, BF_RECT or BF_ADJUST); + SpFillRect(ACanvas, ARect, clBtnFace); + end + else + SpFillRect(ACanvas, ARect, clMenu, clBtnShadow); + sknWindows: // Only Windows Vista painting, XP just fills the background + begin + // Use the new API in Windows Vista + DrawThemeBackground(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPBACKGROUND, 0, ARect, nil); + DrawThemeBackground(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPBORDERS, 0, ARect, nil); + if DrawGutter then begin + CurrentSkin.GetMenuItemMargins(ACanvas, ImageSize, MarginsInfo); + GutterR := ARect; + InflateRect(GutterR, -1, -1); + GutterR.Right := GutterR.Left + MarginsInfo.GutterSize + MarginsInfo.LeftCaptionMargin + 3; // +3 because the popup has 2 pixel border and the gutter separator has 2 pixel + SpDrawXPMenuGutter(ACanvas, GutterR, SkinType); + end; + end; + sknSkin: + begin + // Paint the background, if OfficePopup is true just clip the top + // border corresponding to the Open ItemViewer Rect + if OpenIVRect.Top < 0 then begin + OpenIVRect.Top := ARect.Top; + OpenIVRect.Bottom := ARect.Top + 1; + InflateRect(OpenIVRect, -1, 0); + + // First paint the background + CurrentSkin.PaintBackground(ACanvas, ARect, skncPopup, sknsNormal, True, False); + // Now paint the borders, clip the top border + SaveIndex := SaveDC(ACanvas.Handle); + try + ExcludeClipRect(ACanvas.Handle, OpenIVRect.Left, OpenIVRect.Top, OpenIVRect.Right, OpenIVRect.Bottom); + CurrentSkin.PaintBackground(ACanvas, ARect, skncPopup, sknsNormal, False, True); + finally + RestoreDC(ACanvas.Handle, SaveIndex); + end; + end + else + CurrentSkin.PaintBackground(ACanvas, ARect, skncPopup, sknsNormal, True, True); + + // Paint the gutter + if DrawGutter and not CurrentSkin.Options(skncGutter, sknsNormal).IsEmpty then begin + if ImageSize <= 0 then ImageSize := 16; + CurrentSkin.GetMenuItemMargins(ACanvas, ImageSize, MarginsInfo); + GutterR := ARect; + InflateRect(GutterR, -1, -1); + GutterR.Right := GutterR.Left + MarginsInfo.GutterSize + MarginsInfo.LeftCaptionMargin + 1; // +1 because the popup has 2 pixel border + SpDrawXPMenuGutter(ACanvas, GutterR, SkinType); + end; + end; + end; +end; + +procedure SpDrawXPStatusBar(ACanvas: TCanvas; ARect, AGripRect: TRect; SkinType: TSpTBXSkinType; UsingOfficeTheme: Boolean); +var + R: TRect; + C1, C2: TColor; +begin + case SpTBXSkinType(SkinType) of + sknNone: + begin + if not IsRectEmpty(ARect) then begin + SpFillRect(ACanvas, ARect, clBtnFace); + SpDrawRectangle(ACanvas, ARect, 0, clBtnShadow, clWindow); + end; + if not IsRectEmpty(AGripRect) then begin + InflateRect(AGripRect, 0, -1); + DrawFrameControl(ACanvas.Handle, AGripRect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP); + end; + end; + sknWindows: + begin + if not IsRectEmpty(ARect) then + DrawThemeBackground(ThemeServices.Theme[teStatus], ACanvas.Handle, 0, 0, ARect, nil); + if not IsRectEmpty(AGripRect) then + DrawThemeBackground(ThemeServices.Theme[teStatus], ACanvas.Handle, SP_GRIPPER, 0, AGripRect, nil) + end; + sknSkin: + begin + if not IsRectEmpty(ARect) then + CurrentSkin.PaintBackground(ACanvas, ARect, skncStatusBar, sknsNormal, True, True); + if not IsRectEmpty(AGripRect) then begin + R := AGripRect; + C1 := SkinManager.CurrentSkin.Options(skncStatusBarGrip).Body.Color1; + C2 := SkinManager.CurrentSkin.Options(skncStatusBarGrip).Body.Color2; + // Draw 3 cells at the bottom + R.Left := R.Right - 12; + R.Top := R.Bottom - 4; + SpDrawXPGrip(ACanvas, R, C1, C2); + // Draw 2 cells at the top + R.Bottom := R.Top; + R.Top := R.Bottom - 4; + R.Left := R.Left + 4; + SpDrawXPGrip(ACanvas, R, C1, C2); + // Draw 1 cell at the top + R.Bottom := R.Top; + R.Top := R.Bottom - 4; + R.Left := R.Left + 4; + SpDrawXPGrip(ACanvas, R, C1, C2); + end; + + if UsingOfficeTheme and not IsRectEmpty(ARect) then begin + Inc(ARect.Top); + ACanvas.Brush.Color := clWindow; + ACanvas.FrameRect(ARect); + end; + end; + end; +end; + +procedure SpDrawXPTitleBar(ACanvas: TCanvas; ARect: TRect; IsActive: Boolean; DrawBorders: Boolean = True); +const + XpFlags: array [Boolean] of Integer = (FS_INACTIVE, FS_ACTIVE); + W9xFlags: array [Boolean] of Integer = (0, DC_ACTIVE); + W9xGradientFlag: array [Boolean] of Integer = (0, DC_GRADIENT); +var + Gradient: Boolean; + B: BOOL; +begin + case SkinManager.GetSkinType of + sknNone: + begin + Gradient := SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, @B, 0) and B; + Windows.DrawCaption(GetDesktopWindow, ACanvas.Handle, ARect, DC_TEXT or W9xFlags[IsActive] or W9xGradientFlag[Gradient]); + end; + sknWindows: + // If WP_CAPTION is used instead of WP_SMALLCAPTION the top borders are rounded + DrawThemeBackground(ThemeServices.Theme[teWindow], ACanvas.Handle, WP_SMALLCAPTION, XpFlags[IsActive], ARect, nil); + sknSkin: + CurrentSkin.PaintBackground(ACanvas, ARect, skncWindowTitleBar, sknsNormal, True, DrawBorders); + end; +end; + +procedure SpDrawXPTitleBarBody(ACanvas: TCanvas; ARect: TRect; IsActive: Boolean; + BorderSize: TPoint; DrawBody: Boolean = True); +var + R, MirrorR: TRect; + SaveIndex, Flags: Integer; + B: TBitmap; +begin + case SkinManager.GetSkinType of + sknNone: + begin + if DrawBody then + ACanvas.FillRect(ARect); + SaveIndex := SaveDC(ACanvas.Handle); + try + R := ARect; + InflateRect(R, -BorderSize.X, -BorderSize.Y); + ExcludeClipRect(ACanvas.Handle, R.Left, R.Top, R.Right, R.Bottom); + if not DrawBody then + ACanvas.FillRect(ARect); + Windows.DrawEdge(ACanvas.Handle, ARect, EDGE_RAISED, BF_RECT); + finally + RestoreDC(ACanvas.Handle, SaveIndex); + end; + end; + sknWindows: + begin + if IsActive then + Flags := FS_ACTIVE + else + Flags := FS_INACTIVE; + R := ARect; + R.Top := R.Bottom - BorderSize.Y; + DrawThemeBackground(ThemeServices.Theme[teWindow], ACanvas.Handle, WP_SMALLFRAMEBOTTOM, Flags, R, nil); + R.Top := ARect.Top + BorderSize.Y; + R.Bottom := ARect.Bottom - BorderSize.Y; + R.Right := R.Left + BorderSize.X; + DrawThemeBackground(ThemeServices.Theme[teWindow], ACanvas.Handle, WP_SMALLFRAMELEFT, Flags, R, nil); + R.Right := ARect.Right; + R.Left := R.Right - BorderSize.X; + DrawThemeBackground(ThemeServices.Theme[teWindow], ACanvas.Handle, WP_SMALLFRAMERIGHT, Flags, R, nil); + + // Don't know how to paint a captionless window frame + // We have to mirror the bottom frame and paint it on the top + B := TBitmap.Create; + try + R := ARect; + R.Bottom := R.Top + BorderSize.Y; + B.Width := R.Right - R.Left; + B.Height := R.Bottom - R.Top; + DrawThemeBackground(ThemeServices.Theme[teWindow], B.Canvas.Handle, WP_SMALLFRAMEBOTTOM, Flags, R, nil); + + // Mirror + MirrorR := Rect(0, B.Height - 1, B.Width, -1); + ACanvas.CopyRect(R, B.Canvas, MirrorR); + finally + B.Free; + end; + end; + sknSkin: + begin + CurrentSkin.PaintWindowFrame(ACanvas, ARect, IsActive, DrawBody, BorderSize.X); + end; + end; +end; + +procedure SpDrawXPDock(ACanvas: TCanvas; ARect: TRect; SkinType: TSpTBXSkinType; Vertical: Boolean = False); +begin + SkinType := SpTBXSkinType(SkinType); + case SkinType of + sknNone: + begin + ACanvas.Brush.Color := clBtnFace; + ACanvas.FillRect(ARect); + end; + sknWindows: + begin + if Vertical then Inc(ARect.Bottom, 1); // Fix WindowsXP bug + DrawThemeBackground(ThemeServices.Theme[teRebar], ACanvas.Handle, 0, 0, ARect, nil); + end; + sknSkin: + CurrentSkin.PaintBackground(ACanvas, ARect, skncDock, sknsNormal, True, True, Vertical); + end; +end; + +procedure SpDrawXPToolbar(ACanvas: TCanvas; ARect: TRect; SkinType: TSpTBXSkinType; + Docked, Floating, Vertical, PaintSkinBackground, PaintBorders: Boolean; + SkinComponent: TSpTBXSkinComponentsType = skncToolbar); +begin + SkinType := SpTBXSkinType(SkinType); + case SkinType of + sknNone: + if PaintBorders and Docked then + Windows.DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_RECT or BF_ADJUST); + sknWindows: + if PaintBorders and Docked then + SpDrawRectangle(ACanvas, ARect, 0, SpLighten(clBtnFace, 24), SpLighten(clBtnFace, -32)); + sknSkin: + if Docked or Floating then begin + if Floating and CurrentSkin.Options(SkinComponent, sknsNormal).Body.IsEmpty then // Floating and doesn't have a Body + CurrentSkin.PaintBackground(ACanvas, ARect, skncDock, sknsNormal, True, False) + else begin + if Floating then PaintBorders := False; + CurrentSkin.PaintBackground(ACanvas, ARect, SkinComponent, sknsNormal, PaintSkinBackground, PaintBorders, Vertical); + end; + end; + end; +end; + +procedure SpDrawXPToolbar(W: TTBCustomDockableWindow; ACanvas: TCanvas; + ARect: TRect; PaintOnNCArea: Boolean; PaintBorders: Boolean = True; + SkinComponent: TSpTBXSkinComponentsType = skncToolbar); +var + R: TRect; + PaintDefault, DrawSkinBody: Boolean; + Toolbar: TTBCustomDockableWindowAccess; + IsVertical: Boolean; +begin + if CurrentSkin.Options(SkinComponent, sknsNormal).Body.IsEmpty then + SkinComponent := skncToolbar; + + Toolbar := TTBCustomDockableWindowAccess(W); + IsVertical := SpIsVerticalToolbar(Toolbar); + DrawSkinBody := True; + + if Toolbar.Docked then begin + // Prepare R + R := Toolbar.CurrentDock.ClientRect; + OffsetRect(R, -Toolbar.Left, -Toolbar.Top); + if not PaintOnNCArea then begin + OffsetRect(R, -DefaultToolbarBorderSize, -DefaultToolbarBorderSize); + if IsVertical then + Dec(R.Top, SpGetDragHandleSize(Toolbar)) + else + Dec(R.Left, SpGetDragHandleSize(Toolbar)); + end; + // Draw the Dock background + if Toolbar.CurrentDock is TSpTBXDock then + TSpTBXDock(Toolbar.CurrentDock).DrawBackground(ACanvas.Handle, R); + + DrawSkinBody := not (Toolbar.CurrentDock.BackgroundOnToolbars and SpIsDockUsingBitmap(Toolbar.CurrentDock)); + end + else begin + if Toolbar.Floating then begin + if SkinManager.GetSkinType <> sknSkin then begin + if Toolbar.Color = clNone then ACanvas.Brush.Color := clBtnFace + else ACanvas.Brush.Color := Toolbar.Color; + ACanvas.FillRect(ARect); + end; + end + else begin + // Draw the parent background if the toolbar is not docked nor floating + // SpDrawParentBackground doesn't seem to work correctly here + // (when a toolbar is inside a toolwindow), use PerformEraseBackground instead + Controls.PerformEraseBackground(Toolbar, ACanvas.Handle); + end; + end; + + // Default painting + PaintDefault := True; + if W is TSpTBXToolbar then begin + if TSpTBXToolbar(W).MenuBar then + SkinComponent := skncMenuBar; + TSpTBXToolbar(W).DoDrawBackground(ACanvas, ARect, pstPrePaint, PaintDefault); + end + else + if W is TSpTBXCustomToolWindow then + TSpTBXCustomToolWindow(W).DoDrawBackground(ACanvas, ARect, pstPrePaint, PaintDefault); + + if PaintDefault then begin + R := ARect; + if Toolbar.Color <> clNone then begin + ACanvas.Brush.Color := Toolbar.Color; + ACanvas.FillRect(R); + end + else + SpDrawXPToolbar(ACanvas, R, SkinManager.GetSkinType, Toolbar.Docked, Toolbar.Floating, IsVertical, DrawSkinBody, PaintBorders, SkinComponent); + end; + + PaintDefault := True; + if W is TSpTBXToolbar then + TSpTBXToolbar(W).DoDrawBackground(ACanvas, ARect, pstPostPaint, PaintDefault) + else + if W is TSpTBXCustomToolWindow then + TSpTBXCustomToolWindow(W).DoDrawBackground(ACanvas, ARect, pstPostPaint, PaintDefault); +end; + +procedure SpDrawXPToolbarGrip(W: TTBCustomDockableWindow; ACanvas: TCanvas; ARect: TRect); +const + GripperPart: array [Boolean] of Cardinal = (RP_GRIPPER, RP_GRIPPERVERT); + Pattern: array [0..15] of Byte = (0, 0, $CC, 0, $78, 0, $30, 0, $78, 0, $CC, 0, 0, 0, 0, 0); +var + GripR, CloseR: TRect; + GripSize, Z: Integer; + Vertical: Boolean; + C1, C2, PatternColor: TColor; + Flags: Integer; + Toolbar: TTBCustomDockableWindowAccess; + State: TSpTBXSkinStatesType; +begin + Toolbar := TTBCustomDockableWindowAccess(W); + + GripSize := SpGetDragHandleSize(Toolbar); + if GripSize <= 0 then Exit; + + Vertical := SpIsVerticalToolbar(Toolbar); + + GripR := ARect; + if Vertical then begin + GripR.Bottom := GripR.Top + GripSize; + InflateRect(GripR, -2, 0); + end + else begin + GripR.Right := GripR.Left + GripSize; + InflateRect(GripR, 0, -2); + end; + + if Toolbar.DragHandleStyle <> dhNone then begin + if Toolbar.CloseButtonWhenDocked then begin + if Vertical then begin + CloseR.Left := ARect.Right - GripSize; + CloseR.Right := CloseR.Left + GripSize - 2; + CloseR.Top := ARect.Top + 2; + CloseR.Bottom := CloseR.Top + GripSize - 2; + Dec(GripR.Right, GripSize - 1); + end + else begin + CloseR.Left := ARect.Left + 2; + CloseR.Right := CloseR.Left + GripSize - 2; + CloseR.Top := ARect.Top + 2; + CloseR.Bottom := CloseR.Top + GripSize - 2; + Inc(GripR.Top, GripSize - 1); + end; + end; + + case SkinManager.GetSkinType of + sknNone: + begin + OffsetRect(CloseR, -1, -1); + if Vertical then begin + if Toolbar.CloseButtonWhenDocked then + if Toolbar.DragHandleStyle = dhDouble then Inc(GripR.Top, 1) + else Inc(GripR.Top, 3); + Inc(GripR.Top, 3); + GripR.Bottom := GripR.Top + 3; + end + else begin + if Toolbar.CloseButtonWhenDocked then + if Toolbar.DragHandleStyle = dhDouble then Inc(GripR.Left, 1) + else Inc(GripR.Left, 3); + Inc(GripR.Left, 3); + GripR.Right := GripR.Left + 3; + end; + Windows.DrawEdge(ACanvas.Handle, GripR, BDR_RAISEDINNER, BF_RECT); + ACanvas.Pixels[GripR.Left, GripR.Bottom - 1] := clBtnHighlight; + if Toolbar.DragHandleStyle = dhDouble then begin + if Vertical then OffsetRect(GripR, 0, 3) + else OffsetRect(GripR, 3, 0); + Windows.DrawEdge(ACanvas.Handle, GripR, BDR_RAISEDINNER, BF_RECT); + ACanvas.Pixels[GripR.Left, GripR.Bottom - 1] := clBtnHighlight; + end; + + // Close button + if Toolbar.CloseButtonWhenDocked then begin + if Toolbar.CloseButtonDown then + Windows.DrawEdge(ACanvas.Handle, CloseR, BDR_SUNKENOUTER, BF_RECT) + else + if Toolbar. CloseButtonHover then + Windows.DrawEdge(ACanvas.Handle, CloseR, BDR_RAISEDINNER, BF_RECT); + if Toolbar.CloseButtonDown then OffsetRect(CloseR, 1, 1); + SpDrawGlyphPattern(ACanvas.Handle, CloseR, 7, 7, Pattern[0], clBtnText); + end; + end; + sknWindows: + begin + // Since GetThemePartSize does not seem to work properly, assume we use default + // WindowsXP themes where the gripper pattern repeats itself every 4 pixels + if Vertical then begin + OffsetRect(GripR, -1, 0); + GripR := SpCenterRectVert(GripR, 6); + Z := GripR.Right - GripR.Left; + GripR.Left := GripR.Left - 1 + (Z and $3) shr 1; + GripR.Right := GripR.Left + Z and not $3 + 2; + end + else begin + OffsetRect(GripR, 0, -1); + GripR := SpCenterRectHoriz(GripR, 6); + Z := GripR.Bottom - GripR.Top; + GripR.Top := GripR.Top - 1 + (Z and $3) shr 1; + GripR.Bottom := GripR.Top + Z and not $3 + 1; + end; + DrawThemeBackground(ThemeServices.Theme[teRebar], ACanvas.Handle, GripperPart[Vertical], 0, GripR, nil); + + // Close button + if Toolbar.CloseButtonWhenDocked then begin + Flags := TS_NORMAL; + if Toolbar.CloseButtonDown then Flags := TS_PRESSED + else if Toolbar.CloseButtonHover then Flags := TS_HOT; + DrawThemeBackground(ThemeServices.Theme[teToolbar], ACanvas.Handle, TP_BUTTON, Flags, CloseR, nil); + if Toolbar.CloseButtonDown then OffsetRect(CloseR, 1, 1); + SpDrawGlyphPattern(ACanvas.Handle, CloseR, 7, 7, Pattern[0], clBtnText); + end; + end; + sknSkin: + begin + if Vertical then begin + InflateRect(GripR, -3, 0); + OffsetRect(GripR, 0, 2); + GripR := SpCenterRectVert(GripR, 4); + end + else begin + InflateRect(GripR, 0, -3); + OffsetRect(GripR, 2, 0); + GripR := SpCenterRectHoriz(GripR, 4); + end; + C1 := SkinManager.CurrentSkin.Options(skncToolbarGrip).Body.Color1; + C2 := SkinManager.CurrentSkin.Options(skncToolbarGrip).Body.Color2; + SpDrawXPGrip(ACanvas, GripR, C1, C2); + + // Close button + if Toolbar.CloseButtonWhenDocked then begin + State := sknsNormal; + if Toolbar.CloseButtonDown then State := sknsPushed + else if Toolbar.CloseButtonHover then State := sknsHotTrack; + CurrentSkin.PaintBackground(ACanvas, CloseR, skncToolbarItem, State, True, True); + if Toolbar.CloseButtonDown then OffsetRect(CloseR, 1, 1); + PatternColor := CurrentSkin.GetTextColor(skncToolbarItem, State); + SpDrawGlyphPattern(ACanvas.Handle, CloseR, 7, 7, Pattern[0], PatternColor); + end; + end; + end; + end; +end; + +procedure SpDrawXPTooltipBackground(ACanvas: TCanvas; ARect: TRect); +var + ClipRect: TRect; +begin + if SpIsWinVistaOrUp and ThemeServices.ThemesEnabled then begin + // Paint Vista gradient background if themes enabled + ClipRect := ARect; + InflateRect(ARect, 4, 4); + DrawThemeBackground(ThemeServices.Theme[teToolTip], ACanvas.Handle, TTP_STANDARD, TTSS_NORMAL, ARect, @ClipRect); + end + else + ACanvas.FillRect(ARect); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Menu helpers } + +function SpCalcPopupPosition(const X, Y, Width, Height: Integer; + PopupControl: TControl = nil; IsVertical: Boolean = False): TPoint; +var + R, MonitorR: TRect; +begin + if Assigned(PopupControl) then begin + Result := Point(0, 0); + if PopupControl.Parent = nil then Exit; + + R := PopupControl.BoundsRect; + R.TopLeft := PopupControl.Parent.ClientToScreen(R.TopLeft); + R.BottomRight := PopupControl.Parent.ClientToScreen(R.BottomRight); + + if IsVertical then + Result := Point(R.Right, R.Top) + else + Result := Point(R.Left, R.Bottom); + + MonitorR := GetRectOfMonitorContainingPoint(Result, True); + + if IsVertical then begin + if Result.X + Width > MonitorR.Right then + Result.X := R.Left - Width; + if Result.Y + Height > MonitorR.Bottom then + if R.Bottom > MonitorR.Bottom then + Result.Y := MonitorR.Bottom - Height + else + Result.Y := R.Bottom - Height; + end + else begin + if Result.X + Width > MonitorR.Right then + if R.Right > MonitorR.Right then + Result.X := MonitorR.Right - Width + else + Result.X := R.Right - Width; + if Result.Y + Height > MonitorR.Bottom then + Result.Y := R.Top - Height; + end; + end + else begin + Result := Point(X, Y); + MonitorR := GetRectOfMonitorContainingPoint(Result, True); + if X + Width > MonitorR.Right then + Result.X := X - Width; + if Y + Height > MonitorR.Bottom then + Result.Y := Y - Height; + end; +end; + +function SpHMenuGetCaption(Menu: HMenu; Index: Integer): WideString; +var + AnsiBuf: array[0..MAX_PATH] of AnsiChar; + WideBuf: array[0..MAX_PATH] of WideChar; + Size: Integer; +begin + Result := ''; + if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then begin + FillChar(AnsiBuf, MAX_PATH, #0); + GetMenuStringA(Menu, Index, @AnsiBuf, MAX_PATH, MF_BYPOSITION); + Size := lstrlenA(@AnsiBuf); + Result := WideString(AnsiBuf); + SetLength(Result, Size); + end + else begin + // [Bugfix] Windows bug: + // GetMenuStringW when a DBCS code page is active (e.g. Japanese) + // the result of the function is incorrect (it returns Size * 2) + // http://news.jrsoftware.org/read/article.php?id=12268&group=jrsoftware.toolbar2000.thirdparty + FillChar(WideBuf, MAX_PATH, #0); + GetMenuStringW(Menu, Index, @WideBuf, MAX_PATH, MF_BYPOSITION); + Size := lstrlenW(@WideBuf); + Result := WideBuf; + SetLength(Result, Size); + end; +end; + +function SpHMenuToTBMenuItem(Menu: HMenu; ParentItem: TTBCustomItem): Boolean; +var + MenuInfo: TMenuItemInfo; + I, C: Integer; + Item: TSpTBXItem; + HasSubMenu: Boolean; +begin + Result := False; + if not Assigned(ParentItem) or not IsMenu(Menu) then Exit; + + C := GetMenuItemCount(Menu); + + for I := 0 to C - 1 do begin + FillChar(MenuInfo, SizeOf(MenuInfo), #0); + MenuInfo.cbSize := SizeOf(MenuInfo); + MenuInfo.fMask := MIIM_TYPE or MIIM_STATE or MIIM_ID or MIIM_SUBMENU; + GetMenuItemInfo(Menu, I, True, MenuInfo); + + if MenuInfo.fType and MFT_SEPARATOR <> 0 then + ParentItem.Add(TSpTBXSeparatorItem.Create(nil)) + else begin + HasSubmenu := IsMenu(MenuInfo.hSubMenu); + if HasSubmenu then + Item := TSpTBXSubmenuItem.Create(nil) + else + Item := TSpTBXItem.Create(nil); + + Item.Caption := SpHMenuGetCaption(Menu, I); + Item.Tag := MenuInfo.wID; + if MenuInfo.fState and MFS_DISABLED <> 0 then + Item.Enabled := False; + if MenuInfo.fState and MFS_CHECKED <> 0 then + Item.Checked := True; + if MenuInfo.fState and MFS_DEFAULT <> 0 then + Item.Options := Item.Options + [tboDefault]; + ParentItem.Add(Item); + end; + end; + + Result := True; +end; + +function SpShowSystemPopupMenu(ParentForm: TCustomForm; ScreenPos: TPoint; DoDefault: Boolean = True): Integer; +var + SysMenu: HMENU; +begin + ReleaseCapture; + SysMenu := GetSystemMenu(ParentForm.Handle, False); + case ParentForm.WindowState of + wsMaximized: + begin + EnableMenuItem(SysMenu, SC_RESTORE, MF_ENABLED); + EnableMenuItem(SysMenu, SC_MAXIMIZE, MF_GRAYED); + EnableMenuItem(SysMenu, SC_MOVE, MF_GRAYED); + EnableMenuItem(SysMenu, SC_SIZE, MF_GRAYED); + end; + wsNormal: + begin + EnableMenuItem(SysMenu, SC_RESTORE, MF_GRAYED); + EnableMenuItem(SysMenu, SC_MAXIMIZE, MF_ENABLED); + EnableMenuItem(SysMenu, SC_MOVE, MF_ENABLED); + EnableMenuItem(SysMenu, SC_SIZE, MF_ENABLED); + end; + end; + Result := Integer(TrackPopupMenuEx(SysMenu, TPM_LEFTALIGN or TPM_RETURNCMD or + TPM_RIGHTBUTTON or TPM_HORIZONTAL or TPM_VERTICAL, ScreenPos.X, ScreenPos.Y, ParentForm.Handle, nil)); + if DoDefault then + case Result of + SC_MAXIMIZE: ParentForm.WindowState := wsMaximized; + SC_RESTORE: ParentForm.WindowState := wsNormal; + else + // WindowState := wsMinimized will not minimize the app correctly + SendMessage(ParentForm.Handle, WM_SYSCOMMAND, Result, 0); + end; +end; + +function SpFillSystemSpTBXPopup(ParentForm: TCustomForm; ParentItem: TTBCustomItem; + ShowSize, ShowMinimize, ShowMaximize, ShowClose: Boolean; ClickEvent: TNotifyEvent = nil): Boolean; +var + Menu: HMENU; + I: Integer; + Item: TTBCustomItem; +begin + Result := False; + Menu := GetSystemMenu(ParentForm.Handle, False); + + if SpHMenuToTBMenuItem(Menu, ParentItem) then begin + for I := 0 to ParentItem.Count - 1 do begin + Item := ParentItem.Items[I]; + Item.OnClick := ClickEvent; + case Item.Tag of + SC_MINIMIZE: + begin + Item.Visible := ShowMinimize; + Item.Enabled := ParentForm.WindowState <> wsMinimized; + Item.Images := MDIButtonsImgList; + Item.ImageIndex := 2; + end; + SC_RESTORE: + begin + Item.Visible := ShowMaximize; + Item.Enabled := ParentForm.WindowState <> wsNormal; + Item.Images := MDIButtonsImgList; + Item.ImageIndex := 3; + end; + SC_MAXIMIZE: + begin + Item.Visible := ShowMaximize; + Item.Enabled := ParentForm.WindowState <> wsMaximized; + Item.Images := MDIButtonsImgList; + Item.ImageIndex := 1; + end; + SC_CLOSE: + begin + Item.Visible := ShowClose; + Item.Options := Item.Options + [tboDefault]; + Item.Images := MDIButtonsImgList; + Item.ImageIndex := 0; + end; + SC_MOVE: + begin + Item.Enabled := ParentForm.WindowState <> wsMaximized; + end; + SC_SIZE: + begin + Item.Visible := ShowSize; + Item.Enabled := ParentForm.WindowState <> wsMaximized; + end; + end; + end; + + Result := True; + end; +end; + +function SpShowSystemSpTBXPopupMenu(ParentForm: TCustomForm; ScreenPos: TPoint; + ShowSize, ShowMinimize, ShowMaximize, ShowClose: Boolean; + PopupEvent: TSpTBXPopupEvent; DoDefault: Boolean = True): Integer; +var + Popup: TSpTBXPopupMenu; + ClickedItem: TTBCustomItem; +begin + Result := 0; + ReleaseCapture; + + Popup := TSpTBXPopupMenu.Create(ParentForm); + try + if SpFillSystemSpTBXPopup(ParentForm, Popup.Items, ShowSize, ShowMinimize, ShowMaximize, ShowClose) then begin + if Assigned(PopupEvent) then + Popup.OnInitPopup := PopupEvent; + Popup.PopupComponent := ParentForm; + ClickedItem := Popup.PopupEx(ScreenPos.X, ScreenPos.Y, nil, True); + if Assigned(ClickedItem) then begin + Result := ClickedItem.Tag; + // If it's not a SystemMenu item fire the OnClick event of the item + // We can't use PostClick because the Item will be destroyed by the + // time the message is handled. + if (Result < SC_SIZE) or (Result > SC_CONTEXTHELP) then + ClickedItem.Click; + end; + end; + finally + Popup.Free; + end; + + if DoDefault and (Result > 0) then + case Result of + SC_MAXIMIZE: + ParentForm.WindowState := wsMaximized; + SC_RESTORE: + ParentForm.WindowState := wsNormal; + SC_SIZE, SC_MOVE, SC_MINIMIZE, SC_CLOSE: + begin + // WindowState := wsMinimized will not minimize the app correctly + SendMessage(ParentForm.Handle, WM_SYSCOMMAND, Result, 0); + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Misc helpers } + +procedure SpActivateDwmNC(WinControl: TWinControl; Activate: Boolean); +{$IFDEF JR_D11} +var + ncrp: Cardinal; +{$ENDIF} +begin + {$IFDEF JR_D11} + // Use the new API on Windows Vista + if DwmCompositionEnabled and WinControl.HandleAllocated then begin + if Activate then + ncrp := DWMNCRP_USEWINDOWSTYLE + else + ncrp := DWMNCRP_DISABLED; + DwmSetWindowAttribute(WinControl.Handle, DWMWA_NCRENDERING_POLICY, @ncrp, SizeOf(ncrp)); + end; + {$ENDIF} +end; + +function SpIsDwmCompositionEnabled: Boolean; +begin + {$IFDEF JR_D11} + // Use the new API on Windows Vista + Result := DwmCompositionEnabled; + {$ELSE} + Result := False; + {$ENDIF} +end; + +function SpCanFocus(WinControl: TWinControl): Boolean; +var + Form: TCustomForm; +begin + Result := False; + if Assigned(WinControl) and not WinControl.Focused then begin + Form := GetParentForm(WinControl); + if Assigned(Form) and Form.Enabled and Form.Visible then + Result := WinControl.CanFocus; + end; +end; + +function SpIsFocused(WinControl: TWinControl; out FocusedChild: TWinControl): Boolean; +var + Form: TCustomForm; +begin + Result := False; + FocusedChild := nil; + if WinControl.Focused then + Result := True + else begin + Form := GetParentForm(WinControl); + if Assigned(Form) and Form.Enabled and Form.Visible then + if Assigned(Form.ActiveControl) and Form.ActiveControl.Focused then + if IsChild(WinControl.Handle, Form.ActiveControl.Handle) then begin + Result := True; + FocusedChild := Form.ActiveControl; + end; + end; +end; + +function SpFocusFirstChild(WinControl: TWinControl): TWinControl; +var + Form: TCustomForm; +begin + Result := nil; + Form := GetParentForm(WinControl); + if Assigned(Form) and Form.Enabled and Form.Visible then begin + TWinControlAccess(WinControl).SelectFirst; + Result := Form.ActiveControl; + end; +end; + +function SpFindControl(Parent: TWinControl; Child: TControl): Integer; +var + I: Integer; +begin + Result := -1; + for I := 0 to Parent.ControlCount - 1 do + if Parent.Controls[I] = Child then begin + Result := I; + Break; + end; +end; + +function SpFindParent(Control: TControl; ParentClass: TClass): TWinControl; +var + P: TWinControl; +begin + Result := nil; + if Assigned(Control) then begin + P := Control.Parent; + while Assigned(P) do + if P is ParentClass then begin + Result := P; + Break; + end + else + P := P.Parent; + end; +end; + +function SpHasBorders(WinControl: TWinControl): Boolean; +var + Style, ExStyle: Integer; +begin + Result := False; + Style := GetWindowLong(WinControl.Handle, GWL_STYLE); + ExStyle := GetWindowLong(WinControl.Handle, GWL_EXSTYLE); + + if (Style and WS_BORDER <> 0) or (ExStyle and WS_EX_CLIENTEDGE <> 0) then + Result := True; +end; + +function SpGetFormWindowState(F: TCustomForm; out RestoreBoundsRect: TRect): TWindowState; +// This method is more accurate than Form.WindowState +var + P: TWindowPlacement; +begin + Result := wsNormal; + RestoreBoundsRect := Rect(0, 0, 0, 0); + if Assigned(F) and (F.HandleAllocated) then begin + P.Length := SizeOf(TWindowPlacement); + if GetWindowPlacement(F.Handle, @P) then begin + case P.showCmd of + SW_SHOWMINIMIZED: Result := wsMinimized; + SW_SHOWMAXIMIZED: Result := wsMaximized; + end; + // rcNormalPosition contains the window's coordinates when the window is in the restored position + with P.rcNormalPosition do + RestoreBoundsRect := Rect(Left, Top, Right - Left, Bottom - Top); + end; + end; +end; + +procedure SpSetFormWindowState(F: TCustomForm; WindowState: TWindowState; RestoreBoundsRect: TRect); +// This method is more accurate than Form.WindowState +var + P: TWindowPlacement; +begin + if Assigned(F) and (F.HandleAllocated) then begin + P.Length := SizeOf(TWindowPlacement); + case WindowState of + wsMinimized: P.showCmd := SW_SHOWMINIMIZED; + wsMaximized: P.showCmd := SW_SHOWMAXIMIZED; + else + P.showCmd := SW_SHOWNORMAL; + end; + // rcNormalPosition contains the window's coordinates when the window is in the restored position + if not IsRectEmpty(RestoreBoundsRect) then + with RestoreBoundsRect do + P.rcNormalPosition := Bounds(Left, Top, Right, Bottom); + + SetWindowPlacement(F.Handle, @P); + end; +end; + +function SpGetTaskBar(out State, Edge: Cardinal; out Bounds: TRect): Boolean; +// Returns the TaskBar state and bounds +// State can be: 0, ABS_ALWAYSONTOP, ABS_AUTOHIDE +// Edge can be: ABE_LEFT, ABE_RIGHT, ABE_TOP, ABE_BOTTOM +// ABM_GETSTATE + +var + AppData: TAppBarData; +begin + Result := False; + State := 0; + Edge := 0; + Bounds := Rect(0, 0, 0, 0); + + // 'Shell_TrayWnd' is the name of the task bar's window + AppData.Hwnd := FindWindow('Shell_TrayWnd', nil); + if AppData.Hwnd <> 0 then begin + AppData.cbSize := SizeOf(TAppBarData); + if SHAppBarMessage(ABM_GETTASKBARPOS, AppData) <> 0 then begin + Edge := AppData.uEdge; + Bounds := AppData.rc; + + AppData.cbSize := SizeOf(TAppBarData); + State := SHAppBarMessage(ABM_GETSTATE, AppData); + + Result := True; + end; + end; +end; + +procedure SpRecalcNCArea(WinControl: TWinControl); +begin + if WinControl.HandleAllocated then + SetWindowPos(WinControl.Handle, 0, 0, 0, 0, 0, SWP_FRAMECHANGED or + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Customizer helpers } + +procedure SpCustomizeAllToolbars(AParentComponent: TComponent; Reset: Boolean); +var + I: Integer; + TB: TSpTBXToolbar; +begin + if Assigned(AParentComponent) then begin + for I := 0 to AParentComponent.ComponentCount - 1 do + if AParentComponent.Components[I] is TSpTBXToolbar then begin + TB := AParentComponent.Components[I] as TSpTBXToolbar; + if Reset then + TB.EndCustomize + else + TB.BeginCustomize; + end; + end; +end; + +procedure SpBeginUpdateAllToolbars(AParentComponent: TComponent); +var + I: Integer; + TB: TTBCustomToolbar; +begin + if Assigned(AParentComponent) then begin + for I := 0 to AParentComponent.ComponentCount - 1 do + if AParentComponent.Components[I] is TTBCustomToolbar then begin + TB := AParentComponent.Components[I] as TTBCustomToolbar; + TB.BeginUpdate; + end; + end; +end; + +procedure SpEndUpdateAllToolbars(AParentComponent: TComponent); +var + I: Integer; + TB: TTBCustomToolbar; +begin + if Assigned(AParentComponent) then begin + for I := 0 to AParentComponent.ComponentCount - 1 do + if AParentComponent.Components[I] is TTBCustomToolbar then begin + TB := AParentComponent.Components[I] as TTBCustomToolbar; + TB.View.UpdatePositions; + TB.EndUpdate; + TB.Invalidate; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Unicode helpers } + +procedure SpPersistent_AfterInherited_DefineProperties(Filer: TFiler; Instance: TPersistent); +begin + {$IFNDEF UNICODE} + // Don't let the streaming system store the WideStrings, + // we need to store them manually + TntPersistent_AfterInherited_DefineProperties(Filer, Instance); + {$ENDIF} +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXFontSettings } + +constructor TSpTBXFontSettings.Create; +begin + FSize := 100; + FColor := clNone; +end; + +procedure TSpTBXFontSettings.Apply(AFont: TFont); +begin + AFont.Charset := DEFAULT_CHARSET; + AFont.Color := FColor; + if FSize <> 100 then + AFont.Size := (AFont.Size * FSize + 50) div 100; + if FName <> '' then + AFont.Name := Name; + if FStyle <> [] then + AFont.Style := FStyle; +end; + +procedure TSpTBXFontSettings.Assign(Src: TPersistent); +var + F: TSpTBXFontSettings; +begin + if Src is TPersistent then begin + F := TSpTBXFontSettings(Src); + FColor := F.Color; + FName := F.Name; + FSize := F.Size; + FStyle := F.Style; + Modified; + end + else + inherited; +end; + +procedure TSpTBXFontSettings.Modified; +begin + if Assigned(FOnChange) then FOnChange(Self); +end; + +procedure TSpTBXFontSettings.SetColor(Value: TColor); +begin + if FColor <> Value then begin + FColor := Value; + Modified; + end; +end; + +procedure TSpTBXFontSettings.SetName(const Value: TFontName); +begin + if FName <> Value then begin + FName := Value; + Modified; + end; +end; + +procedure TSpTBXFontSettings.SetSize(Value: TSpTBXFontSize); +begin + if FSize <> Value then begin + FSize := Value; + Modified; + end; +end; + +procedure TSpTBXFontSettings.SetStyle(const Value: TFontStyles); +begin + if FStyle <> Value then begin + FStyle := Value; + Modified; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomDragObject } + +constructor TSpTBXCustomDragObject.Create(ASourceControl: TControl; AItem: TTBCustomItem); +begin + FSourceControl := ASourceControl; + FSourceItem := AItem; + FDragCursorAccept := crSpTBXCustomization; + FDragCursorCancel := crNo; +end; + +procedure TSpTBXCustomDragObject.Finished(Target: TObject; X, Y: Integer; + Accepted: Boolean); +begin + inherited; + if not Accepted then begin + if Assigned(FSourceControl) then + TControlAccess(FSourceControl).DragCanceled; + Target := nil; + end; + + if Assigned(FSourceControl) then + TControlAccess(FSourceControl).DoEndDrag(Target, X, Y); +end; + +function TSpTBXCustomDragObject.GetDragCursor(Accepted: Boolean; X, + Y: Integer): TCursor; +begin + if Accepted then Result := FDragCursorAccept + else Result := FDragCursorCancel; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomItemActionLink } + +{$IFNDEF UNICODE} +procedure TSpTBXCustomItemActionLink.AssignClient(AClient: TObject); +begin + inherited AssignClient(AClient); + FUnicodeClient := AClient as TSpTBXCustomItem; +end; + +function TSpTBXCustomItemActionLink.IsCaptionLinked: Boolean; +begin + if (Action is TCustomAction) and Supports(Action, ITntAction) then + Result := FUnicodeClient.Caption = TntActnList.TntAction_GetCaption(Action as TCustomAction) + else + Result := inherited IsCaptionLinked; +end; + +function TSpTBXCustomItemActionLink.IsHintLinked: Boolean; +begin + if (Action is TCustomAction) and Supports(Action, ITntAction) then + Result := FUnicodeClient.Hint = TntActnList.TntAction_GetHint(Action as TCustomAction) + else + Result := inherited IsCaptionLinked; +end; + +procedure TSpTBXCustomItemActionLink.SetCaption(const Value: String); +begin + if IsCaptionLinked then + if (Action is TCustomAction) and Supports(Action, ITntAction) then + FUnicodeClient.Caption := TntActnList.TntAction_GetNewCaption(Action as TCustomAction, Value) + else + FUnicodeClient.Caption := Value; +end; + +procedure TSpTBXCustomItemActionLink.SetHint(const Value: String); +begin + if IsHintLinked then + if (Action is TCustomAction) and Supports(Action, ITntAction) then + FUnicodeClient.Hint := TntActnList.TntAction_GetNewHint(Action as TCustomAction, Value) + else + FUnicodeClient.Hint := Value; +end; +{$ENDIF} + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomControl } + +{$IFNDEF UNICODE} +procedure TSpTBXCustomControl.CreateWindowHandle(const Params: TCreateParams); +begin + CreateUnicodeHandle(Self, Params, ''); +end; + +procedure TSpTBXCustomControl.DefineProperties(Filer: TFiler); +begin + inherited; + // Don't let the streaming system store the WideStrings, + // we need to store them manually + SpPersistent_AfterInherited_DefineProperties(Filer, Self); +end; + +procedure TSpTBXCustomControl.ActionChange(Sender: TObject; CheckDefaults: Boolean); +begin + if (Action is TCustomAction) and Supports(Action, ITntAction) then begin + if not CheckDefaults or (Self.Caption = '') then + Self.Caption := TntActnList.TntAction_GetCaption(Action as TCustomAction); + if not CheckDefaults or (Self.Hint = '') then + Self.Hint := TntActnList.TntAction_GetHint(Action as TCustomAction); + end; + // Call inherited after we changed the unicode Caption and Hint + inherited; +end; + +function TSpTBXCustomControl.IsCaptionStored: Boolean; +begin + Result := TntControl_IsCaptionStored(Self); +end; + +function TSpTBXCustomControl.IsHintStored: Boolean; +begin + Result := TntControl_IsHintStored(Self); +end; + +function TSpTBXCustomControl.GetCaption: TWideCaption; +begin + Result := TntControl_GetText(Self); +end; + +function TSpTBXCustomControl.GetHint: WideString; +begin + Result := TntControl_GetHint(Self); +end; + +procedure TSpTBXCustomControl.SetCaption(const Value: TWideCaption); +begin + TntControl_SetText(Self, Value); +end; + +procedure TSpTBXCustomControl.SetHint(const Value: WideString); +begin + TntControl_SetHint(Self, Value); +end; +{$ENDIF} + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomItem } + +constructor TSpTBXCustomItem.Create(AOwner: TComponent); +begin + inherited; + FFontSettings := TSpTBXFontSettings.Create; + FFontSettings.OnChange := FontSettingsChanged; + + {$IFNDEF UNICODE} + FCaption := ''; + {$ENDIF} + FAlignment := taCenter; + FCaptionGlowColor := clYellow; + FCustomWidth := -1; + FCustomHeight := -1; + FMargins := 0; + SetStretch(True); + FWrapping := twWrap; +end; + +destructor TSpTBXCustomItem.Destroy; +begin + FreeAndNil(FFontSettings); + inherited; +end; + +procedure TSpTBXCustomItem.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = Control) then Control := nil; +end; + +procedure TSpTBXCustomItem.DefineProperties(Filer: TFiler); +begin + inherited; + // Don't let the streaming system store the WideStrings, + // we need to store them manually + SpPersistent_AfterInherited_DefineProperties(Filer, Self); +end; + +procedure TSpTBXCustomItem.ActionChange(Sender: TObject; CheckDefaults: Boolean); +begin + {$IFNDEF UNICODE} + if (Action is TCustomAction) and Supports(Action, ITntAction) then begin + if not CheckDefaults or (Self.Caption = '') then + Self.Caption := TntActnList.TntAction_GetCaption(Action as TCustomAction); + if not CheckDefaults or (Self.Hint = '') then + Self.Hint := TntActnList.TntAction_GetHint(Action as TCustomAction); + inherited; + Exit; + end; + {$ENDIF} + + if Action is TCustomAction then + with TCustomAction(Sender) do begin + if not CheckDefaults or (Self.Caption = '') then + Self.Caption := Caption; + if not CheckDefaults or (Self.Hint = '') then + Self.Hint := Hint; + end; + inherited; +end; + +function TSpTBXCustomItem.DialogChar(CharCode: Word): Boolean; +begin + Result := False; +end; + +procedure TSpTBXCustomItem.DoDrawAdjustFont(AFont: TFont; State: TSpTBXSkinStatesType); +begin + // Do nothing +end; + +procedure TSpTBXCustomItem.DoDrawHint(AHintBitmap: TBitmap; var AHint: Widestring; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawHint) then FOnDrawHint(Self, AHintBitmap, AHint, PaintDefault); +end; + +procedure TSpTBXCustomItem.DoDrawButton(ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawItem) then FOnDrawItem(Self, ACanvas, ARect, ItemInfo, PaintStage, PaintDefault); +end; + +procedure TSpTBXCustomItem.DoDrawCaption(ACanvas: TCanvas; ClientAreaRect: TRect; + State: TSpTBXSkinStatesType; var ACaption: WideString; var CaptionRect: TRect; var CaptionFormat: Cardinal; + IsTextRotated: Boolean; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawCaption) then FOnDrawCaption(Self, ACanvas, ClientAreaRect, + State, ACaption, CaptionRect, CaptionFormat, IsTextRotated, PaintStage, PaintDefault); +end; + +procedure TSpTBXCustomItem.DoDrawImage(ACanvas: TCanvas; + State: TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; + var AImageList: TCustomImageList; var AImageIndex: Integer; + var ARect: TRect; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawImage) then FOnDrawImage(Self, ACanvas, State, PaintStage, + AImageList, AImageIndex, ARect, PaintDefault); +end; + +procedure TSpTBXCustomItem.DoPopupShowingChanged(APopupWindow: TTBPopupWindow; IsVisible: Boolean); +// This method is called by TSpTBXPopupWindow when the popup is Opened and Closed +begin + if Assigned(APopupWindow) then begin + if IsVisible then begin + if Assigned(FOnInitPopup) then FOnInitPopup(Self, APopupWindow.View); + end + else begin + if Assigned(FOnClosePopup) then FOnClosePopup(Self); + end; + end; +end; + +procedure TSpTBXCustomItem.FontSettingsChanged(Sender: TObject); +begin + Change(True); +end; + +function TSpTBXCustomItem.GetActionLinkClass: TTBCustomItemActionLinkClass; +begin + Result := TSpTBXCustomItemActionLink; +end; + +function TSpTBXCustomItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TSpTBXItemViewer; +end; + +function TSpTBXCustomItem.GetPopupWindowClass: TTBPopupWindowClass; +begin + Result := TSpTBXPopupWindow; +end; + +function TSpTBXCustomItem.GetShortCutText: WideString; +var + P: Integer; +begin + P := Pos(#9, Caption); + if (P = 0) or (P = Length(Caption)) then begin + if ShortCut <> 0 then + Result := ShortCutToText(ShortCut) + else + Result := ''; + end + else + Result := Copy(Caption, P+1, Maxint); +end; + +procedure TSpTBXCustomItem.Click; +begin + if Assigned(FControl) then ToggleControl; + inherited; +end; + +procedure TSpTBXCustomItem.InitiateAction; +begin + inherited; + UpdateProps; +end; + +procedure TSpTBXCustomItem.Invalidate; +begin + Change(False); +end; + +{$IFNDEF UNICODE} +function TSpTBXCustomItem.IsCaptionStored: Boolean; +begin + Result := (ActionLink = nil) or not TActionLinkAccess(ActionLink).IsCaptionLinked; +end; + +function TSpTBXCustomItem.IsHintStored: Boolean; +begin + Result := (ActionLink = nil) or not TActionLinkAccess(ActionLink).IsHintLinked; +end; + +procedure TSpTBXCustomItem.SetCaption(const Value: WideString); +var + S, PrevS: string; +begin + if FCaption <> Value then begin + FCaption := Value; + // We need to compare the Ansi inherited Caption + // to force the change. + // Sometimes '???' = '???' and the change is not executed. + S := inherited Caption; + PrevS := Value; + if S <> PrevS then + inherited Caption := Value + else + Change(True); + end; +end; + +procedure TSpTBXCustomItem.SetHint(const Value: WideString); +begin + if FHint <> Value then begin + FHint := Value; + inherited Hint := Value; + end; +end; +{$ENDIF} + +procedure TSpTBXCustomItem.SetAlignment(const Value: TAlignment); +begin + if FAlignment <> Value then begin + FAlignment := Value; + Change(False); + end; +end; + +procedure TSpTBXCustomItem.SetAnchored(const Value: Boolean); +begin + if FAnchored <> Value then begin + FAnchored := Value; + end; +end; + +procedure TSpTBXCustomItem.SetCaptionGlow(const Value: TSpGlowDirection); +begin + if FCaptionGlow <> Value then begin + FCaptionGlow := Value; + Change(False); + end; +end; + +procedure TSpTBXCustomItem.SetCaptionGlowColor(const Value: TColor); +begin + if FCaptionGlowColor <> Value then begin + FCaptionGlowColor := Value; + Change(False); + end; +end; + +procedure TSpTBXCustomItem.SetControl(const Value: TControl); +begin + if FControl <> Value then + begin + FControl := Value; + if Assigned(Value) then + Value.FreeNotification(Self); + UpdateProps; + end; +end; + +procedure TSpTBXCustomItem.SetCustomWidth(Value: Integer); +begin + if Value < -1 then Value := -1; + if FCustomWidth <> Value then begin + FCustomWidth := Value; + Change(True); + end; +end; + +procedure TSpTBXCustomItem.SetCustomHeight(Value: Integer); +begin + if Value < -1 then Value := -1; + if FCustomHeight <> Value then begin + FCustomHeight := Value; + Change(True); + end; +end; + +procedure TSpTBXCustomItem.SetFontSettings(const Value: TSpTBXFontSettings); +begin + FFontSettings.Assign(Value); +end; + +procedure TSpTBXCustomItem.SetMargins(Value: Integer); +begin + if FMargins <> Value then begin + FMargins := Value; + Change(True); + end; +end; + +procedure TSpTBXCustomItem.SetMinHeight(const Value: Integer); +begin + if Value <> FMinHeight then begin + FMinHeight := Value; + Change(True); + end; +end; + +procedure TSpTBXCustomItem.SetMinWidth(const Value: Integer); +begin + if Value <> FMinWidth then begin + FMinWidth := Value; + Change(True); + end; +end; + +procedure TSpTBXCustomItem.SetStretch(const Value: Boolean); +begin + if FStretch <> Value then begin + FStretch := Value; + Change(True); + end; +end; + +procedure TSpTBXCustomItem.SetToolBoxPopup(const Value: Boolean); +begin + FToolBoxPopup := Value; + if FToolBoxPopup then + Options := Options + [tboToolbarStyle] + else + Options := Options - [tboToolbarStyle]; +end; + +procedure TSpTBXCustomItem.SetWrapping(const Value: TTextWrapping); +begin + if FWrapping <> Value then begin + FWrapping := Value; + Change(False); + end; +end; + +procedure TSpTBXCustomItem.ToggleControl; +begin + FControl.Visible := not FControl.Visible; +end; + +procedure TSpTBXCustomItem.UpdateProps; +begin + if Assigned(Control) then + if (ComponentState * [csDesigning, csLoading, csDestroying] = []) then + Checked := Control.Visible; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXItemViewer } + +function TSpTBXItemViewer.CaptionShown: Boolean; +var + T: TSpTBXToolbar; +begin + Result := inherited CaptionShown; + + if Assigned(View) and Assigned(View.Owner) and (View.Owner is TSpTBXToolbar) then begin + T := View.Owner as TSpTBXToolbar; + case T.DisplayMode of + tbdmImageOnly: + if GetImageShown then Result := False; + tbdmTextOnly: + Result := True; + end; + end; +end; + +function TSpTBXItemViewer.GetImageShown: Boolean; +begin + Result := (Item.ImageIndex >= 0) and + ((Item.DisplayMode in [nbdmDefault, nbdmImageAndText]) or + (IsToolbarStyle and (Item.DisplayMode = nbdmTextOnlyInMenus))); + + if Assigned(View) and Assigned(View.Owner) and (View.Owner is TSpTBXToolbar) then + if TSpTBXToolbar(View.Owner).DisplayMode = tbdmTextOnly then + Result := False; +end; + +function TSpTBXItemViewer.GetImageSize: TSize; +var + IL: TCustomImageList; +begin + IL := GetImageList; + if Assigned(IL) then begin + Result.cx := IL.Width; + Result.cy := IL.Height; + end + else begin + Result.cx := 0; + Result.cy := 0; + end; +end; + +function TSpTBXItemViewer.GetRightImageSize: TSize; +begin + Result.cx := 0; + Result.cy := 0; +end; + +procedure TSpTBXItemViewer.DoDrawButton(ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + Item.DoDrawButton(ACanvas, ARect, ItemInfo, PaintStage, PaintDefault); +end; + +procedure TSpTBXItemViewer.DoDrawCaption(ACanvas: TCanvas; ClientAreaRect: TRect; + State: TSpTBXSkinStatesType; var ACaption: WideString; var CaptionRect: TRect; var CaptionFormat: Cardinal; + IsTextRotated: Boolean; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + Item.DoDrawCaption(ACanvas, ClientAreaRect, State, ACaption, CaptionRect, + CaptionFormat, IsTextRotated, PaintStage, PaintDefault); +end; + +procedure TSpTBXItemViewer.DoDrawHint(AHintBitmap: TBitmap; CursorPos: TPoint; + var CursorRect: TRect; var AHint: Widestring; var PaintDefault: Boolean); +begin + Item.DoDrawHint(AHintBitmap, AHint, PaintDefault); +end; + +procedure TSpTBXItemViewer.DoDrawImage(ACanvas: TCanvas; + State: TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; + var AImageList: TCustomImageList; var AImageIndex: Integer; + var ARect: TRect; var PaintDefault: Boolean); +begin + Item.DoDrawImage(ACanvas, State, PaintStage, AImageList, AImageIndex, ARect, PaintDefault); +end; + +procedure TSpTBXItemViewer.DoDrawAdjustFont(AFont: TFont; State: TSpTBXSkinStatesType); +begin + Item.FontSettings.Apply(AFont); + + if tboDefault in Item.EffectiveOptions then + AFont.Style := AFont.Style + [fsBold]; + + if AFont.Color = clNone then + AFont.Color := GetTextColor(State); + + Item.DoDrawAdjustFont(AFont, State); +end; + +procedure TSpTBXItemViewer.DrawItemImage(ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo; ImgIndex: Integer); +var + PaintDefault: Boolean; + ImgList: TCustomImageList; + PatternColor: TColor; +begin + ImgList := GetImageList; + + PaintDefault := True; + DoDrawImage(ACanvas, ItemInfo.State, pstPrePaint, ImgList, ImgIndex, ARect, PaintDefault); + if PaintDefault and Assigned(ImgList) then + if ImgList = MDIButtonsImgList then begin + if (Item.Enabled) and not IsToolbarStyle and (SkinManager.GetSkinType <> sknSkin) then + PatternColor := clMenuText + else + PatternColor := GetTextColor(ItemInfo.State); + SpDrawGlyphPattern(ACanvas, ARect, ImgIndex, PatternColor); + end + else + if (ImgIndex >= 0) and (ImgIndex < ImgList.Count) then + SpDrawXPMenuItemImage(ACanvas, ARect, ItemInfo, ImgList, ImgIndex); + PaintDefault := True; + DoDrawImage(ACanvas, ItemInfo.State, pstPostPaint, ImgList, ImgIndex, ARect, PaintDefault); +end; + +procedure TSpTBXItemViewer.DrawItemRightImage(ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo); +begin + // Do nothing +end; + +procedure TSpTBXItemViewer.InternalCalcSize(const Canvas: TCanvas; + CalcStretch: Boolean; var AWidth, AHeight: Integer); +var + I, W, H: Integer; + DropDownArrowSize, DropDownArrowMargin, SplitBtnArrowSize: Integer; + ImgSize, RightImgSize: TSize; + GlyphTop, ToolbarStyle: Boolean; + WS: WideString; + TextMetric: TTextMetric; + MenuMargins: TSpTBXMenuItemMarginsInfo; + State: TSpTBXSkinStatesType; + IsHoverItem, IsOpen, IsPushed: Boolean; + TextInfo: TSpTBXTextInfo; + TB: TSpTBXToolbar; +begin + CurrentSkin.GetDropDownArrowSize(DropDownArrowSize, DropDownArrowMargin, SplitBtnArrowSize); + + ToolbarStyle := IsToolbarStyle; + + ImgSize := GetImageSize; + if (ImgSize.CX <= 0) or (ImgSize.CY <= 0) then begin + ImgSize.CX := 0; + ImgSize.CY := 0; + end; + RightImgSize := GetRightImageSize; + if (RightImgSize.CX <= 0) or (RightImgSize.CY <= 0) then begin + RightImgSize.CX := 0; + RightImgSize.CY := 0; + end; + + GlyphTop := False; + if tboImageAboveCaption in Item.EffectiveOptions then + GlyphTop := True; + + // Setup font and get the text info + IsOpen := Self = View.OpenViewer; + IsHoverItem := Self = View.Selected; + IsPushed := IsHoverItem and (IsOpen or (View.MouseOverSelected and View.Capture)); + State := CurrentSkin.GetState(Item.Enabled, IsPushed, IsHoverItem, Item.Checked); + GetTextInfo(Canvas, State, TextInfo); + + // Measure size + if ToolbarStyle then begin + AWidth := 6; + AHeight := 6; + + if CaptionShown then begin + Inc(AWidth, TextInfo.TextSize.CX); + Inc(AHeight, TextInfo.TextSize.CY); + if not TextInfo.IsTextRotated then Inc(AWidth, 4) + else Inc(AHeight, 4); + end; + + if GetImageShown and (ImgSize.CX > 0) and (ImgSize.CY > 0) then begin + if not GlyphTop then begin + if not TextInfo.IsTextRotated then begin + Inc(AWidth, ImgSize.CX); + Inc(AWidth); + if AHeight < ImgSize.CY + 6 then AHeight := ImgSize.CY + 6; + end + else begin + Inc(AHeight, ImgSize.CY); + Inc(AHeight); + if AWidth < ImgSize.CX + 6 then AWidth := ImgSize.CX + 6; + end; + end + else begin + Inc(AHeight, ImgSize.CY); + if AWidth < ImgSize.CX + 7 then AWidth := ImgSize.CX + 7; + end; + end; + + if (RightImgSize.cx > 0) and (RightImgSize.cy > 0) then begin + if View.Orientation = tbvoVertical then + Inc(AHeight, 4 + RightImgSize.cy) + else + Inc(AWidth, 4 + RightImgSize.cx); + end; + + if (tbisSubmenu in Item.ItemStyle) and (tbisCombo in Item.ItemStyle) then + Inc(AWidth, SplitBtnArrowSize) + else begin + if tboDropdownArrow in Item.Options then + if not GlyphTop or (ImgSize.CX = 0) or TextInfo.IsTextRotated then begin + if View.Orientation = tbvoVertical then Inc(AHeight, DropDownArrowSize) + else Inc(AWidth, DropDownArrowSize); + end + else + if GlyphTop and (TextInfo.IsTextRotated xor (View.Orientation <> tbvoVertical)) then begin + W := ImgSize.CX + DropDownArrowSize + 2; + if W > AWidth - 7 then AWidth := W + 7; + end + else begin + H := ImgSize.CY + DropDownArrowSize + 2; + if H > AHeight - 7 then AHeight := H + 7; + end; + end; + + // Widen MenuBar SubMenuItems + if (tbisSubmenu in Item.ItemStyle) and (vsMenuBar in View.Style) then + Inc(AWidth, 6); + + // Toolbar.Stretch property doesn't work correctly, I don't know how to fix + // it without changing the TB2K source. + // http://news.jrsoftware.org/read/article.php?id=8176&group=jrsoftware.toolbar2000#8176 + if CalcStretch and Item.Stretch and (View is TSpTBXToolbarView) and (View.ViewerCount > 2) then begin + if View.Orientation = tbvoVertical then begin + if AWidth < TSpTBXToolbarView(View).FTallestItemSize then AWidth := TSpTBXToolbarView(View).FTallestItemSize; + end + else + if AHeight < TSpTBXToolbarView(View).FTallestItemSize then AHeight := TSpTBXToolbarView(View).FTallestItemSize; + end; + end + else begin // Menu Item + GetTextMetrics(Canvas.Handle, TextMetric); + Inc(TextInfo.TextSize.cy, TextMetric.tmExternalLeading); + + AWidth := TextInfo.TextSize.cx; + AHeight := TextInfo.TextSize.cy; + + if ImgSize.cy = 0 then ImgSize.cy := 16; + if AHeight < ImgSize.cy then AHeight := ImgSize.cy; + + if View.Window is TSpTBXPopupWindow then + CurrentSkin.GetMenuItemMargins(Canvas, TSpTBXPopupWindow(View.Window).MaximumImageSize.cx, MenuMargins) + else + CurrentSkin.GetMenuItemMargins(Canvas, ImgSize.cx, MenuMargins); + + Inc(AWidth, MenuMargins.Margins.Left + MenuMargins.Margins.Right); + Inc(AHeight, MenuMargins.Margins.Top + MenuMargins.Margins.Bottom); + + Inc(AWidth, MenuMargins.GutterSize + MenuMargins.ImageTextSpace + MenuMargins.LeftCaptionMargin + MenuMargins.RightCaptionMargin); + WS := Item.GetShortCutText; + if Length(WS) > 0 then + Inc(AWidth, (AHeight - 6) + SpGetTextSize(Canvas.Handle, WS, True).cx); + Inc(AWidth, AHeight); { Note: maybe this should be controlled by the theme } + end; + + if AWidth < Item.MinWidth then AWidth := Item.MinWidth; + if AHeight < Item.MinHeight then AHeight := Item.MinHeight; + + // Handle Custom size and anchors + if IsRotated then begin + // Reverse + H := AWidth + Item.Margins; + W := AHeight; + end + else begin + W := AWidth + Item.Margins; + H := AHeight; + end; + + if Item.CustomWidth > -1 then + W := Item.CustomWidth; + if Item.CustomHeight > -1 then + H := Item.CustomHeight; + + if IsToolbarStyle and Item.Anchored then + W := W + FAnchorDelta; + if W < Item.MinWidth then W := Item.MinWidth; + if H < Item.MinHeight then H := Item.MinHeight; + // Apply View.MaxSize to the height of the item + if View.Window is TSpTBXToolbar then begin + TB := View.Window as TSpTBXToolbar; + I := TB.MaxSize - TB.NonClientHeight; + if (I > -1) and (H > I) then + H := I; + end; + + if IsRotated then begin + // Reverse + AWidth := H; + AHeight := W; + end + else begin + AWidth := W; + AHeight := H; + end; +end; + +procedure TSpTBXItemViewer.InternalMouseMove(Shift: TShiftState; X, Y: Integer); +begin + // Do nothing +end; + +procedure TSpTBXItemViewer.CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); +begin + InternalCalcSize(Canvas, True, AWidth, AHeight); +end; + +function TSpTBXItemViewer.GetCaptionText: WideString; +begin + Result := SpStripShortcut(Item.Caption); +end; + +function TSpTBXItemViewer.GetTextColor(State: TSpTBXSkinStatesType): TColor; +begin + Result := Item.FontSettings.Color; + if Result = clNone then begin + if IsToolbarStyle then begin + if View.Window is TSpTBXToolbar then + Result := TSpTBXToolbar(View.Window).GetItemsTextColor(State); + if Result = clNone then + Result := CurrentSkin.GetTextColor(skncToolbarItem, State); + end + else + Result := CurrentSkin.GetTextColor(skncMenuItem, State); + end; +end; + +procedure TSpTBXItemViewer.GetTextInfo(ACanvas: TCanvas; State: TSpTBXSkinStatesType; out TextInfo: TSpTBXTextInfo); +var + ToolbarStyle: Boolean; + I: Integer; +const + WordWraps: array [TTextWrapping] of Cardinal = (0, + DT_SINGLELINE or DT_END_ELLIPSIS, + DT_SINGLELINE or DT_PATH_ELLIPSIS, DT_WORDBREAK); + + function GetRealTextSize(TextFlags: Cardinal): TSize; + var + R, CaptionRect: TRect; + begin + TextFlags := TextFlags and not DT_SINGLELINE; + TextFlags := TextFlags and not (DT_WORDBREAK or DT_END_ELLIPSIS or DT_PATH_ELLIPSIS); + if (TextFlags and (DT_WORDBREAK or DT_END_ELLIPSIS or DT_PATH_ELLIPSIS)) <> 0 then begin + // will never get here, TextFlags doesn't have wrapping + CaptionRect := BoundsRect; + R := Rect(0, 0, CaptionRect.Right - CaptionRect.Left, 80); + end + else + R := Rect(0, 0, 1, 1); + SpDrawXPText(ACanvas, TextInfo.Text, R, TextFlags or DT_CALCRECT, gldNone, clYellow, TextInfo.TextAngle); + Result.CX := R.Right; + Result.CY := R.Bottom; + end; + +begin + ToolbarStyle := IsToolbarStyle; + FillChar(TextInfo, SizeOf(TextInfo), 0); + + // Setup Font + ACanvas.Font.Assign(View.GetFont); + DoDrawAdjustFont(ACanvas.Font, State); // Let the Item adjust the font + + // Text Flags + TextInfo.TextFlags := 0; + if not AreKeyboardCuesEnabled and (vsUseHiddenAccels in View.Style) and + not (vsShowAccels in View.State) then TextInfo.TextFlags := DT_HIDEPREFIX; + TextInfo.TextFlags := TextInfo.TextFlags or DT_VCENTER or WordWraps[Item.Wrapping]; + + TextInfo.IsCaptionShown := CaptionShown; + if TextInfo.IsCaptionShown then begin + TextInfo.Text := GetCaptionText; + + TextInfo.IsTextRotated := IsRotated; + if TextInfo.IsTextRotated or not ToolbarStyle then + TextInfo.TextFlags := TextInfo.TextFlags or DT_SINGLELINE; + + TextInfo.TextSize := GetRealTextSize(TextInfo.TextFlags); + if TextInfo.IsTextRotated then begin + I := TextInfo.TextSize.cx; + TextInfo.TextSize.cx := TextInfo.TextSize.cy; + TextInfo.TextSize.cy := I; + end; + end + else begin + TextInfo.Text := ''; + TextInfo.IsTextRotated := False; + TextInfo.TextSize.cx := 0; + TextInfo.TextSize.cy := 0; + end; + + if TextInfo.IsTextRotated then + TextInfo.TextAngle := tra270 + else + TextInfo.TextAngle := tra0; +end; + +procedure TSpTBXItemViewer.Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); +var + View: TTBViewAccess; + ItemInfo: TSpTBXMenuItemInfo; + TextInfo: TSpTBXTextInfo; + TextAlignment: TAlignment; + TextMetrics: TTextMetric; + PaintDefault, IsSpecialDropDown: Boolean; + + R, CaptionRect, ImageRect, RightImageRect: TRect; + P: TPoint; + + DropDownArrowSize, DropDownArrowMargin, SplitBtnArrowSize, ImgAndArrowWidth: Integer; + WS: WideString; + TextC, DropDownC: TColor; + + GlyphLayout: TSpGlyphLayout; +const + WordWraps: array [TTextWrapping] of Cardinal = (0, + DT_SINGLELINE or DT_END_ELLIPSIS, + DT_SINGLELINE or DT_PATH_ELLIPSIS, DT_WORDBREAK); +begin + CaptionRect := Rect(0, 0, 0, 0); + ImageRect := Rect(0, 0, 0, 0); + RightImageRect := Rect(0, 0, 0, 0); + CurrentSkin.GetDropDownArrowSize(DropDownArrowSize, DropDownArrowMargin, SplitBtnArrowSize); + + View := TTBViewAccess(Self.View); + SpFillItemInfo(Canvas, Self, ItemInfo); + + GlyphLayout := ghlGlyphLeft; + if tboImageAboveCaption in Item.EffectiveOptions then GlyphLayout := ghlGlyphTop; + + { Setup font and get the text info } + GetTextInfo(Canvas, ItemInfo.State, TextInfo); + TextC := Canvas.Font.Color; + TextAlignment := Item.Alignment; + + // Special DropDown, toolbar item with arrow, image and text. The Image is above the caption + // the arrow must be aligned with the image, above the text + IsSpecialDropDown := ItemInfo.HasArrow and not ItemInfo.IsSplit and ItemInfo.ToolbarStyle and + (tboImageAboveCaption in Item.EffectiveOptions) and + (ItemInfo.ImageSize.cx > 0) and not (TextInfo.IsTextRotated) and (Length(Item.Caption) > 0); + + { Border & Arrows } + R := ClientAreaRect; + if ItemInfo.ToolbarStyle then begin + if ItemInfo.HasArrow then begin + if ItemInfo.IsSplit then begin + ItemInfo.ComboRect := R; + Dec(R.Right, SplitBtnArrowSize); + ItemInfo.ComboRect.Left := R.Right; + end + else + if not IsSpecialDropDown then begin + if View.Orientation <> tbvoVertical then + ItemInfo.ComboRect := Rect(R.Right - DropDownArrowSize - DropDownArrowMargin, 0, + R.Right - DropDownArrowMargin, R.Bottom) + else + ItemInfo.ComboRect := Rect(0, R.Bottom - DropDownArrowSize - DropDownArrowMargin, + R.Right, R.Bottom - DropDownArrowMargin); + end + else begin + // Special DropDown, toolbar item with arrow, image and text. The Image is above the caption + // the arrow must be aligned with the image, above the text + ImgAndArrowWidth := ItemInfo.ImageSize.cx + DropDownArrowSize + 2; + ItemInfo.ComboRect.Right := (R.Left + R.Right + ImgAndArrowWidth + 2) div 2; + ItemInfo.ComboRect.Left := ItemInfo.ComboRect.Right - DropDownArrowSize; + ItemInfo.ComboRect.Top := (R.Top + R.Bottom - ItemInfo.ImageSize.cy - 2 - TextInfo.TextSize.CY) div 2; + ItemInfo.ComboRect.Bottom := ItemInfo.ComboRect.Top + ItemInfo.ImageSize.cy; + end; + end; + + PaintDefault := True; + DoDrawButton(Canvas, R, ItemInfo, pstPrePaint, PaintDefault); + if PaintDefault then + SpDrawXPMenuItem(Canvas, R, ItemInfo); + PaintDefault := True; + DoDrawButton(Canvas, R, ItemInfo, pstPostPaint, PaintDefault); + + // Draw dropdown arrow + if PaintDefault and ItemInfo.HasArrow then begin + P.X := (ItemInfo.ComboRect.Left + ItemInfo.ComboRect.Right) div 2 - 1; + P.Y := (ItemInfo.ComboRect.Top + ItemInfo.ComboRect.Bottom) div 2 - 1; + // Don't draw the arrow if is a split button in Windows XP, it's + // painted by the Windows theme. + if not (ItemInfo.IsSplit and (ItemInfo.SkinType = sknWindows)) then begin + DropDownC := TextC; + if ItemInfo.IsSplit and ItemInfo.Enabled then + DropDownC := GetTextColor(ItemInfo.ComboState); + if ItemInfo.IsSunkenCaption then + P := Point(P.X + 1, P.Y + 1); + SpDrawArrow(Canvas, P.X, P.Y, DropDownC, not ItemInfo.IsVertical, False, 2); + end; + if not ItemInfo.IsSplit and not IsSpecialDropDown then begin + if View.Orientation <> tbvoVertical then Dec(R.Right, DropDownArrowSize) + else Dec(R.Bottom, DropDownArrowSize); + end; + end; + + InflateRect(R, -4, -4); // Adjust + end + else begin // Menu items + InflateRect(R, 0, -1); + PaintDefault := True; + DoDrawButton(Canvas, R, ItemInfo, pstPrePaint, PaintDefault); + if PaintDefault then + SpDrawXPMenuItem(Canvas, R, ItemInfo); + PaintDefault := True; + DoDrawButton(Canvas, R, ItemInfo, pstPostPaint, PaintDefault); + InflateRect(R, 0, 1); + + // Draw the submenu arrows + if PaintDefault and (tbisSubmenu in Item.ItemStyle) then + SpDrawArrow(Canvas, R.Right - 10, R.Bottom div 2, TextC, False, False, 3); + + // Don't apply the margins if the menu item has + // tbisClicksTransparent itemstyle (like a SpTBXLabelItem) + // the caption will be automatically centered. + if not (tbisClicksTransparent in Item.ItemStyle) then begin + Inc(R.Left, ItemInfo.MenuMargins.Margins.Left); + Dec(R.Right, ItemInfo.MenuMargins.Margins.Right); + Inc(R.Top, ItemInfo.MenuMargins.Margins.Top); + Dec(R.Bottom, ItemInfo.MenuMargins.Margins.Bottom); + end; + end; + + { Caption } + if TextInfo.IsCaptionShown then + begin + WS := GetCaptionText; + + if ItemInfo.ToolbarStyle then begin + TextInfo.TextFlags := TextInfo.TextFlags and not DT_VCENTER; + // When ItemInfo.RightImageSize is valid use taLeftJustify + if (ItemInfo.RightImageSize.cx > 0) and (ItemInfo.RightImageSize.cy > 0) then + TextAlignment := taLeftJustify; + case TextAlignment of + taCenter: + if GlyphLayout = ghlGlyphTop then TextInfo.TextFlags := TextInfo.TextFlags or DT_CENTER; + taRightJustify: + TextInfo.TextFlags := TextInfo.TextFlags or DT_RIGHT; + end; + SpCalcXPText(Canvas, R, WS, TextAlignment, TextInfo.TextFlags, ItemInfo.ImageSize, ItemInfo.RightImageSize, GlyphLayout, False, CaptionRect, ImageRect, RightImageRect, TextInfo.TextAngle); + + if ItemInfo.IsSunkenCaption then + OffsetRect(CaptionRect, 1, 1); + end + else begin + if tbisClicksTransparent in Item.ItemStyle then begin + // The caption should be centered on the menu popup if the item has + // tbisClicksTransparent itemstyle (like a SpTBXLabelItem) + TextInfo.TextFlags := DT_SINGLELINE or DT_CENTER or DT_VCENTER; + CaptionRect := R; + end + else begin + TextInfo.TextFlags := TextInfo.TextFlags or DT_LEFT or DT_VCENTER; + GetTextMetrics(Canvas.Handle, TextMetrics); + CaptionRect := R; + Inc(CaptionRect.Left, ItemInfo.MenuMargins.GutterSize + ItemInfo.MenuMargins.ImageTextSpace + ItemInfo.MenuMargins.LeftCaptionMargin); + if (CaptionRect.Bottom - CaptionRect.Top) - (TextMetrics.tmHeight + TextMetrics.tmExternalLeading) = ItemInfo.MenuMargins.Margins.Bottom then + Dec(CaptionRect.Bottom); + Inc(CaptionRect.Top, TextMetrics.tmExternalLeading); + CaptionRect.Right := CaptionRect.Left + TextInfo.TextSize.CX; + end; + end; + + Canvas.Font.Color := TextC; + PaintDefault := True; + DoDrawCaption(Canvas, ClientAreaRect, ItemInfo.State, WS, CaptionRect, TextInfo.TextFlags, TextInfo.IsTextRotated, pstPrePaint, PaintDefault); + if PaintDefault then begin + if (not IsSelected or ItemInfo.ToolbarStyle) and + (ItemInfo.State = sknsDisabled) and (ItemInfo.SkinType = sknNone) then + begin + OffsetRect(CaptionRect, 1, 1); + Canvas.Font.Color := clBtnHighlight; + SpDrawXPText(Canvas, WS, CaptionRect, TextInfo.TextFlags, Item.CaptionGlow, Item.CaptionGlowColor, TextInfo.TextAngle); + OffsetRect(CaptionRect, -1, -1); + Canvas.Font.Color := clGrayText; + end; + SpDrawXPText(Canvas, WS, CaptionRect, TextInfo.TextFlags, Item.CaptionGlow, Item.CaptionGlowColor, TextInfo.TextAngle); + end; + PaintDefault := True; + DoDrawCaption(Canvas, ClientAreaRect, ItemInfo.State, WS, CaptionRect, TextInfo.TextFlags, TextInfo.IsTextRotated, pstPostPaint, PaintDefault); + end; + + { Shortcut } + if not ItemInfo.ToolbarStyle then + begin + WS := Item.GetShortCutText; + if Length(WS) > 0 then + begin + CaptionRect := R; + CaptionRect.Left := CaptionRect.Right - (CaptionRect.Bottom - CaptionRect.Top) - SpGetTextSize(Canvas.Handle, WS, True).cx; + if (CaptionRect.Bottom - CaptionRect.Top) - (TextMetrics.tmHeight + TextMetrics.tmExternalLeading) = ItemInfo.MenuMargins.Margins.Bottom then + Dec(CaptionRect.Bottom); + Inc(CaptionRect.Top, TextMetrics.tmExternalLeading); + Canvas.Font.Color := TextC; + PaintDefault := True; + DoDrawCaption(Canvas, ClientAreaRect, ItemInfo.State, WS, CaptionRect, TextInfo.TextFlags, TextInfo.IsTextRotated, pstPrePaint, PaintDefault); + if PaintDefault then + SpDrawXPText(Canvas, WS, CaptionRect, TextInfo.TextFlags, Item.CaptionGlow, Item.CaptionGlowColor, TextInfo.TextAngle); + PaintDefault := True; + DoDrawCaption(Canvas, ClientAreaRect, ItemInfo.State, WS, CaptionRect, TextInfo.TextFlags, TextInfo.IsTextRotated, pstPostPaint, PaintDefault); + end; + end; + + { Image, or check box } + if ItemInfo.ImageOrCheckShown then begin + if ItemInfo.ToolBarStyle then begin + if IsRectEmpty(ImageRect) then + ImageRect := R; + if IsSpecialDropDown then OffsetRect(ImageRect, (-DropDownArrowSize + 1) div 2, 0); + end + else begin + ImageRect := R; + ImageRect.Right := ImageRect.Left + ItemInfo.MenuMargins.GutterSize; + end; + + if ItemInfo.ImageShown then begin + ImageRect := SpCenterRect(ImageRect, ItemInfo.ImageSize.cx, ItemInfo.ImageSize.cy); + DrawItemImage(Canvas, ImageRect, ItemInfo, Item.ImageIndex); + end + else begin + if not ItemInfo.ToolbarStyle and Item.Checked then begin + if Item.RadioItem then + CurrentSkin.PaintMenuRadioMark(Canvas, ImageRect, True, True, ItemInfo.State) + else + CurrentSkin.PaintMenuCheckMark(Canvas, ImageRect, True, False, True, ItemInfo.State); + end; + end; + end; + + { Right Image } + if ItemInfo.ToolbarStyle and (ItemInfo.RightImageSize.cx > 0) and (ItemInfo.RightImageSize.cy > 0) then begin + if IsRectEmpty(RightImageRect) then begin + RightImageRect.Left := R.Right - ItemInfo.RightImageSize.cx; + RightImageRect.Right := RightImageRect.Left + ItemInfo.RightImageSize.cx; + RightImageRect.Top := R.Top + (R.Bottom - R.Top - ItemInfo.RightImageSize.cy) div 2; + RightImageRect.Bottom := RightImageRect.Top + ItemInfo.RightImageSize.cy; + end; + DrawItemRightImage(Canvas, RightImageRect, ItemInfo); + end; +end; + +function TSpTBXItemViewer.GetItem: TSpTBXCustomItem; +var + TBItem: TTBCustomItem; +begin + TBItem := inherited Item; + if Assigned(TBItem) then + Result := TBItem as TSpTBXCustomItem + else + Result := nil; +end; + +function TSpTBXItemViewer.GetHintText: Widestring; +var + I: Integer; + S: string; +begin + // Get the short hint + I := Pos('|', Item.Hint); + if I = 0 then + Result := Item.Hint + else + Result := Copy(Item.Hint, 1, I - 1); + // Use the caption if there is no hint + if (Result = '') and not(tboNoAutoHint in Item.EffectiveOptions) and + (not(tbisSubmenu in Item.ItemStyle) or (tbisCombo in Item.ItemStyle) or + not CaptionShown) then + begin + Result := SpStripAccelChars(SpStripTrailingPunctuation(Item.Caption)); + end; + + // Call associated action's OnHint event handler to post-process the hint + if Assigned(Item.ActionLink) and (Item.ActionLink.Action is TCustomAction) and + Assigned(TCustomAction(Item.ActionLink.Action).OnHint) then + begin + S := Result; + if TCustomAction(Item.ActionLink.Action).DoHint(S) then + Result := S + else + Result := ''; + // Note: TControlActionLink.DoShowHint actually misinterprets the result of DoHint, but we get it right... + end; + + // Add shortcut text + if (Result <> '') and Application.HintShortCuts and (Item.ShortCut <> scNone) then + Result := Result + ' (' + ShortCutToText(Item.ShortCut) + ')'; +end; + +procedure TSpTBXItemViewer.Entering; +begin + // When a Popupmenu is opened the TB2K modal handler will reset + // the TApplication.Hint in UpdateAppHint subprocedure of + // TTBModalHandler.Create, this in turn sets TTntApplication.Hint + // to AnsiString: + // ... + // if Assigned(View.FSelected) then + // Application.Hint := GetLongHint(View.FSelected.Item.Hint) + // else + // Application.Hint := ''; + // ... + // We need to set TTntApplication.Hint before TB2K. + // TTntStatusBar uses TTntApplication.Hint when AutoHint is true. + + inherited; + {$IFNDEF UNICODE} + if View.IsPopup then + TntApplication.Hint := Item.Hint; + {$ENDIF} +end; + +procedure TSpTBXItemViewer.CMHintShow(var Message: TMessage); +// Handle the CM_HINTSHOW message to show unicode hints using +// a custom THintWindow. +var + HintInfo: PHintInfo; + WideHint, PrevWideHint: Widestring; + R, TextR, CursorR: TRect; + PaintDefault: Boolean; +begin + HintInfo := TCMHintShow(Message).HintInfo; + WideHint := GetHintText; + CursorR := BoundsRect; + + // Prepare the HintInfo + HintInfo.HintStr := WideHint; + HintInfo.CursorRect := CursorR; + HintInfo.HintWindowClass := SpTBXHintWindowClass; // Custom HintWindow class + HintInfo.HintData := SpStockHintBitmap; // TApplication.ActivateHint will pass the data to the HintWindow + HintInfo.HideTimeout := 60000; // 1 minute + + // Prepare the HintBitmap + SpStockHintBitmap.Canvas.Font.Assign(Screen.HintFont); + SpStockHintBitmap.Canvas.Font.Color := clInfoText; + SpStockHintBitmap.Canvas.Pen.Color := clBlack; + SpStockHintBitmap.Canvas.Brush.Color := clInfoBk; + TextR := Rect(0, 0, 1, 1); + SpDrawXPText(SpStockHintBitmap.Canvas, WideHint, TextR, DT_NOPREFIX or DT_CALCRECT); + SpStockHintBitmap.Width := TextR.Right + 8; + SpStockHintBitmap.Height := TextR.Bottom + 4; + R := Rect(0, 0, SpStockHintBitmap.Width, SpStockHintBitmap.Height); + SpDrawXPTooltipBackground(SpStockHintBitmap.Canvas, R); + + // Draw the hint in the HintBitmap + PrevWideHint := WideHint; + PaintDefault := True; + DoDrawHint(SpStockHintBitmap, HintInfo.CursorPos, CursorR, WideHint, PaintDefault); + if PaintDefault then begin + HintInfo.HintStr := WideHint; + HintInfo.CursorRect := CursorR; + + // Adjust the bounds and repaint the background if it's needed + if WideHint <> PrevWideHint then begin + TextR := Rect(0, 0, 1, 1); + SpDrawXPText(SpStockHintBitmap.Canvas, WideHint, TextR, DT_NOPREFIX or DT_CALCRECT); + SpStockHintBitmap.Width := TextR.Right + 8; + SpStockHintBitmap.Height := TextR.Bottom + 4; + R := Rect(0, 0, SpStockHintBitmap.Width, SpStockHintBitmap.Height); + SpDrawXPTooltipBackground(SpStockHintBitmap.Canvas, R); + end + else + R := Rect(0, 0, SpStockHintBitmap.Width, SpStockHintBitmap.Height); + + // Draw the hint + OffsetRect(TextR, ((R.Right - TextR.Right) div 2) - 2, (R.Bottom - TextR.Bottom) div 2); + SpDrawXPText(SpStockHintBitmap.Canvas, WideHint, TextR, DT_NOPREFIX); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXRootItem } + +procedure TSpTBXRootItem.DoPopupShowingChanged(APopupWindow: TTBPopupWindow; IsVisible: Boolean); +// This method is called by TSpTBXPopupWindow when the popup is Opened +begin + if Assigned(APopupWindow) then begin + if IsVisible then begin + if Assigned(FOnInitPopup) then FOnInitPopup(Self, APopupWindow.View); + end + else begin + if Assigned(FOnClosePopup) then FOnClosePopup(Self); + end; + end; +end; + +function TSpTBXRootItem.GetPopupWindowClass: TTBPopupWindowClass; +begin + Result := TSpTBXPopupWindow; +end; + +procedure TSpTBXRootItem.SetToolBoxPopup(const Value: Boolean); +begin + FToolBoxPopup := Value; + if FToolBoxPopup then + Options := Options + [tboToolbarStyle] + else + Options := Options - [tboToolbarStyle]; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSubmenuItem } + +constructor TSpTBXSubmenuItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle + [tbisSubMenu, tbisSubitemsEditable]; +end; + +function TSpTBXSubmenuItem.GetDropdownCombo: Boolean; +begin + Result := tbisCombo in ItemStyle; +end; + +procedure TSpTBXSubmenuItem.SetDropdownCombo(Value: Boolean); +begin + if (tbisCombo in ItemStyle) <> Value then begin + if Value then ItemStyle := ItemStyle + [tbisCombo] + else ItemStyle := ItemStyle - [tbisCombo]; + Change(True); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorItem } + +constructor TSpTBXColorItem.Create(AOwner: TComponent); +begin + inherited; + FColor := clWhite; +end; + +function TSpTBXColorItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TSpTBXColorItemViewer; +end; + +procedure TSpTBXColorItem.SetColor(Value: TColor); +begin + if FColor <> Value then begin + FColor := Value; + Change(False); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorItemViewer } + +procedure TSpTBXColorItemViewer.DoDrawImage(ACanvas: TCanvas; + State: TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; + var AImageList: TCustomImageList; var AImageIndex: Integer; var ARect: TRect; + var PaintDefault: Boolean); +var + C: TColor; +begin + if PaintStage = pstPrePaint then begin + if State = sknsDisabled then begin + Inc(ARect.Right); + Inc(ARect.Bottom); + DrawEdge(ACanvas.Handle, ARect, BDR_SUNKENOUTER or BDR_RAISEDINNER, BF_RECT); + end + else begin + if not IsToolbarStyle then + InflateRect(ARect, -2, -2); + C := TSpTBXColorItem(Item).Color; + if C <> clNone then begin + ACanvas.Brush.Color := clBtnShadow; + ACanvas.FrameRect(ARect); + InflateRect(ARect, -1, -1); + ACanvas.Brush.Color := C; + ACanvas.FillRect(ARect); + end; + end; + end; + inherited; +end; + +function TSpTBXColorItemViewer.GetImageShown: Boolean; +begin + Result := ((Item.DisplayMode in [nbdmDefault, nbdmImageAndText]) or + (IsToolbarStyle and (Item.DisplayMode = nbdmTextOnlyInMenus))); +end; + +function TSpTBXColorItemViewer.GetImageSize: TSize; +begin + if IsToolbarStyle then begin + Result.cx := 12; + Result.cy := 12; + end + else begin + Result.cx := 16; + Result.cy := 16; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomLabelItem } + +constructor TSpTBXCustomLabelItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle - [tbisSelectable, tbisRedrawOnSelChange, + tbisRedrawOnMouseOverChange] + [tbisClicksTransparent]; + Alignment := taLeftJustify; + Stretch := False; + DisplayMode := nbdmImageAndText; +end; + +function TSpTBXCustomLabelItem.DialogChar(CharCode: Word): Boolean; +begin + Result := inherited DialogChar(CharCode); + if Enabled and Visible and Assigned(Control) and (Control is TWinControl) and + IsAccel(CharCode, Caption) and SpCanFocus(TWinControl(Control)) then + begin + TWinControl(Control).SetFocus; + Result := True; + end; +end; + +procedure TSpTBXCustomLabelItem.DoDrawButton(ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + PaintDefault := True; + inherited DoDrawButton(ACanvas, ARect, ItemInfo, PaintStage, PaintDefault); + PaintDefault := False; +end; + +function TSpTBXCustomLabelItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TSpTBXLabelItemViewer; +end; + +procedure TSpTBXCustomLabelItem.ToggleControl; +begin + // Do nothing, the Control property is not valid +end; + +procedure TSpTBXCustomLabelItem.UpdateProps; +begin + // Do nothing, the Control property is not valid +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXLabelItemViewer } + +procedure TSpTBXLabelItemViewer.CalcSize(const Canvas: TCanvas; var AWidth, + AHeight: Integer); +var + TextMetrics: TTextMetric; +begin + inherited CalcSize(Canvas, AWidth, AHeight); + if not IsToolbarStyle and (Length(GetCaptionText) > 0) and (Item.CustomHeight <= -1) then begin + GetTextMetrics(Canvas.Handle, TextMetrics); + AHeight := TextMetrics.tmHeight; + end; +end; + +function TSpTBXLabelItemViewer.DoExecute: Boolean; +begin + // Clicking a TSpTBXLabelItem on a popup menu causes the menu to close. + // This is caused by TTBXItemViewer.MouseUp, which calls + // TTBItemViewer.DoExecute + // The TBXLabelItem doesn't fire the click because the ItemViewer descends + // from TTBItemViewer instead of TTBXItemViewer. + // TTBXItemViewer.MouseUp is the culprit of firing the DoExecute + Result := False; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSeparatorItem } + +function TSpTBXSeparatorItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TSpTBXSeparatorItemViewer; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSeparatorItemViewer } + +procedure TSpTBXSeparatorItemViewer.CalcSize(const Canvas: TCanvas; var AWidth, + AHeight: Integer); +begin + if not IsToolbarStyle then begin + if CurrentSkin.OfficeMenuSeparator then + AHeight := 4 // For Office XP, 2003, 2007 + else + AHeight := 10; + end + else begin + AWidth := 6; + AHeight := 6; + end; +end; + +function TSpTBXSeparatorItemViewer.IsStatusBarSeparator: Boolean; +var + C: TComponent; +begin + Result := False; + C := Item.GetParentComponent; + if Assigned(C) and (C is TSpTBXStatusToolbar) then + Result := TSpTBXStatusToolbar(C).NeedsSeparatorRepaint; +end; + +procedure TSpTBXSeparatorItemViewer.Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); +var + Vertical, MenuItemStyle: Boolean; + MarginsInfo: TSpTBXMenuItemMarginsInfo; + R: TRect; +begin + if TTBSeparatorItem(Item).Blank or IsStatusBarSeparator then + Exit; + + R := ClientAreaRect; + MenuItemStyle := View.IsPopup; + if MenuItemStyle then begin + Vertical := False; + case SkinManager.GetSkinType of + sknNone: + begin + // Add separator spacing when it's not on a ToolBoxPopup + if not (tboToolbarStyle in Item.EffectiveOptions) then + InflateRect(R, -tbMenuSeparatorOffset, 0); + end; + sknWindows, sknSkin: + begin + // Draw the separator from the gutter end if the separator is not on + // a ToolBoxPopup and we are using the default Vista theme or the + // skin has a gutter specified. + if not (tboToolbarStyle in Item.EffectiveOptions) then + if SpIsWinVistaOrUp or not CurrentSkin.Options(skncGutter, sknsNormal).IsEmpty then begin + if View.Window is TSpTBXPopupWindow then + CurrentSkin.GetMenuItemMargins(Canvas, TSpTBXPopupWindow(View.Window).MaximumImageSize.cx, MarginsInfo) + else + CurrentSkin.GetMenuItemMargins(Canvas, 0, MarginsInfo); + if SpIsWinVistaOrUp then + R.Left := MarginsInfo.GutterSize + MarginsInfo.ImageTextSpace + else + R.Left := MarginsInfo.GutterSize + MarginsInfo.ImageTextSpace + MarginsInfo.LeftCaptionMargin; + end; + end; + end; + end + else + Vertical := View.Orientation <> tbvoVertical; + + SpDrawXPMenuSeparator(Canvas, R, MenuItemStyle, Vertical); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXRadioGroupItem } + +constructor TSpTBXRadioGroupItem.Create(AOwner: TComponent); +begin + inherited; + FDefaultIndex := 0; + FLastClickedIndex := 0; + FStrings := TTntStringList.Create; +end; + +destructor TSpTBXRadioGroupItem.Destroy; +begin + FStrings.Free; + inherited; +end; + +procedure TSpTBXRadioGroupItem.DoClick(AItem: TSpTBXItem); +begin + if Assigned(FOnClick) then FOnClick(AItem); +end; + +procedure TSpTBXRadioGroupItem.DoFillStrings; +begin + if Assigned(FOnFillStrings) then FOnFillStrings(Self, FStrings); +end; + +procedure TSpTBXRadioGroupItem.ItemClickEvent(Sender: TObject); +var + Item: TSpTBXItem; +begin + Item := Sender as TSpTBXItem; + if not Item.Checked and (Item.Tag > -1) and (Item.Tag < FStrings.Count) then + begin + Item.Checked := True; + FLastClickedIndex := IndexOf(Item); + DoClick(Item); + end; +end; + +procedure TSpTBXRadioGroupItem.Loaded; +begin + inherited; + if not (csDesigning in ComponentState) then + Recreate; +end; + +procedure TSpTBXRadioGroupItem.Recreate; +var + I: Integer; + A: TSpTBXItem; +begin + // Delete FStrings items + FStrings.Clear; + for I := Count - 1 downto 0 do + if Items[I].GroupIndex = C_SpTBXRadioGroupIndex then + Delete(I); + + DoFillStrings; + + // Create group items + for I := 0 to FStrings.Count - 1 do begin + A := TSpTBXItem.Create(Self); + A.Caption := FStrings[I]; + A.AutoCheck := False; + A.GroupIndex := C_SpTBXRadioGroupIndex; + A.Tag := I; + A.OnClick := ItemClickEvent; + Insert(I, A); + if I = FDefaultIndex then A.Click; + end; + + if Assigned(FOnUpdate) then FOnUpdate(Self); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSkinGroupItem } + +constructor TSpTBXSkinGroupItem.Create(AOwner: TComponent); +begin + inherited; + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXSkinGroupItem.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +procedure TSpTBXSkinGroupItem.DoClick(AItem: TSpTBXItem); +begin + SkinManager.SetSkin(FStrings[AItem.Tag]); + inherited; +end; + +procedure TSpTBXSkinGroupItem.DoSkinChange; +var + I: Integer; +begin + I := FStrings.IndexOf(SkinManager.CurrentSkinName); + if I > -1 then + Items[I].Click; + + if Assigned(FOnSkinChange) then FOnSkinChange(Self); +end; + +procedure TSpTBXSkinGroupItem.DoFillStrings; +var + I: Integer; +begin + {$IFNDEF UNICODE} + SkinManager.SkinsList.GetSkinNames(FStrings.AnsiStrings); + {$ELSE} + SkinManager.SkinsList.GetSkinNames(FStrings); + {$ENDIF} + + // Sort the list and move the Default skin to the top + FStrings.Sort; + I := FStrings.IndexOf('Default'); + if I > -1 then FStrings.Move(I, 0); + inherited; + FDefaultIndex := FStrings.IndexOf(SkinManager.CurrentSkinName); +end; + +procedure TSpTBXSkinGroupItem.WMSpSkinChange(var Message: TMessage); +begin + DoSkinChange; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSystemMenuItem } + +constructor TSpTBXSystemMenuItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle + [tbisSubMenu, tbisDontSelectFirst] - [tbisRedrawOnSelChange, tbisRedrawOnMouseOverChange]; + Caption := '&-'; + FShowSize := True; +end; + +function TSpTBXSystemMenuItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TSpTBXSystemMenuItemViewer; +end; + +function TSpTBXSystemMenuItem.GetSystemMenuParentForm: TCustomForm; +var + C: TComponent; +begin + Result := nil; + C := GetParentComponent; + if Assigned(C) and (C is TControl) then + Result := GetParentForm(TControl(C)); + + if not Assigned(Result) and Assigned(Application.MainForm) then begin + if FMDISystemMenu then + Result := Application.MainForm.ActiveMDIChild + else + Result := Application.MainForm; + end; +end; + +procedure TSpTBXSystemMenuItem.Click; +var + Form: TCustomForm; +begin + inherited; + Clear; + + Form := GetSystemMenuParentForm; + if Assigned(Form) then + SpFillSystemSpTBXPopup(Form, Self, True, True, True, True, CommandClick); +end; + +procedure TSpTBXSystemMenuItem.CommandClick(Sender: TObject); +var + Form: TCustomForm; + I: Integer; +begin + Form := GetSystemMenuParentForm; + if Assigned(Form) and Assigned(Sender) then begin + I := TComponent(Sender).Tag; + if I = SC_MAXIMIZE then + Form.WindowState := wsMaximized + else + SendMessage(Form.Handle, WM_SYSCOMMAND, I, GetMessagePos); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSystemMenuItemViewer } + +procedure TSpTBXSystemMenuItemViewer.CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); +begin + AWidth := GetSystemMetrics(SM_CXSMICON) + 2; + AHeight := GetSystemMetrics(SM_CYSMICON) + 2; +end; + +procedure TSpTBXSystemMenuItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); + + function GetIconHandle: HICON; + var + Form: TForm; + begin + Result := 0; + if Assigned(Application.MainForm) then begin + if TSpTBXSystemMenuItem(Item).MDISystemMenu then + Form := Application.MainForm.ActiveMDIChild + else + Form := Application.MainForm; + if Assigned(Form) then + Result := Form.Icon.Handle; + end; + if Result = 0 then + Result := Application.Icon.Handle; + if Result = 0 then + Result := LoadIcon(0, IDI_APPLICATION); + end; + +var + R: TRect; + TempIcon: HICON; +begin + R := ClientAreaRect; + InflateRect(R, -1, -1); + TempIcon := CopyImage(GetIconHandle, IMAGE_ICON, R.Right - R.Left, R.Bottom - R.Top, LR_COPYFROMRESOURCE); + try + DrawIconEx(Canvas.Handle, R.Left, R.Top, TempIcon, 0, 0, 0, 0, DI_NORMAL); + finally + DestroyIcon(TempIcon); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomToolPalette } + +constructor TSpTBXCustomToolPalette.Create(AOwner: TComponent); +begin + inherited; + FColCount := 1; + FRowCount := 1; + FSelectedCell.X := -1; +end; + +function TSpTBXCustomToolPalette.DoCellClick(ACol, ARow: Integer): Boolean; +begin + Result := True; + if Assigned(FOnCellClick) then FOnCellClick(Self, ACol, ARow, Result); +end; + +procedure TSpTBXCustomToolPalette.DoChange; +begin + if Assigned(FOnChange) then FOnChange(Self); +end; + +procedure TSpTBXCustomToolPalette.DoDrawCellImage(ACanvas: TCanvas; + const ARect: TRect; ACol, ARow: Integer; ItemInfo: TSpTBXMenuItemInfo); +begin + if Assigned(FOnDrawCellImage) then + FOnDrawCellImage(Self, ACanvas, ARect, ACol, ARow, ItemInfo.Checked, + ItemInfo.HotTrack, ItemInfo.Enabled); +end; + +procedure TSpTBXCustomToolPalette.DoGetCellHint(ACol, ARow: Integer; var AHint: WideString); +begin + if Assigned(FOnGetCellHint) then FOnGetCellHint(Self, ACol, ARow, AHint); +end; + +function TSpTBXCustomToolPalette.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TSpTBXToolViewer; +end; + +procedure TSpTBXCustomToolPalette.HandleClickCell(ACol, ARow: Integer); +begin + if DoCellClick(ACol, ARow) then SetSelectedCell(Point(ACol, ARow)); +end; + +procedure TSpTBXCustomToolPalette.SetColCount(Value: TSpTBXRowColCount); +begin + if FColCount <> Value then begin + FColCount := Value; + Change(True); + end; +end; + +procedure TSpTBXCustomToolPalette.SetRowCount(Value: TSpTBXRowColCount); +begin + if FRowCount <> Value then begin + FRowCount := Value; + Change(True); + end; +end; + +procedure TSpTBXCustomToolPalette.SetSelectedCell(Value: TPoint); +begin + FSelectedCell := Value; + Change(True); + DoChange; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXToolViewer } + +constructor TSpTBXToolViewer.Create(AView: TTBView; AItem: TTBCustomItem; + AGroupLevel: Integer); +begin + inherited; + FColCount := TSpTBXCustomToolPalette(AItem).ColCount; + FRowCount := TSpTBXCustomToolPalette(AItem).RowCount; +end; + +procedure TSpTBXToolViewer.CalcCellSize(ACanvas: TCanvas; var AWidth, AHeight: Integer); +var + ImageSize: TSize; +begin + ImageSize := GetImageSize; + AWidth := ImageSize.cx + 6; + AHeight := ImageSize.cy + 6; +end; + +procedure TSpTBXToolViewer.CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); +var + W, H: Integer; + MarginsInfo: TSpTBXMenuItemMarginsInfo; +begin + if IsToolbarStyle then + FIndent := 0 + else begin + if View.Window is TSpTBXPopupWindow then + CurrentSkin.GetMenuItemMargins(Canvas, TSpTBXPopupWindow(View.Window).MaximumImageSize.cx, MarginsInfo) + else + CurrentSkin.GetMenuItemMargins(Canvas, 0, MarginsInfo); + FIndent := MarginsInfo.GutterSize + MarginsInfo.ImageTextSpace + MarginsInfo.LeftCaptionMargin - 3; + end; + + FColCount := Item.ColCount; + FRowCount := Item.RowCount; + CalcCellSize(Canvas, W, H); + AWidth := FIndent + W * FColCount; + if not IsToolbarStyle then + Inc(AWidth, MarginsInfo.RightCaptionMargin); + AHeight := H * FRowCount; + if AWidth < 8 then AWidth := 8; + if AHeight < 8 then AHeight := 8; +end; + +procedure TSpTBXToolViewer.DoDrawHint(AHintBitmap: TBitmap; CursorPos: TPoint; + var CursorRect: TRect; var AHint: Widestring; var PaintDefault: Boolean); +var + Col, Row: Integer; +begin + if GetCellAt(CursorPos.X - BoundsRect.Left, CursorPos.Y - BoundsRect.Top, Col, Row) then begin + AHint := GetCellHint(Col, Row); + CursorRect := GetCellRect(CursorRect, Col, Row); + inherited DoDrawHint(AHintBitmap, CursorPos, CursorRect, AHint, PaintDefault); + end + else + PaintDefault := False; +end; + +procedure TSpTBXToolViewer.DrawCellImage(ACanvas: TCanvas; const ARect: TRect; + Col, Row: Integer; ItemInfo: TSpTBXMenuItemInfo); +var + I: Integer; + IL: TCustomImageList; +begin + if not Item.CustomImages then begin + I := GetImageIndex(Col, Row); + IL := Item.Images; + SpDrawImageList(ACanvas, ARect, IL, I, ItemInfo.Enabled, True); + end; + Item.DoDrawCellImage(ACanvas, ARect, Col, Row, ItemInfo); +end; + +procedure TSpTBXToolViewer.Entering; +begin + FHotCell := Point(-1, 0); + if (View is TSpTBXPopupWindowView) and Assigned(View.Selected) then begin + if View.Selected.Index > Index then begin + FHotCell := Point(FColCount - 1, FRowCount - 1); + while (FHotCell.X > 0) and not IsCellVisible(FHotCell) do + Dec(FHotCell.X); + end + else + if View.Selected.Index < Index then + FHotCell := Point(0, 0); + end; + inherited; +end; + +function TSpTBXToolViewer.GetCellAt(X, Y: Integer; out Col, Row: Integer): Boolean; +begin + if (FCellWidth = 0) or (FCellHeight = 0) then begin + Col := 0; + Row := 0; + end + else begin + Col := (X - FIndent) div FCellWidth; + Row := Y div FCellHeight; + end; + Result := (Col >= 0) and (Row >= 0) and (Col < FColCount) and (Row < FRowCount); +end; + +function TSpTBXToolViewer.GetCellHint(Col, Row: Integer): WideString; +begin + Result := ''; + Item.DoGetCellHint(Col, Row, Result); +end; + +function TSpTBXToolViewer.GetCellRect(ClientAreaRect: TRect; Col, Row: Integer): TRect; +begin + Result := Bounds(ClientAreaRect.Left + FIndent + Col * FCellWidth, ClientAreaRect.Top + Row * FCellHeight, FCellWidth, FCellHeight); +end; + +function TSpTBXToolViewer.GetImageIndex(Col, Row: Integer): Integer; +begin + Result := Col + Row * FColCount; +end; + +function TSpTBXToolViewer.GetImageShown: Boolean; +begin + Result := True; +end; + +function TSpTBXToolViewer.GetImageSize: TSize; +var + IL: TCustomImageList; +begin + if Item.CustomImages then + IL := nil + else + IL := Item.Images; + + if Assigned(IL) then begin + Result.cx := IL.Width; + Result.cy := IL.Height; + end + else begin + Result.cx := 12; + Result.cy := 12; + end; +end; + +function TSpTBXToolViewer.GetItem: TSpTBXCustomToolPalette; +var + TBItem: TTBCustomItem; +begin + TBItem := inherited Item; + if Assigned(TBItem) then + Result := TBItem as TSpTBXCustomToolPalette + else + Result := nil; +end; + +procedure TSpTBXToolViewer.InvalidateCell(ACol, ARow: Integer); +var + R: TRect; +begin + R := GetCellRect(BoundsRect, ACol, ARow); + InvalidateRect(View.Window.Handle, @R, False); +end; + +function TSpTBXToolViewer.IsCellVisible(Cell: TPoint): Boolean; +var + IL: TCustomImageList; +begin + Result := (Cell.X >= 0) and (Cell.Y >= 0) and (Cell.X < FColCount) and (Cell.Y < FRowCount); + if Result and not Item.CustomImages then begin + IL := Item.Images; + if Assigned(IL) then + Result := (Cell.X + Cell.Y * FColCount) < IL.Count; + end; +end; + +procedure TSpTBXToolViewer.KeyDown(var Key: Word; Shift: TShiftState); +var + OldPos, Pos: TPoint; +begin + if IsCellVisible(FHotCell) then + OldPos := FHotCell + else + if IsCellVisible(Item.SelectedCell) then + OldPos := Item.SelectedCell + else + OldPos.X := -1; + + if OldPos.X >= 0 then begin + Pos := OldPos; + case Key of + VK_LEFT: + begin + Dec(Pos.X); + if Pos.X < 0 then begin + Pos.X := FColCount - 1; + Dec(Pos.Y); + end; + end; + VK_UP: Dec(Pos.Y); + VK_RIGHT: + begin + Inc(Pos.X); + if Pos.X >= FColCount then + begin + Pos.X := 0; + Inc(Pos.Y); + end; + end; + VK_DOWN: Inc(Pos.Y); + VK_PRIOR: Pos.Y := 0; + VK_NEXT: Pos.Y := FRowCount - 1; + VK_HOME: Pos.X := 0; + VK_END: Pos.Y := FColCount - 1; + VK_RETURN: + if IsCellVisible(FHotCell) then begin + Item.HandleClickCell(FHotCell.X, FHotCell.Y); + Exit; + end; + else + inherited; + Exit; + end; + end + else begin + OldPos := Point(-1, 0); + Pos := Point(0, 0); + end; + + if ((OldPos.X <> Pos.X) or (OldPos.Y <> Pos.Y)) and IsCellVisible(Pos) then begin + Key := 0; + FHotCell := Pos; + Item.Change(False); + end; +end; + +procedure TSpTBXToolViewer.MouseDown(Shift: TShiftState; X, Y: Integer; + var MouseDownOnMenu: Boolean); +begin + FMouseIsDown := True; + MouseMove(X, Y); + inherited; + View.SetCapture; +end; + +procedure TSpTBXToolViewer.MouseMove(X, Y: Integer); +var + OldHotCell: TPoint; +begin + OldHotCell := FHotCell; + if not GetCellAt(X, Y, FHotCell.X, FHotCell.Y) then + FHotCell := Point(-1, 0); + + if (FHotCell.X <> OldHotCell.X) or (FHotCell.Y <> OldHotCell.Y) then + if Show and not IsRectEmpty(BoundsRect) {and not (Item is TTBControlItem)} then begin + Include(State, tbisInvalidated); + InvalidateCell(OldHotCell.X, OldHotCell.Y); + InvalidateCell(FHotCell.X, FHotCell.Y); + end; +end; + +procedure TSpTBXToolViewer.MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); +var + Col, Row: Integer; +begin + FMouseIsDown := False; + if GetCellAt(X, Y, Col, Row) then + Item.HandleClickCell(Col, Row); + View.EndModalWithClick(Self); + inherited; +end; + +procedure TSpTBXToolViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, + UseDisabledShadow: Boolean); +var + I, J: Integer; + ItemInfo: TSpTBXMenuItemInfo; + CellRect: TRect; + ItemHotTrack: Boolean; + ImageSize: TSize; +begin + CalcCellSize(Canvas, FCellWidth, FCellHeight); + + SpFillItemInfo(Canvas, Self, ItemInfo); + ItemInfo.ToolbarStyle := True; + ItemHotTrack := False; + if IsSelected then + if not ItemInfo.Enabled and not View.MouseOverSelected then ItemHotTrack := True + else if ItemInfo.Enabled then ItemHotTrack := True; + + for J := 0 to FRowCount - 1 do + for I := 0 to FColCount - 1 do + if IsCellVisible(Point(I, J)) then begin + ItemInfo.HotTrack := False; + ItemInfo.Pushed := False; + if ItemHotTrack and (FHotCell.X = I) and (FHotCell.Y = J) then begin + ItemInfo.HotTrack := True; + if IsPushed then ItemInfo.Pushed := True + end; + if (Item.SelectedCell.X = I) and (Item.SelectedCell.Y = J) then + ItemInfo.Checked := True + else + ItemInfo.Checked := False; + ItemInfo.State := CurrentSkin.GetState(ItemInfo.Enabled, ItemInfo.Pushed, ItemInfo.HotTrack, ItemInfo.Checked); + CellRect := GetCellRect(ClientAreaRect, I, J); + + // Paint the cell + SpDrawXPMenuItem(Canvas, CellRect, ItemInfo); + ImageSize := GetImageSize; + CellRect := SpCenterRect(CellRect, ImageSize.cx, ImageSize.cy); + DrawCellImage(Canvas, CellRect, I, J, ItemInfo); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXColorPalette } + +constructor TSpTBXColorPalette.Create(AOwner: TComponent); +begin + inherited; + CustomImages := True; + FCustomColors := False; + ColCount := CPDefaultCols; + RowCount := CPDefaultRows; // 40 Default Colors + Options := Options + [tboShowHint]; + FColor := clNone; +end; + +procedure TSpTBXColorPalette.DoChange; +begin + if SelectedCell.X >= 0 then + FColor := GetCellColor(SelectedCell.X, SelectedCell.Y); + inherited; +end; + +procedure TSpTBXColorPalette.DoDrawCellImage(ACanvas: TCanvas; + const ARect: TRect; ACol, ARow: Integer; ItemInfo: TSpTBXMenuItemInfo); +var + R: TRect; +begin + R := ARect; + ACanvas.Brush.Color := clBtnShadow; + ACanvas.FrameRect(R); + InflateRect(R, -1, -1); + if ItemInfo.Enabled then begin + ACanvas.Brush.Color := GetCellColor(ACol, ARow); + ACanvas.FillRect(R); + end; +end; + +procedure TSpTBXColorPalette.DoGetCellHint(ACol, ARow: Integer; var AHint: WideString); +var + C: TColor; +begin + GetCellInfo(ACol, ARow, C, AHint); +end; + +function TSpTBXColorPalette.FindCell(AColor: TColor): TPoint; +var + I, J: Integer; + C: TColor; +begin + if AColor <> clNone then + AColor := ColorToRGB(AColor); + for J := 0 to RowCount - 1 do + for I := 0 to ColCount - 1 do begin + C := GetCellColor(I, J); + if C <> clNone then + C := ColorToRGB(C); + if C = AColor then begin + Result.X := I; + Result.Y := J; + Exit; + end; + end; + Result.X := -1; + Result.Y := 0; +end; + +function TSpTBXColorPalette.GetCellColor(ACol, ARow: Integer): TColor; +var + W: WideString; +begin + GetCellInfo(ACol, ARow, Result, W); +end; + +procedure TSpTBXColorPalette.GetCellInfo(ACol, ARow: Integer; + out AColor: TColor; out AName: WideString); +var + I: Integer; +begin + AColor := clNone; + AName := ''; + if not FCustomColors then begin + I := ACol + ARow * ColCount; + if (I > -1) and (I < CPDefaultCols * CPDefaultRows) then begin + AColor := CPDefaultColors[I].Value; + AName := CPDefaultColors[I].Name; + end; + end; + + if Assigned(FOnGetColor) then FOnGetColor(Self, ACol, ARow, AColor, AName); +end; + +procedure TSpTBXColorPalette.SetColor(Value: TColor); +begin + FColor := Value; + SelectedCell := FindCell(Value); +end; + +procedure TSpTBXColorPalette.SetCustomColors(const Value: Boolean); +begin + if FCustomColors <> Value then begin + FCustomColors := Value; + if not Value then begin + RowCount := CPDefaultCols; + ColCount := CPDefaultRows; + end; + Change(True); + end; +end; + +procedure TSpTBXColorPalette.SetColCount(Value: TSpTBXRowColCount); +begin + if FCustomColors then + inherited SetColCount(Value) + else + inherited SetColCount(CPDefaultCols); +end; + +procedure TSpTBXColorPalette.SetRowCount(Value: TSpTBXRowColCount); +begin + if FCustomColors then + inherited SetRowCount(Value) + else + inherited SetRowCount(CPDefaultRows); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXItemCache } + +procedure TSpTBXItemCache.Assign(Source: TPersistent); +var + C: TSpTBXItemCache; +begin + if Source is TSpTBXItemCache then + begin + C := Source as TSpTBXItemCache; + Dock := C.Dock; + Item := C.Item; + Width := C.Width; + Height := C.Height; + ParentWidth := C.ParentWidth; + ParentHeight := C.ParentHeight; + end + else inherited Assign(Source); +end; + +function TSpTBXItemCache.GetName: TComponentName; +begin + if Assigned(FItem) then + Result := FItem.Name + else + Result := FName; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXItemCacheCollection } + +function TSpTBXItemCacheCollection.Add(AItem: TTBCustomItem): Integer; +var + F: TSpTBXItemCache; +begin + F := TSpTBXItemCache(inherited Add); + F.Item := AItem; + Result := F.Index; +end; + +function TSpTBXItemCacheCollection.GetItem(Index: Integer): TSpTBXItemCache; +begin + Result := TSpTBXItemCache(inherited Items[Index]); +end; + +function TSpTBXItemCacheCollection.IndexOf(AItem: TTBCustomItem): Integer; +var + I: Integer; +begin + Result := -1; + if Assigned(AItem) then + for I := 0 to Count - 1 do + if Items[I].Item = AItem then begin + Result := I; + Break; + end; +end; + +procedure TSpTBXItemCacheCollection.SetItem(Index: Integer; + const Value: TSpTBXItemCache); +begin + inherited Items[Index] := Value; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXDock } + +constructor TSpTBXDock.Create(AOwner: TComponent); +begin + inherited; + Color := clNone; + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXDock.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +function TSpTBXDock.CanResize(var NewWidth, NewHeight: Integer): Boolean; +begin + FPrevWidth := Width; + FPrevHeight := Height; + Result := inherited CanResize(NewWidth, NewHeight); +end; + +procedure TSpTBXDock.DoDrawBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, PaintStage, PaintDefault); +end; + +procedure TSpTBXDock.DrawBackground(DC: HDC; const DrawRect: TRect); +var + ACanvas: TCanvas; + PaintDefault: Boolean; +begin + // OnDrawBackground should be used to paint all the toolbars + dock, it is + // used by TSpTBXStatusBar and TSpTBXDockablePanel to paint the whole client + // area with custom painting. + // OnDrawBackground is triggered by the Dock and by the docked Toolbar. + if (csDestroying in ComponentState) then Exit; + + ACanvas := TCanvas.Create; + try + ACanvas.Handle := DC; + ACanvas.Lock; + + PaintDefault := True; + DoDrawBackground(ACanvas, DrawRect, pstPrePaint, PaintDefault); + if PaintDefault then + InternalDrawBackground(ACanvas, DrawRect); + + PaintDefault := True; + DoDrawBackground(ACanvas, DrawRect, pstPostPaint, PaintDefault); + finally + ACanvas.Unlock; + ACanvas.Handle := 0; + ACanvas.Free; + end; +end; + +procedure TSpTBXDock.InternalDrawBackground(ACanvas: TCanvas; ARect: TRect); +begin + if (csDestroying in ComponentState) then Exit; + + // Paint the Bitmap if it's assigned, or use the skin, or use the Color + if UsingBitmap then + inherited + else + if Color = clNone then + SpDrawXPDock(ACanvas, ARect, SkinManager.GetSkinType, Position in [dpLeft, dpRight]) + else begin + ACanvas.Brush.Color := Color; + ACanvas.FillRect(ARect); + end; +end; + +procedure TSpTBXDock.Resize; +var + I, J: Integer; + ResizeToolbars: Boolean; + V: TTBItemViewer; + R: TRect; +begin + inherited Resize; + + // For anchored and right aligned items + if Position in [dpLeft, dpRight] then + ResizeToolbars := Height < FPrevHeight + else + ResizeToolbars := Width < FPrevWidth; + if ResizeToolbars then + for I := 0 to ToolbarCount - 1 do + if Toolbars[I] is TSpTBXToolbar then + TSpTBXToolbar(Toolbars[I]).Resize; + + // Invalidate the dock and the toolbars + for J := 0 to ToolbarCount - 1 do begin + Invalidate; + if Toolbars[J] is TSpTBXToolbar then begin + with TSpTBXToolbar(Toolbars[J]) do begin + // Invalidate Control Items + for I := 0 to View.ViewerCount - 1 do begin + V := View.Viewers[I]; + if V.Show and not IsRectEmpty(V.BoundsRect) and not (V.Item is TTBControlItem) then + View.Invalidate(V); + end; + // Invalidate Toolbar + Update; + if HandleAllocated then + RedrawWindow(Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE or RDW_ERASE); + // Invalidate Items + for I := 0 to View.ViewerCount - 1 do begin + V := View.Viewers[I]; + if V.Show and not IsRectEmpty(V.BoundsRect) and not (V.Item is TTBControlItem) then begin + R := V.BoundsRect; + ValidateRect(Handle, @R); + end; + end; + end; + end + else + if Toolbars[J] is TSpTBXCustomToolWindow then + with TSpTBXCustomToolWindow(Toolbars[J]) do begin + if HandleAllocated then + RedrawWindow(Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE or RDW_ERASE); + end; + end; +end; + +function TSpTBXDock.UsingBackground: Boolean; +begin + // UsingBackground is used by TTB2Dock to repaint the Dock and Toolbars + // To check if the Dock is using a Bitmap use SpIsUsingBitmap instead + Result := True; +end; + +function TSpTBXDock.UsingBitmap: Boolean; +begin + Result := SpIsDockUsingBitmap(Self); +end; + +procedure TSpTBXDock.WMEraseBkgnd(var Message: TWMEraseBkgnd); +begin + DrawBackground(Message.DC, ClientRect); + Message.Result := 1; +end; + +procedure TSpTBXDock.WMMove(var Message: TWMMove); +begin + FMoving := True; + inherited; + FMoving := False; +end; + +procedure TSpTBXDock.WMSize(var Message: TWMSize); +begin + FResizing := True; + inherited; + FResizing := False; +end; + +procedure TSpTBXDock.WMSpSkinChange(var Message: TMessage); +begin + Invalidate; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXToolbarView } + +constructor TSpTBXToolbarView.Create(AOwner: TComponent; AParentView: TTBView; + AParentItem: TTBCustomItem; AWindow: TWinControl; + AIsToolbar, ACustomizing, AUsePriorityList: Boolean); +begin + inherited; + FMaxSize := -1; +end; + +procedure TSpTBXToolbarView.DoUpdatePositions(var ASize: TPoint); +var + I, W, H: Integer; + CtlCanvas: TControlCanvas; +begin + // Find the tallest item size so we can stretch the items + // vertically (if Toolbar.Stretch is true) + FTallestItemSize := 0; + + if Assigned(Window) and Window.HandleAllocated and + (Window.ClientWidth > 0) and (Window.ClientHeight > 0) and + (ViewerCount > 2) then + begin + CtlCanvas := TControlCanvas.Create; + try + CtlCanvas.Control := Window; + for I := 0 to ViewerCount - 1 do begin + W := 0; + H := 0; + if TTBCustomItem(Viewers[I].Item).Visible then + if Viewers[I] is TSpTBXItemViewer then + TSpTBXItemViewer(Viewers[I]).InternalCalcSize(CtlCanvas, False, W, H) + else + TTBItemViewerAccess(Viewers[I]).CalcSize(CtlCanvas, W, H); + if Orientation = tbvoVertical then begin + if W > FTallestItemSize then FTallestItemSize := W; + end + else + if H > FTallestItemSize then FTallestItemSize := H; + end; + finally + CtlCanvas.Free; + end; + end; + + inherited DoUpdatePositions(ASize); +end; + +procedure TSpTBXToolbarView.SetMaxSize(const Value: Integer); +begin + if FMaxSize <> Value then begin + FMaxSize := Value; + UpdatePositions; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXToolbar } + +constructor TSpTBXToolbar.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle - [csOpaque]; + Color := clNone; + + Items.RegisterNotification(DoItemNotification); + FAnchoredControlItems := TSpTBXItemCacheCollection.Create(TSpTBXItemCache); + FChevronVertical := True; + FCustomizable := True; + FDisplayMode := tbdmSelectiveCaption; + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXToolbar.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + Items.UnRegisterNotification(DoItemNotification); + FAnchoredControlItems.Free; + inherited; +end; + +procedure TSpTBXToolbar.CreateWindowHandle(const Params: TCreateParams); +begin + {$IFNDEF UNICODE} + CreateUnicodeHandle(Self, Params, ''); + {$ELSE} + inherited; + {$ENDIF} +end; + +procedure TSpTBXToolbar.DefineProperties(Filer: TFiler); +begin + inherited; + // Don't let the streaming system store the WideStrings, + // we need to store them manually + SpPersistent_AfterInherited_DefineProperties(Filer, Self); +end; + +procedure TSpTBXToolbar.DoDrawBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, + PaintStage, PaintDefault); +end; + +procedure TSpTBXToolbar.DoItemClick(Item: TTBCustomItem; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + // Force OnClick event, by default tbisClicksTransparent Items doesn't get executed + if (Button = mbLeft) and Item.Enabled then + if (tbisClicksTransparent in TTBCustomItemAccess(Item).ItemStyle) then + if Assigned(Item.OnClick) then Item.OnClick(Item); +end; + +procedure TSpTBXToolbar.DoItemNotification(Ancestor: TTBCustomItem; + Relayed: Boolean; Action: TTBItemChangedAction; Index: Integer; + Item: TTBCustomItem); +var + I: Integer; +begin + if (csDestroying in ComponentState) or (csReading in ComponentState) then Exit; + + if not (tstResizing in FState) and not IsItemMoving then begin + if Assigned(FOnItemNotification) then FOnItemNotification(Self, Ancestor, Relayed, Action, Index, Item); + + case Action of + tbicInserted: + begin + RightAlignItems; + AnchorItems(True); + end; + tbicDeleting: + begin + I := FAnchoredControlItems.IndexOf(Item); + if I > -1 then + FAnchoredControlItems.Delete(I); + RightAlignItems; + AnchorItems(True); + end; + tbicInvalidateAndResize: + begin + RightAlignItems; + end; + end; + end; +end; + +procedure TSpTBXToolbar.Resize; +begin + FState := FState + [tstResizing]; + try + RightAlignItems; + AnchorItems; + finally + FState := FState - [tstResizing]; + end; + inherited; +end; + +procedure TSpTBXToolbar.AnchorItems(UpdateControlItems: Boolean); +var + I, J, UpdatedDelta: Integer; + SpIV: TSpTBXItemViewer; + Size: TPoint; + CI: TTBControlItem; + IV: TTBItemViewer; + IsRotated: Boolean; +begin + if (csDestroying in ComponentState) or + (tstAnchoring in FState) or not Assigned(CurrentDock) or + (CurrentDock.Width = 0) or (CurrentDock.Height = 0) or + not Stretch or (ShrinkMode <> tbsmNone) then + Exit; + + FState := FState + [tstAnchoring]; + View.BeginUpdate; + try + View.ValidatePositions; + IsRotated := IsVertical; + // Adjust the delta, only used when inserting/deleting an item on the toolbar + UpdatedDelta := 0; + if (FLastSelectableWidth > 0) and UpdateControlItems then begin + IV := View.NextSelectable(nil, False); + if Assigned(IV) then + if IsRotated then + UpdatedDelta := FLastSelectableWidth - IV.BoundsRect.Bottom + else + UpdatedDelta := FLastSelectableWidth - IV.BoundsRect.Right; + end; + + // Calculate the Toolbar size + Size := Point(CurrentDock.Width, CurrentDock.Height); + + // Resize the anchored items + for I := 0 to View.ViewerCount - 1 do + if View.Viewers[I] is TSpTBXItemViewer then begin + SpIV := View.Viewers[I] as TSpTBXItemViewer; + if SpIV.Item.Anchored then begin + // Revalidate FAnchorSize and set FAnchorDelta + if (SpIV.FAnchorSize.X = 0) and (SpIV.FAnchorSize.Y = 0) then + SpIV.FAnchorSize := Size; + + // Adjust the delta, only used when inserting/deleting an item on + // the toolbar and resize + if IsRotated then begin + SpIV.FAnchorSize.Y := SpIV.FAnchorSize.Y - UpdatedDelta; + SpIV.FAnchorDelta := Size.Y - SpIV.FAnchorSize.Y; + end + else begin + SpIV.FAnchorSize.X := SpIV.FAnchorSize.X - UpdatedDelta; + SpIV.FAnchorDelta := Size.X - SpIV.FAnchorSize.X; + end; + end; + end + else begin + // Client align TTBControlItem items if the associated Control is client + // aligned or has akRight in its Anchors property. + CI := IsAnchoredControlItem(View.Viewers[I].Item); + J := FAnchoredControlItems.IndexOf(View.Viewers[I].Item); + if Assigned(CI) then begin + // Add the TTBControlItem item to the list if its not there + if J = -1 then begin + J := FAnchoredControlItems.Add(CI); + FAnchoredControlItems[J].Width := CI.Control.Width; + FAnchoredControlItems[J].Height := CI.Control.Height; + FAnchoredControlItems[J].ParentWidth := Size.X; + FAnchoredControlItems[J].ParentHeight := Size.Y; + FAnchoredControlItems[J].Dock := CurrentDock; + end; + // Resize + if FAnchoredControlItems[J].Dock = CurrentDock then begin + FAnchoredControlItems[J].Width := FAnchoredControlItems[J].Width + UpdatedDelta; + CI.Control.Width := FAnchoredControlItems[J].Width + (Size.X - FAnchoredControlItems[J].ParentWidth); + end; + end + else + // If ControlItem is not valid delete it from the list + if J > -1 then + FAnchoredControlItems.Delete(J); + end; + View.UpdatePositions; + finally + View.EndUpdate; + FState := FState - [tstAnchoring]; + end; + + // We can't calculate the delta based on the IV.BoundsRect because + // the IV is nil on tbicDeleting notification. + // We have to keep track of the sum of the selectable items width + IV := View.NextSelectable(nil, False); + if Assigned(IV) then begin + if IsRotated then + FLastSelectableWidth := IV.BoundsRect.Bottom + else + FLastSelectableWidth := IV.BoundsRect.Right; + end + else + FLastSelectableWidth := 0; +end; + +function TSpTBXToolbar.IsAnchoredControlItem(Item: TTBCustomItem): TTBControlItem; +var + CI: TTBControlItem; +begin + Result := nil; + if Assigned(CurrentDock) and (Item is TTBControlItem) then begin + CI := Item as TTBControlItem; + if Assigned(CI.Control) and + ((CI.Control.Align = alClient) or (akRight in CI.Control.Anchors)) then + begin + Result := CI; + end + else + Result := nil; + end; +end; + +procedure TSpTBXToolbar.RightAlignItems; +var + I, VisibleWidth, RightAlignedWidth: Integer; + Spacer: TSpTBXItemViewer; + IsRotated: Boolean; +begin + if (csDestroying in ComponentState) or (tstRightAligning in FState) or + not Assigned(CurrentDock) or (Items.Count <= 0) or + not Stretch or (ShrinkMode <> tbsmNone) or + ((CurrentDock.Width = 0) and (CurrentDock.Height = 0)) then + Exit; + + FState := FState + [tstRightAligning]; + View.ValidatePositions; + View.BeginUpdate; + try + // Find the spacer and the right aligned items + IsRotated := IsVertical; + Spacer := SpGetRightAlignedItems(View, nil, IsRotated, VisibleWidth, RightAlignedWidth); + if Assigned(Spacer) then begin + // Resize the spacer + if IsRotated then + I := CurrentDock.Height - GetRightAlignMargin - (VisibleWidth - (Spacer.BoundsRect.Bottom - Spacer.BoundsRect.Top)) + else + I := CurrentDock.Width - GetRightAlignMargin - (VisibleWidth - (Spacer.BoundsRect.Right - Spacer.BoundsRect.Left)); + + if I < 0 then I := 0; + Spacer.Item.CustomWidth := I; + end; + View.UpdatePositions; + finally + View.EndUpdate; + FState := FState - [tstRightAligning]; + end; +end; + +function TSpTBXToolbar.GetChevronItemClass: TTBChevronItemClass; +begin + Result := TSpTBXChevronItem; +end; + +function TSpTBXToolbar.GetFloatingBorderSize: TPoint; +begin + if SkinManager.GetSkinType = sknSkin then + Result := Point(CurrentSkin.FloatingWindowBorderSize, CurrentSkin.FloatingWindowBorderSize) + else + Result := inherited GetFloatingBorderSize; +end; + +function TSpTBXToolbar.GetFloatingWindowParentClass: TTBFloatingWindowParentClass; +begin + Result := TSpTBXFloatingWindowParent; +end; + +function TSpTBXToolbar.GetRightAlignMargin: Integer; +begin + if IsVertical then + Result := NonClientHeight + else + Result := NonClientWidth; +end; + +function TSpTBXToolbar.GetViewClass: TTBToolbarViewClass; +begin + Result := TSpTBXToolbarView; +end; + +function TSpTBXToolbar.GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; +begin + if vsMenuBar in View.Style then + Result := CurrentSkin.GetTextColor(skncMenuBarItem, State) + else + Result := CurrentSkin.GetTextColor(skncToolbarItem, State); +end; + +function TSpTBXToolbar.IsVertical: Boolean; +begin + Result := SpIsVerticalToolbar(Self); +end; + +procedure TSpTBXToolbar.InternalDrawBackground(ACanvas: TCanvas; ARect: TRect; + PaintOnNCArea: Boolean; PaintBorders: Boolean = True); +begin + SpDrawXPToolbar(Self, ACanvas, ARect, PaintOnNCArea, PaintBorders and (BorderStyle <> bsNone)); +end; + +procedure TSpTBXToolbar.DrawNCArea(const DrawToDC: Boolean; const ADC: HDC; + const Clip: HRGN); +var + DC: HDC; + R, ExcludeR: TRect; + GripSize: Integer; + ACanvas: TCanvas; +begin + if (csDestroying in ComponentState) or not Docked or not HandleAllocated then Exit; + + if not DrawToDC then DC := GetWindowDC(Handle) + else DC := ADC; + try + GetWindowRect(Handle, R); + OffsetRect(R, -R.Left, -R.Top); + GripSize := SpGetDragHandleSize(Self); + + if not DrawToDC then begin + SelectNCUpdateRgn(Handle, DC, Clip); + ExcludeR := R; + InflateRect(ExcludeR, -DefaultToolbarBorderSize, -DefaultToolbarBorderSize); + if IsVertical then + Inc(ExcludeR.Top, GripSize) + else + Inc(ExcludeR.Left, GripSize); + ExcludeClipRect(DC, ExcludeR.Left, ExcludeR.Top, ExcludeR.Right, ExcludeR.Bottom); + end; + + ACanvas := TCanvas.Create; + try + ACanvas.Handle := DC; + + // Paint the background and borders + InternalDrawBackground(ACanvas, R, True); + + // Paint the grip and close button + SpDrawXPToolbarGrip(Self, ACanvas, R); + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; + finally + if not DrawToDC then ReleaseDC(Handle, DC); + end; +end; + +procedure TSpTBXToolbar.CMHintShow(var Message: TCMHintShow); +// Dispatch the message to the Item Viewer. +// TSpTBXItemViewer will handle CM_HINTSHOW message to show unicode hints using +// a custom THintWindow. +begin + with Message.HintInfo^ do begin + HintStr := ''; + if Assigned(View.Selected) then begin + CursorRect := View.Selected.BoundsRect; + HintStr := View.Selected.GetHintText; + View.Selected.Dispatch(Message); + end; + end; +end; + +procedure TSpTBXToolbar.CMControlChange(var Message: TCMControlChange); +begin + // When a control is dropped on the toolbar a TTBControlItem is created by + // TTBCustomToolbar.CreateWrapper, unfortunately it is created with the + // Self.Owner instead of the Form (Owner.Owner for CompoundToolbars like + // the TabToolbar or StatusToolbar). + + if CompoundToolbar and Message.Inserting and not(csLoading in ComponentState) and + not (csUpdating in ComponentState) then + begin + CreateWrapper(Items.Count, Message.Control); + end + else + inherited; +end; + +function TSpTBXToolbar.CreateWrapper(Index: Integer; Ctl: TControl): TTBControlItem; +// CreateWrapper is used only when CompoundToolbar is true, otherwise the +// wrapper is created by TB2K +var + I: Integer; + S: String; + C: TComponent; + ItemsInterface: ITBItems; +begin + Result := nil; + if SpFindControlItem(Items, Ctl) <> nil then Exit; + + C := Owner.Owner; // The Form + Result := TTBControlItem.Create(C); + Result.Control := Ctl; + if (csDesigning in ComponentState) and Assigned(C) then begin + { Needs a name for compatibility with form inheritance } + I := 1; + while True do begin + S := Format('TBControlItem%d', [I]); + if C.FindComponent(S) = nil then + Break; + Inc(I); + end; + Result.Name := S; + end; + + if CompoundToolbar then begin + if Assigned(Owner) and Owner.GetInterface(ITBItems, ItemsInterface) then begin + if Index > ItemsInterface.GetItems.Count then + Index := 0; + ItemsInterface.GetItems.Insert(Index, Result) + end; + end + else + Items.Insert(Index, Result); +end; + +procedure TSpTBXToolbar.CMDialogChar(var Message: TCMDialogChar); +var + I: Integer; +begin + if Enabled and Visible then + for I := 0 to Items.Count - 1 do + if Items[I] is TSpTBXCustomItem then + if TSpTBXCustomItem(Items[I]).DialogChar(Message.CharCode) then begin + Message.Result := 1; + Exit; + end; + inherited; +end; + +procedure TSpTBXToolbar.CMMouseleave(var Message: TMessage); +begin + inherited; + if IsCustomizing and FCustomizable then begin + // Clear the last DropMark + InvalidateRect(Handle, @FLastDropMark, True); + end; +end; + +procedure TSpTBXToolbar.CMTextChanged(var Message: TMessage); +begin + inherited; + if HandleAllocated then begin + if Floating then RedrawWindow(TSpTBXFloatingWindowParent(Parent).Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE) + else RedrawWindow(Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE) + end; +end; + +procedure TSpTBXToolbar.WMSpSkinChange(var Message: TMessage); +begin + if HandleAllocated and not Floating then + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); +end; + +procedure TSpTBXToolbar.WMEraseBkgnd(var Message: TWMEraseBkgnd); +// Same as TSpTBXToolWindow.WMEraseBkgnd +var + ACanvas: TCanvas; + R: TRect; +begin + if (csDestroying in ComponentState) then Exit; + + Message.Result := 1; + ACanvas := TCanvas.Create; + ACanvas.Handle := Message.DC; + try + R := ClientRect; + if Docked then begin + InflateRect(R, DefaultToolbarBorderSize, DefaultToolbarBorderSize); + if IsVertical then + Dec(R.Top, SpGetDragHandleSize(Self)) + else + Dec(R.Left, SpGetDragHandleSize(Self)); + end; + + InternalDrawBackground(ACanvas, R, False); + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; +end; + +procedure TSpTBXToolbar.WMSize(var Message: TWMSize); +var + I: Integer; + V: TTBItemViewer; + R: TRect; +begin + inherited; + + if Docked and ((CurrentDock is TSpTBXDock) and not TSpTBXDock(CurrentDock).FResizing) then begin + for I := 0 to View.ViewerCount - 1 do begin + V := View.Viewers[I]; + if V.Show and not IsRectEmpty(V.BoundsRect) and not (V.Item is TTBControlItem) then + View.Invalidate(V); + end; + Self.Update; + InvalidateRect(Handle, nil, True); + for I := 0 to View.ViewerCount - 1 do begin + V := View.Viewers[I]; + if V.Show and not IsRectEmpty(V.BoundsRect) and not (V.Item is TTBControlItem) then begin + R := V.BoundsRect; + ValidateRect(Handle, @R); + end; + end; + end; +end; + +{$IFNDEF UNICODE} +function TSpTBXToolbar.IsCaptionStored: Boolean; +begin + Result := TntControl_IsCaptionStored(Self); +end; + +function TSpTBXToolbar.GetCaption: TWideCaption; +begin + Result := TntControl_GetText(Self); +end; + +procedure TSpTBXToolbar.SetCaption(const Value: TWideCaption); +begin + TntControl_SetText(Self, Value); +end; + +function TSpTBXToolbar.GetHint: WideString; +begin + Result := TntControl_GetHint(Self); +end; + +procedure TSpTBXToolbar.SetHint(const Value: WideString); +begin + TntControl_SetHint(Self, Value); +end; +{$ENDIF} + +procedure TSpTBXToolbar.SetDisplayMode(const Value: TSpTBXToolbarDisplayMode); +begin + if FDisplayMode <> Value then begin + FDisplayMode := Value; + if Value = tbdmImageAboveCaption then + Options := Options + [tboImageAboveCaption, tboSameWidth] + else + Options := Options - [tboImageAboveCaption, tboSameWidth]; + View.UpdatePositions; + end; +end; + +function TSpTBXToolbar.GetMaxSize: Integer; +begin + if Assigned(View) then + Result := TSpTBXToolbarView(View).MaxSize + else + Result := -1; +end; + +procedure TSpTBXToolbar.SetMaxSize(const Value: Integer); +begin + if Assigned(View) then + TSpTBXToolbarView(View).MaxSize := Value; +end; + +procedure TSpTBXToolbar.BeginItemMove; +begin + Inc(FItemMovingCount); +end; + +procedure TSpTBXToolbar.EndItemMove; +begin + Dec(FItemMovingCount); + if FItemMovingCount < 0 then FItemMovingCount := 0; +end; + +function TSpTBXToolbar.IsItemMoving: Boolean; +begin + Result := FItemMovingCount > 0; +end; + +procedure TSpTBXToolbar.BeginCustomize; +begin + Inc(FCustomizingCount); +end; + +procedure TSpTBXToolbar.EndCustomize; +begin + Dec(FCustomizingCount); + if FCustomizingCount < 0 then FCustomizingCount := 0; +end; + +function TSpTBXToolbar.IsCustomizing: Boolean; +begin + Result := FCustomizingCount > 0; +end; + +function TSpTBXToolbar.CanDragCustomize(Button: TMouseButton; Shift: TShiftState; X, Y: Integer): Boolean; +var + IV: TTBItemViewer; +begin + Result := False; + FBeginDragIV := nil; + + if not (csDesigning in ComponentState) and IsCustomizing then begin + Result := True; + if FCustomizable then begin + IV := SpGetItemViewerFromPoint(Items, View, Point(X, Y)); + if Assigned(IV) and Assigned(IV.Item) and not (IV.Item is TTBChevronItem) then begin + FBeginDragIV := IV; + BeginDrag(True); + end; + end; + end; +end; + +function TSpTBXToolbar.CanItemClick(Item: TTBCustomItem; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer): Boolean; +begin + Result := True; +end; + +procedure TSpTBXToolbar.MouseMove(Shift: TShiftState; X, Y: Integer); +var + Item: TTBCustomItem; +begin + inherited; + + // Handle the Toolbar items hints + // Set the Toolbar.Hint to change the Application.Hint when the + // mouse is over the Item. + // From TB2Toolbar.MouseMove + if not (csDesigning in ComponentState) then begin + if Assigned(View.Selected) then begin + Item := View.Selected.Item; + if not (tboLongHintInMenuOnly in Item.EffectiveOptions) then + if Item is TSpTBXCustomItem then + Hint := TSpTBXCustomItem(Item).Hint + else + Hint := Item.Hint; + // Send MouseMove to the selected viewer (with TB2K MouseMove is only + // called when the modal handler is active, we need this on the toolbar + // for the tab close button) + if View.Selected is TSpTBXItemViewer then + TSpTBXItemViewer(View.Selected).InternalMouseMove(Shift, X, Y); + end; + end; +end; + +procedure TSpTBXToolbar.MouseDown(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); +var + OldParent: TWinControl; + CurrentPos, OldPos: TPoint; + Item: TTBCustomItem; +begin + if not (csDesigning in ComponentState) and not CanDragCustomize(Button, Shift, X, Y) then begin + OldParent := Parent; + OldPos := ClientToScreen(Point(Left, Top)); + if Assigned(View.Selected) then + Item := View.Selected.Item + else + Item := nil; + + if CanItemClick(Item, Button, Shift, X, Y) then + inherited; + + // Check if the Parent was changed due to the toolbar moving between docks + if (Parent = OldParent) and Assigned(View.Selected) then begin + // Check if the toolbar was moved across the screen + CurrentPos := ClientToScreen(Point(Left, Top)); + if (CurrentPos.X = OldPos.X) and (CurrentPos.Y = OldPos.Y) then + DoItemClick(View.Selected.Item, Button, Shift, X, Y); // Extra click processing + end; + end; +end; + +procedure TSpTBXToolbar.DoStartDrag(var DragObject: TDragObject); +begin + if IsCustomizing and FCustomizable and Assigned(FBeginDragIV) and Assigned(FBeginDragIV.Item) then begin + // TSpTBXItemDragObject will be automatically destroyed since it's + // a descendant of TDragObjectEx. + // It's destroyed on Controls.DragDone + DragObject := TSpTBXItemDragObject.Create(Self, FBeginDragIV.Item); + inherited DoStartDrag(DragObject); + end; +end; + +procedure TSpTBXToolbar.DragOver(Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); +var + DestIV: TTBItemViewer; + DestPos: Integer; + DropMark: TRect; +begin + inherited DragOver(Source, X, Y, State, Accept); + + if IsCustomizing and FCustomizable then begin + Accept := True; + SpGetDropPosItemViewer(Items, View, Point(X, Y), DestIV, DestPos, DropMark); + if not EqualRect(DropMark, FLastDropMark) then begin + // Clear the last DropMark + InvalidateRect(Handle, @FLastDropMark, True); + // Draw the new DropMark + SpDrawDropMark(Canvas, DropMark); + FLastDropMark := DropMark; + end; + end; +end; + +procedure TSpTBXToolbar.DragDrop(Source: TObject; X, Y: Integer); +var + D: TSpTBXItemDragObject; + DestIV: TTBItemViewer; + OrigItem: TTBCustomItem; + OrigPos, DestPos: Integer; + DropMark: TRect; +begin + if Assigned(Source) and (Source is TSpTBXItemDragObject) then begin + D := Source as TSpTBXItemDragObject; + OrigItem := D.SouceItem; + OrigPos := OrigItem.Parent.IndexOf(OrigItem); + + // Get the destination item position + if X < 0 then X := 0; + if Y < 0 then Y := 0; + SpGetDropPosItemViewer(Items, View, Point(X, Y), DestIV, DestPos, DropMark); + if OrigItem.Parent = Items then begin + if DestPos > OrigPos then + dec(DestPos); + if (OrigPos = DestPos) then begin + // Clear the last DropMark + InvalidateRect(Handle, @FLastDropMark, True); + Exit; + end; + end; + + if Assigned(DestIV) and (DestPos < 0) then Exit; + + // Insert the dragging item to the destination toolbar + OrigItem.Parent.Remove(OrigItem); + try + if Assigned(DestIV) then + Items.Insert(DestPos, OrigItem) + else + Items.Add(OrigItem); + + if OrigItem is TTBControlItem then + if D.SourceControl <> Self then + TTBControlItem(OrigItem).Control.Parent := Self; + + OrigItem.Visible := True; + FLastDropMark := Rect(0, 0, 0, 0); + except + OrigItem.Parent.Insert(OrigPos, OrigItem); + end; + end; + + inherited; +end; + +procedure TSpTBXToolbar.ReadPositionData(const Data: TTBReadPositionData); +begin + inherited; + with Data do + DisplayMode := TSpTBXToolbarDisplayMode(ReadIntProc(Name, rvSpTBXDisplayMode, 0, ExtraData)); +end; + +procedure TSpTBXToolbar.WritePositionData(const Data: TTBWritePositionData); +begin + inherited; + with Data do + WriteIntProc(Name, rvSpTBXDisplayMode, Integer(DisplayMode), ExtraData); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomToolWindow } + +constructor TSpTBXCustomToolWindow.Create(AOwner: TComponent); +begin + inherited; + FMinClientWidth := 32; + FMinClientHeight := 32; + SetBounds(Left, Top, FMinClientWidth, FMinClientHeight); + + Color := clNone; + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXCustomToolWindow.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +procedure TSpTBXCustomToolWindow.CreateWindowHandle(const Params: TCreateParams); +begin + {$IFNDEF UNICODE} + CreateUnicodeHandle(Self, Params, ''); + {$ELSE} + inherited; + {$ENDIF} +end; + +procedure TSpTBXCustomToolWindow.DefineProperties(Filer: TFiler); +begin + inherited; + // Don't let the streaming system store the WideStrings, + // we need to store them manually + SpPersistent_AfterInherited_DefineProperties(Filer, Self); +end; + +function TSpTBXCustomToolWindow.CalcSize(ADock: TTBDock): TPoint; +begin + Result.X := FBarSize.cx; + Result.Y := FBarSize.cy; + if Assigned(ADock) and (FullSize or Stretch) then begin + // If docked and stretching, return the minimum size so that the + // toolbar can shrink below FBarSize + if SpIsVerticalToolbar(Self) then + Result.Y := FMinClientHeight + else + Result.X := FMinClientWidth; + end; +end; + +function TSpTBXCustomToolWindow.DoArrange(CanMoveControls: Boolean; + PreviousDockType: TTBDockType; NewFloating: Boolean; NewDock: TTBDock): TPoint; +begin + Result := CalcSize(NewDock); +end; + +procedure TSpTBXCustomToolWindow.GetBaseSize(var ASize: TPoint); +begin + ASize := CalcSize(CurrentDock); +end; + +procedure TSpTBXCustomToolWindow.GetMinMaxSize(var AMinClientWidth, AMinClientHeight, + AMaxClientWidth, AMaxClientHeight: Integer); +begin + // GetMinMaxSize is used only when the window is floating + AMinClientWidth := FMinClientWidth; + AMinClientHeight := FMinClientHeight; + AMaxClientWidth := FMaxClientWidth; + AMaxClientHeight := FMaxClientHeight; +end; + +function TSpTBXCustomToolWindow.IsVertical: Boolean; +begin + Result := SpIsVerticalToolbar(Self); +end; + +procedure TSpTBXCustomToolWindow.SizeChanging(const AWidth, AHeight: Integer); +begin + FBarSize.cx := AWidth; + FBarSize.cy := AHeight; + if Assigned(Parent) then begin + Dec(FBarSize.cx, Width - ClientWidth); + Dec(FBarSize.cy, Height - ClientHeight); + end; +end; + +procedure TSpTBXCustomToolWindow.SetClientAreaSize(AWidth, AHeight: Integer); +var + R: TRect; +begin + if Assigned(Parent) then begin + Windows.GetClientRect(Handle, R); + SetBounds(Left, Top, Width - R.Right + AWidth, Height - R.Bottom + AHeight); + end + else + SetBounds(Left, Top, AWidth, AHeight); +end; + +procedure TSpTBXCustomToolWindow.Paint; +var + R: TRect; +begin + // Dotted border in design mode + if csDesigning in ComponentState then begin + R := ClientRect; + Canvas.Pen.Style := psDot; + Canvas.Pen.Color := clBtnShadow; + Canvas.Brush.Style := bsClear; + Canvas.Rectangle(R.Left, R.Top, R.Right, R.Bottom); + Canvas.Pen.Style := psSolid; + end; +end; + +procedure TSpTBXCustomToolWindow.InternalDrawBackground(ACanvas: TCanvas; + ARect: TRect; PaintOnNCArea, PaintBorders: Boolean); +begin + SpDrawXPToolbar(Self, ACanvas, ARect, PaintOnNCArea, PaintBorders and (BorderStyle <> bsNone)); +end; + +procedure TSpTBXCustomToolWindow.InvalidateBackground(InvalidateChildren: Boolean); +begin + // Force background repaint + if not (csDestroying in ComponentState) and HandleAllocated then + if InvalidateChildren then + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN) + else + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE); +end; + +procedure TSpTBXCustomToolWindow.DrawNCArea(const DrawToDC: Boolean; + const ADC: HDC; const Clip: HRGN); +var + DC: HDC; + R, ExcludeR: TRect; + GripSize: Integer; + ACanvas: TCanvas; +begin + if (csDestroying in ComponentState) or not Docked or not HandleAllocated then Exit; + + if not DrawToDC then DC := GetWindowDC(Handle) + else DC := ADC; + try + GetWindowRect(Handle, R); + OffsetRect(R, -R.Left, -R.Top); + GripSize := SpGetDragHandleSize(Self); + + if not DrawToDC then begin + SelectNCUpdateRgn(Handle, DC, Clip); + ExcludeR := R; + InflateRect(ExcludeR, -DefaultToolbarBorderSize, -DefaultToolbarBorderSize); + if IsVertical then + Inc(ExcludeR.Top, GripSize) + else + Inc(ExcludeR.Left, GripSize); + ExcludeClipRect(DC, ExcludeR.Left, ExcludeR.Top, ExcludeR.Right, ExcludeR.Bottom); + end; + + ACanvas := TCanvas.Create; + try + ACanvas.Handle := DC; + + // Paint the background and borders + InternalDrawBackground(ACanvas, R, True); + + // Paint the grip and close button + SpDrawXPToolbarGrip(Self, ACanvas, R); + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; + finally + if not DrawToDC then ReleaseDC(Handle, DC); + end; +end; + +procedure TSpTBXCustomToolWindow.DoDrawBackground(ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, PaintStage, PaintDefault); +end; + +procedure TSpTBXCustomToolWindow.ReadPositionData(const Data: TTBReadPositionData); +var + W, H: Integer; +begin + inherited; + // Load ClientAreaWidth/ClientAreaHeight + if Resizable then + with Data do begin + W := ReadIntProc(Name, rvClientWidth, FBarSize.cx, ExtraData); + H := ReadIntProc(Name, rvClientHeight, FBarSize.cy, ExtraData); + SetClientAreaSize(W, H); + end; +end; + +procedure TSpTBXCustomToolWindow.WritePositionData(const Data: TTBWritePositionData); +begin + inherited; + // Save ClientAreaWidth/ClientAreaHeight + with Data do begin + WriteIntProc(Name, rvClientWidth, ClientAreaWidth, ExtraData); + WriteIntProc(Name, rvClientHeight, ClientAreaHeight, ExtraData); + end; +end; + +function TSpTBXCustomToolWindow.GetFloatingBorderSize: TPoint; +begin + if SkinManager.GetSkinType = sknSkin then + Result := Point(CurrentSkin.FloatingWindowBorderSize, CurrentSkin.FloatingWindowBorderSize) + else + Result := inherited GetFloatingBorderSize; +end; + +function TSpTBXCustomToolWindow.GetFloatingWindowParentClass: TTBFloatingWindowParentClass; +begin + Result := TSpTBXFloatingWindowParent; +end; + +{$IFNDEF UNICODE} +function TSpTBXCustomToolWindow.IsCaptionStored: Boolean; +begin + Result := TntControl_IsCaptionStored(Self); +end; + +function TSpTBXCustomToolWindow.GetCaption: TWideCaption; +begin + Result := TntControl_GetText(Self); +end; + +procedure TSpTBXCustomToolWindow.SetCaption(const Value: TWideCaption); +begin + TntControl_SetText(Self, Value); +end; +{$ENDIF} + +function TSpTBXCustomToolWindow.GetClientAreaWidth: Integer; +begin + if Assigned(Parent) then Result := ClientWidth + else Result := Width; +end; + +procedure TSpTBXCustomToolWindow.SetClientAreaWidth(Value: Integer); +begin + SetClientAreaSize(Value, ClientAreaHeight); +end; + +function TSpTBXCustomToolWindow.GetClientAreaHeight: Integer; +begin + if Assigned(Parent) then Result := ClientHeight + else Result := Height; +end; + +procedure TSpTBXCustomToolWindow.SetClientAreaHeight(Value: Integer); +begin + SetClientAreaSize(ClientAreaWidth, Value); +end; + +procedure TSpTBXCustomToolWindow.CMTextChanged(var Message: TMessage); +begin + inherited; + if HandleAllocated then begin + if Floating then RedrawWindow(TSpTBXFloatingWindowParent(Parent).Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE) + else RedrawWindow(Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE) + end; +end; + +procedure TSpTBXCustomToolWindow.WMEraseBkgnd(var Message: TWMEraseBkgnd); +// Same as TSpTBXToolbar.WMEraseBkgnd +var + ACanvas: TCanvas; + R: TRect; +begin + if (csDestroying in ComponentState) then Exit; + + Message.Result := 1; + ACanvas := TCanvas.Create; + ACanvas.Handle := Message.DC; + try + R := ClientRect; + if Docked then begin + InflateRect(R, DefaultToolbarBorderSize, DefaultToolbarBorderSize); + if IsVertical then + Dec(R.Top, SpGetDragHandleSize(Self)) + else + Dec(R.Left, SpGetDragHandleSize(Self)); + end; + + InternalDrawBackground(ACanvas, R, False); + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; +end; + +procedure TSpTBXCustomToolWindow.WMSpSkinChange(var Message: TMessage); +begin + if HandleAllocated and not Floating then + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); +end; + +procedure TSpTBXCustomToolWindow.WMWindowPosChanged(var Message: TWMWindowPosChanged); +begin + inherited; + InvalidateBackground; + if (Message.WindowPos.flags and SWP_NOSIZE) = 0 then begin + Realign; + Update; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXFloatingWindowParent } + +constructor TSpTBXFloatingWindowParent.CreateNew(AOwner: TComponent; + Dummy: Integer); +begin + inherited; + ScreenSnap := True; + SkinManager.AddSkinNotification(Self); +end; + +procedure TSpTBXFloatingWindowParent.CreateWnd; +begin + inherited; + UpdateDwmNCSize; +end; + +destructor TSpTBXFloatingWindowParent.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +procedure TSpTBXFloatingWindowParent.DrawNCArea(const DrawToDC: Boolean; + const ADC: HDC; const Clip: HRGN; RedrawWhat: TTBToolWindowNCRedrawWhat); +const + Pattern: array [0..15] of Byte = ($C6, 0, $EE, 0, $7C, 0, $38, 0, $7C, 0, $EE, 0, $C6, 0, 0, 0); +var + DC: HDC; + R, CaptionR, CloseR: TRect; + ACanvas: TCanvas; + DockWindow: TTBCustomDockableWindowAccess; + FloatingBorderSize: TPoint; + WideCaption: WideString; + IsActive: Boolean; + Flags: Integer; + CloseButtonWidth: Integer; + SkinState: TSpTBXSkinStatesType; + PatternColor: TColor; +begin + if not HandleAllocated then Exit; + if not DrawToDC then DC := GetWindowDC(Handle) + else DC := ADC; + try + if not DrawToDC then SelectNCUpdateRgn(Handle, DC, Clip); + GetWindowRect(Handle, R); + OffsetRect(R, -R.Left, -R.Top); + with R do IntersectClipRect(DC, Left, Top, Right, Bottom); + ACanvas := TCanvas.Create; + try + ACanvas.Handle := DC; + ACanvas.Brush.Color := Color; // SpDrawXPTitleBarBody needs it to paint the background + GetWindowRect(Handle, R); + OffsetRect(R, -R.Left, -R.Top); + DockWindow := TTBCustomDockableWindowAccess(DockableWindow); + FloatingBorderSize := DockWindow.GetFloatingBorderSize; + IsActive := not DockWindow.InactiveCaption; + + // Borders + if twrdBorder in RedrawWhat then + SpDrawXPTitleBarBody(ACanvas, R, IsActive, FloatingBorderSize, False); + + // Caption + if DockWindow.ShowCaption then begin + R.Bottom := R.Top + FloatingBorderSize.Y + GetSystemMetrics(SM_CYSMCAPTION); + if SkinManager.GetSkinType = sknWindows then begin + if twrdBorder in RedrawWhat then + SpDrawXPTitleBar(ACanvas, R, IsActive, False); + InflateRect(R, -FloatingBorderSize.X, 0); + R.Top := R.Top + FloatingBorderSize.Y; + end + else begin + InflateRect(R, -FloatingBorderSize.X, 0); + R.Top := R.Top + FloatingBorderSize.Y; + if twrdBorder in RedrawWhat then + SpDrawXPTitleBar(ACanvas, R, IsActive, False); + end; + + // Text + if twrdCaption in RedrawWhat then begin + CaptionR := R; + OffsetRect(CaptionR, 2, 0); + if DockWindow.CloseButton then + Dec(CaptionR.Right, GetSystemMetrics(SM_CYSMCAPTION) + 2); + ACanvas.Brush.Style := bsClear; + try + ACanvas.Font.Assign(SmCaptionFont); + if IsActive then + ACanvas.Font.Color := CurrentSkin.GetTextColor(skncWindowTitleBar, sknsNormal) + else + ACanvas.Font.Color := CurrentSkin.GetTextColor(skncWindowTitleBar, sknsDisabled); + + if DockableWindow is TSpTBXToolbar then + WideCaption := TSpTBXToolbar(DockWindow).Caption + else + if DockableWindow is TSpTBXCustomToolWindow then + WideCaption := TSpTBXCustomToolWindow(DockWindow).Caption + else + WideCaption := ''; + SpDrawXPText(ACanvas, WideCaption, CaptionR, DT_SINGLELINE or DT_VCENTER or DT_END_ELLIPSIS or DT_HIDEPREFIX); + finally + ACanvas.Brush.Style := bsSolid; + end; + end; + + // Close button + if (twrdCloseButton in RedrawWhat) and DockWindow.CloseButton then begin + CloseR := R; + Dec(CloseR.Bottom); + CloseButtonWidth := (CloseR.Bottom - CloseR.Top) - 2 - 2; + CloseR.Left := CloseR.Right - CloseButtonWidth - 2; // TB2Dock.GetCloseButtonRect + CloseR.Right := CloseR.Left + CloseButtonWidth; + CloseR.Top := CloseR.Top + 2; + CloseR.Bottom := CloseR.Top + CloseButtonWidth; + + case SkinManager.GetSkinType of + sknNone: + begin + if CloseButtonDown then + DrawFrameControl(ACanvas.Handle, CloseR, DFC_CAPTION, DFCS_CAPTIONCLOSE or DFCS_PUSHED) + else + DrawFrameControl(ACanvas.Handle, CloseR, DFC_CAPTION, DFCS_CAPTIONCLOSE); + end; + sknWindows: + begin + if CloseButtonDown then Flags := CBS_PUSHED + else if FCloseButtonHover then Flags := CBS_HOT + else Flags := CBS_NORMAL; + DrawThemeBackground(ThemeServices.Theme[teWindow], ACanvas.Handle, WP_SMALLCLOSEBUTTON, Flags, CloseR, nil); + end; + sknSkin: + begin + SkinState := CurrentSkin.GetState(True, CloseButtonDown, FCloseButtonHover, False); + PatternColor := CurrentSkin.GetTextColor(skncWindowTitleBar, SkinState); + if PatternColor = clNone then + PatternColor := CurrentSkin.GetTextColor(skncToolbarItem, SkinState); + CurrentSkin.PaintBackground(ACanvas, CloseR, skncToolbarItem, SkinState, True, True); + SpDrawGlyphPattern(ACanvas, CloseR, 0, PatternColor); + end; + end; + end; + end; + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; + finally + if not DrawToDC then ReleaseDC(Handle, DC); + end; +end; + +procedure TSpTBXFloatingWindowParent.RedrawCloseButton; +begin + if HandleAllocated and IsWindowVisible(Handle) then + if SkinManager.GetSkinType <> sknNone then + DrawNCArea(False, 0, 0, [twrdBorder, twrdCaption, twrdCloseButton]); +end; + +procedure TSpTBXFloatingWindowParent.UpdateDwmNCSize; +var + Style: Integer; +begin + if HandleAllocated then begin + // Make sure WS_THICKFRAME is setted only when Windows themes are used with + // DwmComposition, otherwise borders are incorrectly painted on Vista + Style := GetWindowLong(Handle, GWL_STYLE); + if SpIsDwmCompositionEnabled and (SkinManager.GetSkinType = sknWindows) then + Style := Style or WS_THICKFRAME + else + Style := Style and not WS_THICKFRAME; + SetWindowLong(Handle, GWL_STYLE, Style); + + // Update the NC area size, CurrentSkin.FloatingWindowBorderSize could have changed + // Make sure to resize the toolbar + SpRecalcNCArea(Self); + if Assigned(DockableWindow) then + TTBCustomDockableWindowAccess(DockableWindow).Arrange; + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_FRAME); + SpActivateDwmNC(Self, SkinManager.GetSkinType <> sknSkin); + end; +end; + +procedure TSpTBXFloatingWindowParent.CancelNCHover; +begin + if FCloseButtonHover then begin + FCloseButtonHover := False; + RedrawCloseButton; + end; +end; + +procedure TSpTBXFloatingWindowParent.VisibleChanging; +begin + inherited; + Caption := ''; +end; + +procedure TSpTBXFloatingWindowParent.CMMouseLeave(var Message: TMessage); +begin + inherited; + CancelNCHover; +end; + +procedure TSpTBXFloatingWindowParent.WMActivateApp(var Message: TWMActivateApp); +var + DockWindow: TTBCustomDockableWindowAccess; +begin + inherited; + + // The floating window is not repainted correctly if HideWhenInactive is + // false and the application is deactivated/activated. + if HandleAllocated then begin + DockWindow := TTBCustomDockableWindowAccess(DockableWindow); + if not DockWindow.HideWhenInactive then + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN); + end; +end; + +procedure TSpTBXFloatingWindowParent.WMClose(var Message: TWMClose); +begin + if FCloseOnAltF4 then begin + if Assigned(DockableWindow) then + TTBCustomDockableWindowAccess(DockableWindow).Close; + end + else + inherited; +end; + +procedure TSpTBXFloatingWindowParent.WMEraseBkgnd(var Message: TMessage); +begin + Message.Result := 1; +end; + +procedure TSpTBXFloatingWindowParent.WMNCMouseLeave(var Message: TMessage); +begin + if not MouseCapture then CancelNCHover; + inherited; +end; + +procedure TSpTBXFloatingWindowParent.WMNCMouseMove(var Message: TWMNCMouseMove); +var + InArea: Boolean; +begin + inherited; + { Note: TME_NONCLIENT was introduced in Windows 98 and 2000 } + if (Win32MajorVersion >= 5) or + (Win32MajorVersion = 4) and (Win32MinorVersion >= 10) then + CallTrackMouseEvent(Handle, TME_LEAVE or $10 {TME_NONCLIENT}); + InArea := Message.HitTest = 2001; {HT_TB2k_Close} + if FCloseButtonHover <> InArea then begin + FCloseButtonHover := InArea; + RedrawCloseButton; + end; +end; + +procedure TSpTBXFloatingWindowParent.WMSpSkinChange(var Message: TMessage); +begin + UpdateDwmNCSize; + inherited; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXPopupWindow } + +constructor TSpTBXPopupWindow.CreatePopupWindow(AOwner: TComponent; + const AParentView: TTBView; const AItem: TTBCustomItem; + const ACustomizing: Boolean); +begin + inherited; + if AItem is TSpTBXCustomItem then + if Assigned(View) and (View is TSpTBXPopupWindowView) then begin + if TSpTBXCustomItem(AItem).ToolbarStylePopup then + TSpTBXPopupWindowView(View).SetIsToolbar(True); + end; + + FMaximumImageSize := SpGetMenuMaximumImageSize(View); +end; + +destructor TSpTBXPopupWindow.Destroy; +begin + DoPopupShowingChanged(False); + + inherited; +end; + +procedure TSpTBXPopupWindow.DoPopupShowingChanged(IsVisible: Boolean); +begin + if View.ParentItem is TSpTBXCustomItem then + TSpTBXCustomItem(View.ParentItem).DoPopupShowingChanged(Self, IsVisible) + else + if View.ParentItem is TSpTBXRootItem then + TSpTBXRootItem(View.ParentItem).DoPopupShowingChanged(Self, IsVisible); +end; + +function TSpTBXPopupWindow.GetViewClass: TTBViewClass; +begin + Result := TSpTBXPopupWindowView; +end; + +function TSpTBXPopupWindow.CanDrawGutter: Boolean; +begin + if View.IsToolbar then + Result := False + else begin + Result := True; + // Is it a toolbox? + if Assigned(View) and Assigned(View.ParentItem) then begin + if View.ParentItem is TSpTBXCustomItem then + Result := not TSpTBXCustomItem(View.ParentItem).ToolBoxPopup + else + if View.ParentItem is TSpTBXRootItem then + Result := not TSpTBXRootItem(View.ParentItem).ToolBoxPopup; + end; + end; +end; + +procedure PopupWindowNCPaintProc(Wnd: HWND; DC: HDC; AppData: TObject); +// Paints the NC area and the client background, used by WMEraseBkgnd, WMNCPaint, WMPrint +var + ACanvas: TCanvas; + R: TRect; + PopupWindow: TSpTBXPopupWindow; +begin + ACanvas := TCanvas.Create; + try + ACanvas.Handle := DC; + GetWindowRect(Wnd, R); + OffsetRect(R, -R.Left, -R.Top); + + PopupWindow := TSpTBXPopupWindow(AppData); + // If it's used by WM_ERASEBKGND offset the rect + if PopupWindow.FPaintingClientArea then begin + PopupWindow.FPaintingClientArea := False; + OffsetRect(R, -3, -3); + end; + + PopupWindow.PaintBackground(ACanvas, R); + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; +end; + +procedure TSpTBXPopupWindow.PaintBackground(ACanvas: TCanvas; ARect: TRect); +// Paints the NC area and the client background, used by WMEraseBkgnd, WMNCPaint, WMPrint +var + DrawGutter: Boolean; + OpenIVRect: TRect; + OpenIV: TTBItemViewer; + OpenIVSize: Integer; +begin + OpenIVRect := Rect(0, 0, 0, 0); + DrawGutter := False; + + if Assigned(View) then begin + ACanvas.Font.Assign(ToolbarFont); + DrawGutter := CanDrawGutter; + + if Assigned(View.ParentView) and CurrentSkin.OfficePopup then begin + OpenIV := TTBViewAccess(View.ParentView).OpenViewer; + if Assigned(OpenIV) and OpenIV.IsToolbarStyle and + ((OpenIV is TSpTBXItemViewer) or (OpenIV is TSpTBXChevronItemViewer)) then + begin + // Get the OpenIVRect in window coordinates + OpenIVRect := OpenIV.BoundsRect; + OpenIVRect.TopLeft := View.ParentView.Window.ClientToScreen(OpenIVRect.TopLeft); + OpenIVRect.BottomRight := View.ParentView.Window.ClientToScreen(OpenIVRect.BottomRight); + OpenIVRect.TopLeft := ScreenToClient(OpenIVRect.TopLeft); + OpenIVRect.BottomRight := ScreenToClient(OpenIVRect.BottomRight); + OffsetRect(OpenIVRect, 3, 3); // Offset to get it on window coordinates + OpenIVSize := OpenIVRect.Right - OpenIVRect.Left; + + // Get the Clip rect based on OpenIVRect + OpenIVRect.Left := OpenIVRect.Left + ARect.Left; // ARect.Left is -3 when called by WMEraseBkgnd and is 0 when called by WMNCPaint and WMPrint + OpenIVRect.Right := OpenIVRect.Left + OpenIVSize; + end; + end; + end; + + SpDrawXPMenuPopupWindow(ACanvas, ARect, OpenIVRect, DrawGutter, MaximumImageSize.cx, sknSkin); +end; + +procedure TSpTBXPopupWindow.CMHintShow(var Message: TCMHintShow); +// Dispatch the message to the Item Viewer. +// TSpTBXItemViewer will handle CM_HINTSHOW message to show unicode hints using +// a custom THintWindow. +begin + with Message.HintInfo^ do begin + HintStr := ''; + if Assigned(View.Selected) then begin + CursorRect := View.Selected.BoundsRect; + HintStr := View.Selected.GetHintText; + View.Selected.Dispatch(Message); + end; + end; +end; + +procedure TSpTBXPopupWindow.CMShowingchanged(var Message: TMessage); +const + ShowFlags: array[Boolean] of UINT = ( + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_HIDEWINDOW, + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_SHOWWINDOW); +var + HideEmptyPopup: Boolean; +begin + if View.ParentItem is TSpTBXSubmenuItem then + HideEmptyPopup := TSpTBXSubmenuItem(View.ParentItem).HideEmptyPopup + else + HideEmptyPopup := False; + + // When the View is empty the size is set to 0 on TSpTBXPopupWindowView.AutoSize + // We should disable the animation because it can't animate an empty window + if HideEmptyPopup and Showing and (View.ViewerCount = 0) then begin + SetWindowPos(WindowHandle, 0, 0, 0, 0, 0, ShowFlags[Showing]); + end + else + inherited; + + if Visible then + DoPopupShowingChanged(True); +end; + +procedure TSpTBXPopupWindow.WMEraseBkgnd(var Message: TWMEraseBkgnd); +begin + case SkinManager.GetSkinType of + sknNone: + inherited; + sknWindows: + // If it's Windows theme and we're not on Vista do default painting + if not SpIsWinVistaOrUp then + inherited + else begin + Message.Result := 1; + FPaintingClientArea := True; + TBEndAnimation(WindowHandle); + PopupWindowNCPaintProc(Handle, Message.DC, Self); + end; + sknSkin: + begin + Message.Result := 1; + FPaintingClientArea := True; + TBEndAnimation(WindowHandle); + PopupWindowNCPaintProc(Handle, Message.DC, Self); + end; + end; +end; + +procedure TSpTBXPopupWindow.WMNCPaint(var Message: TMessage); +var + DC: HDC; +begin + DC := GetWindowDC(Handle); + try + FPaintingClientArea := False; + SelectNCUpdateRgn(Handle, DC, HRGN(Message.WParam)); + PopupWindowNCPaintProc(Handle, DC, Self); + finally + ReleaseDC(Handle, DC); + end; +end; + +procedure TSpTBXPopupWindow.WMPrint(var Message: TMessage); +begin + FPaintingClientArea := False; + HandleWMPrint(Handle, Message, PopupWindowNCPaintProc, Self); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXPopupWindowView } + +procedure TSpTBXPopupWindowView.AutoSize(AWidth, AHeight: Integer); +begin + // When the View is empty the size should be 0 + if (ViewerCount = 0) and (ParentItem is TSpTBXSubmenuItem) then + if TSpTBXSubmenuItem(ParentItem).HideEmptyPopup then begin + AWidth := -(PopupMenuWindowNCSize * 2); + AHeight := -(PopupMenuWindowNCSize * 2); + end; + + inherited AutoSize(AWidth, AHeight); +end; + +procedure TSpTBXPopupWindowView.SetIsToolbar(const Value: Boolean); +begin + // Change the readonly IsToolbar property using RTTI, the property must + // be published. + // Tip from: http://hallvards.blogspot.com/2004/05/hack-1-write-access-to-read-only.html + PBoolean(Integer(Self) + (Integer(GetPropInfo(TSpTBXPopupWindowView, 'IsToolbar').GetProc) and $00FFFFFF))^ := Value; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXChevronItem } + +function TSpTBXChevronItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TSpTBXChevronItemViewer; +end; + +function TSpTBXChevronItem.GetPopupWindowClass: TTBPopupWindowClass; +begin + Result := TSpTBXChevronPopupWindow; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXChevronItemViewer } + +function TSpTBXChevronItemViewer.GetTextColor(State: TSpTBXSkinStatesType): TColor; +begin + Result := clNone; + if IsToolbarStyle then begin + if View.Window is TSpTBXToolbar then + Result := TSpTBXToolbar(View.Window).GetItemsTextColor(State); + if Result = clNone then + Result := CurrentSkin.GetTextColor(skncToolbarItem, State); + end + else + Result := CurrentSkin.GetTextColor(skncMenuItem, State); +end; + +procedure TSpTBXChevronItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, + UseDisabledShadow: Boolean); +const + Pattern: array[Boolean, 0..15] of Byte = ( + ($CC, 0, $66, 0, $33, 0, $66, 0, $CC, 0, 0, 0, 0, 0, 0, 0), + ($88, 0, $D8, 0, $70, 0, $20, 0, $88, 0, $D8, 0, $70, 0, $20, 0)); +var + ItemInfo: TSpTBXMenuItemInfo; + R2: TRect; + P: PByte; + W, H: Integer; + DC: HDC; + PatternColor: TColor; +begin + DC := Canvas.Handle; + SpFillItemInfo(Canvas, Self, ItemInfo); + SpDrawXPMenuItem(Canvas, ClientAreaRect, ItemInfo); + + // Chevron glyph + R2 := ClientAreaRect; + if not ItemInfo.IsVertical then begin + Inc(R2.Top, 4); + R2.Bottom := R2.Top + 5; + W := 8; + H := 5; + end + else begin + R2.Left := R2.Right - 9; + R2.Right := R2.Left + 5; + W := 5; + H := 8; + end; + if ItemInfo.Pushed then OffsetRect(R2, 1, 1); + + if SkinManager.GetSkinType = sknSkin then + PatternColor := GetTextColor(ItemInfo.State) + else + PatternColor := clBtnText; + P := @Pattern[ItemInfo.IsVertical][0]; + if ItemInfo.Enabled then + SpDrawGlyphPattern(DC, R2, W, H, P^, PatternColor) + else begin + OffsetRect(R2, 1, 1); + SpDrawGlyphPattern(DC, R2, W, H, P^, clBtnHighlight); + OffsetRect(R2, -1, -1); + SpDrawGlyphPattern(DC, R2, W, H, P^, clBtnShadow); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXChevronPopupWindow } + +procedure TSpTBXChevronPopupWindow.CMColorChanged(var Message: TMessage); +var + V: TSpTBXPopupWindowView; + PV: TTBView; +begin + // The private FIsToolbar field of the ChevronItem is setted to True + // in TTBCustomItem.CreatePopup, we need to reset it to False before + // the Popup is showed. + // TTBCustomItem.CreatePopup changes the PopupWindow color to clBtnFace + // after it changes the FIsToolbar value (and before it is visible), + // that's why we are trapping CM_COLORCHANGED to reset the field. + + inherited; + if Assigned(View) and (View is TSpTBXPopupWindowView) then begin + V := TSpTBXPopupWindowView(View); + PV := V.ParentView; + // Do we really need to change it? + if (Color = clBtnFace) and V.IsToolbar and Assigned(PV) and + Assigned(PV.Owner) and (PV.Owner is TSpTBXToolbar) and + (TSpTBXToolbar(PV.Owner).ChevronVertical) then + begin + V.SetIsToolbar(False); + Color := clMenu; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXPopupMenu } + +function TSpTBXPopupMenu.GetOnClosePopup: TNotifyEvent; +begin + Result := TSpTBXRootItem(Items).OnClosePopup; +end; + +function TSpTBXPopupMenu.GetOnInitPopup: TSpTBXPopupEvent; +begin + Result := TSpTBXRootItem(Items).OnInitPopup; +end; + +function TSpTBXPopupMenu.GetRootItemClass: TTBRootItemClass; +begin + Result := TSpTBXRootItem; +end; + +function TSpTBXPopupMenu.InternalPopup(X, Y: Integer; ForceFocus: Boolean; + PopupControl: TControl = nil): Boolean; +var + P: TPoint; + PopupControlRect: TRect; + WinPopupControl: TWinControl; + Msg: TMessage; +begin + Result := True; + FClickedItem := nil; + P := Point(X, Y); + + {$IFDEF JR_D9} + SetPopupPoint(P); + {$ELSE} + PPoint(@PopupPoint)^ := P; + {$ENDIF} + + WinPopupControl := nil; + if Assigned(PopupControl) and Assigned(PopupControl.Parent) then begin + PopupControlRect := PopupControl.BoundsRect; + PopupControlRect.TopLeft := PopupControl.Parent.ClientToScreen(PopupControlRect.TopLeft); + PopupControlRect.BottomRight := PopupControl.Parent.ClientToScreen(PopupControlRect.BottomRight); + if PopupControl is TWinControl then + WinPopupControl := PopupControl as TWinControl; + end + else + PopupControlRect := Rect(X, Y, X, Y); + + P.X := PopupControlRect.Left; + P.Y := PopupControlRect.Bottom; + TSpTBXRootItem(Items).ToolBoxPopup := ToolBoxPopup; + FClickedItem := Items.Popup(P.X, P.Y, TrackButton = tbRightButton, + TTBPopupAlignment(Alignment), FReturnClickedItemOnly); + + if Assigned(WinPopupControl) then begin + // Send a message to the PopupControl and it's children controls + // to inform that the Popup is closed. + Msg.Msg := CM_SPPOPUPCLOSE; + Msg.WParam := Integer(Self); + Msg.LParam := 0; + Msg.Result := 0; + PostMessage(WinPopupControl.Handle, Msg.Msg, Msg.WParam, Msg.LParam); + WinPopupControl.Broadcast(Msg); + end; +end; + +procedure TSpTBXPopupMenu.Popup(X, Y: Integer); +begin + PopupEx(X, Y); +end; + +function TSpTBXPopupMenu.PopupEx(X, Y: Integer; PopupControl: TControl = nil; + ReturnClickedItemOnly: Boolean = False): TTBCustomItem; +begin + FReturnClickedItemOnly := ReturnClickedItemOnly; + try + InternalPopup(X, Y, False, PopupControl); + Result := FClickedItem; + finally + FReturnClickedItemOnly := False; + end; +end; + +procedure TSpTBXPopupMenu.SetOnClosePopup(const Value: TNotifyEvent); +begin + TSpTBXRootItem(Items).OnClosePopup := Value; +end; + +procedure TSpTBXPopupMenu.SetOnInitPopup(const Value: TSpTBXPopupEvent); +begin + TSpTBXRootItem(Items).OnInitPopup := Value; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCompoundItemsControl } + +constructor TSpTBXCompoundItemsControl.Create(AOwner: TComponent); +begin + inherited; + + FDock := GetDockClass.Create(Self); + FDock.Parent := Self; + FDock.OnRequestDock := DockRequestDock; + + FToolbar := GetToolbarClass.Create(Self); + FToolbar.CompoundToolbar := True; + FToolbar.Parent := FDock; + FToolbar.CurrentDock := FDock; + FToolbar.Name := Name + 'Toolbar'; + FToolbar.Customizable := False; + FToolbar.BorderStyle := bsNone; + FToolbar.DockMode := dmCannotFloatOrChangeDocks; + FToolbar.DragHandleStyle := dhNone; + FToolbar.Stretch := True; + FToolbar.ShrinkMode := tbsmNone; + FToolbar.ShowCaption := False; + + FSkinType := sknSkin; + SkinManager.AddSkinNotification(Self); +end; + +procedure TSpTBXCompoundItemsControl.CreateParams(var Params: TCreateParams); +begin + // Disable complete redraws when size changes. CS_HREDRAW and CS_VREDRAW + // cause flicker and are not necessary for this control at run time + // Invalidate in WMWindowPosChanged message instead. + inherited CreateParams(Params); + if not (csDesigning in ComponentState) then begin + with Params do + Style := Style or WS_CLIPCHILDREN; + with Params do + WindowClass.Style := WindowClass.Style and not (CS_HREDRAW or CS_VREDRAW); + end; +end; + +destructor TSpTBXCompoundItemsControl.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + FToolbar.Free; + FDock.Free; + inherited; +end; + +procedure TSpTBXCompoundItemsControl.Loaded; +var + I: Integer; + C: TControl; + DesignerRootItem: TTBCustomItem; +begin + inherited; + + // The parent of TTBControlItem.Control should be the toolbar, not Self + // (as setted in GetChildren for dfm streaming). + DesignerRootItem := GetItems; + for I := 0 to DesignerRootItem.Count - 1 do + if DesignerRootItem[I] is TTBControlItem then begin + C := TTBControlItem(DesignerRootItem[I]).Control; + if Assigned(C) and (C.Parent <> FToolbar) then + C.Parent := FToolbar; + end; +end; + +procedure TSpTBXCompoundItemsControl.DockRequestDock(Sender: TObject; + Bar: TTBCustomDockableWindow; var Accept: Boolean); +begin + if Assigned(FToolbar) then Accept := Bar = FToolbar; +end; + +procedure TSpTBXCompoundItemsControl.GetChildren(Proc: TGetChildProc; + Root: TComponent); +var + I: Integer; + C: TControl; + DesignerRootItem: TTBCustomItem; +begin + // Needed to fake the DFM streaming system because the owner of the items + // is the Form and not the Toolbar nor Self. + // But the parent must be the Toolbar. + // GetChildren is used to pass the children components of Self to the DFM + // streaming system. + // We also need to do the same with the controls of TTBControlItems. + // More info on the Delphi help or Classes.TWriter.WriteData + // Same as TSpTBXCompoundItemsControl and TSpTBXCustomDockablePanel + + DesignerRootItem := GetItems; + TTBCustomItemAccess(DesignerRootItem).GetChildren(Proc, Root); + for I := 0 to DesignerRootItem.Count - 1 do + if (DesignerRootItem[I] is TTBControlItem) then begin + C := TTBControlItem(DesignerRootItem[I]).Control; + if Assigned(C) then + if SpFindControl(Self, C) = -1 then Proc(C); + end; + inherited; +end; + +function TSpTBXCompoundItemsControl.GetItems: TTBCustomItem; +begin + Result := FToolbar.Items; +end; + +function TSpTBXCompoundItemsControl.GetRootItems: TTBRootItem; +begin + Result := FToolbar.Items; +end; + +function TSpTBXCompoundItemsControl.GetDockClass: TSpTBXDockClass; +begin + Result := TSpTBXDock; +end; + +function TSpTBXCompoundItemsControl.GetToolbarClass: TSpTBXToolbarClass; +begin + Result := TSpTBXToolbar; +end; + +function TSpTBXCompoundItemsControl.GetView: TSpTBXToolbarView; +begin + Result := FToolbar.View as TSpTBXToolbarView; +end; + +function TSpTBXCompoundItemsControl.GetImages: TCustomImageList; +begin + if Assigned(FToolbar) then + Result := FToolbar.Images + else + Result := nil; +end; + +procedure TSpTBXCompoundItemsControl.InvalidateBackground(InvalidateChildren: Boolean); +begin + // Invalidate will not fire WM_ERASEBKGND, because csOpaque is setted + if not (csDestroying in ComponentState) and HandleAllocated then + if InvalidateChildren then + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN) + else + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE); +end; + +procedure TSpTBXCompoundItemsControl.SetImages(const Value: TCustomImageList); +begin + if Assigned(FToolbar) then FToolbar.Images := Value; +end; + +procedure TSpTBXCompoundItemsControl.SetName(const Value: TComponentName); +begin + inherited; + if Name = Value then + if Assigned(FToolbar) then + FToolbar.Name := Name + 'Toolbar'; +end; + +procedure TSpTBXCompoundItemsControl.SetSkinType(const Value: TSpTBXSkinType); +begin + if FSkinType <> Value then begin + FSkinType := Value; + InvalidateBackground; + end; +end; + +procedure TSpTBXCompoundItemsControl.WMSpSkinChange(var Message: TMessage); +begin + InvalidateBackground; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCompoundBar } + +constructor TSpTBXCompoundBar.Create(AOwner: TComponent); +begin + inherited; + Height := FDock.Height; + FDock.OnDrawBackground := DrawDockBackground; + FDock.OnResize := DockResize; + FToolbar.OnDrawBackground := DrawToolbarBackground; +end; + +procedure TSpTBXCompoundBar.DockResize(Sender: TObject); +begin + if Assigned(FDock) then + if Height <> FDock.Height then + Height := FDock.Height; +end; + +procedure TSpTBXCompoundBar.DoDrawDockBackground(ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + if Assigned(FOnDrawDockBackground) then FOnDrawDockBackground(Self, ACanvas, ARect, PaintStage, PaintDefault); +end; + +procedure TSpTBXCompoundBar.DrawDockBackground(Sender: TObject; + ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +var + InternalPaintDefault: Boolean; +begin + if PaintStage = pstPrePaint then begin + // OnDrawBackground is triggered by the Dock and by the docked Toolbar. + // The Toolbar triggers it only if Dock.ThemedBackground is true, which depends + // on CurrentTheme.PaintDockBackground, this is done in + // TTBXToolbar.WMEraseBkgnd. + ACanvas.Brush.Color := clBtnFace; + InternalPaintDefault := True; + DoDrawDockBackground(ACanvas, ARect, pstPrePaint, InternalPaintDefault); + PaintDefault := InternalPaintDefault; + InternalPaintDefault := True; + DoDrawDockBackground(ACanvas, ARect, pstPostPaint, InternalPaintDefault); + end; +end; + +procedure TSpTBXCompoundBar.DrawToolbarBackground(Sender: TObject; + ACanvas: TCanvas; ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + // Let the background be painted by the Dock + if PaintStage = pstPrePaint then + PaintDefault := False; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXButtonOptions } + +constructor TSpTBXButtonOptions.Create(AParent: TWinControl); +begin + inherited Create; + + FToolbar := nil; + if AParent is TSpTBXCompoundItemsControl then + FToolbar := TSpTBXCompoundItemsControl(AParent).FToolbar; + FParentControl := AParent; + + FCaption := True; + FClose := True; + FMinimize := True; + FMaximize := True; + FCaptionImageIndex := -1; + FCloseImageIndex := -1; + FMinimizeImageIndex := -1; + FMaximizeImageIndex := -1; + FRestoreImageIndex := -1; + FTitleBarMaxSize := 21; + FButtonBorders := True; + CreateButtons; +end; + +procedure TSpTBXButtonOptions.CreateButtons; +begin + FRightAlignSpacer := TSpTBXRightAlignSpacerItem.Create(nil); + FRightAlignSpacer.FontSettings.Style := FRightAlignSpacer.FontSettings.Style + [fsBold]; + FRightAlignSpacer.Wrapping := twEndEllipsis; + FToolbar.Items.Add(FRightAlignSpacer); + + FEditableItems := TTBGroupItem.Create(nil); + FToolbar.Items.Add(FEditableItems); + + FMinimizeButton := TSpTBXItem.Create(nil); + SetupButton(FMinimizeButton); + FMinimizeButton.Visible := FMinimize; + + FMaximizeButton := TSpTBXItem.Create(nil); + SetupButton(FMaximizeButton); + FMaximizeButton.Visible := FMaximize; + + FCloseButton := TSpTBXItem.Create(nil); + SetupButton(FCloseButton); + FCloseButton.Visible := FClose; + + SetTitleBarMaxSize(FTitleBarMaxSize); +end; + +procedure TSpTBXButtonOptions.MoveItemToTheLeft(B: TTBCustomItem); +var + I: Integer; +begin + I := EditableItems.IndexOf(B); + if I > -1 then begin + EditableItems.Delete(I); + I := FToolbar.Items.IndexOf(RightAlignSpacer); + FToolbar.Items.Insert(I, B); + end; +end; + +procedure TSpTBXButtonOptions.SetupButton(B: TSpTBXCustomItem); +begin + B.CustomWidth := 17; + B.CustomHeight := FTitleBarMaxSize; + B.DisplayMode := nbdmImageAndText; + B.OnDrawImage := ButtonsDrawImage; + B.OnDrawItem := ButtonsDrawItem; + B.OnClick := ButtonsClick; + FToolbar.Items.Add(B); + B.Visible := False; + SetupButtonIcon(B); +end; + +procedure TSpTBXButtonOptions.SetupButtonIcon(B: TSpTBXCustomItem); +var + Index, GlyphIndex: Integer; +begin + if Assigned(B) then begin + Index := -1; + GlyphIndex := -1; + + if B = FRightAlignSpacer then begin + Index := FCaptionImageIndex; + end else + if B = FCloseButton then begin + Index := FCloseImageIndex; + GlyphIndex := 0; + end else + if B = FMaximizeButton then begin + if Restoring(B) then begin + Index := FRestoreImageIndex; + GlyphIndex := 3; + end + else begin + Index := FMaximizeImageIndex; + GlyphIndex := 1; + end; + end else + if B = FMinimizeButton then begin + if Restoring(B) then begin + Index := FRestoreImageIndex; + GlyphIndex := 3; + end + else begin + Index := FMinimizeImageIndex; + GlyphIndex := 2; + end; + end; + + if Index = -1 then begin + B.Images := MDIButtonsImgList; + B.ImageIndex := GlyphIndex; + end + else begin + B.Images := nil; + B.ImageIndex := Index; + end; + end; +end; + +procedure TSpTBXButtonOptions.UpdateButtonsVisibility; +begin + FRightAlignSpacer.Visible := FCaption or FClose or FMaximize or FMinimize; +end; + +procedure TSpTBXButtonOptions.ButtonsDrawImage(Sender: TObject; + ACanvas: TCanvas; State: TSpTBXSkinStatesType; + const PaintStage: TSpTBXPaintStage; var AImageList: TCustomImageList; + var AImageIndex: Integer; var ARect: TRect; var PaintDefault: Boolean); +begin + // Empty, useful for descendants +end; + +procedure TSpTBXButtonOptions.ButtonsDrawItem(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + if (PaintStage = pstPrePaint) then begin + // [Theme-Change] + // Don't draw the items background if the Default theme is used + if (PaintStage = pstPrePaint) and not ButtonBorders then + PaintDefault := False; + end; +end; + +procedure TSpTBXButtonOptions.SetCaptionLabel(const Value: WideString); +begin + if FCaptionLabel <> Value then begin + FCaptionLabel := Value; + if Assigned(FRightAlignSpacer) then + FRightAlignSpacer.Caption := Value; + end; +end; + +procedure TSpTBXButtonOptions.SetCaption(const Value: Boolean); +begin + FCaption := Value; + if Assigned(FRightAlignSpacer) then begin + if Value then + FRightAlignSpacer.Caption := CaptionLabel + else + FRightAlignSpacer.Caption := ''; + UpdateButtonsVisibility; + end; +end; + +procedure TSpTBXButtonOptions.SetClose(const Value: Boolean); +begin + FClose := Value; + if Assigned(FCloseButton) then begin + FCloseButton.Visible := Value; + UpdateButtonsVisibility; + end; +end; + +procedure TSpTBXButtonOptions.SetMaximize(const Value: Boolean); +begin + FMaximize := Value; + if Assigned(FMaximizeButton) then begin + FMaximizeButton.Visible := Value; + UpdateButtonsVisibility; + end; +end; + +procedure TSpTBXButtonOptions.SetMinimize(const Value: Boolean); +begin + FMinimize := Value; + if Assigned(FMinimizeButton) then begin + FMinimizeButton.Visible := Value; + UpdateButtonsVisibility; + end; +end; + +procedure TSpTBXButtonOptions.SetCaptionImageIndex(Value: Integer); +begin + if Value < 0 then Value := -1; + FCaptionImageIndex := Value; + if Assigned(FRightAlignSpacer) then SetupButtonIcon(FRightAlignSpacer); +end; + +procedure TSpTBXButtonOptions.SetCloseImageIndex(Value: Integer); +begin + if Value < 0 then Value := -1; + FCloseImageIndex := Value; + if Assigned(FCloseButton) then SetupButtonIcon(FCloseButton); +end; + +procedure TSpTBXButtonOptions.SetMinimizeImageIndex(Value: Integer); +begin + if Value < 0 then Value := -1; + FMinimizeImageIndex := Value; + if Assigned(FMinimizeButton) then SetupButtonIcon(FMinimizeButton); +end; + +procedure TSpTBXButtonOptions.SetMaximizeImageIndex(Value: Integer); +begin + if Value < 0 then Value := -1; + FMaximizeImageIndex := Value; + if Assigned(FMaximizeButton) then SetupButtonIcon(FMaximizeButton); +end; + +procedure TSpTBXButtonOptions.SetRestoreImageIndex(Value: Integer); +begin + if Value < 0 then Value := -1; + FRestoreImageIndex := Value; + SetupButtonIcon(FMinimizeButton); + SetupButtonIcon(FMaximizeButton); +end; + +procedure TSpTBXButtonOptions.SetTitleBarMaxSize(const Value: Integer); +begin + FTitleBarMaxSize := Value; + TSpTBXToolbarView(FToolbar.View).MaxSize := Value; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXStatusToolbar } + +constructor TSpTBXStatusToolbar.Create(AOwner: TComponent); +begin + inherited; + FSkinType := sknSkin; + FSizeGrip := True; +end; + +destructor TSpTBXStatusToolbar.Destroy; +begin + FParentForm := nil; + inherited; +end; + +function TSpTBXStatusToolbar.GetParentFormWindowState: TWindowState; +// This method is more accurate than FParentForm.WindowState +var + R: TRect; +begin + if not Assigned(FParentForm) then + FParentForm := GetParentForm(Self); + Result := SpGetFormWindowState(FParentForm, R); +end; + +function TSpTBXStatusToolbar.IsPointInGrip(P: TPoint): Boolean; +var + GR: TRect; +begin + Result := False; + GR := GetGripRect; + if not IsRectEmpty(GR) and PtInRect(GR, P) then + Result := True; +end; + +function TSpTBXStatusToolbar.GetGripRect: TRect; +var + C: TWinControl; + FS: TWindowState; + HasGrip: Boolean; +begin + Result := Rect(0, 0, 0, 0); + if not (csDestroying in ComponentState) and FSizeGrip and Assigned(CurrentDock) then begin + FS := GetParentFormWindowState; // initializes FParentForm + if Assigned(FParentForm) and FParentForm.HandleAllocated then begin + C := SpFindParent(Self, TSpTBXTitleBar); + if Assigned(C) and TSpTBXTitleBar(C).Active and not TSpTBXTitleBar(C).FixedSize then + HasGrip := (FS = wsNormal) or not TSpTBXTitleBar(C).MouseActive + else + HasGrip := (FS = wsNormal) and (GetWindowLong(FParentForm.Handle, GWL_STYLE) and WS_THICKFRAME <> 0); + if HasGrip then begin + Result := CurrentDock.ClientRect; + Result.Left := Result.Right - GetSystemMetrics(SM_CXVSCROLL); + end; + end; + end; +end; + +function TSpTBXStatusToolbar.GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; +begin + if Assigned(Owner) and (Owner is TSpTBXCustomStatusBar) then + Result := CurrentSkin.GetTextColor(skncStatusBar, State, TSpTBXCustomStatusBar(Owner).SkinType) + else + Result := clNone; +end; + +function TSpTBXStatusToolbar.GetRightAlignMargin: Integer; +var + R: TRect; +begin + R := GetGripRect; + Result := R.Right - R.Left; + if Result = 0 then + Result := 4; +end; + +function TSpTBXStatusToolbar.NeedsSeparatorRepaint: Boolean; +var + T: TSpTBXSkinType; +begin + // [Theme-Change] + // Office themes have rectangle panels, the separator needs + // to be painted by the Toolbar. + if Assigned(Owner) and (Owner is TSpTBXCustomStatusBar) then begin + T := TSpTBXCustomStatusBar(Owner).SkinType; + Result := (CurrentSkin.OfficeStatusBar and (T = sknSkin)) or (T = sknNone); + end + else + Result := False; +end; + +procedure TSpTBXStatusToolbar.SetSizeGrip(const Value: Boolean); +begin + if FSizeGrip <> Value then begin + FSizeGrip := Value; + if Owner is TSpTBXStatusBar then + TSpTBXStatusBar(Owner).InvalidateBackground; + end; +end; + +procedure TSpTBXStatusToolbar.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + P: TPoint; +begin + // Resize the StatusBar if the parent is TSpTBXTitleBar + if not (csDesigning in ComponentState) and (Button = mbLeft) and Assigned(FParentForm) then begin + P := Point(X, Y); + if IsPointInGrip(P) then begin + ReleaseCapture; + SendMessage(FParentForm.Handle, WM_SYSCOMMAND, $F008, 0); + Exit; + end; + end; + + inherited; +end; + +procedure TSpTBXStatusToolbar.WMNCLButtonDown(var Message: TWMNCLButtonDown); +var + P: TPoint; +begin + if not (csDesigning in ComponentState) and Assigned(FParentForm) then begin + P := ScreenToClient(SmallPointToPoint(TSmallPoint(GetMessagePos()))); + if IsPointInGrip(P) then begin + ReleaseCapture; + SendMessage(FParentForm.Handle, WM_SYSCOMMAND, $F008, 0); + Exit; + end; + end; + + inherited; +end; + +procedure TSpTBXStatusToolbar.WMSetCursor(var Message: TWMSetCursor); +var + P: TPoint; +begin + if not (csDesigning in ComponentState) and (Message.CursorWnd = Handle) and + (Screen.Cursor = crDefault) and Assigned(FParentForm) then + begin + GetCursorPos(P); + P := ScreenToClient(P); + if IsPointInGrip(P) then begin + Windows.SetCursor(Screen.Cursors[-8]); + Message.Result := 1; + Exit; + end; + end; + + inherited; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomStatusBar } + +constructor TSpTBXCustomStatusBar.Create(AOwner: TComponent); +begin + inherited; + Align := alBottom; +end; + +function TSpTBXCustomStatusBar.CanResize(var NewWidth, NewHeight: Integer): Boolean; +begin + if Assigned(FDock) and (NewHeight <> FDock.Height) then + Result := False + else + Result := inherited CanResize(NewWidth, NewHeight); +end; + +procedure TSpTBXCustomStatusBar.DoDrawDockBackground(ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +var + G: TRect; + OfficeSeparators: Boolean; +begin + inherited DoDrawDockBackground(ACanvas, ARect, PaintStage, PaintDefault); + if (PaintStage = pstPrePaint) and PaintDefault then begin + PaintDefault := False; + G := Toolbar.GetGripRect; + if not IsRectEmpty(G) then begin + // When it's called by the Toolbar the Gripper position should be corrected + if (ARect.Left = -2) and (ARect.Top = -2) then + OffsetRect(G, -2, -2); + end; + + OfficeSeparators := Toolbar.NeedsSeparatorRepaint; + SpDrawXPStatusBar(ACanvas, ARect, G, SkinType, OfficeSeparators); + if OfficeSeparators then + DrawSeparators(ACanvas, ARect, G); + end; +end; + +procedure TSpTBXCustomStatusBar.DrawSeparators(ACanvas: TCanvas; ARect, AGripRect: TRect); +var + I: Integer; + IV: TTBItemViewer; + R: TRect; + C: TColor; +begin + C := ACanvas.Pen.Color; + try + for I := 0 to FToolbar.View.ViewerCount - 1 do begin + IV := FToolbar.View.Viewers[I]; + if (IV is TSpTBXSeparatorItemViewer) and (not TSpTBXSeparatorItem(IV.Item).Blank) then begin + R := IV.BoundsRect; + OffsetRect(R, ARect.Left + 2, ARect.Top + 2); + + R.Top := 0; + R.Bottom := Height; + R.Left := ((R.Right + R.Left) div 2) - 2; + R.Right := R.Left + 3; + + ACanvas.Brush.Color := clBtnFace; + ACanvas.FillRect(R); + + if SpTBXSkinType(FSkinType) = sknNone then begin + SpDrawLine(ACanvas, R.Left, R.Top, R.Left, R.Bottom, clWindow); + SpDrawLine(ACanvas, R.Right, R.Top, R.Right, R.Bottom, clBtnShadow); + end + else begin + // For Office XP, when called by the Dock inc Top by 1 + if ARect.Top = 0 then Inc(R.Top); + SpDrawLine(ACanvas, R.Left, R.Top, R.Left, R.Bottom, clWindow); + SpDrawLine(ACanvas, R.Right, R.Top, R.Right, R.Bottom, clWindow); + end; + end; + end; + finally + ACanvas.Pen.Color := C; + end; +end; + +function TSpTBXCustomStatusBar.GetStatusToolbar: TSpTBXStatusToolbar; +begin + Result := FToolbar as TSpTBXStatusToolbar; +end; + +function TSpTBXCustomStatusBar.GetToolbarClass: TSpTBXToolbarClass; +begin + Result := TSpTBXStatusToolbar; +end; + +function TSpTBXCustomStatusBar.GetSizeGrip: Boolean; +begin + Result := Toolbar.SizeGrip; +end; + +procedure TSpTBXCustomStatusBar.SetSizeGrip(const Value: Boolean); +begin + Toolbar.SizeGrip := Value; +end; + +procedure TSpTBXCustomStatusBar.WMEraseBkgnd(var Message: TWMEraseBkgnd); +begin + Message.Result := 1; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTitleToolbar } + +function TSpTBXTitleToolbar.GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; +begin + Result := CurrentSkin.GetTextColor(skncWindowTitleBar, State); +end; + +function TSpTBXTitleToolbar.GetRightAlignMargin: Integer; +begin + Result := 4; +end; + +function TSpTBXTitleToolbar.GetTitleBar: TSpTBXCustomTitleBar; +begin + Result := CurrentDock.Parent as TSpTBXCustomTitleBar; +end; + +procedure TSpTBXTitleToolbar.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + TransparentClick: Boolean; + F: TCustomForm; + TitleBar: TSpTBXCustomTitleBar; + P: TPoint; + IV: TTBItemViewer; +begin + // Move the Parent Form if the toolbar client area or an item with + // tbisClicksTransparent itemstyle is clicked (like a TBXLabelItem) + if not (csDesigning in ComponentState) then begin + TitleBar := GetTitleBar; + F := TitleBar.FParentForm; + if not Assigned(F) or not Assigned(TitleBar) then Exit; + if not TitleBar.IsActive then Exit; + + if Assigned(View.Selected) then + TransparentClick := tbisClicksTransparent in TTBCustomItemAccess(View.Selected.Item).ItemStyle + else + TransparentClick := True; + + case Button of + mbLeft: + if TransparentClick then begin + if ssDouble in Shift then begin + // Maximize or restore when double clicking the toolbar + if TitleBar.Options.Maximize and not TitleBar.FixedSize then + TitleBar.Options.MaximizeButton.Click; + end + else + if F.WindowState <> wsMaximized then begin + // Drag the form when dragging the toolbar + ReleaseCapture; + SendMessage(F.Handle, WM_SYSCOMMAND, $F012, 0); + end; + Exit; // Do not process transparent clicks + end + else + if (ssDouble in Shift) and TitleBar.Options.SystemMenu then begin + // Close the form when the system menu button is double clicked + IV := View.ViewerFromPoint(Point(X, Y)); + if Assigned(IV) and (IV.Item = TitleBar.Options.SystemButton) then begin + F.Close; + Exit; // Do not process transparent clicks + end; + end; + mbRight: + if TransparentClick and TitleBar.Options.SystemMenu then begin + P := ClientToScreen(Point(X, Y)); + TitleBar.Options.SystemButton.Popup(P.X, P.Y, True); + Exit; // Do not process transparent clicks + end; + end; + end; + + inherited; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTitleBarButtonOptions } + +constructor TSpTBXTitleBarButtonOptions.Create(AParent: TWinControl); +begin + FSystemMenu := True; + FTitleBar := AParent as TSpTBXCustomTitleBar; + inherited Create(AParent); +end; + +procedure TSpTBXTitleBarButtonOptions.CreateButtons; +begin + FSystemButton := TSpTBXSystemMenuItem.Create(nil); + SetupButton(FSystemButton); + FSystemButton.Visible := FSystemMenu; + + inherited; +end; + +procedure TSpTBXTitleBarButtonOptions.SetSystemMenu(const Value: Boolean); +begin + FSystemMenu := Value; + if Assigned(FSystemButton) then + FSystemButton.Visible := Value; +end; + +procedure TSpTBXTitleBarButtonOptions.ButtonsDrawItem(Sender: TObject; ACanvas: TCanvas; + ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + inherited; + if (PaintStage = pstPrePaint) then begin + + // [Theme-Change] + // Don't draw the items background if the Default theme is used + if (PaintStage = pstPrePaint) and (not ButtonBorders or SkinManager.IsDefaultSkin) then + PaintDefault := False; + end; +end; + +procedure TSpTBXTitleBarButtonOptions.ButtonsClick(Sender: TObject); +begin + if not Assigned(FTitleBar.FParentForm) or not FTitleBar.IsActive then Exit; + + if Sender = FSystemButton then + FSystemButton.ShowSize := not FTitleBar.FixedSize + else + if Sender = FMinimizeButton then + FTitleBar.WindowState := wsMinimized + else + if Sender = FCloseButton then + FTitleBar.FParentForm.Close + else + if Sender = FMaximizeButton then begin + if FTitleBar.WindowState = wsNormal then + FTitleBar.WindowState := wsMaximized + else + FTitleBar.WindowState := wsNormal; + end; +end; + +function TSpTBXTitleBarButtonOptions.Restoring(B: TSpTBXCustomItem): Boolean; +begin + Result := False; + if (B = MaximizeButton) and (FTitleBar.WindowState = wsMaximized) then Result := True; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomTitleBar } + +constructor TSpTBXCustomTitleBar.Create(AOwner: TComponent); +begin + inherited; + + FActive := True; + FMouseActive := True; + ControlStyle := ControlStyle + [csAcceptsControls]; + + Align := alClient; + FDock.OnResize := nil; + + FParentForm := GetParentForm(Self); + FOptions := TSpTBXTitleBarButtonOptions.Create(Self); + FOptions.CaptionLabel := Caption; +end; + +destructor TSpTBXCustomTitleBar.Destroy; +begin + ChangeTitleBarState(False); + FOptions.Free; + + if Assigned(FParentForm) and Assigned(FOldParentFormWndProc) then begin + FParentForm.WindowProc := FOldParentFormWndProc; + FOldParentFormWndProc := nil; + end; + + if Assigned(Application) and Assigned(FNewAppWndProc) then begin + SetWindowLong(Application.Handle, GWL_WNDPROC, Longint(FOldAppWndProc)); + Classes.FreeObjectInstance(FNewAppWndProc); + FNewAppWndProc := nil; + end; + + inherited; +end; + +procedure TSpTBXCustomTitleBar.Loaded; +begin + inherited; + + // Subclass the ParentForm and Application for the System menu handling + if not (csDesigning in ComponentState) then begin + FParentForm := GetParentForm(Self); + // Hook the ParentForm + if Assigned(FParentForm) then begin + FOldParentFormWndProc := FParentForm.WindowProc; + FParentForm.WindowProc := NewParentFormWndProc; + end; + + // Hook the Application to trap the $0313 message, more info on AppWndProc + if not (csDesigning in ComponentState) and (Application.Handle <> 0) and + (Application.MainForm = nil) and (FOldAppWndProc = nil) then + begin + // When Application.MainForm asume FParentForm as the MainForm + FOldAppWndProc := Pointer(GetWindowLong(Application.Handle, GWL_WNDPROC)); + FNewAppWndProc := Classes.MakeObjectInstance(AppWndProc); + SetWindowLong(Application.Handle, GWL_WNDPROC, Longint(FNewAppWndProc)); + end; + + ChangeTitleBarState(Active); + end; +end; + +procedure TSpTBXCustomTitleBar.UpdateSkinMetrics; +begin + if HandleAllocated then begin + // Update the NC area size, CurrentSkin.FloatingWindowBorderSize could have changed + // Make sure to realign the toolbars + SpRecalcNCArea(Self); + Realign; + end; +end; + +procedure TSpTBXCustomTitleBar.AppWndProc(var Msg: TMessage); +var + SystemButtonP: TPoint; +begin + // Handle undocumented $0313 message, this is sent when the + // taskbar button of the application is right clicked. + // When Application.MainFormOnTaskbar = True (Delphi 2007 and above) + // the message is sent to the Main Form, otherwise it is sent + // to the Application. + // More info: + // http://delphi.about.com/od/vclwriteenhance/a/ttaskbarmenu.htm + if (Msg.Msg = $0313) and Assigned(FParentForm) and Assigned(Options) then begin + GetCursorPos(SystemButtonP); + FOptions.SystemButton.Popup(SystemButtonP.X, SystemButtonP.Y, True); + end + else + if Assigned(FOldAppWndProc) then + Msg.Result := CallWindowProc(FOldAppWndProc, Application.Handle, Msg.Msg, Msg.wParam, Msg.lParam); +end; + +procedure TSpTBXCustomTitleBar.NewParentFormWndProc(var Message: TMessage); +var + M: TWMSysCommand; + I: Integer; + HandleSpaceKey: Boolean; + + MMI: ^TMinMaxInfo; + MonitorBounds, WorkArea, TaskBarBounds: TRect; + TaskBarState, TaskBarEdge: Cardinal; + SystemButtonIV: TTBItemViewer; + SystemButtonP: TPoint; +begin + if not Assigned(FParentForm) then Exit; + + case Message.Msg of + $0313: + begin + // Handle undocumented $0313 message, this is sent when the + // taskbar button of the application is right clicked. + // When Application.MainFormOnTaskbar = True (Delphi 2007 and above) + // the message is sent to the Main Form, otherwise it is sent + // to the Application. + // More info: + // http://delphi.about.com/od/vclwriteenhance/a/ttaskbarmenu.htm + GetCursorPos(SystemButtonP); + FOptions.SystemButton.Popup(SystemButtonP.X, SystemButtonP.Y, True); + Exit; + end; + WM_GETMINMAXINFO: + if IsActive and not FFullScreenMaximize then begin + MMI := Pointer(Message.lParam); + WorkArea := GetRectOfMonitorContainingWindow(Handle, True); + MonitorBounds := GetRectOfMonitorContainingWindow(Handle, False); + + // Calculate the Max position and size + // http://news.jrsoftware.org/news/toolbar2000.thirdparty/msg13127.html + MMI^.ptMaxPosition.X := WorkArea.Left - MonitorBounds.Left; + MMI^.ptMaxPosition.Y := WorkArea.Top - MonitorBounds.Top; + MMI^.ptMaxSize.X := WorkArea.Right - WorkArea.Left; + MMI^.ptMaxSize.Y := WorkArea.Bottom - WorkArea.Top; + + // Reduce the Max Size if the TaskBar is AutoHidden + if SpGetTaskBar(TaskBarState, TaskBarEdge, TaskBarBounds) then begin + if (TaskBarState and ABS_AUTOHIDE) = ABS_AUTOHIDE then + case TaskBarEdge of + ABE_LEFT, ABE_RIGHT: MMI^.ptMaxSize.X := MMI^.ptMaxSize.X - 2; + ABE_TOP, ABE_BOTTOM: MMI^.ptMaxSize.Y := MMI^.ptMaxSize.Y - 2; + end; + end; + + // Max size during window resize, change the ParentForm constraints + // to make it work + if WindowState = wsMaximized then begin + MMI^.ptMaxTrackSize.X := MMI^.ptMaxSize.X; + MMI^.ptMaxTrackSize.Y := MMI^.ptMaxSize.Y; + FParentForm.Constraints.MaxWidth := MMI^.ptMaxSize.X; + FParentForm.Constraints.MaxHeight := MMI^.ptMaxSize.Y; + end + else begin + FParentForm.Constraints.MaxWidth := 0; + FParentForm.Constraints.MaxHeight := 0; + end; + + Message.Result := 0; + end; + WM_SYSCOMMAND: + if IsActive and Options.SystemMenu then begin + HandleSpaceKey := True; + M := TWMSysCommand(Message); + if M.CmdType and $FFF0 = SC_KEYMENU then + case M.Key of + VK_SPACE: + begin + // Show the custom SysMenu + SystemButtonIV := FToolbar.View.Find(FOptions.SystemButton); + if Assigned(SystemButtonIV) then begin + SystemButtonP.X := SystemButtonIV.BoundsRect.Left; + SystemButtonP.Y := SystemButtonIV.BoundsRect.Bottom; + SystemButtonP := FToolbar.ClientToScreen(SystemButtonP); + FOptions.SystemButton.Popup(SystemButtonP.X, SystemButtonP.Y, True); + Message.Result := 1; + Exit; + end; + end; + 0: + if GetCapture = 0 then begin + // When only the Alt key is pressed and a few seconds latter the Space + // key is pressed the default SysMenu is showed, this only happens + // when there are no menubars on the form. + // In this case the WM_SYSCOMMAND is sent when the Alt key is + // pressed (Key = 0), but not when the space key is pressed. + // Apparently there's no way to override this, the only solution is to + // handle the Alt key press (Key = 0). + // + // Message log when Alt [...] Space is pressed: + // WM_SYSKEYDOWN: VK_MENU + // WM_SYSKEYUP: VK_MENU + // WM_SYSCOMMAND: Key = 0 + // WM_ENTERMENULOOP + // WM_INITMENU + // WM_KEYDOWN: VK_SPACE + // WM_CHAR: VK_SPACE + // WM_INITMENUPOPUP: system hmenu + + // If the form has a main menu VK_SPACE will be correctly handled + if Assigned(FParentForm.Menu) then + HandleSpaceKey := False + else + for I := 0 to FParentForm.ComponentCount - 1 do + if FParentForm.Components[I] is TTBCustomToolbar then + if TTBCustomToolbar(FParentForm.Components[I]).MenuBar then begin + HandleSpaceKey := False; + Break; + end; + if HandleSpaceKey then begin + Message.Result := 1; + Exit; + end; + end; + end; + end; + end; + + // Default processing + if Assigned(FOldParentFormWndProc) then + FOldParentFormWndProc(Message); +end; + +procedure TSpTBXCustomTitleBar.ChangeTitleBarState(Activate: Boolean); +var + FloatingBorderSize: TPoint; + Style: Integer; + RestoreR: TRect; + WState: TWindowState; + OnParentFormShow: TNotifyEvent; +begin + FParentForm := GetParentForm(Self); + if Assigned(FParentForm) and (FParentForm.HandleAllocated) and ([csDesigning, csDestroying] * FParentForm.ComponentState = []) then begin + + if FMouseActive then begin + FloatingBorderSize := GetFloatingBorderSize; + + // Changing the BorderStyle of the form will recreate it, + // causing it to call Form.OnShow everytime Active is changed + // We need to disable the OnShow calling. + OnParentFormShow := TCustomFormAccess(FParentForm).OnShow; + TCustomFormAccess(FParentForm).OnShow := nil; + try + WState := SpGetFormWindowState(FParentForm, RestoreR); + + if Activate then begin + // Remove the border and titlebar from the form, and add the sysmenu + FParentForm.BorderStyle := bsNone; + Style := GetWindowLong(FParentForm.Handle, GWL_STYLE); + Style := Style or WS_SYSMENU; + SetWindowLong(FParentForm.Handle, GWL_STYLE, Style); + + // Resize the form to retain the same size before it was activated. + // This is needed to keep the designtime size + if (WState <> wsMaximized) and (TCustomFormAccess(FParentForm).FormStyle <> fsMDIChild) then begin + FParentForm.Height := FParentForm.Height - GetSystemMetrics(SM_CYCAPTION) - (FloatingBorderSize.Y * 2); + FParentForm.Width := FParentForm.Width - (FloatingBorderSize.X * 2); + end; + end + else begin + FParentForm.BorderStyle := bsSizeable; + + // Resize the form to retain the same size before it was deactivated. + // This is needed to keep the designtime size + if (WState <> wsMaximized) and (TCustomFormAccess(FParentForm).FormStyle <> fsMDIChild) then begin + FParentForm.Height := FParentForm.Height + GetSystemMetrics(SM_CYCAPTION) + (FloatingBorderSize.Y * 2); + FParentForm.Width := FParentForm.Width + (FloatingBorderSize.X * 2); + end; + end; + + // When Active is changed the Form is recreated, we have to + // reset the Restore size if the form is currently Maximized. + if WState = wsMaximized then + SpSetFormWindowState(FParentForm, WState, RestoreR); + + InvalidateBackground; + finally + TCustomFormAccess(FParentForm).OnShow := OnParentFormShow; + end; + end; + + FDock.Visible := FActive; + end; +end; + +procedure TSpTBXCustomTitleBar.AdjustClientRect(var Rect: TRect); +begin + inherited AdjustClientRect(Rect); + Rect := GetClientAreaRect; +end; + +procedure TSpTBXCustomTitleBar.DoDrawDockBackground(ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +var + FloatingBorderSize: TPoint; +begin + inherited DoDrawDockBackground(ACanvas, ARect, PaintStage, PaintDefault); + if (PaintStage = pstPrePaint) and PaintDefault then begin + PaintDefault := False; + + // [Theme-Change] + // On WindowsXP make sure we paint the titlebar on the NC area + // TSpTBXCustomTitleBar.WMEraseBkgnd and TSpTBXCustomTitleBar.DoDrawDockBackground handles this issue + if SkinManager.GetSkinType = sknWindows then begin + FloatingBorderSize := GetFloatingBorderSize; + InflateRect(ARect, FloatingBorderSize.X, FloatingBorderSize.Y); + end; + + SpDrawXPTitleBar(ACanvas, ARect, True); + end; +end; + +procedure TSpTBXCustomTitleBar.DoDrawBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, PaintStage, PaintDefault); +end; + +function TSpTBXCustomTitleBar.GetClientAreaRect: TRect; +var + FloatingBorderSize: TPoint; +begin + Result := ClientRect; + if Active then begin + FloatingBorderSize := GetFloatingBorderSize; + if Assigned(FParentForm) then begin + if not FMouseActive or (FParentForm.WindowState <> wsMaximized) then + InflateRect(Result, -FloatingBorderSize.X, -FloatingBorderSize.Y); + end + else + InflateRect(Result, -FloatingBorderSize.X, -FloatingBorderSize.Y); + end; +end; + +function TSpTBXCustomTitleBar.GetFloatingBorderSize: TPoint; +begin + if SkinManager.GetSkinType = sknSkin then + Result := Point(CurrentSkin.FloatingWindowBorderSize, CurrentSkin.FloatingWindowBorderSize) + else begin + Result.X := GetSystemMetrics(SM_CXFRAME); + Result.Y := GetSystemMetrics(SM_CYFRAME); + end +end; + +function TSpTBXCustomTitleBar.GetItems: TTBCustomItem; +begin + // The ToolbarEditor designer will open the editable items and + // not the Toolbar.Items + Result := Options.EditableItems; +end; + +procedure TSpTBXCustomTitleBar.GetSizeCursor(MousePos: TPoint; var SizeCursor, + SizeCode: Integer); +var + R: TRect; + Pt, FloatingBorderSize: TPoint; +const + SC_SizeLeft = $F001; + SC_SizeRight = $F002; + SC_SizeUp = $F003; + SC_SizeUpLeft = $F004; + SC_SizeUpRight = $F005; + SC_SizeDown = $F006; + SC_SizeDownLeft = $F007; + SC_SizeDownRight = $F008; +begin + SizeCursor := 0; + SizeCode := 0; + + if not IsActive or (Assigned(FParentForm) and (FParentForm.WindowState = wsMaximized)) then Exit; + + R := ClientRect; + FloatingBorderSize := GetFloatingBorderSize; + InflateRect(R, -FloatingBorderSize.X, -FloatingBorderSize.Y); + Pt := MousePos; + if not PtInRect(R, Pt) then begin + if (Pt.X < 10) and (Pt.Y < 10) then SizeCode := SC_SizeUpLeft + else if (Pt.X > Width - 10) and (Pt.Y < 10) then SizeCode := SC_SizeUpRight + else if (Pt.X < 10) and (Pt.Y > Height - 10) then SizeCode := SC_SizeDownLeft + else if (Pt.X > Width - 10) and (Pt.Y > Height - 10) then SizeCode := SC_SizeDownRight + else if (Pt.X > 10) and (Pt.X < Width - 10) and (Pt.Y < 10) then SizeCode := SC_SizeUp + else if (Pt.X > 10) and (Pt.X < Width - 10) and (Pt.Y > Height - 10) then SizeCode := SC_SizeDown + else if (Pt.Y > 10) and (Pt.Y < Height - 10) and (Pt.X < 10) then SizeCode := SC_SizeLeft + else if (Pt.Y > 10) and (Pt.Y < Height - 10) and (Pt.X > Width - 10) then SizeCode := SC_SizeRight; + + case SizeCode of + SC_SizeLeft, SC_SizeRight: SizeCursor := -9; + SC_SizeUp, SC_SizeDown: SizeCursor := -7; + SC_SizeUpLeft, SC_SizeDownRight: SizeCursor := -8; + SC_SizeDownLeft, SC_SizeUpRight: SizeCursor := -6; + end; + end +end; + +function TSpTBXCustomTitleBar.GetToolbarClass: TSpTBXToolbarClass; +begin + Result := TSpTBXTitleToolbar; +end; + +function TSpTBXCustomTitleBar.GetWindowState: TWindowState; +begin + if Assigned(FParentForm) then + Result := FParentForm.WindowState + else + Result := wsNormal; +end; + +function TSpTBXCustomTitleBar.IsActive: Boolean; +begin + Result := FActive and FMouseActive; +end; + +procedure TSpTBXCustomTitleBar.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + Pt: TPoint; + SizeCursor, SizeCode: Integer; +begin + inherited; + if not FixedSize and (Button = mbLeft) then begin + Pt := Point(X, Y); + GetSizeCursor(Pt, SizeCursor, SizeCode); + if (SizeCode > 0) and Assigned(FParentForm) then begin + ReleaseCapture; + FParentForm.Perform(WM_SYSCOMMAND, SizeCode, 0); + end; + end; +end; + +procedure TSpTBXCustomTitleBar.SetActive(const Value: Boolean); +begin + if FActive <> Value then begin + FActive := Value; + ChangeTitleBarState(Value); + end; +end; + +procedure TSpTBXCustomTitleBar.SetFullScreenMaximize(const Value: Boolean); +begin + if FFullScreenMaximize <> Value then begin + FFullScreenMaximize := Value; + if IsActive and Assigned(FParentForm) and FParentForm.HandleAllocated then begin + FParentForm.Constraints.MaxWidth := 0; + FParentForm.Constraints.MaxHeight := 0; + if (WindowState = wsMaximized) and not (csDesigning in ComponentState) then + TCustomFormAccess(FParentForm).RecreateWnd; + end; + end; +end; + +procedure TSpTBXCustomTitleBar.SetMouseActive(const Value: Boolean); +begin + if FMouseActive <> Value then begin + FMouseActive := Value; + ChangeTitleBarState(Value); + end; +end; + +procedure TSpTBXCustomTitleBar.SetWindowState(const Value: TWindowState); +begin + if Assigned(FParentForm) then begin + case Value of + wsMinimized: + begin + // WindowState := wsMinimized will not minimize the app correctly + SendMessage(FParentForm.Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0); + end; + wsMaximized, wsNormal: + FParentForm.WindowState := Value; + end; + end; +end; + +procedure TSpTBXCustomTitleBar.WMSpSkinChange(var Message: TMessage); +begin + UpdateSkinMetrics; + inherited; +end; + +procedure TSpTBXCustomTitleBar.CMTextChanged(var Message: TMessage); +begin + inherited; + if Assigned(FOptions) then + FOptions.CaptionLabel := Caption; +end; + +procedure TSpTBXCustomTitleBar.WMEraseBkgnd(var Message: TMessage); +var + ARect, DockAreaR: TRect; + FloatingBorderSize: TPoint; + Maximized, PaintDefault: Boolean; + B: TBitmap; +begin + Message.Result := 1; + if not DoubleBuffered or (Message.wParam = Message.lParam) then begin + B := TBitmap.Create; + try + ARect := GetClientRect; + B.Width := ARect.Right; + B.Height := ARect.Bottom; + B.Canvas.Brush.Color := Color; // SpDrawXPTitleBarBody needs it to paint the background + B.Canvas.FillRect(ARect); + + PaintDefault := True; + DoDrawBackground(B.Canvas, ARect, pstPrePaint, PaintDefault); + if PaintDefault then begin + Maximized := (WindowState = wsMaximized) and FMouseActive; + if Maximized then + InflateRect(ARect, 4, 4); + if Active then begin + FloatingBorderSize := GetFloatingBorderSize; + SpDrawXPTitleBarBody(B.Canvas, ARect, True, FloatingBorderSize); + + // [Theme-Change] + // On WindowsXP make sure we paint the titlebar on the NC area + // TSpTBXCustomTitleBar.WMEraseBkgnd and TSpTBXCustomTitleBar.DoDrawDockBackground handles this issue + if Assigned(FDock) and not Maximized and (SkinManager.GetSkinType = sknWindows) then begin + DockAreaR := ARect; + DockAreaR.Bottom := FDock.Height + FloatingBorderSize.Y; // don't multiply by 2 + SpDrawXPTitleBar(B.Canvas, DockAreaR, True); + end; + end; + end; + + PaintDefault := True; + DoDrawBackground(B.Canvas, ARect, pstPostPaint, PaintDefault); + + BitBlt(TWMEraseBkgnd(Message).DC, 0, 0, B.Width, B.Height, B.Canvas.Handle, 0, 0, SRCCOPY); + finally + B.Free; + end; + end; +end; + +procedure TSpTBXCustomTitleBar.WMSetCursor(var Message: TWMSetCursor); +var + P: TPoint; + SizeCursor, SizeCode: Integer; +begin + if not FixedSize and not (csDesigning in ComponentState) and + (Message.CursorWnd = Handle) and (Screen.Cursor = crDefault) then + begin + GetCursorPos(P); + P := ScreenToClient(P); + GetSizeCursor(P, SizeCursor, SizeCode); + if SizeCursor <> 0 then begin + Windows.SetCursor(Screen.Cursors[SizeCursor]); + Message.Result := 1; + end + else + inherited; + end + else + inherited; +end; + +procedure TSpTBXCustomTitleBar.WMWindowPosChanged(var Message: TWMWindowPosChanged); +begin + inherited; + InvalidateBackground(False); + if [csDesigning, csDestroying] * ComponentState = [] then begin + if FOptions.Maximize then + FOptions.SetupButtonIcon(FOptions.MaximizeButton); + // Hide the Toolbar if the Form is a MDI child and it's maximized + if Assigned(FParentForm) and (FParentForm.HandleAllocated) then begin + if (TCustomFormAccess(FParentForm).FormStyle = fsMDIChild) then + FDock.Visible := FParentForm.WindowState <> wsMaximized; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TBitmapHint } + +procedure TBitmapHint.ActivateHint(Rect: TRect; const AHint: string); +var + SaveActivating: Boolean; + // Detect Delphi 7 + {$IF CompilerVersion < 17} + MonitorR: TRect; + Delta: TPoint; + {$IFEND} +begin + // [Bugfix] Delphi 7 bug, D7 hints doesn't support multi-monitors + {$IF CompilerVersion < 17} + MonitorR := GetRectOfMonitorContainingPoint(Point(Rect.Left, Rect.Top), True); + Delta := Point(0, 0); + if (Rect.Left < MonitorR.Right) and (Rect.Right > MonitorR.Right) then + Delta.X := - (Rect.Right - MonitorR.Right); + if (Rect.Top < MonitorR.Bottom) and (Rect.Bottom > MonitorR.Bottom) then + Delta.Y := - (Rect.Bottom - MonitorR.Bottom); + OffsetRect(Rect, Delta.X, Delta.Y); + {$IFEND} + + SaveActivating := FActivating; + try + FActivating := True; + inherited ActivateHint(Rect, AHint); + finally + FActivating := SaveActivating; + end; +end; + +procedure TBitmapHint.ActivateHintData(Rect: TRect; const AHint: string; AData: Pointer); +begin + //The AData parameter is a bitmap + FHintBitmap := TBitmap(AData); + Rect.Right := Rect.Left + FHintBitmap.Width - 2; + Rect.Bottom := Rect.Top + FHintBitmap.Height - 2; + inherited ActivateHintData(Rect, AHint, AData); +end; + +procedure TBitmapHint.CMTextChanged(var Message: TMessage); +begin + Message.Result := 1; +end; + +procedure TBitmapHint.Paint; +begin + if Assigned(FHintBitmap) then + Canvas.Draw(0, 0, FHintBitmap); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Stock Objects } + +procedure InitializeStock; +var + NonClientMetrics: TNonClientMetrics; +begin + // Small caption font + SmCaptionFont := TFont.Create; + NonClientMetrics.cbSize := SizeOf(NonClientMetrics); + if SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @NonClientMetrics, 0) then + SmCaptionFont.Handle := CreateFontIndirect(NonClientMetrics.lfSmCaptionFont); + + SpStockHintBitmap := TBitmap.Create; + + Screen.Cursors[crSpTBXNewHandPoint] := LoadCursor(0, IDC_HAND); + Screen.Cursors[crSpTBXCustomization] := LoadCursor(HInstance, 'CZMOVE'); + Screen.Cursors[crSpTBXCustomizationCancel] := LoadCursor(HInstance, 'CZCANCEL'); + + // Dummy ImageList, used by TSpTBXItemViewer and TSpTBXButtonOptions + MDIButtonsImgList := TImageList.Create(nil); +end; + +procedure FinalizeStock; +begin + FreeAndNil(SmCaptionFont); + FreeAndNil(SpStockHintBitmap); + FreeAndNil(MDIButtonsImgList); +end; + +initialization + InitializeStock; + +finalization + FinalizeStock; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.dcu new file mode 100644 index 0000000..1173a9c Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.hpp new file mode 100644 index 0000000..eca43c9 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.hpp @@ -0,0 +1,171 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxmdimru.pas' rev: 20.00 + +#ifndef SptbxmdimruHPP +#define SptbxmdimruHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxmdimru +{ +//-- type declarations ------------------------------------------------------- +typedef void __fastcall (__closure *TSpTBXMRUListClickEvent)(System::TObject* Sender, const System::WideString Filename); + +class DELPHICLASS TSpTBXMDIHandler; +class DELPHICLASS TSpTBXMDIButtonsItem; +class PASCALIMPLEMENTATION TSpTBXMDIHandler : public Classes::TComponent +{ + typedef Classes::TComponent inherited; + +private: + TSpTBXMDIButtonsItem* FButtonsItem; + Sptbxitem::TSpTBXSystemMenuItem* FSystemMenuItem; + Tb2toolbar::TTBCustomToolbar* FToolbar; + void __fastcall SetToolbar(Tb2toolbar::TTBCustomToolbar* Value); + +protected: + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + +public: + __fastcall virtual TSpTBXMDIHandler(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXMDIHandler(void); + +__published: + __property Tb2toolbar::TTBCustomToolbar* Toolbar = {read=FToolbar, write=SetToolbar}; +}; + + +class PASCALIMPLEMENTATION TSpTBXMDIButtonsItem : public Tb2item::TTBCustomItem +{ + typedef Tb2item::TTBCustomItem inherited; + +private: + Sptbxitem::TSpTBXItem* FMinimizeItem; + Sptbxitem::TSpTBXItem* FRestoreItem; + Sptbxitem::TSpTBXItem* FCloseItem; + void __fastcall InvalidateSystemMenuItem(void); + void __fastcall ItemClick(System::TObject* Sender); + void __fastcall UpdateState(HWND W, bool Maximized); + +public: + __fastcall virtual TSpTBXMDIButtonsItem(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXMDIButtonsItem(void); +}; + + +class DELPHICLASS TSpTBXMDIWindowItem; +class PASCALIMPLEMENTATION TSpTBXMDIWindowItem : public Tb2item::TTBCustomItem +{ + typedef Tb2item::TTBCustomItem inherited; + +private: + Forms::TForm* FForm; + Classes::TNotifyEvent FOnUpdate; + Menus::TMenuItem* FWindowMenu; + void __fastcall ItemClick(System::TObject* Sender); + void __fastcall SetForm(Forms::TForm* AForm); + +protected: + virtual void __fastcall EnabledChanged(void); + DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + +public: + __fastcall virtual TSpTBXMDIWindowItem(Classes::TComponent* AOwner); + virtual void __fastcall InitiateAction(void); + +__published: + __property Enabled = {default=1}; + __property Classes::TNotifyEvent OnUpdate = {read=FOnUpdate, write=FOnUpdate}; +public: + /* TTBCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXMDIWindowItem(void) { } + +}; + + +class DELPHICLASS TSpTBXMRUListItem; +class PASCALIMPLEMENTATION TSpTBXMRUListItem : public Tb2item::TTBCustomItem +{ + typedef Tb2item::TTBCustomItem inherited; + +private: + int FMaxItems; + TSpTBXMRUListClickEvent FOnClick; + bool FHidePathExtension; + void __fastcall ClickHandler(System::TObject* Sender); + void __fastcall SetHidePathExtension(const bool Value); + void __fastcall SetMaxItems(const int Value); + +public: + __fastcall virtual TSpTBXMRUListItem(Classes::TComponent* AOwner); + void __fastcall GetMRUFilenames(Classes::TStrings* MRUFilenames); + int __fastcall IndexOfMRU(System::WideString Filename); + int __fastcall MRUAdd(System::WideString Filename); + bool __fastcall MRUClick(System::WideString Filename); + void __fastcall MRURemove(System::WideString Filename); + void __fastcall MRUUpdateCaptions(void); + void __fastcall LoadFromIni(Inifiles::TCustomIniFile* Ini, const System::UnicodeString Section); + void __fastcall SaveToIni(Inifiles::TCustomIniFile* Ini, const System::UnicodeString Section); + +__published: + __property bool HidePathExtension = {read=FHidePathExtension, write=SetHidePathExtension, default=1}; + __property int MaxItems = {read=FMaxItems, write=SetMaxItems, default=4}; + __property TSpTBXMRUListClickEvent OnClick = {read=FOnClick, write=FOnClick}; +public: + /* TTBCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXMRUListItem(void) { } + +}; + + +class DELPHICLASS TSpTBXMRUItem; +class PASCALIMPLEMENTATION TSpTBXMRUItem : public Sptbxitem::TSpTBXCustomItem +{ + typedef Sptbxitem::TSpTBXCustomItem inherited; + +private: + System::WideString FMRUString; + +public: + __property System::WideString MRUString = {read=FMRUString, write=FMRUString}; +public: + /* TSpTBXCustomItem.Create */ inline __fastcall virtual TSpTBXMRUItem(Classes::TComponent* AOwner) : Sptbxitem::TSpTBXCustomItem(AOwner) { } + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXMRUItem(void) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- + +} /* namespace Sptbxmdimru */ +using namespace Sptbxmdimru; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxmdimruHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.pas new file mode 100644 index 0000000..6ed2491 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXMDIMRU.pas @@ -0,0 +1,718 @@ +unit SpTBXMDIMRU; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development notes: + - All the theme changes and adjustments are marked with '[Theme-Change]'. + +History: +8 May 2009 - version 2.4.2 + - Fixed incorrect MRU saving on TSpTBXMRUListItem, the + items were not correctly encoded when saving to an Ini + file, thanks to Dirk for reporting this. + +15 March 2009 - version 2.4.1 + - No changes. + +17 January 2009 - version 2.4 + - Added GetMRUFilenames and MRUClick methods to + TSpTBXMRUListItem. + - Added Hints to the items of TSpTBXMRUListItem. + +26 September 2008 - version 2.3 + - No changes. + +29 July 2008 - version 2.2 + - No changes. + +26 June 2008 - version 2.1 + - No changes. + +3 May 2008 - version 2.0 + - No changes. + +2 April 2008 - version 1.9.5 + - Fixed incorrect MRU loading on TSpTBXMRUListItem, thanks + to Pete for reporting this. + - Fixed incorrect TSpTBXMRUListItem behavior, MaxItems + had no effect when new files were added, thanks to + Senfore for reporting this. + +3 February 2008 - version 1.9.4 + - Added HidePathExtension property to TSpTBXMRUListItem. + +19 January 2008 - version 1.9.3 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + Menus, IniFiles, TB2Item, TB2Toolbar, SpTBXSkins, SpTBXItem; + +type + TSpTBXMDIButtonsItem = class; + + TSpTBXMRUListClickEvent = procedure(Sender: TObject; const Filename: WideString) of object; + + { TSpTBXMDIHandler } + + TSpTBXMDIHandler = class(TComponent) + private + FButtonsItem: TSpTBXMDIButtonsItem; + FSystemMenuItem: TSpTBXSystemMenuItem; + FToolbar: TTBCustomToolbar; + procedure SetToolbar(Value: TTBCustomToolbar); + protected + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property Toolbar: TTBCustomToolbar read FToolbar write SetToolbar; + end; + + { TSpTBXMDIButtonsItem: should only be used by TSpTBXMDIHandler } + + TSpTBXMDIButtonsItem = class(TTBCustomItem) + private + FMinimizeItem, FRestoreItem, FCloseItem: TSpTBXItem; + procedure InvalidateSystemMenuItem; + procedure ItemClick(Sender: TObject); + procedure UpdateState(W: HWND; Maximized: Boolean); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + + { TSpTBXMDIWindowItem } + + TSpTBXMDIWindowItem = class(TTBCustomItem) + private + FForm: TForm; + FOnUpdate: TNotifyEvent; + FWindowMenu: TMenuItem; + procedure ItemClick(Sender: TObject); + procedure SetForm(AForm: TForm); + protected + procedure EnabledChanged; override; + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(AOwner: TComponent); override; + procedure InitiateAction; override; + published + property Enabled; + property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate; + end; + + { TSpTBXMRUListItem } + + TSpTBXMRUListItem = class(TTBCustomItem) + private + FMaxItems: Integer; + FOnClick: TSpTBXMRUListClickEvent; + FHidePathExtension: Boolean; + procedure ClickHandler(Sender: TObject); + procedure SetHidePathExtension(const Value: Boolean); + procedure SetMaxItems(const Value: Integer); + public + constructor Create(AOwner: TComponent); override; + procedure GetMRUFilenames(MRUFilenames: TStrings); + function IndexOfMRU(Filename: WideString): Integer; + function MRUAdd(Filename: WideString): Integer; + function MRUClick(Filename: WideString): Boolean; + procedure MRURemove(Filename: WideString); + procedure MRUUpdateCaptions; + procedure LoadFromIni(Ini: TCustomIniFile; const Section: string); + procedure SaveToIni(Ini: TCustomIniFile; const Section: string); + published + property HidePathExtension: Boolean read FHidePathExtension write SetHidePathExtension default True; + property MaxItems: Integer read FMaxItems write SetMaxItems default 4; + property OnClick: TSpTBXMRUListClickEvent read FOnClick write FOnClick; + end; + + { TSpTBXMRUItem: should only be used by TSpTBXMRUListItem } + + TSpTBXMRUItem = class(TSpTBXCustomItem) + private + FMRUString: WideString; + public + property MRUString: WideString read FMRUString write FMRUString; + end; + +implementation + +uses + {$IFNDEF UNICODE} + TntSysUtils, + {$ENDIF} + TB2Common, TB2Consts; + +type + TTBCustomToolbarAccess = class(TTBCustomToolbar); + TTBCustomItemAccess = class(TTBCustomItem); + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXMDIHandler } + +constructor TSpTBXMDIHandler.Create(AOwner: TComponent); +begin + inherited; + FSystemMenuItem := TSpTBXSystemMenuItem.Create(Self); + FSystemMenuItem.MDISystemMenu := True; + FButtonsItem := TSpTBXMDIButtonsItem.Create(Self); +end; + +destructor TSpTBXMDIHandler.Destroy; +begin + SetToolbar(nil); + inherited; +end; + +procedure TSpTBXMDIHandler.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if (AComponent = FToolbar) and (Operation = opRemove) then + Toolbar := nil; +end; + +procedure TSpTBXMDIHandler.SetToolbar(Value: TTBCustomToolbar); +var + Rebuild: Boolean; +begin + if FToolbar <> Value then begin + if Assigned(FToolbar) then begin + Rebuild := False; + if TTBCustomToolbarAccess(FToolbar).FMDIButtonsItem = FButtonsItem then begin + TTBCustomToolbarAccess(FToolbar).FMDIButtonsItem := nil; + Rebuild := True; + end; + if TTBCustomToolbarAccess(FToolbar).FMDISystemMenuItem = FSystemMenuItem then begin + TTBCustomToolbarAccess(FToolbar).FMDISystemMenuItem := nil; + Rebuild := True; + end; + if Rebuild and Assigned(FToolbar.View) then + FToolbar.View.RecreateAllViewers; + end; + FToolbar := Value; + if Assigned(Value) then begin + Value.FreeNotification(Self); + TTBCustomToolbarAccess(Value).FMDIButtonsItem := FButtonsItem; + TTBCustomToolbarAccess(Value).FMDISystemMenuItem := FSystemMenuItem; + Value.View.RecreateAllViewers; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXMDIButtonsItem } + +var + CBTHookHandle: HHOOK; + MDIButtonsItems: TList; + +function WindowIsMDIChild(W: HWND): Boolean; +var + I: Integer; + MainForm, ChildForm: TForm; +begin + MainForm := Application.MainForm; + if Assigned(MainForm) then + for I := 0 to MainForm.MDIChildCount-1 do begin + ChildForm := MainForm.MDIChildren[I]; + if ChildForm.HandleAllocated and (ChildForm.Handle = W) then begin + Result := True; + Exit; + end; + end; + Result := False; +end; + +function CBTHook(Code: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; +stdcall; +var + Maximizing: Boolean; + WindowPlacement: TWindowPlacement; + I: Integer; +begin + case Code of + HCBT_SETFOCUS: begin + if WindowIsMDIChild(HWND(WParam)) and Assigned(MDIButtonsItems) then begin + for I := 0 to MDIButtonsItems.Count-1 do + TSpTBXMDIButtonsItem(MDIButtonsItems[I]).InvalidateSystemMenuItem; + end; + end; + HCBT_MINMAX: begin + if WindowIsMDIChild(HWND(WParam)) and Assigned(MDIButtonsItems) and + (LParam in [SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_MINIMIZE, SW_RESTORE]) then begin + Maximizing := (LParam = SW_MAXIMIZE); + if (LParam = SW_RESTORE) and not IsZoomed(HWND(WParam)) then begin + WindowPlacement.length := SizeOf(WindowPlacement); + GetWindowPlacement(HWND(WParam), @WindowPlacement); + Maximizing := (WindowPlacement.flags and WPF_RESTORETOMAXIMIZED <> 0); + end; + for I := 0 to MDIButtonsItems.Count-1 do + TSpTBXMDIButtonsItem(MDIButtonsItems[I]).UpdateState(HWND(WParam), Maximizing); + end; + end; + HCBT_DESTROYWND: begin + if WindowIsMDIChild(HWND(WParam)) and Assigned(MDIButtonsItems) then begin + for I := 0 to MDIButtonsItems.Count-1 do + TSpTBXMDIButtonsItem(MDIButtonsItems[I]).UpdateState(HWND(WParam), False); + end; + end; + end; + Result := CallNextHookEx(CBTHookHandle, Code, WParam, LParam); +end; + +constructor TSpTBXMDIButtonsItem.Create(AOwner: TComponent); + + function CreateItem(ImageIndex: Integer): TSpTBXItem; + var + A: TTBCustomItemAccess; + begin + Result := TSpTBXItem.Create(Self); + A := TTBCustomItemAccess(Result); + A.ItemStyle := A.ItemStyle + [tbisRightAlign]; + Result.Images := MDIButtonsImgList; + Result.ImageIndex := ImageIndex; + Result.CustomWidth := 17; + Result.OnClick := ItemClick; + end; + +begin + inherited; + ItemStyle := ItemStyle + [tbisEmbeddedGroup]; + + FMinimizeItem := CreateItem(2); + FRestoreItem := CreateItem(3); + FCloseItem := CreateItem(0); + + Add(FMinimizeItem); + Add(FRestoreItem); + Add(FCloseItem); + + UpdateState(0, False); + AddToList(MDIButtonsItems, Self); + if CBTHookHandle = 0 then + CBTHookHandle := SetWindowsHookEx(WH_CBT, CBTHook, 0, GetCurrentThreadId); +end; + +destructor TSpTBXMDIButtonsItem.Destroy; +begin + RemoveFromList(MDIButtonsItems, Self); + if (MDIButtonsItems = nil) and (CBTHookHandle <> 0) then begin + UnhookWindowsHookEx(CBTHookHandle); + CBTHookHandle := 0; + end; + inherited; +end; + +procedure TSpTBXMDIButtonsItem.UpdateState(W: HWND; Maximized: Boolean); +var + HasMaxChild, VisibilityChanged: Boolean; + + procedure UpdateVisibleEnabled(const Item: TTBCustomItem; const AEnabled: Boolean); + begin + if (Item.Visible <> HasMaxChild) or (Item.Enabled <> AEnabled) then begin + Item.Visible := HasMaxChild; + Item.Enabled := AEnabled; + VisibilityChanged := True; + end; + end; + +var + MainForm, ActiveMDIChild, ChildForm: TForm; + I: Integer; +begin + HasMaxChild := False; + MainForm := Application.MainForm; + ActiveMDIChild := nil; + if Assigned(MainForm) then begin + for I := 0 to MainForm.MDIChildCount - 1 do begin + ChildForm := MainForm.MDIChildren[I]; + if ChildForm.HandleAllocated and + (((ChildForm.Handle = W) and Maximized) or + ((ChildForm.Handle <> W) and IsZoomed(ChildForm.Handle))) then begin + HasMaxChild := True; + Break; + end; + end; + ActiveMDIChild := MainForm.ActiveMDIChild; + end; + + VisibilityChanged := False; + UpdateVisibleEnabled(TSpTBXMDIHandler(Owner).FSystemMenuItem, True); + UpdateVisibleEnabled(FMinimizeItem, (ActiveMDIChild = nil) or (GetWindowLong(ActiveMDIChild.Handle, GWL_STYLE) and WS_MINIMIZEBOX <> 0)); + UpdateVisibleEnabled(FRestoreItem, True); + UpdateVisibleEnabled(FCloseItem, True); + + if VisibilityChanged and Assigned((Owner as TSpTBXMDIHandler).FToolbar) then begin + TSpTBXMDIHandler(Owner).FToolbar.View.InvalidatePositions; + TSpTBXMDIHandler(Owner).FToolbar.View.TryValidatePositions; + end; +end; + +procedure TSpTBXMDIButtonsItem.ItemClick(Sender: TObject); +var + MainForm, ChildForm: TForm; + Cmd: WPARAM; +begin + MainForm := Application.MainForm; + if Assigned(MainForm) then begin + ChildForm := MainForm.ActiveMDIChild; + if Assigned(ChildForm) then begin + if Sender = FRestoreItem then + Cmd := SC_RESTORE + else if Sender = FCloseItem then + Cmd := SC_CLOSE + else + Cmd := SC_MINIMIZE; + SendMessage(ChildForm.Handle, WM_SYSCOMMAND, Cmd, GetMessagePos); + end; + end; +end; + +procedure TSpTBXMDIButtonsItem.InvalidateSystemMenuItem; +var + View: TTBView; +begin + if Assigned((Owner as TSpTBXMDIHandler).FToolbar) then begin + View := TSpTBXMDIHandler(Owner).FToolbar.View; + View.Invalidate(View.Find(TSpTBXMDIHandler(Owner).FSystemMenuItem)); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXMDIWindowItem } + +constructor TSpTBXMDIWindowItem.Create(AOwner: TComponent); +var + Form: TForm; +begin + inherited; + ItemStyle := ItemStyle + [tbisEmbeddedGroup]; + Caption := STBMDIWindowItemDefCaption; + FWindowMenu := TMenuItem.Create(Self); + + if not (csDesigning in ComponentState) then begin + { Need to set WindowMenu before MDI children are created. Otherwise the + list incorrectly shows the first 9 child windows, even if window 10+ is + active. } + Form := Application.MainForm; + if (Form = nil) and (Screen.FormCount > 0) then + Form := Screen.Forms[0]; + SetForm(Form); + end; +end; + +procedure TSpTBXMDIWindowItem.GetChildren(Proc: TGetChildProc; Root: TComponent); +begin + // Do nothing +end; + +procedure TSpTBXMDIWindowItem.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = FForm) then + SetForm(nil); +end; + +procedure TSpTBXMDIWindowItem.SetForm(AForm: TForm); +begin + if FForm <> AForm then begin + if Assigned(FForm) and (FForm.WindowMenu = FWindowMenu) then + FForm.WindowMenu := nil; + FForm := AForm; + if Assigned(FForm) then + FForm.FreeNotification(Self); + end; + if Assigned(FForm) then + FForm.WindowMenu := FWindowMenu; +end; + +procedure TSpTBXMDIWindowItem.EnabledChanged; +var + I: Integer; +begin + inherited; + for I := 0 to Count-1 do + Items[I].Enabled := Enabled; +end; + +procedure TSpTBXMDIWindowItem.InitiateAction; +var + MainForm: TForm; + I: Integer; + M: HMENU; + Item: TSpTBXItem; + ItemCount: Integer; + Buf: array[0..1023] of Char; +begin + inherited; + if csDesigning in ComponentState then + Exit; + MainForm := Application.MainForm; + if Assigned(MainForm) then + SetForm(MainForm); + if FForm = nil then + Exit; + if FForm.ClientHandle <> 0 then + { This is needed, otherwise windows selected on the More Windows dialog + don't move back into the list } + SendMessage(FForm.ClientHandle, WM_MDIREFRESHMENU, 0, 0); + M := FWindowMenu.Handle; + ItemCount := GetMenuItemCount(M) - 1; + if ItemCount < 0 then + ItemCount := 0; + while Count < ItemCount do begin + Item := TSpTBXItem.Create(Self); + Item.Enabled := Enabled; + Item.OnClick := ItemClick; + Add(Item); + end; + while Count > ItemCount do + Items[Count - 1].Free; + for I := 0 to ItemCount - 1 do begin + Item := TSpTBXItem(Items[I]); + Item.Tag := GetMenuItemID(M, I+1); + if GetMenuString(M, I+1, Buf, SizeOf(Buf), MF_BYPOSITION) = 0 then + Buf[0] := #0; + Item.Caption := Buf; + Item.Checked := GetMenuState(M, I+1, MF_BYPOSITION) and MF_CHECKED <> 0; + end; + if Assigned(FOnUpdate) then + FOnUpdate(Self); +end; + +procedure TSpTBXMDIWindowItem.ItemClick(Sender: TObject); +var + Form: TForm; +begin + Form := Application.MainForm; + if Assigned(Form) then + PostMessage(Form.Handle, WM_COMMAND, TTBCustomItem(Sender).Tag, 0); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXMRUListItem } + +procedure TSpTBXMRUListItem.ClickHandler(Sender: TObject); +var + I: Integer; + A: TSpTBXMRUItem; +begin + if Sender is TSpTBXMRUItem then begin + A := TSpTBXMRUItem(Sender); + I := IndexOf(A); + if I > 0 then + Move(I, 0); + MRUUpdateCaptions; + if Assigned(FOnClick) then FOnClick(Self, A.MRUString); + end; +end; + +constructor TSpTBXMRUListItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle + [tbisEmbeddedGroup]; + Caption := STBMRUListItemDefCaption; + Options := Options + [tboShowHint]; + FMaxItems := 4; + FHidePathExtension := True; +end; + +procedure TSpTBXMRUListItem.GetMRUFilenames(MRUFilenames: TStrings); +var + I: Integer; +begin + MRUFilenames.Clear; + for I := 0 to Count - 1 do + if Items[I] is TSpTBXMRUItem then + MRUFilenames.Add(TSpTBXMRUItem(Items[I]).MRUString); +end; + +function TSpTBXMRUListItem.IndexOfMRU(Filename: WideString): Integer; +var + I: Integer; +begin + Result := -1; + for I := 0 to Count - 1 do + if Items[I] is TSpTBXMRUItem then + if SpSameText(TSpTBXMRUItem(Items[I]).MRUString, Filename) then begin + Result := I; + Break; + end; +end; + +function TSpTBXMRUListItem.MRUAdd(Filename: WideString): Integer; +var + A: TSpTBXMRUItem; + I: Integer; +begin + Result := -1; + I := IndexOfMRU(Filename); + if I > -1 then begin + // If Filename is already in the MRU list, move it to the top + Move(I, 0); + MRUUpdateCaptions; + end + else begin + // Add the new Filename, if it exceeds the MaxItems limit delete the bottom items + A := TSpTBXMRUItem.Create(Self); + A.MRUString := Filename; + A.Hint := Filename; + A.OnClick := ClickHandler; + Insert(0, A); + while Count > FMaxItems do + Items[Count - 1].Free; + MRUUpdateCaptions; + Result := 0; + end; +end; + +function TSpTBXMRUListItem.MRUClick(Filename: WideString): Boolean; +var + I: Integer; +begin + Result := False; + I := IndexOfMRU(Filename); + if I > -1 then begin + Items[I].Click; + Result := True; + end; +end; + +procedure TSpTBXMRUListItem.MRURemove(Filename: WideString); +var + I: Integer; +begin + I := IndexOfMRU(Filename); + if I > -1 then begin + Items[I].Free; + MRUUpdateCaptions; + end; +end; + +procedure TSpTBXMRUListItem.MRUUpdateCaptions; +var + I: Integer; + A: TSpTBXMRUItem; + S: WideString; +begin + for I := 0 to Count - 1 do + if Items[I] is TSpTBXMRUItem then begin + A := TSpTBXMRUItem(Items[I]); + S := A.MRUString; + if FHidePathExtension then begin + {$IFDEF UNICODE} + S := ExtractFileName(S); + {$ELSE} + S := TntSysUtils.WideExtractFileName(S); + {$ENDIF} + end; + A.Caption := '&' + IntToStr(I + 1) + ' ' + S; + end; +end; + +procedure TSpTBXMRUListItem.LoadFromIni(Ini: TCustomIniFile; const Section: string); +var + I: Integer; + S: WideString; +begin + Clear; + for I := FMaxItems downto 1 do begin + S := Ini.ReadString(Section, IntToStr(I), ''); + {$IFDEF UNICODE} + S := UTF8ToUnicodeString(ShortString(S)); + {$ELSE} + S := UTF8Decode(S); + {$ENDIF} + if S <> '' then + MRUAdd(S); + end; +end; + +procedure TSpTBXMRUListItem.SaveToIni(Ini: TCustomIniFile; const Section: string); +var + I: Integer; + A: TSpTBXMRUItem; + S: string; +begin + for I := 1 to FMaxItems do begin + if I <= Count then begin + A := TSpTBXMRUItem(Items[I - 1]); + {$IFDEF UNICODE} + S := UnicodeString(UTF8EncodeToShortString(A.MRUString)); + {$ELSE} + S := UTF8Encode(A.MRUString); + {$ENDIF} + Ini.WriteString(Section, IntToStr(I), S); + end + else + Ini.DeleteKey(Section, IntToStr(I)); + end; +end; + +procedure TSpTBXMRUListItem.SetHidePathExtension(const Value: Boolean); +begin + if FHidePathExtension <> Value then begin + FHidePathExtension := Value; + MRUUpdateCaptions; + end; +end; + +procedure TSpTBXMRUListItem.SetMaxItems(const Value: Integer); +begin + if FMaxItems <> Value then begin + FMaxItems := Value; + if Count > FMaxItems then begin + while Count > FMaxItems do + Items[Count - 1].Free; + MRUUpdateCaptions; + end; + end; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.dcr b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.dcr new file mode 100644 index 0000000..c3f2986 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.dcr differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.dcu new file mode 100644 index 0000000..ca68ad9 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.hpp new file mode 100644 index 0000000..b30ca22 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.hpp @@ -0,0 +1,106 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxreg.pas' rev: 20.00 + +#ifndef SptbxregHPP +#define SptbxregHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxreg +{ +//-- type declarations ------------------------------------------------------- +class DELPHICLASS TSpTBXItemsEditor; +class PASCALIMPLEMENTATION TSpTBXItemsEditor : public Tb2dsgnitemeditor::TTBItemsEditor +{ + typedef Tb2dsgnitemeditor::TTBItemsEditor inherited; + +public: + virtual void __fastcall Edit(void); +public: + /* TComponentEditor.Create */ inline __fastcall virtual TSpTBXItemsEditor(Classes::TComponent* AComponent, Designintf::_di_IDesigner ADesigner) : Tb2dsgnitemeditor::TTBItemsEditor(AComponent, ADesigner) { } + +public: + /* TObject.Destroy */ inline __fastcall virtual ~TSpTBXItemsEditor(void) { } + +}; + + +class DELPHICLASS TSpTBXImageIndexEditor; +class PASCALIMPLEMENTATION TSpTBXImageIndexEditor : public Designeditors::TIntegerProperty +{ + typedef Designeditors::TIntegerProperty inherited; + +public: + virtual Designintf::TPropertyAttributes __fastcall GetAttributes(void); + virtual void __fastcall GetValues(Classes::TGetStrProc Proc); + virtual Imglist::TCustomImageList* __fastcall GetImageListAt(int Index); + void __fastcall ListMeasureHeight(const System::UnicodeString Value, Graphics::TCanvas* ACanvas, int &AHeight); + void __fastcall ListMeasureWidth(const System::UnicodeString Value, Graphics::TCanvas* ACanvas, int &AWidth); + void __fastcall ListDrawValue(const System::UnicodeString Value, Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool ASelected); +public: + /* TPropertyEditor.Create */ inline __fastcall virtual TSpTBXImageIndexEditor(const Designintf::_di_IDesigner ADesigner, int APropCount) : Designeditors::TIntegerProperty(ADesigner, APropCount) { } + /* TPropertyEditor.Destroy */ inline __fastcall virtual ~TSpTBXImageIndexEditor(void) { } + +private: + void *__ICustomPropertyListDrawing; /* Vcleditors::ICustomPropertyListDrawing */ + +public: + #if defined(MANAGED_INTERFACE_OPERATORS) + operator Vcleditors::_di_ICustomPropertyListDrawing() + { + Vcleditors::_di_ICustomPropertyListDrawing intf; + GetInterface(intf); + return intf; + } + #else + operator ICustomPropertyListDrawing*(void) { return (ICustomPropertyListDrawing*)&__ICustomPropertyListDrawing; } + #endif + +}; + + +//-- var, const, procedure --------------------------------------------------- +extern PACKAGE void __fastcall Register(void); + +} /* namespace Sptbxreg */ +using namespace Sptbxreg; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxregHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.pas new file mode 100644 index 0000000..ca77a95 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXReg.pas @@ -0,0 +1,300 @@ +unit SpTBXReg; + +{============================================================================== +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ +==============================================================================} + +interface + +{$I TB2Ver.inc} + +uses + Windows, Classes, Controls, SysUtils, Graphics, ImgList, Dialogs, + {$IFDEF JR_D6} DesignIntf, DesignEditors, VCLEditors, {$ELSE} DsgnIntf, {$ENDIF} + TB2Reg, TB2Toolbar, TB2Item, TB2DsgnItemEditor, + SpTBXItem, SpTBXTabs, SpTBXDkPanels, SpTBXFormPopupMenu, + SpTBXControls, SpTBXEditors, SpTBXExtEditors, SpTBXCustomizer, SpTBXMDIMRU; + +type + { TSpTBXItemsEditor } + + TSpTBXItemsEditor = class(TTBItemsEditor) + public + procedure Edit; override; + end; + + { TSpTBXImageIndexEditor } + + TSpTBXImageIndexEditor = class(TIntegerProperty, ICustomPropertyListDrawing) + public + function GetAttributes: TPropertyAttributes; override; + procedure GetValues(Proc: TGetStrProc); override; + function GetImageListAt(Index: Integer): TCustomImageList; virtual; + + // ICustomPropertyListDrawing + procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas; var AHeight: Integer); + procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas; var AWidth: Integer); + procedure ListDrawValue(const Value: string; ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); + end; + +procedure Register; + +implementation + +uses + Forms, TypInfo; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +procedure SpEditFormAddItems(Sender: TTBItemEditForm; const ToolbarName, ItemsPrefix: string); +// Creates a new toolbar in the EditForm with all the items that have the same prefix. +var + TB: TTBToolbar; + Item: TTBCustomItem; + NewItem: TTBItem; + S: string; + I, C: Integer; +begin + if Sender.FindComponent(ToolbarName) <> nil then Exit; + + // Create our own toolbar in the editor + TB := TTBToolbar.Create(Sender); + TB.Top := Sender.Height; + TB.Parent := Sender; + TB.Align := alTop; + TB.Images := Sender.ToolbarItems.SubMenuImages; + TB.ShowHint := True; + TB.Name := ToolbarName; + + C := Length(ItemsPrefix); + for I := 0 to Sender.MoreMenu.Count - 1 do + begin + Item := Sender.MoreMenu.Items[I]; + if Item is TTBCustomItem then + begin + S := TTBCustomItemClass(Item.Tag).ClassName; + if StrLComp(PChar(S), PChar(ItemsPrefix), C) = 0 then + begin + NewItem := TTBItem.Create(TB); + TB.Items.Add(NewItem); + NewItem.Caption := Item.Caption; + NewItem.ImageIndex := Item.ImageIndex; + NewItem.Tag := Item.Tag; + NewItem.Hint := S; + NewItem.OnClick := Item.OnClick; + end; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBItemsEditor } + +procedure TSpTBXItemsEditor.Edit; +var + Intf: ITBItems; + F: TTBItemEditForm; + I: Integer; +begin + if Assigned(Component) and Component.GetInterface(ITBItems, Intf) then begin + inherited; + F := nil; + if Screen.ActiveForm is TTBItemEditForm then + F := Screen.ActiveForm as TTBItemEditForm + else + for I := 0 to Screen.FormCount - 1 do + if Screen.Forms[I] is TTBItemEditForm then begin + F := Screen.Forms[I] as TTBItemEditForm; + Break; + end; + + if Assigned(F) then + SpEditFormAddItems(F, 'SpTBToolbar', 'TSpTBX'); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXImageIndexEditor } + +function TSpTBXImageIndexEditor.GetAttributes: TPropertyAttributes; +begin + Result := [paMultiSelect, paValueList, paRevertable]; +end; + +function TSpTBXImageIndexEditor.GetImageListAt(Index: Integer): TCustomImageList; +begin + Result := TCustomImageList(TypInfo.GetObjectProp(GetComponent(Index), 'Images')); +end; + +procedure TSpTBXImageIndexEditor.GetValues(Proc: TGetStrProc); +var + ImgList: TCustomImageList; + I: Integer; +begin + ImgList := GetImageListAt(0); + if Assigned(ImgList) then + for I := 0 to ImgList.Count-1 do + Proc(IntToStr(I)); +end; + +procedure TSpTBXImageIndexEditor.ListDrawValue(const Value: string; + ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); +var + ImgList: TCustomImageList; + X: Integer; +begin + ImgList := GetImageListAt(0); + ACanvas.FillRect(ARect); + X := ARect.Left + 2; + if Assigned(ImgList) then begin + ImgList.Draw(ACanvas, X, ARect.Top + 2, StrToInt(Value)); + Inc(X, ImgList.Width); + end; + ACanvas.TextOut(X + 3, ARect.Top + 1, Value); +end; + +procedure TSpTBXImageIndexEditor.ListMeasureHeight(const Value: string; + ACanvas: TCanvas; var AHeight: Integer); +var + ImgList: TCustomImageList; +begin + ImgList := GetImageListAt(0); + AHeight := ACanvas.TextHeight(Value) + 2; + if Assigned(ImgList) and (ImgList.Height + 4 > AHeight) then + AHeight := ImgList.Height + 4; +end; + +procedure TSpTBXImageIndexEditor.ListMeasureWidth(const Value: string; + ACanvas: TCanvas; var AWidth: Integer); +var + ImgList: TCustomImageList; +begin + ImgList := GetImageListAt(0); + AWidth := ACanvas.TextWidth(Value) + 4; + if Assigned(ImgList) then + Inc(AWidth, ImgList.Width); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM + +procedure Register; +begin + {$IFDEF JR_D9} + ForceDemandLoadState(dlDisable); + {$ENDIF} + + RegisterComponents('SpTBXLib', [TSpTBXDock, TSpTBXMultiDock, TSpTBXToolbar, + TSpTBXToolWindow, TSpTBXDockablePanel, TSpTBXTabSet, TSpTBXTabControl, TSpTBXStatusBar, + TSpTBXPopupMenu, TSpTBXFormPopupMenu, TSpTBXMDIHandler, TSpTBXTitleBar, + TSpTBXLabel, TSpTBXCheckBox, TSpTBXRadioButton, TSpTBXButton, TSpTBXSpeedButton, + TSpTBXProgressBar, TSpTBXTrackBar, TSpTBXSplitter, TSpTBXPanel, TSpTBXGroupBox, + TSpTBXRadioGroup, TSpTBXEdit, TSpTBXButtonEdit, TSpTBXSpinEdit, TSpTBXColorEdit, + TSpTBXComboBox, TSpTBXFontComboBox, TSpTBXListBox, TSpTBXCheckListBox, TSpTBXColorListBox, + TSpTBXCustomizer]); + + RegisterClasses([TSpTBXTabSheet, TSpTBXCustomTabSet, TSpTBXCustomTabControl]); + + // TSpTBXItem + RegisterNoIcon([TSpTBXItem]); + RegisterClasses([TSpTBXItem]); + TBRegisterItemClass(TSpTBXItem, 'New SpTBX Item', HInstance); + // TSpTBXSubmenuItem + RegisterNoIcon([TSpTBXSubmenuItem]); + RegisterClasses([TSpTBXSubmenuItem]); + TBRegisterItemClass(TSpTBXSubmenuItem, 'New SpTBX Submenu Item', HInstance); + // TSpTBXSeparatorItem + RegisterNoIcon([TSpTBXSeparatorItem]); + RegisterClasses([TSpTBXSeparatorItem]); + TBRegisterItemClass(TSpTBXSeparatorItem, 'New SpTBX Separator Item', HInstance); + // TSpTBXSpacerItem + RegisterNoIcon([TSpTBXRightAlignSpacerItem]); + RegisterClasses([TSpTBXRightAlignSpacerItem]); + TBRegisterItemClass(TSpTBXRightAlignSpacerItem, 'New SpTBX RightAlignSpacer Item', HInstance); + // TSpTBXLabelItem + RegisterNoIcon([TSpTBXLabelItem]); + RegisterClasses([TSpTBXLabelItem]); + TBRegisterItemClass(TSpTBXLabelItem, 'New SpTBX Label Item', HInstance); + // TSpTBXSkinGroupItem + RegisterNoIcon([TSpTBXSkinGroupItem]); + RegisterClasses([TSpTBXSkinGroupItem]); + TBRegisterItemClass(TSpTBXSkinGroupItem, 'New SpTBX SkinGroup Item', HInstance); + // TSpTBXColorItem + RegisterNoIcon([TSpTBXColorItem]); + RegisterClasses([TSpTBXColorItem]); + TBRegisterItemClass(TSpTBXColorItem, 'New SpTBX Color Item', HInstance); + // TSpTBXTabItem + RegisterNoIcon([TSpTBXTabItem]); + RegisterClasses([TSpTBXTabItem]); + TBRegisterItemClass(TSpTBXTabItem, 'New SpTBX Tab Item', HInstance); + // TSpTBXEditItem + RegisterNoIcon([TSpTBXEditItem]); + RegisterClasses([TSpTBXEditItem]); + TBRegisterItemClass(TSpTBXEditItem, 'New SpTBX Edit Item', HInstance); + // TSpTBXSpinEditItem + RegisterNoIcon([TSpTBXSpinEditItem]); + RegisterClasses([TSpTBXSpinEditItem]); + TBRegisterItemClass(TSpTBXSpinEditItem, 'New SpTBX Spin Edit Item', HInstance); + // TSpTBXToolPalette + RegisterNoIcon([TSpTBXToolPalette]); + RegisterClasses([TSpTBXToolPalette]); + TBRegisterItemClass(TSpTBXToolPalette, 'New SpTBX Tool Palette Item', HInstance); + // TSpTBXColorPalette + RegisterNoIcon([TSpTBXColorPalette]); + RegisterClasses([TSpTBXColorPalette]); + TBRegisterItemClass(TSpTBXColorPalette, 'New SpTBX Color Palette Item', HInstance); + // TSpTBXMRUListItem + RegisterNoIcon([TSpTBXMRUListItem]); + RegisterClasses([TSpTBXMRUListItem]); + TBRegisterItemClass(TSpTBXMRUListItem, 'New SpTBX MRU List Item', HInstance); + // TSpTBXMDIWindowItem + RegisterNoIcon([TSpTBXMDIWindowItem]); + RegisterClasses([TSpTBXMDIWindowItem]); + TBRegisterItemClass(TSpTBXMDIWindowItem, 'New SpTBX MDI Window Item', HInstance); + + // Register the components editor, the components must implement IItems interface + RegisterComponentEditor(TSpTBXToolbar, TSpTBXItemsEditor); + RegisterComponentEditor(TSpTBXCompoundItemsControl, TSpTBXItemsEditor); + RegisterComponentEditor(TSpTBXDockablePanel, TSpTBXItemsEditor); + RegisterComponentEditor(TSpTBXCustomizer, TSpTBXItemsEditor); + RegisterComponentEditor(TSpTBXPopupMenu, TSpTBXItemsEditor); + + // Register the ImageIndex property editor for TSpTBXTextObject descendants, this is + // needed to show the preview of images in the property editor combobox. + RegisterPropertyEditor(TypeInfo(TImageIndex), TSpTBXTextObject, '', TSpTBXImageIndexEditor); +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.dcu new file mode 100644 index 0000000..762b7c5 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.hpp new file mode 100644 index 0000000..e9028d0 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.hpp @@ -0,0 +1,459 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxskins.pas' rev: 20.00 + +#ifndef SptbxskinsHPP +#define SptbxskinsHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxskins +{ +//-- type declarations ------------------------------------------------------- +#pragma option push -b- +enum TSpTBXSkinType { sknNone, sknWindows, sknSkin }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXLunaScheme { lusBlue, lusMetallic, lusGreen, lusUnknown }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXSkinComponentsType { skncDock, skncDockablePanel, skncDockablePanelTitleBar, skncGutter, skncMenuBar, skncOpenToolbarItem, skncPanel, skncPopup, skncSeparator, skncSplitter, skncStatusBar, skncStatusBarGrip, skncTabBackground, skncTabToolbar, skncToolbar, skncToolbarGrip, skncWindow, skncWindowTitleBar, skncMenuBarItem, skncMenuItem, skncToolbarItem, skncButton, skncCheckBox, skncEditButton, skncEditFrame, skncHeader, skncLabel, skncListItem, skncProgressBar, skncRadioButton, skncTab, skncTrackBar, skncTrackBarButton }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXSkinStatesType { sknsNormal, sknsDisabled, sknsHotTrack, sknsPushed, sknsChecked, sknsCheckedAndHotTrack }; +#pragma option pop + +typedef Set TSpTBXSkinStatesSet; + +#pragma option push -b- +enum TSpTBXSkinPartsType { sknpBody, sknpBorders, sknpText }; +#pragma option pop + +struct TSpTBXSkinComponentsIdentEntry +{ + +public: + System::UnicodeString Name; + TSpTBXSkinStatesSet States; +}; + + +typedef StaticArray Sptbxskins__1; + +typedef StaticArray Sptbxskins__2; + +typedef StaticArray Sptbxskins__3; + +#pragma option push -b- +enum TSpTextRotationAngle { tra0, tra90, tra270 }; +#pragma option pop + +struct TSpTBXTextInfo +{ + +public: + System::WideString Text; + TSpTextRotationAngle TextAngle; + unsigned TextFlags; + tagSIZE TextSize; + bool IsCaptionShown; + bool IsTextRotated; +}; + + +#pragma option push -b- +enum TSpGlyphLayout { ghlGlyphLeft, ghlGlyphTop }; +#pragma option pop + +#pragma option push -b- +enum TSpGlowDirection { gldNone, gldAll, gldTopLeft, gldBottomRight }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXComboPart { cpNone, cpCombo, cpSplitLeft, cpSplitRight }; +#pragma option pop + +struct TSpTBXMenuItemMarginsInfo +{ + +public: + Types::TRect Margins; + int GutterSize; + int LeftCaptionMargin; + int RightCaptionMargin; + int ImageTextSpace; +}; + + +struct TSpTBXMenuItemInfo +{ + +public: + bool Enabled; + bool HotTrack; + bool Pushed; + bool Checked; + bool HasArrow; + bool ImageShown; + bool ImageOrCheckShown; + tagSIZE ImageSize; + tagSIZE RightImageSize; + bool IsDesigning; + bool IsOnMenuBar; + bool IsOnToolbox; + bool IsOpen; + bool IsSplit; + bool IsSunkenCaption; + bool IsVertical; + TSpTBXMenuItemMarginsInfo MenuMargins; + TSpTBXComboPart ComboPart; + Types::TRect ComboRect; + TSpTBXSkinStatesType ComboState; + bool ToolbarStyle; + TSpTBXSkinStatesType State; + TSpTBXSkinType SkinType; +}; + + +#pragma option push -b- +enum TSpTBXColorTextType { cttDefault, cttHTML, cttIdentAndHTML }; +#pragma option pop + +class DELPHICLASS TSpTBXSkinOptionEntry; +class PASCALIMPLEMENTATION TSpTBXSkinOptionEntry : public Classes::TPersistent +{ + typedef Classes::TPersistent inherited; + +private: + int FSkinType; + Graphics::TColor FColor1; + Graphics::TColor FColor2; + Graphics::TColor FColor3; + Graphics::TColor FColor4; + +protected: + virtual void __fastcall AssignTo(Classes::TPersistent* Dest); + +public: + __fastcall virtual TSpTBXSkinOptionEntry(void); + void __fastcall Fill(int ASkinType, Graphics::TColor AColor1, Graphics::TColor AColor2, Graphics::TColor AColor3, Graphics::TColor AColor4); + void __fastcall ReadFromString(System::UnicodeString S); + System::UnicodeString __fastcall WriteToString(); + bool __fastcall IsEmpty(void); + bool __fastcall IsEqual(TSpTBXSkinOptionEntry* AOptionEntry); + void __fastcall Reset(void); + +__published: + __property int SkinType = {read=FSkinType, write=FSkinType, nodefault}; + __property Graphics::TColor Color1 = {read=FColor1, write=FColor1, nodefault}; + __property Graphics::TColor Color2 = {read=FColor2, write=FColor2, nodefault}; + __property Graphics::TColor Color3 = {read=FColor3, write=FColor3, nodefault}; + __property Graphics::TColor Color4 = {read=FColor4, write=FColor4, nodefault}; +public: + /* TPersistent.Destroy */ inline __fastcall virtual ~TSpTBXSkinOptionEntry(void) { } + +}; + + +class DELPHICLASS TSpTBXSkinOptionCategory; +class PASCALIMPLEMENTATION TSpTBXSkinOptionCategory : public Classes::TPersistent +{ + typedef Classes::TPersistent inherited; + +private: + TSpTBXSkinOptionEntry* FBody; + TSpTBXSkinOptionEntry* FBorders; + Graphics::TColor FTextColor; + +protected: + virtual void __fastcall AssignTo(Classes::TPersistent* Dest); + +public: + __fastcall virtual TSpTBXSkinOptionCategory(void); + __fastcall virtual ~TSpTBXSkinOptionCategory(void); + bool __fastcall IsEmpty(void); + void __fastcall Reset(void); + void __fastcall LoadFromIni(Inifiles::TMemIniFile* MemIni, System::UnicodeString Section, System::UnicodeString Ident); + void __fastcall SaveToIni(Inifiles::TMemIniFile* MemIni, System::UnicodeString Section, System::UnicodeString Ident); + +__published: + __property TSpTBXSkinOptionEntry* Body = {read=FBody, write=FBody}; + __property TSpTBXSkinOptionEntry* Borders = {read=FBorders, write=FBorders}; + __property Graphics::TColor TextColor = {read=FTextColor, write=FTextColor, nodefault}; +}; + + +class DELPHICLASS TSpTBXSkinOptions; +class PASCALIMPLEMENTATION TSpTBXSkinOptions : public Classes::TPersistent +{ + typedef Classes::TPersistent inherited; + +private: + Graphics::TColor FColorBtnFace; + int FFloatingWindowBorderSize; + StaticArray, 33> FOptions; + bool FOfficeIcons; + bool FOfficeMenuSeparator; + bool FOfficeStatusBar; + System::UnicodeString FSkinAuthor; + System::UnicodeString FSkinName; + bool __fastcall GetOfficeIcons(void); + bool __fastcall GetOfficeMenuSeparator(void); + bool __fastcall GetOfficePopup(void); + bool __fastcall GetOfficeStatusBar(void); + int __fastcall GetFloatingWindowBorderSize(void); + void __fastcall SetFloatingWindowBorderSize(const int Value); + +protected: + virtual void __fastcall AssignTo(Classes::TPersistent* Dest); + void __fastcall BroadcastChanges(void); + +public: + __fastcall virtual TSpTBXSkinOptions(void); + __fastcall virtual ~TSpTBXSkinOptions(void); + void __fastcall CopyOptions(TSpTBXSkinComponentsType AComponent, TSpTBXSkinComponentsType ToComponent); + virtual void __fastcall FillOptions(void); + TSpTBXSkinOptionCategory* __fastcall Options(TSpTBXSkinComponentsType Component, TSpTBXSkinStatesType State)/* overload */; + TSpTBXSkinOptionCategory* __fastcall Options(TSpTBXSkinComponentsType Component)/* overload */; + void __fastcall LoadFromFile(System::WideString Filename); + virtual void __fastcall LoadFromStrings(Classes::TStrings* L); + void __fastcall SaveToFile(System::WideString Filename); + virtual void __fastcall SaveToStrings(Classes::TStrings* L); + virtual void __fastcall SaveToMemIni(Inifiles::TMemIniFile* MemIni); + void __fastcall Reset(bool ForceResetSkinProperties = false); + virtual void __fastcall GetDropDownArrowSize(/* out */ int &DropDownArrowSize, /* out */ int &DropDownArrowMargin, /* out */ int &SplitBtnArrowSize); + virtual void __fastcall GetMenuItemMargins(Graphics::TCanvas* ACanvas, int ImgSize, /* out */ TSpTBXMenuItemMarginsInfo &MarginsInfo); + TSpTBXSkinStatesType __fastcall GetState(bool Enabled, bool Pushed, bool HotTrack, bool Checked); + virtual Graphics::TColor __fastcall GetTextColor(TSpTBXSkinComponentsType Component, TSpTBXSkinStatesType State, TSpTBXSkinType SkinType = (TSpTBXSkinType)(0x2)); + virtual void __fastcall PaintBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, TSpTBXSkinComponentsType Component, TSpTBXSkinStatesType State, bool Background, bool Borders, bool Vertical = false, Controls::TAnchors ForceRectBorders = Controls::TAnchors() ); + virtual void __fastcall PaintMenuCheckMark(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Checked, bool Grayed, bool MenuItemStyle, TSpTBXSkinStatesType State); + virtual void __fastcall PaintMenuRadioMark(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Checked, bool MenuItemStyle, TSpTBXSkinStatesType State); + virtual void __fastcall PaintWindowFrame(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool IsActive, bool DrawBody, int BorderSize = 0x4); + __property Graphics::TColor ColorBtnFace = {read=FColorBtnFace, write=FColorBtnFace, nodefault}; + __property int FloatingWindowBorderSize = {read=GetFloatingWindowBorderSize, write=SetFloatingWindowBorderSize, nodefault}; + __property bool OfficeIcons = {read=GetOfficeIcons, write=FOfficeIcons, nodefault}; + __property bool OfficeMenuSeparator = {read=GetOfficeMenuSeparator, write=FOfficeMenuSeparator, nodefault}; + __property bool OfficePopup = {read=GetOfficePopup, nodefault}; + __property bool OfficeStatusBar = {read=GetOfficeStatusBar, write=FOfficeStatusBar, nodefault}; + __property System::UnicodeString SkinAuthor = {read=FSkinAuthor, write=FSkinAuthor}; + __property System::UnicodeString SkinName = {read=FSkinName, write=FSkinName}; +}; + + +typedef TMetaClass* TSpTBXSkinOptionsClass; + +class DELPHICLASS TSpTBXSkinsListEntry; +class PASCALIMPLEMENTATION TSpTBXSkinsListEntry : public System::TObject +{ + typedef System::TObject inherited; + +public: + TSpTBXSkinOptionsClass SkinClass; + Classes::TStringList* SkinStrings; + __fastcall virtual ~TSpTBXSkinsListEntry(void); +public: + /* TObject.Create */ inline __fastcall TSpTBXSkinsListEntry(void) : System::TObject() { } + +}; + + +class DELPHICLASS TSpTBXSkinsList; +class PASCALIMPLEMENTATION TSpTBXSkinsList : public Classes::TStringList +{ + typedef Classes::TStringList inherited; + +private: + TSpTBXSkinsListEntry* __fastcall GetSkinOption(int Index); + +public: + virtual void __fastcall Delete(int Index); + __fastcall virtual ~TSpTBXSkinsList(void); + int __fastcall AddSkin(System::UnicodeString SkinName, TSpTBXSkinOptionsClass SkinClass)/* overload */; + int __fastcall AddSkin(Classes::TStrings* SkinOptions)/* overload */; + int __fastcall AddSkinFromFile(System::WideString Filename); + void __fastcall AddSkinsFromFolder(System::WideString Folder); + void __fastcall GetSkinNames(Classes::TStrings* SkinNames); + __property TSpTBXSkinsListEntry* SkinOptions[int Index] = {read=GetSkinOption}; +public: + /* TStringList.Create */ inline __fastcall TSpTBXSkinsList(void)/* overload */ : Classes::TStringList() { } + +}; + + +class DELPHICLASS TSpTBXSkinManager; +class PASCALIMPLEMENTATION TSpTBXSkinManager : public System::TObject +{ + typedef System::TObject inherited; + +private: + TSpTBXSkinOptions* FCurrentSkin; + Classes::TList* FNotifies; + TSpTBXSkinsList* FSkinsList; + Classes::TNotifyEvent FOnSkinChange; + void __fastcall Broadcast(void); + System::UnicodeString __fastcall GetCurrentSkinName(); + +public: + __fastcall virtual TSpTBXSkinManager(void); + __fastcall virtual ~TSpTBXSkinManager(void); + TSpTBXSkinType __fastcall GetSkinType(void); + bool __fastcall IsDefaultSkin(void); + bool __fastcall IsXPThemesEnabled(void); + void __fastcall AddSkinNotification(System::TObject* AObject); + void __fastcall RemoveSkinNotification(System::TObject* AObject); + void __fastcall BroadcastSkinNotification(void); + void __fastcall LoadFromFile(System::WideString Filename); + void __fastcall SaveToFile(System::WideString Filename); + void __fastcall SetToDefaultSkin(void); + void __fastcall SetSkin(System::UnicodeString SkinName); + void __fastcall ChangeControlSkinType(Controls::TWinControl* Control, TSpTBXSkinType SkinType, bool Recursive = true); + __property TSpTBXSkinOptions* CurrentSkin = {read=FCurrentSkin}; + __property System::UnicodeString CurrentSkinName = {read=GetCurrentSkinName}; + __property TSpTBXSkinsList* SkinsList = {read=FSkinsList}; + __property Classes::TNotifyEvent OnSkinChange = {read=FOnSkinChange, write=FOnSkinChange}; +}; + + +class DELPHICLASS TSpTBXSkinSwitcher; +class PASCALIMPLEMENTATION TSpTBXSkinSwitcher : public Classes::TComponent +{ + typedef Classes::TComponent inherited; + +private: + Classes::TNotifyEvent FOnSkinChange; + System::UnicodeString __fastcall GetSkin(); + void __fastcall SetSkin(const System::UnicodeString Value); + MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +public: + __fastcall virtual TSpTBXSkinSwitcher(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXSkinSwitcher(void); + +__published: + __property System::UnicodeString Skin = {read=GetSkin, write=SetSkin}; + __property Classes::TNotifyEvent OnSkinChange = {read=FOnSkinChange, write=FOnSkinChange}; +}; + + +typedef BOOL __stdcall (*TSpPrintWindow)(HWND Hnd, HDC HdcBlt, unsigned nFlags); + +//-- var, const, procedure --------------------------------------------------- +static const Word WM_SPSKINCHANGE = 0x87d7; +static const ShortInt MENU_POPUPBACKGROUND = 0x9; +static const ShortInt MENU_POPUPBORDERS = 0xa; +static const ShortInt MENU_POPUPCHECK = 0xb; +static const ShortInt MENU_POPUPCHECKBACKGROUND = 0xc; +static const ShortInt MENU_POPUPGUTTER = 0xd; +static const ShortInt MENU_POPUPITEM = 0xe; +static const ShortInt MENU_POPUPSEPARATOR = 0xf; +static const ShortInt MPI_NORMAL = 0x1; +static const ShortInt MPI_HOT = 0x2; +static const ShortInt MPI_DISABLED = 0x3; +static const ShortInt MPI_DISABLEDHOT = 0x4; +static const ShortInt MCB_DISABLED = 0x1; +static const ShortInt MCB_NORMAL = 0x2; +static const ShortInt MCB_BITMAP = 0x3; +static const ShortInt MC_CHECKMARKNORMAL = 0x1; +static const ShortInt MC_CHECKMARKDISABLED = 0x2; +static const ShortInt MC_BULLETNORMAL = 0x3; +static const ShortInt MC_BULLETDISABLED = 0x4; +extern PACKAGE Set SpTBXSkinMultiStateComponents; +#define CSpTBXSkinAllStates (Set () << sknsNormal << sknsDisabled << sknsHotTrack << sknsPushed << sknsChecked << sknsCheckedAndHotTrack ) +extern PACKAGE Sptbxskins__1 CSpTBXSkinComponents; +extern PACKAGE Sptbxskins__2 SSpTBXSkinStatesString; +extern PACKAGE Sptbxskins__3 SSpTBXSkinDisplayStatesString; +extern PACKAGE Graphics::TBitmap* StockBitmap; +extern PACKAGE TSpPrintWindow SpPrintWindow; +extern PACKAGE TSpTBXSkinManager* __fastcall SkinManager(void); +extern PACKAGE TSpTBXSkinOptions* __fastcall CurrentSkin(void); +extern PACKAGE TSpTBXSkinType __fastcall SpTBXSkinType(TSpTBXSkinType T); +extern PACKAGE TSpTBXLunaScheme __fastcall SpGetLunaScheme(void); +extern PACKAGE void __fastcall SpDrawParentBackground(Controls::TControl* Control, HDC DC, const Types::TRect &R); +extern PACKAGE HFONT __fastcall SpCreateRotatedFont(HDC DC, int Orientation = 0xa8c); +extern PACKAGE int __fastcall SpDrawRotatedText(const HDC DC, System::WideString AText, Types::TRect &ARect, const unsigned AFormat, TSpTextRotationAngle RotationAngle = (TSpTextRotationAngle)(0x2)); +extern PACKAGE int __fastcall SpCalcXPText(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, System::WideString Caption, Classes::TAlignment CaptionAlignment, unsigned Flags, const tagSIZE &GlyphSize, const tagSIZE &RightGlyphSize, TSpGlyphLayout Layout, bool PushedCaption, /* out */ Types::TRect &ACaptionRect, /* out */ Types::TRect &AGlyphRect, /* out */ Types::TRect &ARightGlyphRect, TSpTextRotationAngle RotationAngle = (TSpTextRotationAngle)(0x0)); +extern PACKAGE int __fastcall SpDrawXPText(Graphics::TCanvas* ACanvas, System::WideString Caption, Types::TRect &ARect, unsigned Flags, TSpGlowDirection CaptionGlow = (TSpGlowDirection)(0x0), Graphics::TColor CaptionGlowColor = (Graphics::TColor)(0xffff), TSpTextRotationAngle RotationAngle = (TSpTextRotationAngle)(0x0))/* overload */; +extern PACKAGE int __fastcall SpDrawXPText(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, System::WideString Caption, TSpGlowDirection CaptionGlow, Graphics::TColor CaptionGlowColor, Classes::TAlignment CaptionAlignment, unsigned Flags, const tagSIZE &GlyphSize, TSpGlyphLayout Layout, bool PushedCaption, /* out */ Types::TRect &ACaptionRect, /* out */ Types::TRect &AGlyphRect, TSpTextRotationAngle RotationAngle = (TSpTextRotationAngle)(0x0))/* overload */; +extern PACKAGE int __fastcall SpDrawXPText(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, System::WideString Caption, TSpGlowDirection CaptionGlow, Graphics::TColor CaptionGlowColor, Classes::TAlignment CaptionAlignment, unsigned Flags, Imglist::TCustomImageList* IL, int ImageIndex, TSpGlyphLayout Layout, bool Enabled, bool PushedCaption, bool DisabledIconCorrection, /* out */ Types::TRect &ACaptionRect, /* out */ Types::TRect &AGlyphRect, TSpTextRotationAngle RotationAngle = (TSpTextRotationAngle)(0x0))/* overload */; +extern PACKAGE tagSIZE __fastcall SpGetTextSize(HDC DC, System::WideString WS, bool NoPrefix); +extern PACKAGE int __fastcall SpGetControlTextHeight(Controls::TControl* AControl, Graphics::TFont* AFont); +extern PACKAGE tagSIZE __fastcall SpGetControlTextSize(Controls::TControl* AControl, Graphics::TFont* AFont, System::WideString WS); +extern PACKAGE bool __fastcall SpSameText(System::WideString W1, System::WideString W2); +extern PACKAGE System::WideString __fastcall SpStripAccelChars(System::WideString S); +extern PACKAGE System::WideString __fastcall SpStripShortcut(System::WideString S); +extern PACKAGE System::WideString __fastcall SpStripTrailingPunctuation(System::WideString S); +extern PACKAGE System::UnicodeString __fastcall SpRectToString(const Types::TRect &R); +extern PACKAGE bool __fastcall SpStringToRect(System::UnicodeString S, /* out */ Types::TRect &R); +extern PACKAGE System::UnicodeString __fastcall SpColorToHTML(const Graphics::TColor Color); +extern PACKAGE System::UnicodeString __fastcall SpColorToString(const Graphics::TColor Color, TSpTBXColorTextType TextType = (TSpTBXColorTextType)(0x0)); +extern PACKAGE bool __fastcall SpStringToColor(System::UnicodeString S, /* out */ Graphics::TColor &Color); +extern PACKAGE void __fastcall SpGetRGB(Graphics::TColor Color, /* out */ int &R, /* out */ int &G, /* out */ int &B); +extern PACKAGE Graphics::TColor __fastcall SpRGBToColor(int R, int G, int B); +extern PACKAGE Graphics::TColor __fastcall SpLighten(Graphics::TColor Color, int Amount); +extern PACKAGE Graphics::TColor __fastcall SpBlendColors(Graphics::TColor TargetColor, Graphics::TColor BaseColor, int Percent); +extern PACKAGE Graphics::TColor __fastcall SpMixColors(Graphics::TColor TargetColor, Graphics::TColor BaseColor, System::Byte Amount); +extern PACKAGE Types::TRect __fastcall SpCenterRect(const Types::TRect &Parent, int ChildWidth, int ChildHeight)/* overload */; +extern PACKAGE Types::TRect __fastcall SpCenterRect(const Types::TRect &Parent, const Types::TRect &Child)/* overload */; +extern PACKAGE Types::TRect __fastcall SpCenterRectHoriz(const Types::TRect &Parent, int ChildWidth); +extern PACKAGE Types::TRect __fastcall SpCenterRectVert(const Types::TRect &Parent, int ChildHeight); +extern PACKAGE void __fastcall SpFillRect(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Graphics::TColor BrushColor, Graphics::TColor PenColor = (Graphics::TColor)(0x1fffffff)); +extern PACKAGE void __fastcall SpDrawLine(Graphics::TCanvas* ACanvas, int X1, int Y1, int X2, int Y2, Graphics::TColor Color); +extern PACKAGE void __fastcall SpDrawRectangle(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int CornerSize, Graphics::TColor ColorL, Graphics::TColor ColorT, Graphics::TColor ColorR, Graphics::TColor ColorB, Graphics::TColor InternalColorL, Graphics::TColor InternalColorT, Graphics::TColor InternalColorR, Graphics::TColor InternalColorB, Controls::TAnchors ForceRectBorders = Controls::TAnchors() )/* overload */; +extern PACKAGE void __fastcall SpDrawRectangle(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int CornerSize, Graphics::TColor ColorTL, Graphics::TColor ColorBR, Graphics::TColor ColorTLInternal = (Graphics::TColor)(0x1fffffff), Graphics::TColor ColorBRInternal = (Graphics::TColor)(0x1fffffff), Controls::TAnchors ForceRectBorders = Controls::TAnchors() )/* overload */; +extern PACKAGE void __fastcall SpAlphaBlend(HDC SrcDC, HDC DstDC, const Types::TRect &SrcR, const Types::TRect &DstR, System::Byte Alpha, bool SrcHasAlphaChannel = false); +extern PACKAGE void __fastcall SpPaintTo(Controls::TWinControl* WinControl, Graphics::TCanvas* ACanvas, int X, int Y); +extern PACKAGE void __fastcall SpDrawIconShadow(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Imglist::TCustomImageList* ImageList, int ImageIndex); +extern PACKAGE void __fastcall SpDrawImageList(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Imglist::TCustomImageList* ImageList, int ImageIndex, bool Enabled, bool DisabledIconCorrection); +extern PACKAGE void __fastcall SpGradient(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int StartPos, int EndPos, int ChunkSize, Graphics::TColor C1, Graphics::TColor C2, const bool Vertical); +extern PACKAGE void __fastcall SpGradientFill(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Graphics::TColor C1, const Graphics::TColor C2, const bool Vertical); +extern PACKAGE void __fastcall SpGradientFillMirror(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Graphics::TColor C1, const Graphics::TColor C2, const Graphics::TColor C3, const Graphics::TColor C4, const bool Vertical); +extern PACKAGE void __fastcall SpGradientFillMirrorTop(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Graphics::TColor C1, const Graphics::TColor C2, const Graphics::TColor C3, const Graphics::TColor C4, const bool Vertical); +extern PACKAGE void __fastcall SpGradientFillGlass(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Graphics::TColor C1, const Graphics::TColor C2, const Graphics::TColor C3, const Graphics::TColor C4, const bool Vertical); +extern PACKAGE void __fastcall SpDrawArrow(Graphics::TCanvas* ACanvas, int X, int Y, Graphics::TColor AColor, bool Vertical, bool Reverse, int Size); +extern PACKAGE void __fastcall SpDrawDropMark(Graphics::TCanvas* ACanvas, const Types::TRect &DropMark); +extern PACKAGE void __fastcall SpDrawFocusRect(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); +extern PACKAGE void __fastcall SpDrawGlyphPattern(HDC DC, const Types::TRect &R, int Width, int Height, const void *PatternBits, Graphics::TColor PatternColor)/* overload */; +extern PACKAGE void __fastcall SpDrawGlyphPattern(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, int PatternIndex, Graphics::TColor PatternColor)/* overload */; +extern PACKAGE void __fastcall SpDrawXPButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, bool Pushed, bool HotTrack, bool Checked, bool Focused, bool Defaulted, TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPCheckBoxGlyph(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, Stdctrls::TCheckBoxState State, bool HotTrack, bool Pushed, TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPRadioButtonGlyph(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, bool Checked, bool HotTrack, bool Pushed, TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPEditFrame(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, bool HotTrack, TSpTBXSkinType SkinType, bool ClipContent = false, bool AutoAdjust = false)/* overload */; +extern PACKAGE void __fastcall SpDrawXPEditFrame(Controls::TWinControl* AWinControl, bool HotTracking, TSpTBXSkinType SkinType, bool AutoAdjust = false, bool HideFrame = false)/* overload */; +extern PACKAGE void __fastcall SpDrawXPGrip(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Graphics::TColor LoC, Graphics::TColor HiC); +extern PACKAGE void __fastcall SpDrawXPHeader(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool HotTrack, bool Pushed, TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpDrawXPListItemBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool HotTrack, bool Pushed, bool Focused, TSpTBXSkinType SkinType); +extern PACKAGE void __fastcall SpPaintSkinBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, TSpTBXSkinOptionCategory* SkinOption, bool Vertical); +extern PACKAGE void __fastcall SpPaintSkinBorders(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, TSpTBXSkinOptionCategory* SkinOption, Controls::TAnchors ForceRectBorders = Controls::TAnchors() ); +extern PACKAGE bool __fastcall SpIsWinVistaOrUp(void); +extern PACKAGE bool __fastcall SpGetDirectories(System::WideString Path, Classes::TStringList* L); + +} /* namespace Sptbxskins */ +using namespace Sptbxskins; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxskinsHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.pas new file mode 100644 index 0000000..fb46d99 --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXSkins.pas @@ -0,0 +1,3494 @@ +unit SpTBXSkins; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development notes: + - All the Windows and Delphi bugs fixes are marked with '[Bugfix]'. + - All the theme changes and adjustments are marked with '[Theme-Change]'. + - DT_END_ELLIPSIS and DT_PATH_ELLIPSIS doesn't work with rotated text + http://support.microsoft.com/kb/249678 + +History: +8 May 2009 - version 2.4.2 + - No changes. + +15 March 2009 - version 2.4.1 + - Added OnSkinChange event to TSpTBXSkinManager. + +17 January 2009 - version 2.4 + - Minor Fixes. + +26 September 2008 - version 2.3 + - Fixed incorrect skin loading when the Aluminum skin was used, + thanks to Costas Stergiou for reporting this. + +29 July 2008 - version 2.2 + - Fixed incorrect menu items painting on Vista when the Windows + themes was disabled, thanks to Arvid for reporting this. + +26 June 2008 - version 2.1 + - Added Windows Vista specific constants to support Vista + themes on Delphi versions prior to 2007, thanks to Wolf B. + for his contribution. + +3 May 2008 - version 2.0 + - Renamed TSpTBXSkinOptions.TitleBarBorderSize to + FloatingWindowBorderSize. + +2 April 2008 - version 1.9.5 + - No changes. + +3 February 2008 - version 1.9.4 + - Added TitleBarBorderSize to the skins options. + +19 January 2008 - version 1.9.3 + - No changes. + +26 December 2007 - version 1.9.2 + - New gradient skin style added to mimic Vista toolbar gradients, use + 9 or 10 gradient style to paint vertically or horizontally. + +1 December 2007 - version 1.9.1 + - Added Header and Tabs Toolbar skinning. skncHeader and skncTabToolbar + skin elements were added to the skin components type. + - Added SpDrawXPHeader utility function to paint the header controls. + +20 November 2007 - version 1.9 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, Classes, SysUtils, Graphics, Controls, StdCtrls, + ImgList, IniFiles; + +const + WM_SPSKINCHANGE = WM_APP + 2007; // Skin change notification message + + { Windows Vista theme painting constants } + MENU_POPUPBACKGROUND = 9; + MENU_POPUPBORDERS = 10; + MENU_POPUPCHECK = 11; + MENU_POPUPCHECKBACKGROUND = 12; + MENU_POPUPGUTTER = 13; + MENU_POPUPITEM = 14; + MENU_POPUPSEPARATOR = 15; + MPI_NORMAL = 1; + MPI_HOT = 2; + MPI_DISABLED = 3; + MPI_DISABLEDHOT = 4; + MCB_DISABLED = 1; + MCB_NORMAL = 2; + MCB_BITMAP = 3; + MC_CHECKMARKNORMAL = 1; + MC_CHECKMARKDISABLED = 2; + MC_BULLETNORMAL = 3; + MC_BULLETDISABLED = 4; + +type + { Skins } + + TSpTBXSkinType = ( + sknNone, // No themes + sknWindows, // Use Windows themes + sknSkin // Use Skins + ); + + TSpTBXLunaScheme = ( + lusBlue, + lusMetallic, + lusGreen, + lusUnknown + ); + + TSpTBXSkinComponentsType = ( + skncDock, + skncDockablePanel, + skncDockablePanelTitleBar, + skncGutter, + skncMenuBar, + skncOpenToolbarItem, + skncPanel, + skncPopup, + skncSeparator, + skncSplitter, + skncStatusBar, + skncStatusBarGrip, + skncTabBackground, + skncTabToolbar, + skncToolbar, + skncToolbarGrip, + skncWindow, + skncWindowTitleBar, + + // Multiple States + skncMenuBarItem, + skncMenuItem, + skncToolbarItem, + skncButton, + skncCheckBox, + skncEditButton, + skncEditFrame, + skncHeader, + skncLabel, + skncListItem, + skncProgressBar, + skncRadioButton, + skncTab, + skncTrackBar, + skncTrackBarButton + ); + TSpTBXSkinStatesType = (sknsNormal, sknsDisabled, sknsHotTrack, sknsPushed, sknsChecked, sknsCheckedAndHotTrack); + + TSpTBXSkinStatesSet = set of TSpTBXSkinStatesType; + + TSpTBXSkinPartsType = (sknpBody, sknpBorders, sknpText); + + TSpTBXSkinComponentsIdentEntry = record + Name: string; + States: TSpTBXSkinStatesSet; + end; + +const + SpTBXSkinMultiStateComponents: set of TSpTBXSkinComponentsType = [skncMenuBarItem..High(TSpTBXSkinComponentsType)]; + + CSpTBXSkinAllStates = [Low(TSpTBXSkinStatesType)..High(TSpTBXSkinStatesType)]; + CSpTBXSkinComponents: array [TSpTBXSkinComponentsType] of TSpTBXSkinComponentsIdentEntry = ( + // Single state Components + (Name: 'Dock'; States: [sknsNormal]), + (Name: 'DockablePanel'; States: [sknsNormal]), + (Name: 'DockablePanelTitleBar'; States: [sknsNormal]), + (Name: 'Gutter'; States: [sknsNormal]), + (Name: 'MenuBar'; States: [sknsNormal]), + (Name: 'OpenToolbarItem'; States: [sknsNormal]), + (Name: 'Panel'; States: [sknsNormal]), + (Name: 'Popup'; States: [sknsNormal]), + (Name: 'Separator'; States: [sknsNormal]), + (Name: 'Splitter'; States: [sknsNormal]), + (Name: 'StatusBar'; States: [sknsNormal]), + (Name: 'StatusBarGrip'; States: [sknsNormal]), + (Name: 'TabBackground'; States: [sknsNormal]), + (Name: 'TabToolbar'; States: [sknsNormal]), + (Name: 'Toolbar'; States: [sknsNormal]), + (Name: 'ToolbarGrip'; States: [sknsNormal]), + (Name: 'Window'; States: [sknsNormal]), + (Name: 'WindowTitleBar'; States: [sknsNormal]), + // Multi state Components + (Name: 'MenuBarItem'; States: CSpTBXSkinAllStates), + (Name: 'MenuItem'; States: CSpTBXSkinAllStates), + (Name: 'ToolbarItem'; States: CSpTBXSkinAllStates), + (Name: 'Button'; States: CSpTBXSkinAllStates), + (Name: 'CheckBox'; States: CSpTBXSkinAllStates), + (Name: 'EditButton'; States: CSpTBXSkinAllStates), + (Name: 'EditFrame'; States: [sknsNormal, sknsDisabled, sknsHotTrack]), + (Name: 'Header'; States: [sknsNormal, sknsDisabled, sknsHotTrack, sknsPushed]), + (Name: 'Label'; States: [sknsNormal, sknsDisabled]), + (Name: 'ListItem'; States: [sknsHotTrack]), + (Name: 'ProgressBar'; States: [sknsNormal, sknsHotTrack]), + (Name: 'RadioButton'; States: CSpTBXSkinAllStates), + (Name: 'Tab'; States: CSpTBXSkinAllStates), + (Name: 'TrackBar'; States: [sknsNormal, sknsHotTrack]), + (Name: 'TrackBarButton'; States: [sknsNormal, sknsPushed]) + ); + + SSpTBXSkinStatesString: array [TSpTBXSkinStatesType] of string = ('Normal', 'Disabled', 'HotTrack', 'Pushed', 'Checked', 'CheckedAndHotTrack'); + SSpTBXSkinDisplayStatesString: array [TSpTBXSkinStatesType] of string = ('Normal', 'Disabled', 'Hot', 'Pushed', 'Checked', 'Checked && Hot'); + +type + { Text } + + TSpTextRotationAngle = ( + tra0, // No rotation + tra90, // 90 degree rotation + tra270 // 270 degree rotation + ); + + TSpTBXTextInfo = record + Text: WideString; + TextAngle: TSpTextRotationAngle; + TextFlags: Cardinal; + TextSize: TSize; + IsCaptionShown: Boolean; + IsTextRotated: Boolean; + end; + + TSpGlyphLayout = ( + ghlGlyphLeft, // Glyph icon on the left of the caption + ghlGlyphTop // Glyph icon on the top of the caption + ); + + TSpGlowDirection = ( + gldNone, // No glow + gldAll, // Glow on Left, Top, Right and Bottom of the text + gldTopLeft, // Glow on Top-Left of the text + gldBottomRight // Glow on Bottom-Right of the text + ); + + { MenuItem } + + TSpTBXComboPart = (cpNone, cpCombo, cpSplitLeft, cpSplitRight); + TSpTBXMenuItemMarginsInfo = record + Margins: TRect; // MenuItem margins + GutterSize: Integer; // Size of the gutter + LeftCaptionMargin: Integer; // Left margin of the caption + RightCaptionMargin: Integer; // Right margin of the caption + ImageTextSpace: Integer; // Space between the Icon and the caption + end; + + TSpTBXMenuItemInfo = record + Enabled: Boolean; + HotTrack: Boolean; + Pushed: Boolean; + Checked: Boolean; + HasArrow: Boolean; + ImageShown: Boolean; + ImageOrCheckShown: Boolean; + ImageSize: TSize; + RightImageSize: TSize; + IsDesigning: Boolean; + IsOnMenuBar: Boolean; + IsOnToolbox: Boolean; + IsOpen: Boolean; + IsSplit: Boolean; + IsSunkenCaption: Boolean; + IsVertical: Boolean; + MenuMargins: TSpTBXMenuItemMarginsInfo; // Used only on menu items + ComboPart: TSpTBXComboPart; + ComboRect: TRect; + ComboState: TSpTBXSkinStatesType; + ToolbarStyle: Boolean; + State: TSpTBXSkinStatesType; + SkinType: TSpTBXSkinType; + end; + + { Colors } + + TSpTBXColorTextType = ( + cttDefault, // Default format (clWhite, $FFFFFF) + cttHTML, // HTML format (#FFFFFF) + cttIdentAndHTML // Use color idents (clWhite), if not possible use HTML format + ); + + { TSpTBXSkinOptions } + + TSpTBXSkinOptionEntry = class(TPersistent) + private + FSkinType: Integer; + FColor1, FColor2, FColor3, FColor4: TColor; + protected + procedure AssignTo(Dest: TPersistent); override; + public + constructor Create; virtual; + procedure Fill(ASkinType: Integer; AColor1, AColor2, AColor3, AColor4: TColor); + procedure ReadFromString(S: string); + function WriteToString: string; + function IsEmpty: Boolean; + function IsEqual(AOptionEntry: TSpTBXSkinOptionEntry): Boolean; + procedure Reset; + published + property SkinType: Integer read FSkinType write FSkinType; + property Color1: TColor read FColor1 write FColor1; + property Color2: TColor read FColor2 write FColor2; + property Color3: TColor read FColor3 write FColor3; + property Color4: TColor read FColor4 write FColor4; + end; + + TSpTBXSkinOptionCategory = class(TPersistent) + private + FBody: TSpTBXSkinOptionEntry; + FBorders: TSpTBXSkinOptionEntry; + FTextColor: TColor; + protected + procedure AssignTo(Dest: TPersistent); override; + public + constructor Create; virtual; + destructor Destroy; override; + function IsEmpty: Boolean; + procedure Reset; + procedure LoadFromIni(MemIni: TMemIniFile; Section, Ident: string); + procedure SaveToIni(MemIni: TMemIniFile; Section, Ident: string); + published + property Body: TSpTBXSkinOptionEntry read FBody write FBody; + property Borders: TSpTBXSkinOptionEntry read FBorders write FBorders; + property TextColor: TColor read FTextColor write FTextColor; + end; + + TSpTBXSkinOptions = class(TPersistent) + private + FColorBtnFace: TColor; + FFloatingWindowBorderSize: Integer; + FOptions: array [TSpTBXSkinComponentsType, TSpTBXSkinStatesType] of TSpTBXSkinOptionCategory; + FOfficeIcons: Boolean; + FOfficeMenuSeparator: Boolean; + FOfficeStatusBar: Boolean; + FSkinAuthor: string; + FSkinName: string; + function GetOfficeIcons: Boolean; + function GetOfficeMenuSeparator: Boolean; + function GetOfficePopup: Boolean; + function GetOfficeStatusBar: Boolean; + function GetFloatingWindowBorderSize: Integer; + procedure SetFloatingWindowBorderSize(const Value: Integer); + protected + procedure AssignTo(Dest: TPersistent); override; + procedure BroadcastChanges; + public + constructor Create; virtual; + destructor Destroy; override; + procedure CopyOptions(AComponent, ToComponent: TSpTBXSkinComponentsType); + procedure FillOptions; virtual; + function Options(Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType): TSpTBXSkinOptionCategory; overload; + function Options(Component: TSpTBXSkinComponentsType): TSpTBXSkinOptionCategory; overload; + procedure LoadFromFile(Filename: WideString); + procedure LoadFromStrings(L: TStrings); virtual; + procedure SaveToFile(Filename: WideString); + procedure SaveToStrings(L: TStrings); virtual; + procedure SaveToMemIni(MemIni: TMemIniFile); virtual; + procedure Reset(ForceResetSkinProperties: Boolean = False); + + // Metrics + procedure GetDropDownArrowSize(out DropDownArrowSize, DropDownArrowMargin, SplitBtnArrowSize: Integer); virtual; + procedure GetMenuItemMargins(ACanvas: TCanvas; ImgSize: Integer; out MarginsInfo: TSpTBXMenuItemMarginsInfo); virtual; + function GetState(Enabled, Pushed, HotTrack, Checked: Boolean): TSpTBXSkinStatesType; + function GetTextColor(Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; SkinType: TSpTBXSkinType = sknSkin): TColor; virtual; + + // Skin Paint + procedure PaintBackground(ACanvas: TCanvas; ARect: TRect; Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; Background, Borders: Boolean; Vertical: Boolean = False; ForceRectBorders: TAnchors = []); virtual; + + // Element Paint + procedure PaintMenuCheckMark(ACanvas: TCanvas; ARect: TRect; Checked, Grayed, MenuItemStyle: Boolean; State: TSpTBXSkinStatesType); virtual; + procedure PaintMenuRadioMark(ACanvas: TCanvas; ARect: TRect; Checked, MenuItemStyle: Boolean; State: TSpTBXSkinStatesType); virtual; + procedure PaintWindowFrame(ACanvas: TCanvas; ARect: TRect; IsActive, DrawBody: Boolean; BorderSize: Integer = 4); virtual; + + // Properties + property ColorBtnFace: TColor read FColorBtnFace write FColorBtnFace; + property FloatingWindowBorderSize: Integer read GetFloatingWindowBorderSize write SetFloatingWindowBorderSize; + property OfficeIcons: Boolean read GetOfficeIcons write FOfficeIcons; + property OfficeMenuSeparator: Boolean read GetOfficeMenuSeparator write FOfficeMenuSeparator; + property OfficePopup: Boolean read GetOfficePopup; + property OfficeStatusBar: Boolean read GetOfficeStatusBar write FOfficeStatusBar; + property SkinAuthor: string read FSkinAuthor write FSkinAuthor; + property SkinName: string read FSkinName write FSkinName; + end; + + TSpTBXSkinOptionsClass = class of TSpTBXSkinOptions; + + { TSpTBXSkinsList } + + TSpTBXSkinsListEntry = class + public + SkinClass: TSpTBXSkinOptionsClass; + SkinStrings: TStringList; + destructor Destroy; override; + end; + + TSpTBXSkinsList = class(TStringList) + private + function GetSkinOption(Index: Integer): TSpTBXSkinsListEntry; + public + procedure Delete(Index: Integer); override; + destructor Destroy; override; + function AddSkin(SkinName: string; SkinClass: TSpTBXSkinOptionsClass): Integer; overload; + function AddSkin(SkinOptions: TStrings): Integer; overload; + function AddSkinFromFile(Filename: WideString): Integer; + procedure AddSkinsFromFolder(Folder: WideString); + procedure GetSkinNames(SkinNames: TStrings); + property SkinOptions[Index: Integer]: TSpTBXSkinsListEntry read GetSkinOption; + end; + + { TSpTBXSkinManager } + + TSpTBXSkinManager = class + private + FCurrentSkin: TSpTBXSkinOptions; + FNotifies: TList; + FSkinsList: TSpTBXSkinsList; + FOnSkinChange: TNotifyEvent; + procedure Broadcast; + function GetCurrentSkinName: string; + public + constructor Create; virtual; + destructor Destroy; override; + + function GetSkinType: TSpTBXSkinType; + function IsDefaultSkin: Boolean; + function IsXPThemesEnabled: Boolean; + + procedure AddSkinNotification(AObject: TObject); + procedure RemoveSkinNotification(AObject: TObject); + procedure BroadcastSkinNotification; + + procedure LoadFromFile(Filename: WideString); + procedure SaveToFile(Filename: WideString); + + procedure SetToDefaultSkin; + procedure SetSkin(SkinName: string); + procedure ChangeControlSkinType(Control: TWinControl; SkinType: TSpTBXSkinType; Recursive: Boolean = True); + + property CurrentSkin: TSpTBXSkinOptions read FCurrentSkin; + property CurrentSkinName: string read GetCurrentSkinName; + property SkinsList: TSpTBXSkinsList read FSkinsList; + property OnSkinChange: TNotifyEvent read FOnSkinChange write FOnSkinChange; + end; + + { TSpTBXSkinSwitcher } + + TSpTBXSkinSwitcher = class(TComponent) + private + FOnSkinChange: TNotifyEvent; + function GetSkin: string; + procedure SetSkin(const Value: string); + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property Skin: string read GetSkin write SetSkin; + property OnSkinChange: TNotifyEvent read FOnSkinChange write FOnSkinChange; + end; + + { TSpPrintWindow } + // Use SpPrintWindow instead of PaintTo as many controls will not render + // properly (no text on editors, no scrollbars, incorrect borders, etc) + // http://msdn2.microsoft.com/en-us/library/ms535695.aspx + TSpPrintWindow = function(Hnd: HWND; HdcBlt: HDC; nFlags: UINT): BOOL; stdcall; + +{ Themes } +function SkinManager: TSpTBXSkinManager; +function CurrentSkin: TSpTBXSkinOptions; +function SpTBXSkinType(T: TSpTBXSkinType): TSpTBXSkinType; +function SpGetLunaScheme: TSpTBXLunaScheme; +procedure SpDrawParentBackground(Control: TControl; DC: HDC; R: TRect); + +{ WideString helpers } +function SpCreateRotatedFont(DC: HDC; Orientation: Integer = 2700): HFONT; +function SpDrawRotatedText(const DC: HDC; AText: WideString; var ARect: TRect; const AFormat: Cardinal; RotationAngle: TSpTextRotationAngle = tra270): Integer; +function SpCalcXPText(ACanvas: TCanvas; ARect: TRect; Caption: WideString; CaptionAlignment: TAlignment; Flags: Cardinal; GlyphSize, RightGlyphSize: TSize; Layout: TSpGlyphLayout; PushedCaption: Boolean; out ACaptionRect, AGlyphRect, ARightGlyphRect: TRect; RotationAngle: TSpTextRotationAngle = tra0): Integer; +function SpDrawXPText(ACanvas: TCanvas; Caption: WideString; var ARect: TRect; Flags: Cardinal; CaptionGlow: TSpGlowDirection = gldNone; CaptionGlowColor: TColor = clYellow; RotationAngle: TSpTextRotationAngle = tra0): Integer; overload; +function SpDrawXPText(ACanvas: TCanvas; ARect: TRect; Caption: WideString; CaptionGlow: TSpGlowDirection; CaptionGlowColor: TColor; CaptionAlignment: TAlignment; Flags: Cardinal; GlyphSize: TSize; Layout: TSpGlyphLayout; PushedCaption: Boolean; out ACaptionRect, AGlyphRect: TRect; RotationAngle: TSpTextRotationAngle = tra0): Integer; overload; +function SpDrawXPText(ACanvas: TCanvas; ARect: TRect; Caption: WideString; CaptionGlow: TSpGlowDirection; CaptionGlowColor: TColor; CaptionAlignment: TAlignment; Flags: Cardinal; IL: TCustomImageList; ImageIndex: Integer; Layout: TSpGlyphLayout; Enabled, PushedCaption, DisabledIconCorrection: Boolean; out ACaptionRect, AGlyphRect: TRect; RotationAngle: TSpTextRotationAngle = tra0): Integer; overload; +function SpGetTextSize(DC: HDC; WS: WideString; NoPrefix: Boolean): TSize; +function SpGetControlTextHeight(AControl: TControl; AFont: TFont): Integer; +function SpGetControlTextSize(AControl: TControl; AFont: TFont; WS: WideString): TSize; +function SpSameText(W1, W2: WideString): Boolean; +function SpStripAccelChars(S: WideString): WideString; +function SpStripShortcut(S: WideString): WideString; +function SpStripTrailingPunctuation(S: WideString): WideString; +function SpRectToString(R: TRect): string; +function SpStringToRect(S: string; out R: TRect): Boolean; + +{ Color helpers } +function SpColorToHTML(const Color: TColor): string; +function SpColorToString(const Color: TColor; TextType: TSpTBXColorTextType = cttDefault): string; +function SpStringToColor(S: string; out Color: TColor): Boolean; +procedure SpGetRGB(Color: TColor; out R, G, B: Integer); +function SpRGBToColor(R, G, B: Integer): TColor; +function SpLighten(Color: TColor; Amount: Integer): TColor; +function SpBlendColors(TargetColor, BaseColor: TColor; Percent: Integer): TColor; +function SpMixColors(TargetColor, BaseColor: TColor; Amount: Byte): TColor; + +{ Painting helpers } +function SpCenterRect(Parent: TRect; ChildWidth, ChildHeight: Integer): TRect; overload; +function SpCenterRect(Parent, Child: TRect): TRect; overload; +function SpCenterRectHoriz(Parent: TRect; ChildWidth: Integer): TRect; +function SpCenterRectVert(Parent: TRect; ChildHeight: Integer): TRect; +procedure SpFillRect(ACanvas: TCanvas; const ARect: TRect; BrushColor: TColor; PenColor: TColor = clNone); +procedure SpDrawLine(ACanvas: TCanvas; X1, Y1, X2, Y2: Integer; Color: TColor); +procedure SpDrawRectangle(ACanvas: TCanvas; ARect: TRect; CornerSize: Integer; ColorTL, ColorBR: TColor; ColorTLInternal: TColor = clNone; ColorBRInternal: TColor = clNone; ForceRectBorders: TAnchors = []); overload; +procedure SpDrawRectangle(ACanvas: TCanvas; ARect: TRect; CornerSize: Integer; ColorL, ColorT, ColorR, ColorB, InternalColorL, InternalColorT, InternalColorR, InternalColorB: TColor; ForceRectBorders: TAnchors = []); overload; +procedure SpAlphaBlend(SrcDC, DstDC: HDC; SrcR, DstR: TRect; Alpha: Byte; SrcHasAlphaChannel: Boolean = False); +procedure SpPaintTo(WinControl: TWinControl; ACanvas: TCanvas; X, Y: Integer); + +{ ImageList painting } +procedure SpDrawIconShadow(ACanvas: TCanvas; const ARect: TRect; ImageList: TCustomImageList; ImageIndex: Integer); +procedure SpDrawImageList(ACanvas: TCanvas; const ARect: TRect; ImageList: TCustomImageList; ImageIndex: Integer; Enabled, DisabledIconCorrection: Boolean); + +{ Gradients } +procedure SpGradient(ACanvas: TCanvas; const ARect: TRect; StartPos, EndPos, ChunkSize: Integer; C1, C2: TColor; const Vertical: Boolean); +procedure SpGradientFill(ACanvas: TCanvas; const ARect: TRect; const C1, C2: TColor; const Vertical: Boolean); +procedure SpGradientFillMirror(ACanvas: TCanvas; const ARect: TRect; const C1, C2, C3, C4: TColor; const Vertical: Boolean); +procedure SpGradientFillMirrorTop(ACanvas: TCanvas; const ARect: TRect; const C1, C2, C3, C4: TColor; const Vertical: Boolean); +procedure SpGradientFillGlass(ACanvas: TCanvas; const ARect: TRect; const C1, C2, C3, C4: TColor; const Vertical: Boolean); + +{ Element painting } +procedure SpDrawArrow(ACanvas: TCanvas; X, Y: Integer; AColor: TColor; Vertical, Reverse: Boolean; Size: Integer); +procedure SpDrawDropMark(ACanvas: TCanvas; DropMark: TRect); +procedure SpDrawFocusRect(ACanvas: TCanvas; const ARect: TRect); +procedure SpDrawGlyphPattern(DC: HDC; const R: TRect; Width, Height: Integer; const PatternBits; PatternColor: TColor); overload; +procedure SpDrawGlyphPattern(ACanvas: TCanvas; ARect: TRect; PatternIndex: Integer; PatternColor: TColor); overload; +procedure SpDrawXPButton(ACanvas: TCanvas; ARect: TRect; Enabled, Pushed, HotTrack, Checked, Focused, Defaulted: Boolean; SkinType: TSpTBXSkinType); +procedure SpDrawXPCheckBoxGlyph(ACanvas: TCanvas; ARect: TRect; Enabled: Boolean; State: TCheckBoxState; HotTrack, Pushed: Boolean; SkinType: TSpTBXSkinType); +procedure SpDrawXPRadioButtonGlyph(ACanvas: TCanvas; ARect: TRect; Enabled, Checked, HotTrack, Pushed: Boolean; SkinType: TSpTBXSkinType); +procedure SpDrawXPEditFrame(ACanvas: TCanvas; ARect: TRect; Enabled, HotTrack: Boolean; SkinType: TSpTBXSkinType; ClipContent: Boolean = False; AutoAdjust: Boolean = False); overload; +procedure SpDrawXPEditFrame(AWinControl: TWinControl; HotTracking: Boolean; SkinType: TSpTBXSkinType; AutoAdjust: Boolean = False; HideFrame: Boolean = False); overload; +procedure SpDrawXPGrip(ACanvas: TCanvas; ARect: TRect; LoC, HiC: TColor); +procedure SpDrawXPHeader(ACanvas: TCanvas; ARect: TRect; HotTrack, Pushed: Boolean; SkinType: TSpTBXSkinType); +procedure SpDrawXPListItemBackground(ACanvas: TCanvas; ARect: TRect; HotTrack, Pushed, Focused: Boolean; SkinType: TSpTBXSkinType); + +{ Skins painting } +procedure SpPaintSkinBackground(ACanvas: TCanvas; ARect: TRect; SkinOption: TSpTBXSkinOptionCategory; Vertical: Boolean); +procedure SpPaintSkinBorders(ACanvas: TCanvas; ARect: TRect; SkinOption: TSpTBXSkinOptionCategory; ForceRectBorders: TAnchors = []); + +{ Misc } +function SpIsWinVistaOrUp: Boolean; +function SpGetDirectories(Path: WideString; L: TStringList): Boolean; + +{ Stock Objects } +var + StockBitmap: TBitmap; + SpPrintWindow: TSpPrintWindow = nil; + +implementation + +uses + UxTheme, Themes, Forms, Math, TypInfo, SpTBXDefaultSkins; + +var + FInternalSkinManager: TSpTBXSkinManager = nil; + +const + ROP_DSPDxax = $00E20746; + +type + TControlAccess = class(TControl); + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Skin Notification } + +function SkinManager: TSpTBXSkinManager; +begin + if not Assigned(FInternalSkinManager) then + FInternalSkinManager := TSpTBXSkinManager.Create; + Result := FInternalSkinManager; +end; + +function CurrentSkin: TSpTBXSkinOptions; +begin + Result := SkinManager.CurrentSkin; +end; + +function SpTBXSkinType(T: TSpTBXSkinType): TSpTBXSkinType; +begin + Result := T; + if (Result = sknSkin) and SkinManager.IsDefaultSkin then + Result := sknWindows; + if (Result = sknWindows) and not SkinManager.IsXPThemesEnabled then + Result := sknNone; +end; + +function SpGetLunaScheme: TSpTBXLunaScheme; +const + MaxChars = 1024; +var + pszThemeFileName, pszColorBuff, pszSizeBuf: PWideChar; + S: string; +begin + Result := lusUnknown; + + if SkinManager.IsXPThemesEnabled then begin + GetMem(pszThemeFileName, 2 * MaxChars); + GetMem(pszColorBuff, 2 * MaxChars); + GetMem(pszSizeBuf, 2 * MaxChars); + try + if not Failed(GetCurrentThemeName(pszThemeFileName, MaxChars, pszColorBuff, MaxChars, pszSizeBuf, MaxChars)) then + if UpperCase(ExtractFileName(pszThemeFileName)) = 'LUNA.MSSTYLES' then begin + S := UpperCase(pszColorBuff); + if S = 'NORMALCOLOR' then + Result := lusBlue + else if S = 'METALLIC' then + Result := lusMetallic + else if S = 'HOMESTEAD' then + Result := lusGreen; + end; + finally + FreeMem(pszSizeBuf); + FreeMem(pszColorBuff); + FreeMem(pszThemeFileName); + end; + end; +end; + +procedure SpDrawParentBackground(Control: TControl; DC: HDC; R: TRect); +// Delphi 2007 and Vista compatible +var + Parent: TWinControl; + P: TPoint; + Brush: HBRUSH; +begin + Parent := Control.Parent; + if Parent = nil then begin + Brush := CreateSolidBrush(ColorToRGB(clBtnFace)); + Windows.FillRect(DC, R, Brush); + end + else if Parent.HandleAllocated then begin + if not Parent.DoubleBuffered and (Control is TWinControl) and SkinManager.IsXPThemesEnabled then + UxTheme.DrawThemeParentBackground(TWinControl(Control).Handle, DC, @R) + else begin + // Same as Controls.PerformEraseBackground + GetWindowOrgEx(DC, P); + SetWindowOrgEx(DC, P.X + Control.Left, P.Y + Control.Top, nil); + Parent.Perform(WM_ERASEBKGND, Integer(DC), Integer(DC)); + SetWindowOrgEx(DC, P.X, P.Y, nil); + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ WideString helpers} + +function EnumFontsProc(const lplf: TLogFont; const lptm: TTextMetric; + dwType: DWORD; lpData: LPARAM): Integer; stdcall; +begin + Boolean(Pointer(lpData)^) := True; + Result := 0; +end; + +function SpCreateRotatedFont(DC: HDC; Orientation: Integer = 2700): HFONT; +var + LogFont: TLogFont; + TM: TTextMetric; + VerticalFontName: array[0..LF_FACESIZE-1] of Char; + VerticalFontExists: Boolean; +begin + if GetObject(GetCurrentObject(DC, OBJ_FONT), SizeOf(LogFont), + @LogFont) = 0 then begin + { just in case... } + Result := 0; + Exit; + end; + LogFont.lfEscapement := Orientation; + LogFont.lfOrientation := Orientation; + LogFont.lfOutPrecision := OUT_TT_ONLY_PRECIS; { needed for Win9x } + + { Don't let a random TrueType font be substituted when MS Sans Serif or + Microsoft Sans Serif are used. On Windows 2000 and later, hard-code Tahoma + because Arial can't display Japanese or Thai Unicode characters (on Windows + 2000 at least). On earlier versions, hard-code Arial since NT 4.0 doesn't + ship with Tahoma, and 9x doesn't do Unicode. } + if (StrIComp(LogFont.lfFaceName, 'MS Sans Serif') = 0) or + (StrIComp(LogFont.lfFaceName, 'Microsoft Sans Serif') = 0) then begin + if Win32MajorVersion >= 5 then + StrPCopy(LogFont.lfFaceName, 'Tahoma') + else + StrPCopy(LogFont.lfFaceName, 'Arial'); + { Set lfHeight to the actual height of the current font. This is needed + to work around a Windows 98 issue: on a clean install of the OS, + SPI_GETNONCLIENTMETRICS returns -5 for lfSmCaptionFont.lfHeight. This is + wrong; it should return -11 for an 8 pt font. With normal, unrotated text + this actually displays correctly, since MS Sans Serif doesn't support + sizes below 8 pt. However, when we change to a TrueType font like Arial, + this becomes a problem because it'll actually create a font that small. } + if GetTextMetrics(DC, TM) then begin + { If the original height was negative, keep it negative } + if LogFont.lfHeight <= 0 then + LogFont.lfHeight := -(TM.tmHeight - TM.tmInternalLeading) + else + LogFont.lfHeight := TM.tmHeight; + end; + end; + + { Use a vertical font if available so that Asian characters aren't drawn + sideways } + if StrLen(LogFont.lfFaceName) < SizeOf(VerticalFontName)-1 then begin + VerticalFontName[0] := '@'; + StrCopy(@VerticalFontName[1], LogFont.lfFaceName); + VerticalFontExists := False; + EnumFonts(DC, VerticalFontName, @EnumFontsProc, @VerticalFontExists); + if VerticalFontExists then + StrCopy(LogFont.lfFaceName, VerticalFontName); + end; + + Result := CreateFontIndirect(LogFont); +end; + +function SpDrawRotatedText(const DC: HDC; AText: WideString; var ARect: TRect; const AFormat: Cardinal; RotationAngle: TSpTextRotationAngle = tra270): Integer; +{ The format flag this function respects are + DT_CALCRECT, DT_NOPREFIX, DT_HIDEPREFIX, DT_CENTER, DT_END_ELLIPSIS, DT_NOCLIP } +var + RotatedFont, SaveFont: HFONT; + TextMetrics: TTextMetric; + X, Y, P, I, SU, FU, W: Integer; + SaveAlign: UINT; + Clip: Boolean; + Pen, SavePen: HPEN; + Sz: TSize; + Orientation: Integer; +begin + Result := 0; + if Length(AText) = 0 then Exit; + + Orientation := 0; + case RotationAngle of + tra90: Orientation := 900; // 90 degrees + tra270: Orientation := 2700; // 270 degrees + end; + RotatedFont := SpCreateRotatedFont(DC, Orientation); + SaveFont := SelectObject(DC, RotatedFont); + + GetTextMetrics(DC, TextMetrics); + X := ARect.Left + (ARect.Right - ARect.Left - TextMetrics.tmHeight) div 2; + + Clip := AFormat and DT_NOCLIP = 0; + + { Find the index of the character that should be underlined. Delete '&' + characters from the string. Like DrawText, only the last prefixed character + will be underlined. } + P := 0; + I := 1; + if AFormat and DT_NOPREFIX = 0 then + while I <= Length(AText) do + begin + if AText[I] = '&' then + begin + Delete(AText, I, 1); + if PWideChar(AText)[I - 1] <> '&' then P := I; + end; + Inc(I); + end; + + if AFormat and DT_END_ELLIPSIS <> 0 then + begin + if (Length(AText) > 1) and (SpGetTextSize(DC, AText, False).cx > ARect.Bottom - ARect.Top) then + begin + W := ARect.Bottom - ARect.Top; + if W > 2 then + begin + Delete(AText, Length(AText), 1); + while (Length(AText) > 1) and (SpGetTextSize(DC, AText + '...', False).cx > W) do + Delete(AText, Length(AText), 1); + end + else AText := AText[1]; + if P > Length(AText) then P := 0; + AText := AText + '...'; + end; + end; + + Sz := SpGetTextSize(DC, AText, False); + Result := Sz.cy; + + if AFormat and DT_CALCRECT <> 0 then begin + ARect.Right := ARect.Left + Sz.cy; + ARect.Bottom := ARect.Top + Sz.cx; + end + else begin + if AFormat and DT_CENTER <> 0 then + Y := ARect.Top + (ARect.Bottom - ARect.Top - Sz.cx) div 2 + else + Y := ARect.Top; + + if Clip then + begin + SaveDC(DC); + with ARect do IntersectClipRect(DC, Left, Top, Right, Bottom); + end; + + case RotationAngle of + tra90: SaveAlign := SetTextAlign(DC, TA_RIGHT); + tra270: SaveAlign := SetTextAlign(DC, TA_BOTTOM); + else + SaveAlign := SetTextAlign(DC, TA_LEFT); + end; + + if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then + Windows.TextOutA(DC, X, Y, PAnsiChar(AnsiString(AText)), Length(AnsiString(AText))) + else + Windows.TextOutW(DC, X, Y, PWideChar(AText), Length(AText)); + + SetTextAlign(DC, SaveAlign); + + { Underline } + if (P > 0) and (AFormat and DT_HIDEPREFIX = 0) then + begin + SU := SpGetTextSize(DC, Copy(AText, 1, P - 1), False).cx; + FU := SU + SpGetTextSize(DC, PWideChar(AText)[P - 1], False).cx; + Inc(X, TextMetrics.tmDescent - 2); + Pen := CreatePen(PS_SOLID, 1, GetTextColor(DC)); + SavePen := SelectObject(DC, Pen); + MoveToEx(DC, X, Y + SU, nil); + LineTo(DC, X, Y + FU); + SelectObject(DC, SavePen); + DeleteObject(Pen); + end; + + if Clip then RestoreDC(DC, -1); + end; + + SelectObject(DC, SaveFont); + DeleteObject(RotatedFont); +end; + +function SpCalcXPText(ACanvas: TCanvas; ARect: TRect; Caption: WideString; + CaptionAlignment: TAlignment; Flags: Cardinal; GlyphSize, RightGlyphSize: TSize; + Layout: TSpGlyphLayout; PushedCaption: Boolean; out ACaptionRect, AGlyphRect, ARightGlyphRect: TRect; + RotationAngle: TSpTextRotationAngle = tra0): Integer; +var + R: TRect; + TextOffset, Spacing, RightSpacing: TPoint; + CaptionSz: TSize; +begin + Result := 0; + ACaptionRect := Rect(0, 0, 0, 0); + AGlyphRect := Rect(0, 0, 0, 0); + ARightGlyphRect := Rect(0, 0, 0, 0); + TextOffset := Point(0, 0); + Spacing := Point(0, 0); + RightSpacing := Point(0, 0); + if (Caption <> '') and (GlyphSize.cx > 0) and (GlyphSize.cy > 0) then + Spacing := Point(4, 1); + if (Caption <> '') and (RightGlyphSize.cx > 0) and (RightGlyphSize.cy > 0) then + RightSpacing := Point(4, 1); + + Flags := Flags and not DT_CENTER; + Flags := Flags and not DT_VCENTER; + if CaptionAlignment = taRightJustify then + Flags := Flags or DT_RIGHT; + + // DT_END_ELLIPSIS and DT_PATH_ELLIPSIS doesn't work with rotated text + // http://support.microsoft.com/kb/249678 + // Revert the ARect if the text is rotated, from now on work on horizontal text !!! + if RotationAngle <> tra0 then + ARect := Rect(ARect.Top, ARect.Left, ARect.Bottom, ARect.Right); + + // Get the caption size + if ((Flags and DT_WORDBREAK) <> 0) or ((Flags and DT_END_ELLIPSIS) <> 0) or ((Flags and DT_PATH_ELLIPSIS) <> 0) then begin + if Layout = ghlGlyphLeft then // Glyph on left or right side + R := Rect(0, 0, ARect.Right - ARect.Left - GlyphSize.cx - Spacing.X - RightGlyphSize.cx - RightSpacing.X + 2, 1) + else // Glyph on top + R := Rect(0, 0, ARect.Right - ARect.Left + 2, 1); + end + else + R := Rect(0, 0, 1, 1); + + if (fsBold in ACanvas.Font.Style) and (RotationAngle = tra0) and (((Flags and DT_END_ELLIPSIS) <> 0) or ((Flags and DT_PATH_ELLIPSIS) <> 0)) then begin + // [Bugfix] Windows bug: + // When the Font is Bold and DT_END_ELLIPSIS or DT_PATH_ELLIPSIS is used + // DrawTextW returns an incorrect size if the string is unicode. + // The R.Right is reduced by 3 which cuts down the string and + // adds the ellipsis. + // We have to obtain the real size and check if it fits in the Rect. + CaptionSz := SpGetTextSize(ACanvas.Handle, Caption, True); + if CaptionSz.cx <= R.Right then begin + R := Rect(0, 0, CaptionSz.cx, CaptionSz.cy); + Result := CaptionSz.cy; + end; + end; + + if Result <= 0 then begin + Result := SpDrawXPText(ACanvas, Caption, R, Flags or DT_CALCRECT, gldNone, clYellow); + CaptionSz.cx := R.Right; + CaptionSz.cy := R.Bottom; + end; + + // ACaptionRect + if Result > 0 then begin + R.Top := ARect.Top + (ARect.Bottom - ARect.Top - CaptionSz.cy) div 2; // Vertically centered + R.Bottom := R.Top + CaptionSz.cy; + case CaptionAlignment of + taCenter: + R.Left := ARect.Left + (ARect.Right - ARect.Left - CaptionSz.cx) div 2; // Horizontally centered + taLeftJustify: + R.Left := ARect.Left; + taRightJustify: + R.Left := ARect.Right - CaptionSz.cx; + end; + R.Right := R.Left + CaptionSz.cx; + + // Since DT_END_ELLIPSIS and DT_PATH_ELLIPSIS doesn't work with rotated text + // try to fix it by padding the text 8 pixels to the right + if (RotationAngle <> tra0) and (R.Right + 8 < ARect.Right) then + if ((Flags and DT_END_ELLIPSIS) <> 0) or ((Flags and DT_PATH_ELLIPSIS) <> 0) then + R.Right := R.Right + 8; + + if PushedCaption then + OffsetRect(R, 1, 1); + + ACaptionRect := R; + end; + + // AGlyphRect + if (GlyphSize.cx > 0) and (GlyphSize.cy > 0) then begin + R := ARect; + + // If ghlGlyphTop is used the glyph should be centered + if Layout = ghlGlyphTop then + CaptionAlignment := taCenter; + + case CaptionAlignment of + taCenter: + begin + // Total width = Icon + Space + Text + if Layout = ghlGlyphLeft then begin + AGlyphRect.Left := R.Left + (R.Right - R.Left - (GlyphSize.cx + Spacing.X + CaptionSz.cx)) div 2; + TextOffset.X := (GlyphSize.cx + Spacing.X) div 2; + end + else + AGlyphRect.Left := R.Left + (R.Right - R.Left - GlyphSize.cx) div 2; + end; + taLeftJustify: + begin + AGlyphRect.Left := R.Left; + TextOffset.X := GlyphSize.cx + Spacing.X; + end; + taRightJustify: + begin + AGlyphRect.Left := R.Right - GlyphSize.cx; + TextOffset.X := - Spacing.X - GlyphSize.cx; + end; + end; + + if Layout = ghlGlyphLeft then + AGlyphRect.Top := R.Top + (R.Bottom - R.Top - GlyphSize.cy) div 2 + else begin + AGlyphRect.Top := R.Top + (R.Bottom - R.Top - (GlyphSize.cy + Spacing.Y + CaptionSz.cy)) div 2; + Inc(TextOffset.Y, (GlyphSize.cy + Spacing.Y) div 2); + end; + + AGlyphRect.Right := AGlyphRect.Left + GlyphSize.cx; + AGlyphRect.Bottom := AGlyphRect.Top + GlyphSize.cy; + + if PushedCaption then + OffsetRect(AGlyphRect, 1, 1); + end; + + // Move the text according to the icon position + if Result > 0 then + OffsetRect(ACaptionRect, TextOffset.X, TextOffset.Y); + + // ARightGlyphRect, it's valid only when using taLeftJustify + if (RightGlyphSize.cx > 0) and (RightGlyphSize.cy > 0) then + if CaptionAlignment = taLeftJustify then begin + R := ARect; + ARightGlyphRect.Left := R.Right - RightGlyphSize.cx; + ARightGlyphRect.Right := ARightGlyphRect.Left + RightGlyphSize.cx; + ARightGlyphRect.Top := R.Top + (R.Bottom - R.Top - RightGlyphSize.cy) div 2; + ARightGlyphRect.Bottom := ARightGlyphRect.Top + RightGlyphSize.cy; + if (Result > 0) and (ACaptionRect.Right > ARightGlyphRect.Left - RightSpacing.X) then + ACaptionRect.Right := ARightGlyphRect.Left - RightSpacing.X; + end; + + // Revert back, normalize when the text is rotated + if RotationAngle <> tra0 then begin + ACaptionRect := Rect(ACaptionRect.Top, ACaptionRect.Left, ACaptionRect.Bottom, ACaptionRect.Right); + AGlyphRect := Rect(AGlyphRect.Top, AGlyphRect.Left, AGlyphRect.Bottom, AGlyphRect.Right); + ARightGlyphRect := Rect(ARightGlyphRect.Top, ARightGlyphRect.Left, ARightGlyphRect.Bottom, ARightGlyphRect.Right); + end; +end; + +function SpDrawXPText(ACanvas: TCanvas; Caption: WideString; var ARect: TRect; + Flags: Cardinal; CaptionGlow: TSpGlowDirection = gldNone; + CaptionGlowColor: TColor = clYellow; RotationAngle: TSpTextRotationAngle = tra0): Integer; overload; + + function InternalDraw(var R: TRect): Integer; + begin + Result := 0; + case RotationAngle of + tra0: + if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then + Result := Windows.DrawTextA(ACanvas.Handle, PAnsiChar(AnsiString(Caption)), -1, R, Flags) + else + Result := Windows.DrawTextW(ACanvas.Handle, PWideChar(Caption), -1, R, Flags); + tra90, tra270: + Result := SpDrawRotatedText(ACanvas.Handle, Caption, R, Flags, RotationAngle); + end; + end; + +var + BS: TBrushStyle; + GlowR: TRect; + C, FC: TColor; +begin + BS := ACanvas.Brush.Style; + C := ACanvas.Brush.Color; + try + ACanvas.Brush.Style := bsClear; + + if (Flags and DT_CALCRECT = 0) and (CaptionGlow <> gldNone) then begin + FC := ACanvas.Font.Color; + ACanvas.Font.Color := CaptionGlowColor; + case CaptionGlow of + gldAll: + begin + GlowR := ARect; OffsetRect(GlowR, 0, -1); + InternalDraw(GlowR); + GlowR := ARect; OffsetRect(GlowR, 0, 1); + InternalDraw(GlowR); + GlowR := ARect; OffsetRect(GlowR, -1, 0); + InternalDraw(GlowR); + GlowR := ARect; OffsetRect(GlowR, 1, 0); + end; + gldTopLeft: + begin + GlowR := ARect; OffsetRect(GlowR, -1, -1); + InternalDraw(GlowR); + end; + gldBottomRight: + begin + GlowR := ARect; OffsetRect(GlowR, 1, 1); + InternalDraw(GlowR); + end; + end; + ACanvas.Font.Color := FC; + end; + + Result := InternalDraw(ARect); + + if IsRectEmpty(ARect) then + Result := 0 + else + if Flags and DT_CALCRECT <> 0 then begin + // [Bugfix] Windows bug: + // When DT_CALCRECT is used and the font is italic the + // resulting rect is incorrect + if fsItalic in ACanvas.Font.Style then + ARect.Right := ARect.Right + 1 + (ACanvas.Font.Size div 8) * 2; + end; + + finally + ACanvas.Brush.Style := BS; + ACanvas.Brush.Color := C; + end; +end; + +function SpDrawXPText(ACanvas: TCanvas; ARect: TRect; Caption: WideString; + CaptionGlow: TSpGlowDirection; CaptionGlowColor: TColor; CaptionAlignment: TAlignment; + Flags: Cardinal; GlyphSize: TSize; Layout: TSpGlyphLayout; PushedCaption: Boolean; + out ACaptionRect, AGlyphRect: TRect; + RotationAngle: TSpTextRotationAngle = tra0): Integer; overload; +var + DummyRightGlyphSize: TSize; + DummyRightGlyphRect: TRect; +begin + DummyRightGlyphSize.cx := 0; + DummyRightGlyphSize.cy := 0; + DummyRightGlyphRect := Rect(0, 0, 0, 0); + Result := SpCalcXPText(ACanvas, ARect, Caption, CaptionAlignment, Flags, GlyphSize, DummyRightGlyphSize, + Layout, PushedCaption, ACaptionRect, AGlyphRect, DummyRightGlyphRect, RotationAngle); + SpDrawXPText(ACanvas, Caption, ACaptionRect, Flags and not DT_CALCRECT, CaptionGlow, CaptionGlowColor, RotationAngle); +end; + +function SpDrawXPText(ACanvas: TCanvas; ARect: TRect; Caption: WideString; + CaptionGlow: TSpGlowDirection; CaptionGlowColor: TColor; CaptionAlignment: TAlignment; + Flags: Cardinal; IL: TCustomImageList; ImageIndex: Integer; Layout: TSpGlyphLayout; + Enabled, PushedCaption, DisabledIconCorrection: Boolean; out ACaptionRect, AGlyphRect: TRect; + RotationAngle: TSpTextRotationAngle = tra0): Integer; overload; +var + GlyphSize, DummyRightGlyphSize: TSize; + DummyRightGlyphRect: TRect; +begin + GlyphSize.cx := 0; + GlyphSize.cy := 0; + DummyRightGlyphSize.cx := 0; + DummyRightGlyphSize.cy := 0; + DummyRightGlyphRect := Rect(0, 0, 0, 0); + + if Assigned(IL) and (ImageIndex > -1) and (ImageIndex < IL.Count) then begin + GlyphSize.cx := IL.Width; + GlyphSize.cy := IL.Height; + end; + + Result := SpCalcXPText(ACanvas, ARect, Caption, CaptionAlignment, Flags, GlyphSize, DummyRightGlyphSize, + Layout, PushedCaption, ACaptionRect, AGlyphRect, DummyRightGlyphRect, RotationAngle); + + SpDrawXPText(ACanvas, Caption, ACaptionRect, Flags and not DT_CALCRECT, CaptionGlow, CaptionGlowColor, RotationAngle); + + if Assigned(IL) and (ImageIndex > -1) and (ImageIndex < IL.Count) then + SpDrawImageList(ACanvas, AGlyphRect, IL, ImageIndex, Enabled, DisabledIconCorrection); +end; + +function SpGetTextSize(DC: HDC; WS: WideString; NoPrefix: Boolean): TSize; +// Returns the size of the string, if NoPrefix is True, it first removes "&" +// characters as necessary. +// This procedure is 10x faster than using DrawText with the DT_CALCRECT flag +begin + Result.cx := 0; + Result.cy := 0; + if NoPrefix then + WS := SpStripAccelChars(WS); + if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then + Windows.GetTextExtentPoint32A(DC, PAnsiChar(AnsiString(WS)), Length(AnsiString(WS)), Result) + else + Windows.GetTextExtentPoint32W(DC, PWideChar(WS), Length(WS), Result); +end; + +function SpGetControlTextHeight(AControl: TControl; AFont: TFont): Integer; +// Returns the control text height based on the font +var + Sz: TSize; +begin + Sz := SpGetControlTextSize(AControl, AFont, 'WQqJ'); + Result := Sz.cy; +end; + +function SpGetControlTextSize(AControl: TControl; AFont: TFont; WS: WideString): TSize; +// Returns the control text size based on the font +var + ACanvas: TControlCanvas; +begin + ACanvas := TControlCanvas.Create; + try + ACanvas.Control := AControl; + ACanvas.Font.Assign(AFont); + Result := SpGetTextSize(ACanvas.Handle, WS, False); + finally + ACanvas.Free; + end; +end; + +function SpSameText(W1, W2: WideString): Boolean; +begin + {$IFNDEF UNICODE} + if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then + Result := AnsiSameText(AnsiString(W1), AnsiString(W2)) + else + Result := WideSameText(W1, W2); + {$ELSE} + Result := WideSameText(W1, W2); + {$ENDIF} +end; + +function SpStripAccelChars(S: WideString): WideString; +var + I: Integer; +begin + Result := S; + I := 1; + while I <= Length(Result) do begin + if Result[I] = '&' then + System.Delete(Result, I, 1); + Inc(I); + end; +end; + +function SpStripShortcut(S: WideString): WideString; +var + P: Integer; +begin + Result := S; + P := Pos(#9, Result); + if P <> 0 then + SetLength(Result, P - 1); +end; + +function SpStripTrailingPunctuation(S: WideString): WideString; +// Removes any colon (':') or ellipsis ('...') from the end of S and returns +// the resulting string +var + L: Integer; +begin + Result := S; + L := Length(Result); + if (L > 1) and (Result[L] = ':') then + SetLength(Result, L-1) + else if (L > 3) and (Result[L-2] = '.') and (Result[L-1] = '.') and + (Result[L] = '.') then + SetLength(Result, L-3); +end; + +function SpRectToString(R: TRect): string; +begin + Result := Format('%d, %d, %d, %d', [R.Left, R.Top, R.Right, R.Bottom]); +end; + +function SpStringToRect(S: string; out R: TRect): Boolean; +var + L: TStringList; +begin + Result := False; + R := Rect(0, 0, 0, 0); + L := TStringList.Create; + try + L.CommaText := S; + if L.Count = 4 then begin + R.Left := StrToIntDef(L[0], 0); + R.Top := StrToIntDef(L[1], 0); + R.Right := StrToIntDef(L[2], 0); + R.Bottom := StrToIntDef(L[3], 0); + Result := True; + end; + finally + L.Free; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Color Helpers } + +function SpColorToHTML(const Color: TColor): string; +var + R: TColorRef; +begin + R := ColorToRGB(Color); + Result := Format('#%.2x%.2x%.2x', [GetRValue(R), GetGValue(R), GetBValue(R)]); +end; + +function SpColorToString(const Color: TColor; TextType: TSpTBXColorTextType = cttDefault): string; +begin + case TextType of + cttDefault: + Result := ColorToString(Color); + cttHTML: + Result := SpColorToHTML(Color); + cttIdentAndHTML: + begin + Result := ColorToString(Color); + if (Length(Result) > 0) and (Result[1] = '$') then + Result := SpColorToHTML(Color); + end; + end; +end; + +function SpStringToColor(S: string; out Color: TColor): Boolean; +var + E, L: Integer; +begin + Result := False; + Color := clDefault; + L := Length(S); + if L < 2 then Exit; + + if (S[1] = '#') and (L = 7) then begin + Delete(S, 1, 1); // strip the # char + S := Format('$00%s%s%s', [Copy(S, 5, 2), Copy(S, 3, 2), Copy(S, 1, 2)]); + Color := StringToColor(S); + Result := True; + end + else begin + Result := IdentToColor(S, Longint(Color)); + if not Result and (L > 6) and (L < 10) and (S[1] = '$') then begin + Val(S, Color, E); + Result := E = 0; + end; + end; +end; + +procedure SpGetRGB(Color: TColor; out R, G, B: Integer); +begin + Color := ColorToRGB(Color); + R := GetRValue(Color); + G := GetGValue(Color); + B := GetBValue(Color); +end; + +function SpRGBToColor(R, G, B: Integer): TColor; +begin + if R < 0 then R := 0 else if R > 255 then R := 255; + if G < 0 then G := 0 else if G > 255 then G := 255; + if B < 0 then B := 0 else if B > 255 then B := 255; + Result := TColor(RGB(R, G, B)); +end; + +function SpLighten(Color: TColor; Amount: Integer): TColor; +var + R, G, B: Integer; +begin + Color := ColorToRGB(Color); + R := GetRValue(Color) + Amount; + G := GetGValue(Color) + Amount; + B := GetBValue(Color) + Amount; + Result := SpRGBToColor(R, G, B); +end; + +function SpBlendColors(TargetColor, BaseColor: TColor; Percent: Integer): TColor; +// Blend 2 colors with a predefined percent (0..100 or 0..1000) +// If Percent is 0 the result will be BaseColor, +// If Percent is 100 the result will be TargetColor. +// Any other value will return a color between base and target. +// For example if you want to add 70% of yellow ($0000FFFF) to a color: +// NewColor := SpBlendColor($0000FFFF, BaseColor, 70); +// The result will have 70% of yellow and 30% of BaseColor +var + Percent2, D, F: Integer; + R, G, B, R2, G2, B2: Integer; +begin + SpGetRGB(TargetColor, R, G, B); + SpGetRGB(BaseColor, R2, G2, B2); + + if Percent >= 100 then D := 1000 + else D := 100; + Percent2 := D - Percent; + F := D div 2; + + R := (R * Percent + R2 * Percent2 + F) div D; + G := (G * Percent + G2 * Percent2 + F) div D; + B := (B * Percent + B2 * Percent2 + F) div D; + + Result := SpRGBToColor(R, G, B); +end; + +function SpMixColors(TargetColor, BaseColor: TColor; Amount: Byte): TColor; +// Mix 2 colors with a predefined amount (0..255). +// If Amount is 0 the result will be BaseColor, +// If Amount is 255 the result will be TargetColor. +// Any other value will return a color between base and target. +// For example if you want to add 50% of yellow ($0000FFFF) to a color: +// NewColor := SpMixColors($0000FFFF, BaseColor, 128); +// The result will be BaseColor + 50% of yellow +var + R1, G1, B1: Integer; + R2, G2, B2: Integer; +begin + SpGetRGB(BaseColor, R1, G1, B1); + SpGetRGB(TargetColor, R2, G2, B2); + + R1 := (R2 - R1) * Amount div 255 + R1; + G1 := (G2 - G1) * Amount div 255 + G1; + B1 := (B2 - B1) * Amount div 255 + B1; + + Result := SpRGBToColor(R1, G1, B1); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Painting Helpers } + +function SpCenterRect(Parent: TRect; ChildWidth, ChildHeight: Integer): TRect; +begin + Result.Left := Parent.Left + (Parent.Right - Parent.Left - ChildWidth) div 2; + Result.Top := Parent.Top + (Parent.Bottom - Parent.Top - ChildHeight) div 2; + Result.Right := Result.Left + ChildWidth; + Result.Bottom := Result.Top + ChildHeight; +end; + +function SpCenterRect(Parent, Child: TRect): TRect; +begin + Result := SpCenterRect(Parent, Child.Right - Child.Left, Child.Bottom - Child.Top); +end; + +function SpCenterRectHoriz(Parent: TRect; ChildWidth: Integer): TRect; +begin + Result.Left := Parent.Left + (Parent.Right - Parent.Left - ChildWidth) div 2; + Result.Right := Result.Left + ChildWidth; + Result.Top := Parent.Top; + Result.Bottom := Parent.Bottom; +end; + +function SpCenterRectVert(Parent: TRect; ChildHeight: Integer): TRect; +begin + Result.Left := Parent.Left; + Result.Right := Parent.Right; + Result.Top := Parent.Top + (Parent.Bottom - Parent.Top - ChildHeight) div 2; + Result.Bottom := Result.Top + ChildHeight; +end; + +procedure SpFillRect(ACanvas: TCanvas; const ARect: TRect; BrushColor: TColor; PenColor: TColor = clNone); +var + C, C2: TColor; +begin + if BrushColor <> clNone then begin + C := ACanvas.Brush.Color; + C2 := ACanvas.Pen.Color; + ACanvas.Brush.Color := BrushColor; + ACanvas.Pen.Color := PenColor; + if PenColor = clNone then + ACanvas.FillRect(ARect) + else + ACanvas.Rectangle(ARect); + ACanvas.Brush.Color := C; + ACanvas.Pen.Color := C2; + end; +end; + +procedure SpDrawLine(ACanvas: TCanvas; X1, Y1, X2, Y2: Integer; Color: TColor); +var + C: TColor; +begin + if Color <> clNone then begin + C := ACanvas.Pen.Color; + ACanvas.Pen.Color := Color; + ACanvas.MoveTo(X1, Y1); + ACanvas.LineTo(X2, Y2); + ACanvas.Pen.Color := C; + end; +end; + +procedure SpDrawRectangle(ACanvas: TCanvas; ARect: TRect; CornerSize: Integer; + ColorL, ColorT, ColorR, ColorB, + InternalColorL, InternalColorT, InternalColorR, InternalColorB: TColor; + ForceRectBorders: TAnchors = []); +// Draws 2 beveled borders. +// CornerSize can be 0, 1 or 2. +// Color: left, top, right, bottom external border color +// InternalColor: left, top, right, bottom internal border color +// ForceRectBorders: forces the borders to be rect +var + Color: TColor; + CornerSizeTL, CornerSizeTR, CornerSizeBL, CornerSizeBR: Integer; +begin + Color := ACanvas.Pen.Color; + + if CornerSize < 0 then CornerSize := 0; + if CornerSize > 2 then CornerSize := 2; + CornerSizeTL := CornerSize; + CornerSizeTR := CornerSize; + CornerSizeBL := CornerSize; + CornerSizeBR := CornerSize; + if akLeft in ForceRectBorders then begin + CornerSizeTL := 0; + CornerSizeBL := 0; + end; + if akRight in ForceRectBorders then begin + CornerSizeTR := 0; + CornerSizeBR := 0; + end; + if akTop in ForceRectBorders then begin + CornerSizeTL := 0; + CornerSizeTR := 0; + end; + if akBottom in ForceRectBorders then begin + CornerSizeBL := 0; + CornerSizeBR := 0; + end; + + with ARect do begin + Dec(Right); + Dec(Bottom); + + // Internal borders + InflateRect(ARect, -1, -1); + if InternalColorL <> clNone then begin + ACanvas.Pen.Color := InternalColorL; + ACanvas.PolyLine([Point(Left, Bottom), Point(Left, Top)]); + end; + if InternalColorT <> clNone then begin + ACanvas.Pen.Color := InternalColorT; + ACanvas.PolyLine([Point(Left, Top), Point(Right, Top)]); + end; + if InternalColorR <> clNone then begin + ACanvas.Pen.Color := InternalColorR; + ACanvas.PolyLine([Point(Right, Bottom), Point(Right, Top - 1)]); + end; + if InternalColorB <> clNone then begin + ACanvas.Pen.Color := InternalColorB; + ACanvas.PolyLine([Point(Left, Bottom), Point(Right, Bottom)]); + end; + + // External borders + InflateRect(ARect, 1, 1); + if ColorL <> clNone then begin + ACanvas.Pen.Color := ColorL; + ACanvas.PolyLine([ + Point(Left, Bottom - CornerSizeBL), + Point(Left, Top + CornerSizeTL) + ]); + end; + if ColorT <> clNone then begin + ACanvas.Pen.Color := ColorT; + ACanvas.PolyLine([ + Point(Left, Top + CornerSizeTL), + Point(Left + CornerSizeTL, Top), + Point(Right - CornerSizeTR + 1, Top), + Point(Right, Top + CornerSizeTR) + ]); + end; + if ColorR <> clNone then begin + ACanvas.Pen.Color := ColorR; + ACanvas.PolyLine([ + Point(Right, Top + CornerSizeTR), + Point(Right , Bottom - CornerSizeBR) + ]); + end; + if ColorB <> clNone then begin + ACanvas.Pen.Color := ColorB; + ACanvas.PolyLine([ + Point(Right, Bottom - CornerSizeBR), + Point(Right - CornerSizeBR, Bottom), + Point(Left + CornerSizeBL, Bottom), + Point(Left, Bottom - CornerSizeBL) + ]); + end; + end; + + ACanvas.Pen.Color := Color; +end; + + +procedure SpDrawRectangle(ACanvas: TCanvas; ARect: TRect; + CornerSize: Integer; ColorTL, ColorBR, ColorTLInternal, ColorBRInternal: TColor; + ForceRectBorders: TAnchors); +// Draws 2 beveled borders. +// CornerSize can be 0, 1 or 2. +// TLColor, ColorBR: external border color +// InternalTL, ColorBRInternal: internal border color +// ForceRectBorders: forces the borders to be rect +var + Color: TColor; + CornerSizeTL, CornerSizeTR, CornerSizeBL, CornerSizeBR: Integer; +begin + Color := ACanvas.Pen.Color; + + if CornerSize < 0 then CornerSize := 0; + if CornerSize > 2 then CornerSize := 2; + CornerSizeTL := CornerSize; + CornerSizeTR := CornerSize; + CornerSizeBL := CornerSize; + CornerSizeBR := CornerSize; + if akLeft in ForceRectBorders then begin + CornerSizeTL := 0; + CornerSizeBL := 0; + end; + if akRight in ForceRectBorders then begin + CornerSizeTR := 0; + CornerSizeBR := 0; + end; + if akTop in ForceRectBorders then begin + CornerSizeTL := 0; + CornerSizeTR := 0; + end; + if akBottom in ForceRectBorders then begin + CornerSizeBL := 0; + CornerSizeBR := 0; + end; + + with ARect do begin + Dec(Right); + Dec(Bottom); + + // Internal borders + InflateRect(ARect, -1, -1); + if ColorTLInternal <> clNone then begin + ACanvas.Pen.Color := ColorTLInternal; + ACanvas.PolyLine([ + Point(Left, Bottom), + Point(Left, Top), + Point(Right, Top) + ]); + end; + if ColorBRInternal <> clNone then begin + ACanvas.Pen.Color := ColorBRInternal; + ACanvas.PolyLine([ + Point(Left, Bottom), + Point(Right, Bottom), + Point(Right, Top - 1) + ]); + end; + + // External borders + InflateRect(ARect, 1, 1); + if ColorTL <> clNone then begin + ACanvas.Pen.Color := ColorTL; + ACanvas.PolyLine([ + Point(Left + CornerSizeBL, Bottom), + Point(Left, Bottom - CornerSizeBL), + Point(Left, Top + CornerSizeTL), + Point(Left + CornerSizeTL, Top), + Point(Right - CornerSizeTR, Top), + Point(Right, Top + CornerSizeTR) + ]); + end; + if ColorBR <> clNone then begin + ACanvas.Pen.Color := ColorBR; + ACanvas.PolyLine([ + Point(Right, Top + CornerSizeTR), + Point(Right , Bottom - CornerSizeBR), + Point(Right - CornerSizeBR, Bottom), + Point(Left + CornerSizeBL - 1, Bottom) + ]); + end; + end; + + ACanvas.Pen.Color := Color; +end; + +procedure SpAlphaBlend(SrcDC, DstDC: HDC; SrcR, DstR: TRect; Alpha: Byte; + SrcHasAlphaChannel: Boolean = False); +// NOTE: AlphaBlend does not work on Windows 95 and Windows NT +var + BF: TBlendFunction; +begin + BF.BlendOp := AC_SRC_OVER; + BF.BlendFlags := 0; + BF.SourceConstantAlpha := Alpha; + if SrcHasAlphaChannel then + BF.AlphaFormat := AC_SRC_ALPHA + else + BF.AlphaFormat := 0; + Windows.AlphaBlend(DstDC, DstR.Left, DstR.Top, DstR.Right - DstR.Left, DstR.Bottom - DstR.Top, + SrcDC, SrcR.Left, SrcR.Top, SrcR.Right - SrcR.Left, SrcR.Bottom - SrcR.Top, BF); +end; + +procedure SpPaintTo(WinControl: TWinControl; ACanvas: TCanvas; X, Y: Integer); +// NOTE: PrintWindow does not work if the control is not visible +var + B: TBitmap; + PrevTop: Integer; +begin + // Use SpPrintWindow instead of PaintTo as many controls will not render + // properly (no text on editors, no scrollbars, incorrect borders, etc) + // http://msdn2.microsoft.com/en-us/library/ms535695.aspx + if Assigned(SpPrintWindow) then begin + ACanvas.Lock; + try + // It doesn't work if the control is not visible !!! + // Show it and move it offscreen + if not WinControl.Visible then begin + PrevTop := WinControl.Top; + WinControl.Top := 10000; // Move it offscreen + WinControl.Visible := True; + SpPrintWindow(WinControl.Handle, ACanvas.Handle, 0); + WinControl.Visible := False; + WinControl.Top := PrevTop; + end + else + SpPrintWindow(WinControl.Handle, ACanvas.Handle, 0); + finally + ACanvas.UnLock; + end; + end + else begin + // If SpPrintWindow is not available use PaintTo + // If the Control is a Form use GetFormImage instead + if WinControl is TCustomForm then begin + B := TCustomForm(WinControl).GetFormImage; + try + ACanvas.Draw(X, Y, B); + finally + B.Free; + end; + end + else + WinControl.PaintTo(ACanvas, X, Y); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ ImageList painting } + +procedure SpDrawIconShadow(ACanvas: TCanvas; const ARect: TRect; + ImageList: TCustomImageList; ImageIndex: Integer); +var + ImageWidth, ImageHeight: Integer; + I, J: Integer; + Src, Dst: ^Cardinal; + S, C, CBRB, CBG: Cardinal; + B1, B2: TBitmap; +begin + ImageWidth := ARect.Right - ARect.Left; + ImageHeight := ARect.Bottom - ARect.Top; + with ImageList do + begin + if Width < ImageWidth then ImageWidth := Width; + if Height < ImageHeight then ImageHeight := Height; + end; + + B1 := TBitmap.Create; + B2 := TBitmap.Create; + try + B1.PixelFormat := pf32bit; + B2.PixelFormat := pf32bit; + B1.Width := ImageWidth; + B1.Height := ImageHeight; + B2.Width := ImageWidth; + B2.Height := ImageHeight; + + BitBlt(B1.Canvas.Handle, 0, 0, ImageWidth, ImageHeight, ACanvas.Handle, ARect.Left, ARect.Top, SRCCOPY); + BitBlt(B2.Canvas.Handle, 0, 0, ImageWidth, ImageHeight, ACanvas.Handle, ARect.Left, ARect.Top, SRCCOPY); + ImageList.Draw(B2.Canvas, 0, 0, ImageIndex, True); + + for J := 0 to ImageHeight - 1 do + begin + Src := B2.ScanLine[J]; + Dst := B1.ScanLine[J]; + for I := 0 to ImageWidth - 1 do + begin + S := Src^; + if S <> Dst^ then + begin + CBRB := Dst^ and $00FF00FF; + CBG := Dst^ and $0000FF00; + C := ((S and $00FF0000) shr 16 * 29 + (S and $0000FF00) shr 8 * 150 + + (S and $000000FF) * 76) shr 8; + C := (C div 3) + (255 - 255 div 3); + Dst^ := ((CBRB * C and $FF00FF00) or (CBG * C and $00FF0000)) shr 8; + end; + Inc(Src); + Inc(Dst); + end; + end; + BitBlt(ACanvas.Handle, ARect.Left, ARect.Top, ImageWidth, ImageHeight, B1.Canvas.Handle, 0, 0, SRCCOPY); + finally + B1.Free; + B2.Free; + end; +end; + +procedure SpDrawImageList(ACanvas: TCanvas; const ARect: TRect; ImageList: TCustomImageList; + ImageIndex: Integer; Enabled, DisabledIconCorrection: Boolean); +begin + if Assigned(ImageList) and (ImageIndex > -1) and (ImageIndex < ImageList.Count) then + if Enabled then + ImageList.Draw(ACanvas, ARect.Left, ARect.Top, ImageIndex) + else + if DisabledIconCorrection then + SpDrawIconShadow(ACanvas, ARect, ImageList, ImageIndex) + else + ImageList.Draw(ACanvas, ARect.Left, ARect.Top, ImageIndex, False); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Gradients } + +procedure SpGradient(ACanvas: TCanvas; const ARect: TRect; + StartPos, EndPos, ChunkSize: Integer; C1, C2: TColor; const Vertical: Boolean); +// StartPos: start position relative to ARect, usually 0 +// EndPos: end position relative to ARect, usually ARect.Bottom - ARect.Top +// ChunkSize: size of the chunk of the gradient we need to paint +var + I: Integer; + r, g, b: Integer; + rc1, gc1, bc1: Integer; + rc2, gc2, bc2: Integer; + PrevColor: TColor; +begin + PrevColor := ACanvas.Brush.Color; + if ChunkSize = 0 then ChunkSize := 1; + SpGetRGB(C1, rc1, gc1, bc1); + SpGetRGB(C2, rc2, gc2, bc2); + for I := StartPos to EndPos do begin + r := rc1 + (((rc2 - rc1) * (I - StartPos)) div ChunkSize); + g := gc1 + (((gc2 - gc1) * (I - StartPos)) div ChunkSize); + b := bc1 + (((bc2 - bc1) * (I - StartPos)) div ChunkSize); + + ACanvas.Brush.Color := SpRGBToColor(r, g, b); + if Vertical then + ACanvas.FillRect(Rect(ARect.Left, ARect.Top + I, ARect.Right, ARect.Top + I + 1)) + else + ACanvas.FillRect(Rect(ARect.Left + I, ARect.Top, ARect.Left + I + 1, ARect.Bottom)); + end; + ACanvas.Brush.Color := PrevColor; +end; + +procedure SpGradientFill(ACanvas: TCanvas; const ARect: TRect; + const C1, C2: TColor; const Vertical: Boolean); +var + GSize: Integer; +begin + if Vertical then + GSize := (ARect.Bottom - ARect.Top) - 1 + else + GSize := (ARect.Right - ARect.Left) - 1; + + SpGradient(ACanvas, ARect, 0, GSize, GSize, C1, C2, Vertical); +end; + +procedure SpGradientFillMirror(ACanvas: TCanvas; const ARect: TRect; + const C1, C2, C3, C4: TColor; const Vertical: Boolean); +var + GSize, ChunkSize, d1, d2: Integer; +begin + if Vertical then + GSize := (ARect.Bottom - ARect.Top) - 1 + else + GSize := (ARect.Right - ARect.Left) - 1; + + ChunkSize := GSize div 2; + if ChunkSize = 0 then ChunkSize := 1; + d1 := ChunkSize; + d2 := GSize; + + SpGradient(ACanvas, ARect, 0, d1, ChunkSize, C1, C2, Vertical); + SpGradient(ACanvas, ARect, d1, d2, ChunkSize, C3, C4, Vertical); +end; + +procedure SpGradientFillMirrorTop(ACanvas: TCanvas; const ARect: TRect; + const C1, C2, C3, C4: TColor; const Vertical: Boolean); +var + GSize, d1, d2: Integer; +begin + if Vertical then + GSize := (ARect.Bottom - ARect.Top) - 1 + else + GSize := (ARect.Right - ARect.Left) - 1; + + d1 := GSize div 3; + d2 := GSize; + + SpGradient(ACanvas, ARect, 0, d1, d1, C1, C2, Vertical); + SpGradient(ACanvas, ARect, d1, d2, d2 - d1, C3, C4, Vertical); +end; + +procedure SpGradientFillGlass(ACanvas: TCanvas; const ARect: TRect; + const C1, C2, C3, C4: TColor; const Vertical: Boolean); +var + GSize, ChunkSize, d1, d2, d3: Integer; +begin + if Vertical then + GSize := (ARect.Bottom - ARect.Top) - 1 + else + GSize := (ARect.Right - ARect.Left) - 1; + + ChunkSize := GSize div 3; + if ChunkSize = 0 then ChunkSize := 1; + d1 := ChunkSize; + d2 := ChunkSize * 2; + d3 := GSize; + + SpGradient(ACanvas, ARect, 0, d1, ChunkSize, C1, C2, Vertical); + SpGradient(ACanvas, ARect, d1, d2, ChunkSize, C2, C3, Vertical); + SpGradient(ACanvas, ARect, d2, d3, ChunkSize, C3, C4, Vertical); +end; + +procedure SpGradientFill9pixels(ACanvas: TCanvas; const ARect: TRect; + const C1, C2, C3, C4: TColor; const Vertical: Boolean); +// Mimics Vista menubar/toolbar blue gradient +var + GSize, d1, d2: Integer; +begin + if Vertical then + GSize := (ARect.Bottom - ARect.Top) - 1 + else + GSize := (ARect.Right - ARect.Left) - 1; + + d1 := GSize div 3; + if d1 > 9 then d1 := 9; + d2 := GSize; + + SpGradient(ACanvas, ARect, 0, d1, d1, C1, C2, Vertical); + SpGradient(ACanvas, ARect, d1, d2, d2 - d1, C3, C4, Vertical); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Element painting } + +procedure SpDrawArrow(ACanvas: TCanvas; X, Y: Integer; AColor: TColor; Vertical, Reverse: Boolean; Size: Integer); +var + C1, C2: TColor; +begin + C1 := ACanvas.Pen.Color; + C2 := ACanvas.Brush.Color; + ACanvas.Pen.Color := AColor; + ACanvas.Brush.Color := AColor; + + if Vertical then + if Reverse then + ACanvas.Polygon([Point(X, Y), Point(X - Size, Y + Size), Point(X + Size, Y + Size)]) + else + ACanvas.Polygon([Point(X - Size, Y), Point(X + Size, Y), Point(X, Y + Size)]) + else + if Reverse then + ACanvas.Polygon([Point(X, Y), Point(X + Size, Y + Size), Point(X + Size, Y - Size)]) + else + ACanvas.Polygon([Point(X, Y - Size), Point(X, Y + Size), Point(X + Size, Y)]); + + ACanvas.Pen.Color := C1; + ACanvas.Brush.Color := C2; +end; + +procedure SpDrawDropMark(ACanvas: TCanvas; DropMark: TRect); +var + C: TColor; + R: TRect; +begin + if IsRectEmpty(DropMark) then Exit; + C := ACanvas.Brush.Color; + + R := Rect(DropMark.Left + 1, DropMark.Top, DropMark.Right - 1, DropMark.Top + 2); + ACanvas.Rectangle(R); + R := Rect(DropMark.Left + 1, DropMark.Bottom - 2, DropMark.Right - 1, DropMark.Bottom); + ACanvas.Rectangle(R); + + R := Rect(DropMark.Left, DropMark.Top + 1, DropMark.Right, DropMark.Top + 3); + ACanvas.Rectangle(R); + R := Rect(DropMark.Left, DropMark.Bottom - 3, DropMark.Right, DropMark.Bottom - 1); + ACanvas.Rectangle(R); + + R := Rect(DropMark.Left + 1, DropMark.Top + 4, DropMark.Right - 1, DropMark.Bottom - 4); + ACanvas.Rectangle(R); + + { + // Standard DropMark + + R := Rect(DropMark.Left, DropMark.Top, DropMark.Right - 1, DropMark.Bottom - 1); + if IsRectEmpty(R) then Exit; + ACanvas.Brush.Color := clBlack; + ACanvas.Polygon([ + Point(R.Left, R.Top), + Point(R.Left + 2, R.Top + 2), + Point(R.Left + 2, R.Bottom - 2), + Point(R.Left, R.Bottom), + Point(R.Right, R.Bottom), + Point(R.Right - 2, R.Bottom - 2), + Point(R.Right - 2, R.Top + 2), + Point(R.Right, R.Top) + ]); + } + ACanvas.Brush.Color := C; +end; + +procedure SpDrawFocusRect(ACanvas: TCanvas; const ARect: TRect); +var + DC: HDC; + C1, C2: TColor; +begin + if not IsRectEmpty(ARect) then begin + DC := ACanvas.Handle; + C1 := SetTextColor(DC, clBlack); + C2 := SetBkColor(DC, clWhite); + ACanvas.DrawFocusRect(ARect); + SetTextColor(DC, C1); + SetBkColor(DC, C2); + end; +end; + +procedure SpDrawGlyphPattern(DC: HDC; const R: TRect; Width, Height: Integer; + const PatternBits; PatternColor: TColor); +var + B: TBitmap; + OldTextColor, OldBkColor: Longword; + OldBrush, Brush: HBrush; + BitmapWidth, BitmapHeight: Integer; +begin + OldTextColor := SetTextColor(DC, clBlack); + OldBkColor := SetBkColor(DC, clWhite); + B := TBitmap.Create; + try + BitmapWidth := 8; + if Width > BitmapWidth then BitmapWidth := Width; + BitmapHeight := 8; + if Height > BitmapHeight then BitmapHeight := Height; + + B.Handle := CreateBitmap(BitmapWidth, BitmapHeight, 1, 1, @PatternBits); + if PatternColor < 0 then Brush := GetSysColorBrush(PatternColor and $FF) + else Brush := CreateSolidBrush(PatternColor); + OldBrush := SelectObject(DC, Brush); + BitBlt(DC, (R.Left + R.Right + 1 - Width) div 2, (R.Top + R.Bottom + 1 - Height) div 2, + Width, Height, B.Canvas.Handle, 0, 0, ROP_DSPDxax); + SelectObject(DC, OldBrush); + if PatternColor >= 0 then DeleteObject(Brush); + finally + SetTextColor(DC, OldTextColor); + SetBkColor(DC, OldBkColor); + B.Free; + end; +end; + +procedure SpDrawGlyphPattern(ACanvas: TCanvas; ARect: TRect; PatternIndex: Integer; PatternColor: TColor); +// The pattern is a 8x8 bitmap +// The array has 16 elements, only the odd elements are used +// The first value of an element represents the bits from the 4 first horizontal pixels, +// and the next value represents the bits of the 4 last horizontal pixels. +// For example: 0 represents -------- +// $FF represents xxxxxxxx +// $C6 represents xx---xx- +const + ClosePattern: array [0..15] of Byte = ($C6, 0, $EE, 0, $7C, 0, $38, 0, $7C, 0, $EE, 0, $C6, 0, 0, 0); + MaximizePattern: array [0..15] of Byte = ($FF, 0, $FF, 0, $81, 0, $81, 0, $81, 0, $81, 0, $81, 0, $FF, 0); + MinimizePattern: array [0..15] of Byte = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, $7E, 0, $7E, 0, 0, 0); + RestorePattern: array [0..17] of Byte = ($3F, 0, $3F, 0, $21, 0, $FD, 0, $FD, 0, $87, 0, $84, 0, $84, 0, $FC, 0); +begin + case PatternIndex of + 0: SpDrawGlyphPattern(ACanvas.Handle, ARect, 8, 8, ClosePattern[0], PatternColor); + 1: SpDrawGlyphPattern(ACanvas.Handle, ARect, 8, 8, MaximizePattern[0], PatternColor); + 2: SpDrawGlyphPattern(ACanvas.Handle, ARect, 8, 8, MinimizePattern[0], PatternColor); + 3: SpDrawGlyphPattern(ACanvas.Handle, ARect, 8, 9, RestorePattern[0], PatternColor); + end; +end; + +procedure SpDrawXPButton(ACanvas: TCanvas; ARect: TRect; Enabled, Pushed, HotTrack, Checked, Focused, Defaulted: Boolean; + SkinType: TSpTBXSkinType); +var + Flags: Cardinal; + C: TColor; + State: TSpTBXSkinStatesType; +begin + SkinType := SpTBXSkinType(SkinType); + case SkinType of + sknNone: + begin + C := ACanvas.Brush.Color; + ACanvas.Brush.Color := clBtnFace; + ACanvas.FillRect(ARect); + if Defaulted or Focused then begin + ACanvas.Brush.Color := clWindowFrame; + ACanvas.FrameRect(ARect); + InflateRect(ARect, -1, -1); // Reduce the Rect for the focus rect + end; + if Pushed or Checked then begin + ACanvas.Brush.Color := clBtnShadow; + ACanvas.FrameRect(ARect); + end + else + DrawFrameControl(ACanvas.Handle, ARect, DFC_BUTTON, DFCS_BUTTONPUSH); + ACanvas.Brush.Color := C; + end; + sknWindows: + begin + if not Enabled then Flags := PBS_DISABLED + else if Pushed or Checked then Flags := PBS_PRESSED + else if HotTrack then Flags := PBS_HOT + else if Defaulted or Focused then Flags := PBS_DEFAULTED + else Flags := PBS_NORMAL; + DrawThemeBackground(ThemeServices.Theme[teButton], ACanvas.Handle, BP_PUSHBUTTON, Flags, ARect, nil); + end; + sknSkin: + begin + State := CurrentSkin.GetState(Enabled, Pushed, HotTrack, Checked); + CurrentSkin.PaintBackground(ACanvas, ARect, skncButton, State, True, True); + end; + end; + + if Focused then begin + InflateRect(ARect, -3, -3); + SpDrawFocusRect(ACanvas, ARect); + end; +end; + +procedure SpDrawXPCheckBoxGlyph(ACanvas: TCanvas; ARect: TRect; Enabled: Boolean; + State: TCheckBoxState; HotTrack, Pushed: Boolean; SkinType: TSpTBXSkinType); +var + Flags: Integer; + SknState: TSpTBXSkinStatesType; +begin + SkinType := SpTBXSkinType(SkinType); + Flags := 0; + case SkinType of + sknNone: + begin + case State of + cbChecked: Flags := DFCS_BUTTONCHECK or DFCS_CHECKED; + cbGrayed: Flags := DFCS_BUTTON3STATE or DFCS_CHECKED; + cbUnChecked: Flags := DFCS_BUTTONCHECK; + end; + if not Enabled then + Flags := Flags or DFCS_INACTIVE; + if Pushed then + Flags := Flags or DFCS_PUSHED; + DrawFrameControl(ACanvas.Handle, ARect, DFC_BUTTON, Flags); + end; + sknWindows: + begin + case State of + cbChecked: Flags := CBS_CHECKEDNORMAL; + cbGrayed: Flags := CBS_MIXEDNORMAL; + cbUnChecked: Flags := CBS_UNCHECKEDNORMAL; + end; + + if not Enabled then Inc(Flags, 3) + else + if Pushed then Inc(Flags, 2) + else if HotTrack then Inc(Flags); + DrawThemeBackground(ThemeServices.Theme[teButton], ACanvas.Handle, BP_CHECKBOX, Flags, ARect, nil); + end; + sknSkin: + begin + SknState := CurrentSkin.GetState(Enabled, Pushed, HotTrack, State in [cbChecked, cbGrayed]); + CurrentSkin.PaintMenuCheckMark(ACanvas, ARect, State = cbChecked, State = cbGrayed, False, SknState); + end; + end; +end; + +procedure SpDrawXPRadioButtonGlyph(ACanvas: TCanvas; ARect: TRect; Enabled: Boolean; + Checked, HotTrack, Pushed: Boolean; SkinType: TSpTBXSkinType); +var + Flags: Integer; + SknState: TSpTBXSkinStatesType; +begin + SkinType := SpTBXSkinType(SkinType); + case SkinType of + sknNone: + begin + Flags := DFCS_BUTTONRADIO; + if Checked then + Flags := Flags or DFCS_CHECKED; + if not Enabled then + Flags := Flags or DFCS_INACTIVE; + if Pushed then + Flags := Flags or DFCS_PUSHED; + DrawFrameControl(ACanvas.Handle, ARect, DFC_BUTTON, Flags); + end; + sknWindows: + begin + if Checked then Flags := RBS_CHECKEDNORMAL + else Flags := RBS_UNCHECKEDNORMAL; + + if not Enabled then Inc(Flags, 3) + else + if Pushed then Inc(Flags, 2) + else if HotTrack then Inc(Flags); + DrawThemeBackground(ThemeServices.Theme[teButton], ACanvas.Handle, BP_RADIOBUTTON, Flags, ARect, nil); + end; + sknSkin: + begin + SknState := CurrentSkin.GetState(Enabled, Pushed, HotTrack, Checked); + CurrentSkin.PaintMenuRadioMark(ACanvas, ARect, Checked, False, SknState); + end; + end; +end; + +procedure SpDrawXPEditFrame(ACanvas: TCanvas; ARect: TRect; Enabled, HotTrack: Boolean; + SkinType: TSpTBXSkinType; ClipContent: Boolean; AutoAdjust: Boolean); +var + PartID, Flags: Integer; + BorderR: TRect; + State: TSpTBXSkinStatesType; + Entry: TSpTBXSkinOptionEntry; +const + CP_BORDER = 4; // Available only on Vista with Delphi 2007 +begin + SkinType := SpTBXSkinType(SkinType); + + if ClipContent then begin + BorderR := ARect; + if HotTrack then + InflateRect(BorderR, -1, -1) + else + InflateRect(BorderR, -2, -2); + ExcludeClipRect(ACanvas.Handle, BorderR.Left, BorderR.Top, BorderR.Right, BorderR.Bottom); + end; + try + case SkinType of + sknNone: + if HotTrack then + SpDrawRectangle(ACanvas, ARect, 0, clBtnShadow, clBtnHighlight, clBtnFace, clBtnFace) + else + SpDrawRectangle(ACanvas, ARect, 0, clBtnFace, clBtnFace, clBtnFace, clBtnFace); + sknWindows: + begin + if SpIsWinVistaOrUp then begin + PartID := CP_BORDER; + if not Enabled then Flags := CBXS_DISABLED + else if HotTrack then Flags := CBXS_HOT + else Flags := CBXS_NORMAL; + end + else begin + PartID := 0; + Flags := 0; + end; + DrawThemeBackground(ThemeServices.Theme[teComboBox], ACanvas.Handle, PartID, Flags, ARect, nil); + end; + sknSkin: + begin + State := CurrentSkin.GetState(Enabled, False, HotTrack, False); + // Try to adjust the borders if only the internal borders are specified, + // used by some controls that need to paint the edit frames like + // TSpTBXPanel (HotTrack=True), TSpTBXListBox, TSpTBXCheckListBox, etc + if AutoAdjust then begin + Entry := SkinManager.CurrentSkin.Options(skncEditFrame, State).Borders; + if (Entry.Color1 = clNone) and (Entry.Color2 = clNone) and + (Entry.Color3 <> clNone) and (Entry.Color4 <> clNone) then + begin + CurrentSkin.PaintBackground(ACanvas, ARect, skncEditFrame, State, True, False); + SpDrawRectangle(ACanvas, ARect, Entry.SkinType, Entry.Color3, Entry.Color4); + Exit; + end; + end; + + CurrentSkin.PaintBackground(ACanvas, ARect, skncEditFrame, State, True, True); + end; + end; + finally + if ClipContent then + SelectClipRgn(ACanvas.Handle, 0); + end; +end; + +procedure SpDrawXPEditFrame(AWinControl: TWinControl; HotTracking: Boolean; + SkinType: TSpTBXSkinType; AutoAdjust, HideFrame: Boolean); +var + R: TRect; + DC: HDC; + ACanvas: TCanvas; +begin + DC := GetWindowDC(AWinControl.Handle); + try + ACanvas := TCanvas.Create; + try + ACanvas.Handle := DC; + GetWindowRect(AWinControl.Handle, R); + OffsetRect(R, -R.Left, -R.Top); + with R do + ExcludeClipRect(DC, Left + 2, Top + 2, Right - 2, Bottom - 2); + + if HideFrame then begin + ACanvas.Brush.Color := TControlAccess(AWinControl).Color; + ACanvas.FillRect(R); + end + else begin + // Don't use SpDrawParentBackground to paint the background it doesn't get + // the correct WindowOrg in this particular case + PerformEraseBackground(AWinControl, ACanvas.Handle); + SpDrawXPEditFrame(ACanvas, R, AWinControl.Enabled, HotTracking, SkinType, False, AutoAdjust); + end; + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; + finally + ReleaseDC(AWinControl.Handle, DC); + end; +end; + +procedure SpDrawXPGrip(ACanvas: TCanvas; ARect: TRect; LoC, HiC: TColor); +var + I, J: Integer; + XCellCount, YCellCount: Integer; + R: TRect; + C: TColor; +begin + // 4 x 4 cells (Grey, White, Null) + // GG-- + // GGW- + // -WW- + // ---- + + C := ACanvas.Brush.Color; + XCellCount := (ARect.Right - ARect.Left) div 4; + YCellCount := (ARect.Bottom - ARect.Top) div 4; + if XCellCount = 0 then XCellCount := 1; + if YCellCount = 0 then YCellCount := 1; + + for J := 0 to YCellCount - 1 do + for I := 0 to XCellCount - 1 do begin + R.Left := ARect.Left + (I * 4) + 1; + R.Right := R.Left + 2; + R.Top := ARect.Top + (J * 4) + 1; + R.Bottom := R.Top + 2; + + ACanvas.Brush.Color := HiC; + ACanvas.FillRect(R); + OffsetRect(R, -1, -1); + ACanvas.Brush.Color := LoC; + ACanvas.FillRect(R); + end; + ACanvas.Brush.Color := C; +end; + +procedure SpDrawXPHeader(ACanvas: TCanvas; ARect: TRect; HotTrack, Pushed: Boolean; SkinType: TSpTBXSkinType); +var + Flags: Cardinal; + State: TSpTBXSkinStatesType; +begin + SkinType := SpTBXSkinType(SkinType); + case SkinType of + sknNone: + begin + DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER or BDR_RAISEDOUTER, BF_RECT or BF_SOFT); + end; + sknWindows: + begin + if Pushed then Flags := HIS_PRESSED + else if HotTrack then Flags := HIS_HOT + else Flags := HIS_NORMAL; + DrawThemeBackground(ThemeServices.Theme[teHeader], ACanvas.Handle, HP_HEADERITEM, Flags, ARect, nil); + end; + sknSkin: + begin + State := CurrentSkin.GetState(True, Pushed, HotTrack, False); + if (State = sknsPushed) and CurrentSkin.Options(skncHeader, State).IsEmpty then + State := sknsHotTrack; + CurrentSkin.PaintBackground(ACanvas, ARect, skncHeader, State, True, True); + end; + end; +end; + +procedure SpDrawXPListItemBackground(ACanvas: TCanvas; ARect: TRect; HotTrack, Pushed, Focused: Boolean; + SkinType: TSpTBXSkinType); +var + State: TSpTBXSkinStatesType; + PrevColor: TColor; +begin + PrevColor := ACanvas.Font.Color; + if SpTBXSkinType(SkinType) = sknSkin then begin + ACanvas.FillRect(ARect); + if HotTrack then begin + State := CurrentSkin.GetState(True, Pushed, HotTrack, False); + ACanvas.Font.Color := CurrentSkin.GetTextColor(skncListItem, State); + CurrentSkin.PaintBackground(ACanvas, ARect, skncListItem, State, True, True); + end; + end + else begin + if HotTrack then begin + ACanvas.Brush.Color := clHighlight; + ACanvas.Font.Color := clHighlightText; + end; + ACanvas.FillRect(ARect); + if Focused then + SpDrawFocusRect(ACanvas, ARect); + end; + ACanvas.Font.Color := PrevColor; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Skins painting } + +procedure SpPaintSkinBackground(ACanvas: TCanvas; ARect: TRect; SkinOption: TSpTBXSkinOptionCategory; Vertical: Boolean); +var + Part: TSpTBXSkinOptionEntry; + SkinType: Integer; +begin + Part := SkinOption.Body; + SkinType := SkinOption.Body.SkinType; + + if Vertical then + case SkinType of + 1: SkinType := 2; // Vertical Gradient to Horizontal + 2: SkinType := 1; // Horizontal Gradient to Vertical + + 3: SkinType := 4; // Vertical Glass Gradient to Horizontal + 4: SkinType := 3; // Horizontal Glass Gradient to Vertical + + 5: SkinType := 6; // Vertical Mirror Gradient to Horizontal + 6: SkinType := 5; // Horizontal Mirror Gradient to Vertical + + 7: SkinType := 8; // Vertical MirrorTop Gradient to Horizontal + 8: SkinType := 7; // Horizontal MirrorTop Gradient to Vertical + + 9: SkinType := 10; // Vertical 9Pixels Gradient to Horizontal + 10: SkinType := 9; // Horizontal 9Pixels Gradient to Vertical + end; + + case SkinType of + 0: begin // Solid + SpFillRect(ACanvas, ARect, Part.Color1); + end; + 1: begin // Vertical Gradient + SpGradientFill(ACanvas, ARect, Part.Color1, Part.Color2, True); + end; + 2: begin // Horizontal Gradient + SpGradientFill(ACanvas, ARect, Part.Color1, Part.Color2, False); + end; + 3: begin // Vertical Glass Gradient + SpGradientFillGlass(ACanvas, ARect, Part.Color1, Part.Color2, Part.Color3, Part.Color4, True); + end; + 4: begin // Horizontal Glass Gradient + SpGradientFillGlass(ACanvas, ARect, Part.Color1, Part.Color2, Part.Color3, Part.Color4, False); + end; + 5: begin // Vertical Mirror Gradient + SpGradientFillMirror(ACanvas, ARect, Part.Color1, Part.Color2, Part.Color3, Part.Color4, True); + end; + 6: begin // Horizontal Mirror Gradient + SpGradientFillMirror(ACanvas, ARect, Part.Color1, Part.Color2, Part.Color3, Part.Color4, False); + end; + 7: begin // Vertical MirrorTop Gradient + SpGradientFillMirrorTop(ACanvas, ARect, Part.Color1, Part.Color2, Part.Color3, Part.Color4, True); + end; + 8: begin // Horizontal MirrorTop Gradient + SpGradientFillMirrorTop(ACanvas, ARect, Part.Color1, Part.Color2, Part.Color3, Part.Color4, False); + end; + 9: begin // Vertical 9Pixels Gradient + SpGradientFill9Pixels(ACanvas, ARect, Part.Color1, Part.Color2, Part.Color3, Part.Color4, True); + end; + 10:begin // Horizontal 9Pixels Gradient + SpGradientFill9Pixels(ACanvas, ARect, Part.Color1, Part.Color2, Part.Color3, Part.Color4, False); + end; + end; +end; + +procedure SpPaintSkinBorders(ACanvas: TCanvas; ARect: TRect; SkinOption: TSpTBXSkinOptionCategory; + ForceRectBorders: TAnchors = []); +var + Part: TSpTBXSkinOptionEntry; +begin + Part := SkinOption.Borders; + case Part.SkinType of + 0, 1, 2: // Rectangle, Simple Rounded and Double Rounded Border + begin + SpDrawRectangle(ACanvas, ARect, Part.SkinType, Part.Color1, Part.Color2, Part.Color3, Part.Color4, ForceRectBorders); + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Misc } + +function SpIsWinVistaOrUp: Boolean; +begin + Result := (Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion >= 6) and (Win32MinorVersion >= 0) +end; + +function SpGetDirectories(Path: WideString; L: TStringList): Boolean; +var + SearchRec: TSearchRec; +begin + Result := False; + if DirectoryExists(Path) then begin + Path := IncludeTrailingPathDelimiter(Path) + '*.*'; + if FindFirst(Path, faDirectory, SearchRec) = 0 then begin + try + repeat + if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then + L.Add(SearchRec.Name); + until FindNext(SearchRec) <> 0; + Result := True; + finally + FindClose(SearchRec); + end; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSkinOptionEntry } + +procedure TSpTBXSkinOptionEntry.AssignTo(Dest: TPersistent); +begin + if Dest is TSpTBXSkinOptionEntry then + with TSpTBXSkinOptionEntry(Dest) do begin + SkinType := Self.SkinType; + Color1 := Self.Color1; + Color2 := Self.Color2; + Color3 := Self.Color3; + Color4 := Self.Color4; + end + else inherited AssignTo(Dest); +end; + +constructor TSpTBXSkinOptionEntry.Create; +begin + inherited; + Reset; +end; + +procedure TSpTBXSkinOptionEntry.Fill(ASkinType: Integer; AColor1, AColor2, + AColor3, AColor4: TColor); +begin + FSkinType := ASkinType; + FColor1 := AColor1; + FColor2 := AColor2; + FColor3 := AColor3; + FColor4 := AColor4; +end; + +function TSpTBXSkinOptionEntry.IsEmpty: Boolean; +begin + Result := (FColor1 = clNone) and (FColor2 = clNone) and (FColor3 = clNone) and (FColor4 = clNone); +end; + +function TSpTBXSkinOptionEntry.IsEqual(AOptionEntry: TSpTBXSkinOptionEntry): Boolean; +begin + Result := (FSkinType = AOptionEntry.SkinType) and + (FColor1 = AOptionEntry.Color1) and (FColor2 = AOptionEntry.Color2) and + (FColor3 = AOptionEntry.Color3) and (FColor4 = AOptionEntry.Color4); +end; + +procedure TSpTBXSkinOptionEntry.Reset; +begin + FSkinType := 0; + FColor1 := clNone; + FColor2 := clNone; + FColor3 := clNone; + FColor4 := clNone; +end; + +procedure TSpTBXSkinOptionEntry.ReadFromString(S: string); +var + L: TStringList; +begin + Reset; + L := TStringList.Create; + try + L.CommaText := S; + try + if L.Count > 0 then FSkinType := StrToIntDef(L[0], 0); + if L.Count > 1 then FColor1 := StringToColor(L[1]); + if L.Count > 2 then FColor2 := StringToColor(L[2]); + if L.Count > 3 then FColor3 := StringToColor(L[3]); + if L.Count > 4 then FColor4 := StringToColor(L[4]); + except + // do nothing + end; + finally + L.Free; + end; +end; + +function TSpTBXSkinOptionEntry.WriteToString: string; +begin + Result := Format('%d, %s, %s, %s, %s', [FSkinType, + SpColorToString(FColor1), SpColorToString(FColor2), + SpColorToString(FColor3), SpColorToString(FColor4)]); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXThemeOptionCategory } + +procedure TSpTBXSkinOptionCategory.AssignTo(Dest: TPersistent); +begin + if Dest is TSpTBXSkinOptionCategory then + with TSpTBXSkinOptionCategory(Dest) do begin + Body.Assign(Self.Body); + Borders.Assign(Self.Borders); + TextColor := Self.TextColor; + end + else inherited AssignTo(Dest); +end; + +constructor TSpTBXSkinOptionCategory.Create; +begin + inherited; + FBody := TSpTBXSkinOptionEntry.Create; + FBorders := TSpTBXSkinOptionEntry.Create; + FTextColor := clNone; +end; + +destructor TSpTBXSkinOptionCategory.Destroy; +begin + FreeAndNil(FBody); + FreeAndNil(FBorders); + inherited; +end; + +function TSpTBXSkinOptionCategory.IsEmpty: Boolean; +begin + Result := FBody.IsEmpty and FBorders.IsEmpty and (FTextColor = clNone); +end; + +procedure TSpTBXSkinOptionCategory.Reset; +begin + FBody.Reset; + FBorders.Reset; + FTextColor := clNone; +end; + +procedure TSpTBXSkinOptionCategory.SaveToIni(MemIni: TMemIniFile; Section, Ident: string); +begin + if not IsEmpty then begin + MemIni.WriteString(Section, Ident + '.Body', Body.WriteToString); + MemIni.WriteString(Section, Ident + '.Borders', Borders.WriteToString); + MemIni.WriteString(Section, Ident + '.TextColor', SpColorToString(TextColor)); + end; +end; + +procedure TSpTBXSkinOptionCategory.LoadFromIni(MemIni: TMemIniFile; Section, Ident: string); +begin + Reset; + if Ident = '' then Ident := SSpTBXSkinStatesString[sknsNormal]; + + Body.ReadFromString(MemIni.ReadString(Section, Ident + '.Body', '')); + Borders.ReadFromString(MemIni.ReadString(Section, Ident + '.Borders', '')); + TextColor := StringToColor(MemIni.ReadString(Section, Ident + '.TextColor', 'clNone')); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXThemeOptions } + +procedure TSpTBXSkinOptions.AssignTo(Dest: TPersistent); +var + C: TSpTBXSkinComponentsType; + S: TSpTBXSkinStatesType; + DestOp: TSpTBXSkinOptions; +begin + if Dest is TSpTBXSkinOptions then begin + DestOp := TSpTBXSkinOptions(Dest); + for C := Low(C) to High(C) do + for S := Low(S) to High(S) do + DestOp.FOptions[C, S].Assign(Options(C, S)); + DestOp.ColorBtnFace := FColorBtnFace; + DestOp.FloatingWindowBorderSize := FFloatingWindowBorderSize; + DestOp.OfficeIcons := FOfficeIcons; + DestOp.OfficeMenuSeparator := FOfficeMenuSeparator; + DestOp.OfficeStatusBar := FOfficeStatusBar; + DestOp.FSkinAuthor := FSkinAuthor; + DestOp.FSkinName := FSkinName; + end + else inherited AssignTo(Dest); +end; + +procedure TSpTBXSkinOptions.BroadcastChanges; +begin + if Self = SkinManager.CurrentSkin then + SkinManager.BroadcastSkinNotification; +end; + +procedure TSpTBXSkinOptions.CopyOptions(AComponent, ToComponent: TSpTBXSkinComponentsType); +var + S: TSpTBXSkinStatesType; +begin + for S := Low(S) to High(S) do + FOptions[AComponent, S].AssignTo(FOptions[ToComponent, S]); +end; + +constructor TSpTBXSkinOptions.Create; +var + C: TSpTBXSkinComponentsType; + S: TSpTBXSkinStatesType; +begin + inherited; + FSkinName := 'Default'; + FColorBtnFace := clBtnFace; + FFloatingWindowBorderSize := 4; + for C := Low(C) to High(C) do + for S := Low(S) to High(S) do + FOptions[C, S] := TSpTBXSkinOptionCategory.Create; + + FillOptions; +end; + +destructor TSpTBXSkinOptions.Destroy; +var + C: TSpTBXSkinComponentsType; + S: TSpTBXSkinStatesType; +begin + for C := Low(C) to High(C) do + for S := Low(S) to High(S) do + FreeAndNil(FOptions[C, S]); + + inherited; +end; + +procedure TSpTBXSkinOptions.FillOptions; +begin + // Used by descendants to fill the skin options +end; + +procedure TSpTBXSkinOptions.Reset(ForceResetSkinProperties: Boolean); +var + C: TSpTBXSkinComponentsType; + S: TSpTBXSkinStatesType; +begin + if ForceResetSkinProperties then begin + FColorBtnFace := clBtnFace; + FFloatingWindowBorderSize := 4; + FOfficeIcons := False; + FOfficeMenuSeparator := False; + FOfficeStatusBar := False; + end; + + for C := Low(C) to High(C) do + for S := Low(S) to High(S) do + FOptions[C, S].Reset; +end; + +function TSpTBXSkinOptions.Options(Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType): TSpTBXSkinOptionCategory; +begin + if CSpTBXSkinComponents[Component].States = [sknsNormal] then + State := sknsNormal; + Result := FOptions[Component, State]; +end; + +function TSpTBXSkinOptions.Options(Component: TSpTBXSkinComponentsType): TSpTBXSkinOptionCategory; +begin + Result := FOptions[Component, sknsNormal]; +end; + +procedure TSpTBXSkinOptions.SaveToFile(Filename: WideString); +var + MemIni: TMemIniFile; +begin + MemIni := TMemIniFile.Create(Filename); + try + SaveToMemIni(MemIni); + MemIni.UpdateFile; + finally + MemIni.Free; + end; +end; + +procedure TSpTBXSkinOptions.SaveToMemIni(MemIni: TMemIniFile); +var + C: TSpTBXSkinComponentsType; + S: TSpTBXSkinStatesType; +begin + MemIni.WriteString('Skin', 'Name', FSkinName); + MemIni.WriteString('Skin', 'Author', FSkinAuthor); + MemIni.WriteString('Skin', 'ColorBtnFace', SpColorToString(FColorBtnFace)); + MemIni.WriteInteger('Skin', 'FloatingWindowBorderSize', FFloatingWindowBorderSize); + MemIni.WriteBool('Skin', 'OfficeIcons', FOfficeIcons); + MemIni.WriteBool('Skin', 'OfficeMenuSeparator', FOfficeMenuSeparator); + MemIni.WriteBool('Skin', 'OfficeStatusBar', FOfficeStatusBar); + + for C := Low(C) to High(C) do begin + for S := Low(S) to High(S) do + if S in CSpTBXSkinComponents[C].States then + FOptions[C, S].SaveToIni(MemIni, CSpTBXSkinComponents[C].Name, SSpTBXSkinStatesString[S]); + end; +end; + +procedure TSpTBXSkinOptions.SaveToStrings(L: TStrings); +var + MemIni: TMemIniFile; +begin + MemIni := TMemIniFile.Create(''); + try + MemIni.SetStrings(L); // Transfer L contents to MemIni + SaveToMemIni(MemIni); + L.Clear; + MemIni.GetStrings(L); // Transfer MemIni contents to L + finally + MemIni.Free; + end; +end; + +procedure TSpTBXSkinOptions.LoadFromFile(Filename: WideString); +var + L: TStringList; +begin + if FileExists(Filename) then begin + L := TStringList.Create; + try + L.LoadFromFile(Filename); + LoadFromStrings(L); + finally + L.Free; + end; + end; +end; + +procedure TSpTBXSkinOptions.LoadFromStrings(L: TStrings); +var + MemIni: TMemIniFile; + C: TSpTBXSkinComponentsType; + S: TSpTBXSkinStatesType; +begin + MemIni := TMemIniFile.Create(''); + try + MemIni.SetStrings(L); + + FSkinName := MemIni.ReadString('Skin', 'Name', ''); + FSkinAuthor := MemIni.ReadString('Skin', 'Author', ''); + FColorBtnFace := StringToColor(MemIni.ReadString('Skin', 'ColorBtnFace', 'clBtnFace')); + FFloatingWindowBorderSize := MemIni.ReadInteger('Skin', 'FloatingWindowBorderSize', 4); + FOfficeIcons := MemIni.ReadBool('Skin', 'OfficeIcons', False); + FOfficeMenuSeparator := MemIni.ReadBool('Skin', 'OfficeMenuSeparator', False); + FOfficeStatusBar := MemIni.ReadBool('Skin', 'OfficeStautsBar', False); + + for C := Low(C) to High(C) do begin + for S := Low(S) to High(S) do + if S in CSpTBXSkinComponents[C].States then + FOptions[C, S].LoadFromIni(MemIni, CSpTBXSkinComponents[C].Name, SSpTBXSkinStatesString[S]); + end; + + BroadcastChanges; + finally + MemIni.Free; + end; +end; + +function TSpTBXSkinOptions.GetOfficeIcons: Boolean; +// OfficeIcons is used to paint the menu items icons with Office XP shadows. +begin + Result := FOfficeIcons and (SkinManager.GetSkinType = sknSkin); +end; + +function TSpTBXSkinOptions.GetOfficeMenuSeparator: Boolean; +// When OfficeMenuSeparator is True the height of the separators on popup menus +// is 6 pixels, otherwise the size is 10 pixels. +begin + Result := FOfficeMenuSeparator and (SkinManager.GetSkinType = sknSkin); +end; + +function TSpTBXSkinOptions.GetOfficePopup: Boolean; +// OfficePopup is used to paint the PopupWindow with Office XP style. +// It is also used to paint the opened toolbar item with shadows. +begin + Result := (SkinManager.GetSkinType = sknSkin) and not Options(skncOpenToolbarItem).IsEmpty; +end; + +function TSpTBXSkinOptions.GetOfficeStatusBar: Boolean; +// OfficeStatusBar is used to paint the StatusBar panels with Office XP style. +var + T: TSpTBXSkinType; +begin + T := SkinManager.GetSkinType; + Result := (FOfficeStatusBar and (T = sknSkin)) or (T = sknNone); +end; + +function TSpTBXSkinOptions.GetFloatingWindowBorderSize: Integer; +begin + if SkinManager.GetSkinType = sknSkin then + Result := FFloatingWindowBorderSize + else + Result := 4; +end; + +procedure TSpTBXSkinOptions.SetFloatingWindowBorderSize(const Value: Integer); +begin + FFloatingWindowBorderSize := Value; + if FFloatingWindowBorderSize < 0 then FFloatingWindowBorderSize := 0; + if FFloatingWindowBorderSize > 4 then FFloatingWindowBorderSize := 4; +end; + +procedure TSpTBXSkinOptions.GetDropDownArrowSize(out DropDownArrowSize, + DropDownArrowMargin, SplitBtnArrowSize: Integer); +begin + DropDownArrowSize := 8; // TB2Item.tbDropdownArrowWidth + DropDownArrowMargin := 3; // TB2Item.tbDropdownArrowMargin + + SplitBtnArrowSize := 12; // TB2Item.tbDropdownComboArrowWidth + 1 + if SkinManager.GetSkinType = sknWindows then + SplitBtnArrowSize := SplitBtnArrowSize + 1; +end; + +procedure TSpTBXSkinOptions.GetMenuItemMargins(ACanvas: TCanvas; ImgSize: Integer; + out MarginsInfo: TSpTBXMenuItemMarginsInfo); +var + TextMetric: TTextMetric; + H, M2: Integer; +begin + if ImgSize = 0 then + ImgSize := 16; + + FillChar(MarginsInfo, SizeOf(MarginsInfo), 0); + + if (SkinManager.GetSkinType = sknSkin) or ((SkinManager.GetSkinType = sknWindows) and SpIsWinVistaOrUp) then begin + // Office like spacing, used by Windows Vista and all the skins + MarginsInfo.Margins := Rect(1, 4, 1, 4); // MID_MENUITEM + MarginsInfo.ImageTextSpace := 5; // TMI_MENU_IMGTEXTSPACE + MarginsInfo.LeftCaptionMargin := 3; // TMI_MENU_LCAPTIONMARGIN + MarginsInfo.RightCaptionMargin := 3; // TMI_MENU_RCAPTIONMARGIN + end + else begin + MarginsInfo.Margins := Rect(0, 3, 0, 3); // MID_MENUITEM + MarginsInfo.ImageTextSpace := 1; // TMI_MENU_IMGTEXTSPACE + MarginsInfo.LeftCaptionMargin := 2; // TMI_MENU_LCAPTIONMARGIN + MarginsInfo.RightCaptionMargin := 2; // TMI_MENU_RCAPTIONMARGIN + end; + + GetTextMetrics(ACanvas.Handle, TextMetric); + M2 := MarginsInfo.Margins.Top + MarginsInfo.Margins.Bottom; + MarginsInfo.GutterSize := TextMetric.tmHeight + TextMetric.tmExternalLeading + M2; + H := ImgSize + M2; + if H > MarginsInfo.GutterSize then MarginsInfo.GutterSize := H; + MarginsInfo.GutterSize := (ImgSize + M2) * MarginsInfo.GutterSize div H - 2; // GutterSize = GetPopupMargin = ItemInfo.PopupMargin +end; + +function TSpTBXSkinOptions.GetState(Enabled, Pushed, HotTrack, Checked: Boolean): TSpTBXSkinStatesType; +begin + Result := sknsNormal; + if not Enabled then Result := sknsDisabled + else begin + if Pushed then Result := sknsPushed + else + if HotTrack and Checked then Result := sknsCheckedAndHotTrack + else + if HotTrack then Result := sknsHotTrack + else + if Checked then Result := sknsChecked; + end; +end; + +function TSpTBXSkinOptions.GetTextColor(Component: TSpTBXSkinComponentsType; + State: TSpTBXSkinStatesType; SkinType: TSpTBXSkinType = sknSkin): TColor; +var + Flags: Integer; + VistaColor: Cardinal; +begin + Result := clNone; + SkinType := SpTBXSkinType(SkinType); + + if SkinType = sknSkin then begin + if State in CSpTBXSkinComponents[Component].States then begin + Result := Options(Component, State).TextColor; + if Result <> clNone then + Exit; // Text color is specified by the skin + end + else + Exit; // Exit if the State is not valid + end; + + if State = sknsDisabled then Result := clGrayText + else Result := clBtnText; + + case Component of + skncMenuItem: + if SpIsWinVistaOrUp and (SkinType = sknWindows) then begin + Flags := MPI_NORMAL; + if State = sknsDisabled then Flags := MPI_DISABLED + else if State in [sknsHotTrack, sknsCheckedAndHotTrack] then Flags := MPI_HOT; + GetThemeColor(ThemeServices.Theme[teMenu], MENU_POPUPITEM, Flags, TMT_TEXTCOLOR, VistaColor); + Result := TColor(VistaColor); + end + else + if State <> sknsDisabled then begin + Result := clMenuText; + if SkinType <> sknSkin then + if State in [sknsHotTrack, sknsCheckedAndHotTrack, sknsPushed] then + Result := clHighlightText; + end; + skncMenuBarItem: + if State <> sknsDisabled then begin + Result := clMenuText; + if SkinType = sknWindows then + if State in [sknsHotTrack, sknsPushed, sknsChecked, sknsCheckedAndHotTrack] then + Result := clHighlightText; + end; + skncToolbarItem: + if State <> sknsDisabled then Result := clMenuText; + skncListItem: + if SkinType <> sknSkin then + if State in [sknsHotTrack, sknsCheckedAndHotTrack] then + Result := clHighlightText; + skncDockablePanelTitleBar, skncStatusBar, skncTabToolbar: + if SkinType = sknSkin then + Result := clNone; // Reset Result to clNone so the Toolbar can override the items text color + skncWindowTitleBar: + if SkinType = sknSkin then + Result := clNone // Reset Result to clNone so the Toolbar can override the items text color + else + if State = sknsDisabled then Result := clInactiveCaptionText + else Result := clCaptionText; + end; +end; + +procedure TSpTBXSkinOptions.PaintBackground(ACanvas: TCanvas; ARect: TRect; + Component: TSpTBXSkinComponentsType; State: TSpTBXSkinStatesType; + Background, Borders: Boolean; Vertical: Boolean = False; + ForceRectBorders: TAnchors = []); +var + BackgroundRect: TRect; + Op: TSpTBXSkinOptionCategory; +begin + Op := Options(Component, State); + + if Op.Borders.IsEmpty then + Borders := False; + if Op.Body.IsEmpty then + Background := False; + + if Background then begin + BackgroundRect := ARect; + if Borders then + InflateRect(BackgroundRect, -1, -1); + SpPaintSkinBackground(ACanvas, BackgroundRect, Op, Vertical); + end; + + if Borders then + SpPaintSkinBorders(ACanvas, ARect, Op, ForceRectBorders); +end; + +procedure TSpTBXSkinOptions.PaintMenuCheckMark(ACanvas: TCanvas; ARect: TRect; + Checked, Grayed, MenuItemStyle: Boolean; State: TSpTBXSkinStatesType); +var + X, Y: Integer; + PenC, BrushC, CheckColor: TColor; + Flags: Integer; + VistaCheckSize: TSize; +begin + if MenuItemStyle and SpIsWinVistaOrUp and (SkinManager.GetSkinType = sknWindows) then begin + if State = sknsDisabled then Flags := MC_CHECKMARKDISABLED + else Flags := MC_CHECKMARKNORMAL; + VistaCheckSize.cx := 0; + VistaCheckSize.cy := 0; + GetThemePartSize(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPCHECK, Flags, nil, TS_TRUE, VistaCheckSize); + ARect := SpCenterRect(ARect, VistaCheckSize.cx, VistaCheckSize.cy); + DrawThemeBackground(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPCHECK, Flags, ARect, nil); + end + else begin + X := ARect.Left + (ARect.Right - ARect.Left) div 2 - 1; + Y := ARect.Top + (ARect.Bottom - ARect.Top) div 2 + 1; + + PenC := ACanvas.Pen.Color; + BrushC := ACanvas.Brush.Color; + try + if MenuItemStyle then begin + CheckColor := clMenuText; // On sknNone it's clMenuText even when disabled + case SkinManager.GetSkinType of + sknWindows: + CheckColor := GetTextColor(skncCheckBox, State); + sknSkin: + CheckColor := GetTextColor(skncMenuItem, State); + end; + ACanvas.Brush.Color := CheckColor; + ACanvas.Pen.Color := CheckColor; + ACanvas.Polygon([Point(X - 3, Y - 2), Point(X - 1, Y), Point(X + 3, Y - 4), + Point(X + 3, Y - 3), Point(X - 1, Y + 1), Point(X - 3, Y - 1), Point(X - 3, Y -2)]); + end + else begin + CheckColor := GetTextColor(skncCheckBox, State); + ACanvas.Brush.Color := CheckColor; + ACanvas.Pen.Color := CheckColor; + PaintBackground(ACanvas, ARect, skncCheckBox, State, True, True); + if Checked then + ACanvas.Polygon([Point(X - 2, Y), Point(X, Y + 2), Point(X + 4, Y - 2), + Point(X + 4, Y - 4), Point(X, Y), Point(X - 2, Y - 2), Point(X - 2, Y)]) + else + if Grayed then begin + InflateRect(ARect, -3, -3); + // ACanvas.Brush.Color := Options(skncCheckBox, sknsChecked).Borders.Color1; + ACanvas.FillRect(ARect); + end; + end; + finally + ACanvas.Pen.Color := PenC; + ACanvas.Brush.Color := BrushC; + end; + end; +end; + +procedure TSpTBXSkinOptions.PaintMenuRadioMark(ACanvas: TCanvas; ARect: TRect; + Checked, MenuItemStyle: Boolean; State: TSpTBXSkinStatesType); +var + X, Y: Integer; + PenC, BrushC, CheckColor, FrameColor: TColor; + Flags: Integer; + VistaCheckSize: TSize; +begin + if MenuItemStyle and SpIsWinVistaOrUp and (SkinManager.GetSkinType = sknWindows) then begin + if State = sknsDisabled then Flags := MC_BULLETDISABLED + else Flags := MC_BULLETNORMAL; + VistaCheckSize.cx := 0; + VistaCheckSize.cy := 0; + GetThemePartSize(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPCHECK, Flags, nil, TS_TRUE, VistaCheckSize); + ARect := SpCenterRect(ARect, VistaCheckSize.cx, VistaCheckSize.cy); + DrawThemeBackground(ThemeServices.Theme[teMenu], ACanvas.Handle, MENU_POPUPCHECK, Flags, ARect, nil); + end + else begin + PenC := ACanvas.Pen.Color; + BrushC := ACanvas.Brush.Color; + try + if MenuItemStyle then begin + CheckColor := clMenuText; // On sknNone it's clMenuText even when disabled + case SkinManager.GetSkinType of + sknWindows: + CheckColor := GetTextColor(skncRadioButton, State); + sknSkin: + CheckColor := GetTextColor(skncMenuItem, State); + end; + ACanvas.Brush.Color := CheckColor; + ACanvas.Pen.Color := CheckColor; + X := ARect.Left + (ARect.Right - ARect.Left) div 2; + Y := ARect.Top + (ARect.Bottom - ARect.Top) div 2; + ACanvas.RoundRect(X - 3, Y - 3, X + 3, Y + 3, 2, 2); + end + else begin + CheckColor := GetTextColor(skncRadioButton, State); + FrameColor := Options(skncRadioButton, State).Borders.Color1; + if State = sknsDisabled then FrameColor := CheckColor; + if not Checked then CheckColor := clNone; + + // Keep it simple make the radio 13x13 + ARect.Left := ARect.Left + (ARect.Right - ARect.Left - 13) div 2; + ARect.Right := ARect.Left + 13; + ARect.Top := ARect.Top + (ARect.Bottom - ARect.Top - 13) div 2; + ARect.Bottom := ARect.Top + 13; + X := ARect.Left; + Y := ARect.Top; + + // Background + BeginPath(ACanvas.Handle); + ACanvas.Polyline([Point(X, Y + 8), Point(X, Y + 4), Point(X + 1, Y + 3), + Point(X + 1, Y + 2), Point(X + 2, Y + 1), Point(X + 3, Y + 1), + Point(X + 4, Y), Point(X + 8, Y), Point(X + 9, Y + 1), + Point(X + 10, Y + 1), Point(X + 11, Y + 2), Point(X + 11, Y + 3), + Point(X + 12, Y + 4), Point(X + 12, Y + 8), Point(X + 11, Y + 9), + Point(X + 11, Y + 10), Point(X + 10, Y + 11), Point(X + 9, Y + 11), + Point(X + 8, Y + 12), Point(X + 4, Y + 12), Point(X + 3, Y + 11), + Point(X + 2, Y + 11), Point(X + 1, Y + 10), Point(X + 1, Y + 8)]); + EndPath(ACanvas.Handle); + SelectClipPath(ACanvas.Handle, RGN_COPY); + PaintBackground(ACanvas, ARect, skncRadioButton, State, True, False); + SelectClipPath(ACanvas.Handle, 0); + SelectClipRgn(ACanvas.Handle, 0); + + // Frame + ACanvas.Brush.Color := FrameColor; + ACanvas.Pen.Color := FrameColor; + ACanvas.Polyline([Point(X, Y + 8), Point(X, Y + 4), Point(X + 1, Y + 3), + Point(X + 1, Y + 2), Point(X + 2, Y + 1), Point(X + 3, Y + 1), + Point(X + 4, Y), Point(X + 8, Y), Point(X + 9, Y + 1), + Point(X + 10, Y + 1), Point(X + 11, Y + 2), Point(X + 11, Y + 3), + Point(X + 12, Y + 4), Point(X + 12, Y + 8), Point(X + 11, Y + 9), + Point(X + 11, Y + 10), Point(X + 10, Y + 11), Point(X + 9, Y + 11), + Point(X + 8, Y + 12), Point(X + 4, Y + 12), Point(X + 3, Y + 11), + Point(X + 2, Y + 11), Point(X + 1, Y + 10), Point(X + 1, Y + 8)]); + + // Radio + if CheckColor <> clNone then begin + ACanvas.Brush.Color := CheckColor; + ACanvas.Pen.Color := CheckColor; + X := (ARect.Left + ARect.Right) div 2; + Y := (ARect.Top + ARect.Bottom) div 2 + 1; + ACanvas.RoundRect(X - 2, Y - 3, X + 3, Y + 2, 2, 2); + end; + end; + finally + ACanvas.Pen.Color := PenC; + ACanvas.Brush.Color := BrushC; + end; + end; +end; + +procedure TSpTBXSkinOptions.PaintWindowFrame(ACanvas: TCanvas; ARect: TRect; + IsActive, DrawBody: Boolean; BorderSize: Integer = 4); +var + C: TColor; + R: TRect; + I: Integer; + State: TSpTBXSkinStatesType; + Op: TSpTBXSkinOptionEntry; +begin + if IsActive then + State := sknsNormal + else + if Options(skncWindow, sknsDisabled).IsEmpty then + State := sknsNormal + else + State := sknsDisabled; + + C := ACanvas.Brush.Color; + if DrawBody then + PaintBackground(ACanvas, ARect, skncWindow, State, True, False); + R := ARect; + Op := Options(skncWindow, State).Borders; + for I := 1 to BorderSize do begin + if I = 1 then ACanvas.Brush.Color := Op.Color1 + else if I = 2 then ACanvas.Brush.Color := Op.Color2 + else if I = 3 then ACanvas.Brush.Color := Op.Color3 + else if I >= 4 then ACanvas.Brush.Color := Op.Color4; + ACanvas.FrameRect(R); + InflateRect(R, -1, -1); + end; + ACanvas.Brush.Color := C; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSkinsListEntry } + +destructor TSpTBXSkinsListEntry.Destroy; +begin + SkinClass := nil; + FreeAndNil(SkinStrings); + + inherited; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSkinsList } + +destructor TSpTBXSkinsList.Destroy; +begin + // Free all the skins options + while Count > 0 do + Delete(0); + inherited; +end; + +function TSpTBXSkinsList.AddSkin(SkinName: string; SkinClass: TSpTBXSkinOptionsClass): Integer; +var + K: TSpTBXSkinsListEntry; +begin + Result := -1; + if (SkinName <> '') and (IndexOf(SkinName) = -1) then begin + K := TSpTBXSkinsListEntry.Create; + try + K.SkinClass := SkinClass; + Result := AddObject(SkinName, K); // the list owns K + except + K.Free; + end; + end; +end; + +function TSpTBXSkinsList.AddSkin(SkinOptions: TStrings): Integer; +var + K: TSpTBXSkinsListEntry; + S: string; +begin + Result := -1; + K := TSpTBXSkinsListEntry.Create; + try + K.SkinStrings := TStringList.Create; + S := SkinOptions.Values['Name ']; + if S = '' then + S := SkinOptions.Values['Name']; + S := Trim(S); + if (S <> '') and (IndexOf(S) = -1) then begin + K.SkinStrings.Assign(SkinOptions); + Result := AddObject(S, K); // the list owns K + end + else + K.Free; + except + K.Free; + end; +end; + +function TSpTBXSkinsList.AddSkinFromFile(Filename: WideString): Integer; +var + L: TStringList; +begin + L := TStringList.Create; + try + L.LoadFromFile(Filename); + Result := AddSkin(L); + finally + L.Free; + end; +end; + +procedure TSpTBXSkinsList.AddSkinsFromFolder(Folder: WideString); +var + L: TStringList; + I: Integer; + S: string; +begin + L := TStringList.Create; + try + if SpGetDirectories(Folder, L) then begin + for I := 0 to L.Count - 1 do begin + S := IncludeTrailingPathDelimiter(Folder) + L[I] + '\Skin.ini'; + if FileExists(S) then + AddSkinFromFile(S); + end; + end; + finally + L.Free; + end; +end; + +procedure TSpTBXSkinsList.Delete(Index: Integer); +begin + if (Index > -1) and (Index < Count) then + SkinOptions[Index].Free; + inherited Delete(Index); +end; + +procedure TSpTBXSkinsList.GetSkinNames(SkinNames: TStrings); +var + I: Integer; +begin + SkinNames.BeginUpdate; + try + SkinNames.Clear; + SkinNames.Add('Default'); + for I := 0 to Count - 1 do + SkinNames.Add(Strings[I]); + finally + SkinNames.EndUpdate; + end; +end; + +function TSpTBXSkinsList.GetSkinOption(Index: Integer): TSpTBXSkinsListEntry; +begin + Result := TSpTBXSkinsListEntry(Objects[Index]); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSkinManager } + +constructor TSpTBXSkinManager.Create; +begin + FNotifies := TList.Create; + FCurrentSkin := TSpTBXSkinOptions.Create; + FSkinsList := TSpTBXSkinsList.Create; +end; + +destructor TSpTBXSkinManager.Destroy; +begin + FreeAndNil(FNotifies); + FreeAndNil(FCurrentSkin); + FreeAndNil(FSkinsList); + inherited; +end; + +procedure TSpTBXSkinManager.AddSkinNotification(AObject: TObject); +begin + if FNotifies.IndexOf(AObject) < 0 then FNotifies.Add(AObject); +end; + +procedure TSpTBXSkinManager.RemoveSkinNotification(AObject: TObject); +begin + FNotifies.Remove(AObject); +end; + +procedure TSpTBXSkinManager.Broadcast; +var + Msg: TMessage; + I: Integer; +begin + if FNotifies.Count > 0 then begin + Msg.Msg := WM_SPSKINCHANGE; + Msg.WParam := 0; + Msg.LParam := 0; + Msg.Result := 0; + for I := 0 to FNotifies.Count - 1 do + TObject(FNotifies[I]).Dispatch(Msg); + end; + if Assigned(FOnSkinChange) then FOnSkinChange(Self); +end; + +procedure TSpTBXSkinManager.BroadcastSkinNotification; +begin + Broadcast; +end; + +procedure TSpTBXSkinManager.LoadFromFile(Filename: WideString); +begin + FCurrentSkin.LoadFromFile(Filename); +end; + +procedure TSpTBXSkinManager.SaveToFile(Filename: WideString); +begin + FCurrentSkin.SaveToFile(Filename); +end; + +function TSpTBXSkinManager.GetCurrentSkinName: string; +begin + Result := FCurrentSkin.SkinName; +end; + +function TSpTBXSkinManager.GetSkinType: TSpTBXSkinType; +begin + Result := SpTBXSkinType(sknSkin); +end; + +function TSpTBXSkinManager.IsDefaultSkin: Boolean; +begin + Result := CurrentSkinName = 'Default'; +end; + +function TSpTBXSkinManager.IsXPThemesEnabled: Boolean; +begin + Result := ThemeServices.ThemesAvailable and UxTheme.UseThemes; +end; + +procedure TSpTBXSkinManager.SetSkin(SkinName: string); +var + I: Integer; + K: TSpTBXSkinsListEntry; +begin + if not SameText(SkinName, CurrentSkinName) then + if SameText(SkinName, 'Default') then + SetToDefaultSkin + else begin + I := FSkinsList.IndexOf(SkinName); + if I > -1 then begin + K := FSkinsList.SkinOptions[I]; + if Assigned(K.SkinClass) then begin + FCurrentSkin.Free; + FCurrentSkin := K.SkinClass.Create; + Broadcast; + end + else + if Assigned(K.SkinStrings) then begin + FCurrentSkin.Free; + FCurrentSkin := TSpTBXSkinOptions.Create; + FCurrentSkin.LoadFromStrings(K.SkinStrings); + end; + end; + end; +end; + +procedure TSpTBXSkinManager.SetToDefaultSkin; +begin + FCurrentSkin.Free; + FCurrentSkin := TSpTBXSkinOptions.Create; + Broadcast; +end; + +procedure TSpTBXSkinManager.ChangeControlSkinType(Control: TWinControl; + SkinType: TSpTBXSkinType; Recursive: Boolean = True); + + procedure ChangeSkinTypeProperty(Component: TComponent; TM: TSpTBXSkinType); + var + S: string; + PropInfo: PPropInfo; + begin + if Length(Component.ClassName) > 6 then begin + S := Copy(Component.ClassName, 1, 6); + if SameText(S, 'TSpTBX') then begin + PropInfo := GetPropInfo(Component, 'SkinType'); + if (PropInfo <> nil) and (PropInfo.PropType^.Kind = tkEnumeration) then + SetOrdProp(Component, PropInfo, Integer(TM)); + end; + end; + end; + +var + I: Integer; + C: TControl; +begin + for I := 0 to Control.ControlCount - 1 do begin + C := Control.Controls[I]; + ChangeSkinTypeProperty(C, SkinType); + if Recursive and (C is TWinControl) then + ChangeControlSkinType(C as TWinControl, SkinType, Recursive); + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXSkinSwitcher } + +constructor TSpTBXSkinSwitcher.Create(AOwner: TComponent); +begin + inherited; + SkinManager.AddSkinNotification(Self); +end; + +destructor TSpTBXSkinSwitcher.Destroy; +begin + SkinManager.RemoveSkinNotification(Self); + inherited; +end; + +function TSpTBXSkinSwitcher.GetSkin: string; +begin + Result := SkinManager.CurrentSkinName; +end; + +procedure TSpTBXSkinSwitcher.SetSkin(const Value: string); +begin + SkinManager.SetSkin(Value); +end; + +procedure TSpTBXSkinSwitcher.WMSpSkinChange(var Message: TMessage); +begin + if Assigned(FOnSkinChange) then FOnSkinChange(Self); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Stock Objects } + +procedure InitializeStock; +begin + StockBitmap := TBitmap.Create; + StockBitmap.Width := 8; + StockBitmap.Height := 8; + + @SpPrintWindow := GetProcAddress(GetModuleHandle(user32), 'PrintWindow'); + + if not Assigned(FInternalSkinManager) then + FInternalSkinManager := TSpTBXSkinManager.Create; +end; + +procedure FinalizeStock; +begin + FreeAndNil(StockBitmap); + FreeAndNil(FInternalSkinManager); +end; + +initialization + InitializeStock; + +finalization + FinalizeStock; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.dcu b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.dcu new file mode 100644 index 0000000..654aec8 Binary files /dev/null and b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.dcu differ diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.hpp b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.hpp new file mode 100644 index 0000000..dd8925d --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.hpp @@ -0,0 +1,600 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Sptbxtabs.pas' rev: 20.00 + +#ifndef SptbxtabsHPP +#define SptbxtabsHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Sptbxtabs +{ +//-- type declarations ------------------------------------------------------- +#pragma option push -b- +enum TSpTBXTabEdge { tedNone, tedLeft, tedRight }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXTabPosition { ttpTop, ttpBottom }; +#pragma option pop + +#pragma option push -b- +enum TSpTBXTabCloseButton { tcbNone, tcbActive, tcbAll }; +#pragma option pop + +typedef void __fastcall (__closure *TSpTBXTabChangeEvent)(System::TObject* Sender, int TabIndex); + +typedef void __fastcall (__closure *TSpTBXTabChangingEvent)(System::TObject* Sender, int TabIndex, int NewTabIndex, bool &Allow); + +typedef void __fastcall (__closure *TSpTBXTabClosingEvent)(System::TObject* Sender, bool &Allow, bool &CloseAndFree); + +class DELPHICLASS TSpTBXTabItemDragObject; +class PASCALIMPLEMENTATION TSpTBXTabItemDragObject : public Sptbxitem::TSpTBXCustomDragObject +{ + typedef Sptbxitem::TSpTBXCustomDragObject inherited; + +public: + __fastcall virtual TSpTBXTabItemDragObject(Controls::TControl* ASourceControl, Tb2item::TTBCustomItem* AItem); +public: + /* TObject.Destroy */ inline __fastcall virtual ~TSpTBXTabItemDragObject(void) { } + +}; + + +class DELPHICLASS TSpTBXTabItem; +class DELPHICLASS TSpTBXTabToolbar; +class PASCALIMPLEMENTATION TSpTBXTabItem : public Sptbxitem::TSpTBXCustomItem +{ + typedef Sptbxitem::TSpTBXCustomItem inherited; + +private: + Sptbxskins::TSpTBXSkinType FSkinType; + Sptbxitem::TSpTBXDrawImageEvent FOnDrawTabCloseButton; + Classes::TNotifyEvent FOnTabClose; + TSpTBXTabClosingEvent FOnTabClosing; + Graphics::TColor __fastcall GetTabColor(void); + Sptbxskins::TSpTBXSkinType __fastcall GetSkinType(void); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + +protected: + virtual bool __fastcall DialogChar(System::Word CharCode); + virtual void __fastcall DoDrawTabCloseButton(Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, const Sptbxitem::TSpTBXPaintStage PaintStage, Imglist::TCustomImageList* AImageList, int &AImageIndex, Types::TRect &ARect, bool &PaintDefault); + virtual void __fastcall DoTabClose(void); + virtual void __fastcall DoTabClosing(bool &Allow, bool &CloseAndFree); + virtual Tb2item::TTBItemViewerClass __fastcall GetItemViewerClass(Tb2item::TTBView* AView); + bool __fastcall GetTabToolbar(/* out */ TSpTBXTabToolbar* &TabToolbar); + virtual void __fastcall ToggleControl(void); + __property Control; + __property Graphics::TColor TabColor = {read=GetTabColor, nodefault}; + +public: + __fastcall virtual TSpTBXTabItem(Classes::TComponent* AOwner); + virtual void __fastcall Click(void); + void __fastcall TabClose(void); + TSpTBXTabItem* __fastcall GetNextTab(bool GoForward, Sptbxitem::TSpTBXSearchItemViewerType SearchType); + bool __fastcall IsFirstVisible(void); + bool __fastcall IsFirstVisibleTab(void); + bool __fastcall IsLastVisibleTab(void); + +__published: + __property Action; + __property Checked = {default=0}; + __property Enabled = {default=1}; + __property HelpContext = {default=0}; + __property ImageIndex = {default=-1}; + __property Images; + __property InheritOptions = {default=1}; + __property MaskOptions = {default=0}; + __property Options = {default=0}; + __property ShortCut = {default=0}; + __property Visible = {default=1}; + __property OnClick; + __property OnSelect; + __property Alignment = {default=2}; + __property CustomWidth = {default=-1}; + __property CustomHeight = {default=-1}; + __property Margins = {default=4}; + __property MinHeight = {default=0}; + __property MinWidth = {default=0}; + __property FontSettings; + __property Wrapping = {default=1}; + __property OnDrawImage; + __property OnDrawItem; + __property OnDrawHint; + __property OnDrawCaption; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=GetSkinType, write=SetSkinType, default=2}; + __property Sptbxitem::TSpTBXDrawImageEvent OnDrawTabCloseButton = {read=FOnDrawTabCloseButton, write=FOnDrawTabCloseButton}; + __property Classes::TNotifyEvent OnTabClose = {read=FOnTabClose, write=FOnTabClose}; + __property TSpTBXTabClosingEvent OnTabClosing = {read=FOnTabClosing, write=FOnTabClosing}; +public: + /* TSpTBXCustomItem.Destroy */ inline __fastcall virtual ~TSpTBXTabItem(void) { } + +}; + + +class DELPHICLASS TSpTBXTabItemViewer; +class PASCALIMPLEMENTATION TSpTBXTabItemViewer : public Sptbxitem::TSpTBXItemViewer +{ + typedef Sptbxitem::TSpTBXItemViewer inherited; + +private: + Sptbxskins::TSpTBXSkinStatesType FTabCloseButtonState; + Types::TRect __fastcall CorrectTabRect(const Types::TRect &ARect); + HIDESBASE TSpTBXTabItem* __fastcall GetItem(void); + void __fastcall GetTabCloseButtonImgList(Imglist::TCustomImageList* &AImageList, int &AImageIndex); + bool __fastcall IsTabCloseButtonVisible(void); + TSpTBXTabPosition __fastcall GetTabPosition(void); + +protected: + virtual void __fastcall CalcSize(const Graphics::TCanvas* Canvas, int &AWidth, int &AHeight); + virtual void __fastcall DoDrawButton(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawCaption(Graphics::TCanvas* ACanvas, const Types::TRect &ClientAreaRect, Sptbxskins::TSpTBXSkinStatesType State, System::WideString &ACaption, Types::TRect &CaptionRect, unsigned &CaptionFormat, bool IsTextRotated, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual void __fastcall DoDrawImage(Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, const Sptbxitem::TSpTBXPaintStage PaintStage, Imglist::TCustomImageList* &AImageList, int &AImageIndex, Types::TRect &ARect, bool &PaintDefault); + virtual void __fastcall DoDrawTabCloseButton(Graphics::TCanvas* ACanvas, Sptbxskins::TSpTBXSkinStatesType State, const Sptbxitem::TSpTBXPaintStage PaintStage, Imglist::TCustomImageList* &AImageList, int &AImageIndex, Types::TRect &ARect, bool &PaintDefault); + void __fastcall DrawBottomBorder(Graphics::TCanvas* ACanvas, const Types::TRect &ARect); + virtual void __fastcall DrawTab(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool AEnabled, bool AChecked, bool AHoverItem, TSpTBXTabPosition Position, bool ASeparator = false, TSpTBXTabEdge AEdge = (TSpTBXTabEdge)(0x0)); + virtual void __fastcall DrawItemRightImage(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxskins::TSpTBXMenuItemInfo &ItemInfo); + virtual tagSIZE __fastcall GetRightImageSize(); + Types::TRect __fastcall GetRightImageRect(); + virtual Graphics::TColor __fastcall GetTextColor(Sptbxskins::TSpTBXSkinStatesType State); + virtual void __fastcall InternalMouseMove(Classes::TShiftState Shift, int X, int Y); + virtual void __fastcall Leaving(void); + +public: + bool __fastcall IsOnTabToolbar(void); + __property TSpTBXTabItem* Item = {read=GetItem}; + __property Sptbxskins::TSpTBXSkinStatesType TabCloseButtonState = {read=FTabCloseButtonState, nodefault}; + __property TSpTBXTabPosition TabPosition = {read=GetTabPosition, nodefault}; +public: + /* TTBItemViewer.Create */ inline __fastcall virtual TSpTBXTabItemViewer(Tb2item::TTBView* AView, Tb2item::TTBCustomItem* AItem, int AGroupLevel) : Sptbxitem::TSpTBXItemViewer(AView, AItem, AGroupLevel) { } + /* TTBItemViewer.Destroy */ inline __fastcall virtual ~TSpTBXTabItemViewer(void) { } + +}; + + +class DELPHICLASS TSpTBXCustomTabSet; +class PASCALIMPLEMENTATION TSpTBXTabToolbar : public Sptbxitem::TSpTBXToolbar +{ + typedef Sptbxitem::TSpTBXToolbar inherited; + +private: + Sptbxskins::TSpTBXSkinType FSkinType; + int FUpdateHidden; + bool FTabAutofit; + int FTabAutofitMaxSize; + int FTabCloseButtonImageIndex; + TSpTBXTabCloseButton FTabCloseButton; + bool FTabDragReorder; + bool FTabBackgroundBorders; + Graphics::TColor FTabColor; + int FTabMaxSize; + TSpTBXTabPosition FTabPosition; + void __fastcall Scroll(bool ToRight); + TSpTBXTabItem* __fastcall GetActiveTab(void); + void __fastcall SetActiveTabIndex(int Value); + void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + void __fastcall SetTabCloseButton(const TSpTBXTabCloseButton Value); + void __fastcall SetTabCloseButtonImageIndex(const int Value); + void __fastcall SetTabAutofit(const bool Value); + void __fastcall SetTabAutofitMaxSize(const int Value); + void __fastcall SetTabBackgroundBorders(const bool Value); + void __fastcall SetTabColor(const Graphics::TColor Value); + void __fastcall SetTabMaxSize(const int Value); + void __fastcall SetTabPosition(const TSpTBXTabPosition Value); + HIDESBASE MESSAGE void __fastcall CMDesignHitTest(Messages::TWMMouse &Message); + +protected: + Sptbxitem::TSpTBXItemCacheCollection* FHiddenTabs; + int FActiveTabIndex; + TSpTBXCustomTabSet* FOwnerTabControl; + void __fastcall Autofit(void); + virtual Graphics::TColor __fastcall GetItemsTextColor(Sptbxskins::TSpTBXSkinStatesType State); + virtual void __fastcall InternalDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool PaintOnNCArea, bool PaintBorders = true); + virtual void __fastcall DoItemNotification(Tb2item::TTBCustomItem* Ancestor, bool Relayed, Tb2item::TTBItemChangedAction Action, int Index, Tb2item::TTBCustomItem* Item); + virtual void __fastcall RightAlignItems(void); + virtual bool __fastcall CanDragCustomize(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); + DYNAMIC void __fastcall DoStartDrag(Controls::TDragObject* &DragObject); + DYNAMIC void __fastcall DragOver(System::TObject* Source, int X, int Y, Controls::TDragState State, bool &Accept); + +public: + __fastcall virtual TSpTBXTabToolbar(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXTabToolbar(void); + void __fastcall BeginUpdateHidden(void); + void __fastcall EndUpdateHidden(void); + int __fastcall GetTabsCount(bool VisibleOnly); + void __fastcall InvalidateActiveTab(void); + void __fastcall InvalidateNC(void); + void __fastcall MakeVisible(TSpTBXTabItem* ATab); + void __fastcall ScrollLeft(void); + void __fastcall ScrollRight(void); + void __fastcall ScrollState(/* out */ bool &CanScrollToLeft, /* out */ bool &CanScrollToRight); + void __fastcall TabClose(TSpTBXTabItem* ATab); + +__published: + __property TSpTBXTabItem* ActiveTab = {read=GetActiveTab}; + __property int ActiveTabIndex = {read=FActiveTabIndex, write=SetActiveTabIndex, nodefault}; + __property TSpTBXTabCloseButton TabCloseButton = {read=FTabCloseButton, write=SetTabCloseButton, default=0}; + __property int TabCloseButtonImageIndex = {read=FTabCloseButtonImageIndex, write=SetTabCloseButtonImageIndex, default=-1}; + __property bool TabBackgroundBorders = {read=FTabBackgroundBorders, write=SetTabBackgroundBorders, nodefault}; + __property bool TabAutofit = {read=FTabAutofit, write=SetTabAutofit, default=0}; + __property int TabAutofitMaxSize = {read=FTabAutofitMaxSize, write=SetTabAutofitMaxSize, default=200}; + __property Graphics::TColor TabColor = {read=FTabColor, write=SetTabColor, default=-16777201}; + __property int TabMaxSize = {read=FTabMaxSize, write=SetTabMaxSize, default=-1}; + __property TSpTBXTabPosition TabPosition = {read=FTabPosition, write=SetTabPosition, default=0}; + __property bool TabDragReorder = {read=FTabDragReorder, write=FTabDragReorder, default=0}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=FSkinType, write=SetSkinType, default=2}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXTabToolbar(HWND ParentWindow) : Sptbxitem::TSpTBXToolbar(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXTabSheet; +class DELPHICLASS TSpTBXCustomTabControl; +class PASCALIMPLEMENTATION TSpTBXTabSheet : public Controls::TCustomControl +{ + typedef Controls::TCustomControl inherited; + +private: + TSpTBXCustomTabControl* FTabControl; + TSpTBXTabItem* FItem; + System::UnicodeString FItemName; + Controls::TWinControl* FPrevFocused; + void __fastcall ReadItemName(Classes::TReader* Reader); + void __fastcall WriteItemName(Classes::TWriter* Writer); + System::WideString __fastcall GetCaption(); + bool __fastcall GetTabVisible(void); + void __fastcall SetCaption(const System::WideString Value); + void __fastcall SetTabVisible(const bool Value); + int __fastcall GetImageIndex(void); + void __fastcall SetImageIndex(const int Value); + HIDESBASE MESSAGE void __fastcall CMVisiblechanged(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message); + HIDESBASE MESSAGE void __fastcall WMWindowPosChanged(Messages::TWMWindowPosMsg &Message); + +protected: + virtual void __fastcall CreateParams(Controls::TCreateParams &Params); + virtual void __fastcall AdjustClientRect(Types::TRect &Rect); + virtual void __fastcall DefineProperties(Classes::TFiler* Filer); + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + virtual void __fastcall ReadState(Classes::TReader* Reader); + DYNAMIC void __fastcall VisibleChanging(void); + __property Align = {default=5}; + __property Controls::TWinControl* PrevFocused = {read=FPrevFocused}; + +public: + __fastcall virtual TSpTBXTabSheet(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXTabSheet(void); + __property TSpTBXTabItem* Item = {read=FItem, write=FItem}; + __property TSpTBXCustomTabControl* TabControl = {read=FTabControl, write=FTabControl}; + +__published: + __property PopupMenu; + __property System::WideString Caption = {read=GetCaption, write=SetCaption}; + __property int ImageIndex = {read=GetImageIndex, write=SetImageIndex, nodefault}; + __property bool TabVisible = {read=GetTabVisible, write=SetTabVisible, default=1}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXTabSheet(HWND ParentWindow) : Controls::TCustomControl(ParentWindow) { } + +}; + + +class PASCALIMPLEMENTATION TSpTBXCustomTabSet : public Sptbxitem::TSpTBXCompoundItemsControl +{ + typedef Sptbxitem::TSpTBXCompoundItemsControl inherited; + +private: + int FItemMoveCount; + TSpTBXTabItem* FItemMoved; + bool FTabVisible; + int FLoadingActiveIndex; + bool FUpdatingIndex; + bool FResizing; + Sptbxitem::TSpTBXDrawEvent FOnDrawBackground; + TSpTBXTabChangeEvent FOnActiveTabChange; + TSpTBXTabChangingEvent FOnActiveTabChanging; + TSpTBXTabChangeEvent FOnActiveTabReorder; + TSpTBXTabChangingEvent FOnActiveTabReordering; + void __fastcall ReadHiddenItems(Classes::TReader* Reader); + void __fastcall WriteHiddenItems(Classes::TWriter* Writer); + int __fastcall GetActiveTabIndex(void); + void __fastcall SetActiveTabIndex(int Value); + Sptbxskins::TSpTBXSkinType __fastcall GetSkinType(void); + HIDESBASE void __fastcall SetSkinType(const Sptbxskins::TSpTBXSkinType Value); + bool __fastcall GetTabAutofit(void); + void __fastcall SetTabAutofit(const bool Value); + int __fastcall GetTabAutofitMaxSize(void); + void __fastcall SetTabAutofitMaxSize(const int Value); + bool __fastcall GetTabBackgroundBorders(void); + void __fastcall SetTabBackgroundBorders(const bool Value); + Graphics::TColor __fastcall GetTabBackgroundColor(void); + void __fastcall SetTabBackgroundColor(const Graphics::TColor Value); + TSpTBXTabCloseButton __fastcall GetTabCloseButton(void); + void __fastcall SetTabCloseButton(const TSpTBXTabCloseButton Value); + int __fastcall GetTabCloseButtonImageIndex(void); + void __fastcall SetTabCloseButtonImageIndex(const int Value); + bool __fastcall GetTabDragReorder(void); + void __fastcall SetTabDragReorder(const bool Value); + int __fastcall GetTabMaxSize(void); + void __fastcall SetTabMaxSize(const int Value); + TSpTBXTabPosition __fastcall GetTabPosition(void); + void __fastcall SetTabPosition(const TSpTBXTabPosition Value); + void __fastcall SetTabVisible(const bool Value); + TSpTBXTabToolbar* __fastcall GetTabToolbar(void); + HIDESBASE MESSAGE void __fastcall CMColorchanged(Messages::TMessage &Message); + MESSAGE void __fastcall CMSpTBXControlsInvalidate(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TMessage &Message); + MESSAGE void __fastcall WMInvalidateTabBackground(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMWindowPosChanged(Messages::TWMWindowPosMsg &Message); + +protected: + Graphics::TBitmap* FBackground; + virtual void __fastcall DoDrawBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, const Sptbxitem::TSpTBXPaintStage PaintStage, bool &PaintDefault); + virtual bool __fastcall GetFullRepaint(void); + virtual bool __fastcall CanActiveTabChange(const int TabIndex, const int NewTabIndex); + virtual void __fastcall DoActiveTabChange(const int TabIndex); + virtual bool __fastcall CanActiveTabReorder(const int TabIndex, const int NewTabIndex); + virtual void __fastcall DoActiveTabReorder(const int TabIndex); + virtual void __fastcall ItemNotification(Tb2item::TTBCustomItem* Ancestor, bool Relayed, Tb2item::TTBItemChangedAction Action, int Index, Tb2item::TTBCustomItem* Item); + virtual void __fastcall TabInserted(TSpTBXTabItem* Item); + virtual void __fastcall TabDeleting(TSpTBXTabItem* Item, bool FreeTabSheet = true); + virtual void __fastcall DefineProperties(Classes::TFiler* Filer); + virtual Sptbxitem::TSpTBXToolbarClass __fastcall GetToolbarClass(void); + virtual void __fastcall Loaded(void); + __property Color = {default=-16777201}; + __property ParentColor = {default=0}; + __property int ActiveTabIndex = {read=GetActiveTabIndex, write=SetActiveTabIndex, nodefault}; + __property bool TabAutofit = {read=GetTabAutofit, write=SetTabAutofit, default=0}; + __property int TabAutofitMaxSize = {read=GetTabAutofitMaxSize, write=SetTabAutofitMaxSize, default=200}; + __property Graphics::TColor TabBackgroundColor = {read=GetTabBackgroundColor, write=SetTabBackgroundColor, default=536870911}; + __property bool TabBackgroundBorders = {read=GetTabBackgroundBorders, write=SetTabBackgroundBorders, default=0}; + __property TSpTBXTabCloseButton TabCloseButton = {read=GetTabCloseButton, write=SetTabCloseButton, default=0}; + __property int TabCloseButtonImageIndex = {read=GetTabCloseButtonImageIndex, write=SetTabCloseButtonImageIndex, default=-1}; + __property bool TabDragReorder = {read=GetTabDragReorder, write=SetTabDragReorder, default=0}; + __property int TabMaxSize = {read=GetTabMaxSize, write=SetTabMaxSize, default=-1}; + __property TSpTBXTabPosition TabPosition = {read=GetTabPosition, write=SetTabPosition, default=0}; + __property bool TabVisible = {read=FTabVisible, write=SetTabVisible, default=1}; + __property Sptbxskins::TSpTBXSkinType SkinType = {read=GetSkinType, write=SetSkinType, default=2}; + __property TSpTBXTabChangeEvent OnActiveTabChange = {read=FOnActiveTabChange, write=FOnActiveTabChange}; + __property TSpTBXTabChangingEvent OnActiveTabChanging = {read=FOnActiveTabChanging, write=FOnActiveTabChanging}; + __property TSpTBXTabChangeEvent OnActiveTabReorder = {read=FOnActiveTabReorder, write=FOnActiveTabReorder}; + __property TSpTBXTabChangingEvent OnActiveTabReordering = {read=FOnActiveTabReordering, write=FOnActiveTabReordering}; + __property Sptbxitem::TSpTBXDrawEvent OnDrawBackground = {read=FOnDrawBackground, write=FOnDrawBackground}; + +public: + __fastcall virtual TSpTBXCustomTabSet(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomTabSet(void); + TSpTBXTabItem* __fastcall Add(System::WideString ACaption); + HIDESBASE TSpTBXTabItem* __fastcall Insert(int NewIndex, System::WideString ACaption); + bool __fastcall DrawBackground(HDC DC, const Types::TRect &ARect); + int __fastcall GetTabSetHeight(void); + virtual void __fastcall InvalidateBackground(bool InvalidateChildren = true); + void __fastcall MakeVisible(TSpTBXTabItem* ATab); + void __fastcall ScrollLeft(void); + void __fastcall ScrollRight(void); + void __fastcall ScrollState(/* out */ bool &Left, /* out */ bool &Right); + virtual void __fastcall TabClick(TSpTBXTabItem* ATab); + __property Canvas; + __property TSpTBXTabToolbar* Toolbar = {read=GetTabToolbar}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomTabSet(HWND ParentWindow) : Sptbxitem::TSpTBXCompoundItemsControl(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXTabSet; +class PASCALIMPLEMENTATION TSpTBXTabSet : public TSpTBXCustomTabSet +{ + typedef TSpTBXCustomTabSet inherited; + +__published: + __property Align = {default=0}; + __property Anchors = {default=3}; + __property BiDiMode; + __property Color = {default=-16777201}; + __property Constraints; + __property DockSite = {default=0}; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentColor = {default=0}; + __property ParentBiDiMode = {default=1}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowHint; + __property Visible = {default=1}; + __property OnCanResize; + __property OnContextPopup; + __property OnDockDrop; + __property OnDockOver; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnEnter; + __property OnExit; + __property OnGetSiteInfo; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnResize; + __property OnStartDock; + __property OnStartDrag; + __property OnUnDock; + __property ActiveTabIndex; + __property Images; + __property TabAutofit = {default=0}; + __property TabAutofitMaxSize = {default=200}; + __property TabBackgroundColor = {default=536870911}; + __property TabBackgroundBorders = {default=0}; + __property TabCloseButton = {default=0}; + __property TabCloseButtonImageIndex = {default=-1}; + __property TabDragReorder = {default=0}; + __property TabMaxSize = {default=-1}; + __property TabPosition = {default=0}; + __property TabVisible = {default=1}; + __property SkinType = {default=2}; + __property OnActiveTabChange; + __property OnActiveTabChanging; + __property OnActiveTabReorder; + __property OnActiveTabReordering; + __property OnDrawBackground; +public: + /* TSpTBXCustomTabSet.Create */ inline __fastcall virtual TSpTBXTabSet(Classes::TComponent* AOwner) : TSpTBXCustomTabSet(AOwner) { } + /* TSpTBXCustomTabSet.Destroy */ inline __fastcall virtual ~TSpTBXTabSet(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXTabSet(HWND ParentWindow) : TSpTBXCustomTabSet(ParentWindow) { } + +}; + + +class PASCALIMPLEMENTATION TSpTBXCustomTabControl : public TSpTBXCustomTabSet +{ + typedef TSpTBXCustomTabSet inherited; + +private: + TSpTBXTabSheet* FEmptyTabSheet; + void __fastcall RealignTabSheets(void); + TSpTBXTabSheet* __fastcall GetActivePage(void); + TSpTBXTabSheet* __fastcall GetPages(int Index); + int __fastcall GetPagesCount(void); + void __fastcall SetActivePage(const TSpTBXTabSheet* Value); + HIDESBASE MESSAGE void __fastcall CMSpTBXControlsInvalidate(Messages::TMessage &Message); + HIDESBASE MESSAGE void __fastcall WMSpSkinChange(Messages::TMessage &Message); + +protected: + Classes::TList* FPages; + virtual void __fastcall DoActiveTabChange(const int ItemIndex); + virtual bool __fastcall GetFullRepaint(void); + virtual void __fastcall TabInserted(TSpTBXTabItem* Item); + virtual void __fastcall TabDeleting(TSpTBXTabItem* Item, bool FreeTabSheet = true); + +public: + __fastcall virtual TSpTBXCustomTabControl(Classes::TComponent* AOwner); + __fastcall virtual ~TSpTBXCustomTabControl(void); + TSpTBXTabSheet* __fastcall GetPage(TSpTBXTabItem* Item); + __property TSpTBXTabSheet* ActivePage = {read=GetActivePage, write=SetActivePage}; + __property TSpTBXTabSheet* Pages[int Index] = {read=GetPages}; + __property int PagesCount = {read=GetPagesCount, nodefault}; +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXCustomTabControl(HWND ParentWindow) : TSpTBXCustomTabSet(ParentWindow) { } + +}; + + +class DELPHICLASS TSpTBXTabControl; +class PASCALIMPLEMENTATION TSpTBXTabControl : public TSpTBXCustomTabControl +{ + typedef TSpTBXCustomTabControl inherited; + +__published: + __property Align = {default=0}; + __property Anchors = {default=3}; + __property BiDiMode; + __property Color = {default=-16777201}; + __property Constraints; + __property DockSite = {default=0}; + __property DragCursor = {default=-12}; + __property DragKind = {default=0}; + __property DragMode = {default=0}; + __property Enabled = {default=1}; + __property Font; + __property ParentColor = {default=0}; + __property ParentBiDiMode = {default=1}; + __property ParentFont = {default=1}; + __property ParentShowHint = {default=1}; + __property PopupMenu; + __property ShowHint; + __property Visible = {default=1}; + __property OnCanResize; + __property OnContextPopup; + __property OnDockDrop; + __property OnDockOver; + __property OnDragDrop; + __property OnDragOver; + __property OnEndDock; + __property OnEndDrag; + __property OnEnter; + __property OnExit; + __property OnGetSiteInfo; + __property OnMouseDown; + __property OnMouseMove; + __property OnMouseUp; + __property OnResize; + __property OnStartDock; + __property OnStartDrag; + __property OnUnDock; + __property ActiveTabIndex; + __property Images; + __property TabAutofit = {default=0}; + __property TabAutofitMaxSize = {default=200}; + __property TabBackgroundColor = {default=536870911}; + __property TabBackgroundBorders = {default=0}; + __property TabCloseButton = {default=0}; + __property TabCloseButtonImageIndex = {default=-1}; + __property TabDragReorder = {default=0}; + __property TabMaxSize = {default=-1}; + __property TabPosition = {default=0}; + __property TabVisible = {default=1}; + __property SkinType = {default=2}; + __property OnActiveTabChange; + __property OnActiveTabChanging; + __property OnActiveTabReorder; + __property OnActiveTabReordering; + __property OnDrawBackground; +public: + /* TSpTBXCustomTabControl.Create */ inline __fastcall virtual TSpTBXTabControl(Classes::TComponent* AOwner) : TSpTBXCustomTabControl(AOwner) { } + /* TSpTBXCustomTabControl.Destroy */ inline __fastcall virtual ~TSpTBXTabControl(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TSpTBXTabControl(HWND ParentWindow) : TSpTBXCustomTabControl(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +static const Word C_SpTBXTabGroupIndex = 0x1e61; +static const Word WM_INVALIDATETABBACKGROUND = 0x2261; +extern PACKAGE Tb2item::TTBItemViewer* __fastcall SpGetNextTabItemViewer(Tb2item::TTBView* View, Tb2item::TTBItemViewer* IV, bool GoForward, Sptbxitem::TSpTBXSearchItemViewerType SearchType); +extern PACKAGE void __fastcall SpDrawXPTab(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, bool Enabled, bool Checked, bool HotTrack, bool Focused, TSpTBXTabPosition Position, Sptbxskins::TSpTBXSkinType SkinType, TSpTBXTabEdge Edge = (TSpTBXTabEdge)(0x0)); +extern PACKAGE void __fastcall SpDrawXPTabControlBackground(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, Graphics::TColor AColor, bool BottomTabs, Sptbxskins::TSpTBXSkinType SkinType); + +} /* namespace Sptbxtabs */ +using namespace Sptbxtabs; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // SptbxtabsHPP diff --git a/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.pas b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.pas new file mode 100644 index 0000000..763836a --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/Source/SpTBXTabs.pas @@ -0,0 +1,3420 @@ +unit SpTBXTabs; + +{============================================================================== +Version 2.4.2 + +The contents of this file are subject to the SpTBXLib License; you may +not use or distribute this file except in compliance with the +SpTBXLib License. +A copy of the SpTBXLib License may be found in SpTBXLib-LICENSE.txt or at: + http://www.silverpointdevelopment.com/sptbxlib/SpTBXLib-LICENSE.htm + +Alternatively, the contents of this file may be used under the terms of the +Mozilla Public License Version 1.1 (the "MPL v1.1"), in which case the provisions +of the MPL v1.1 are applicable instead of those in the SpTBXLib License. +A copy of the MPL v1.1 may be found in MPL-LICENSE.txt or at: + http://www.mozilla.org/MPL/ + +If you wish to allow use of your version of this file only under the terms of +the MPL v1.1 and not to allow others to use your version of this file under the +SpTBXLib License, indicate your decision by deleting the provisions +above and replace them with the notice and other provisions required by the +MPL v1.1. If you do not delete the provisions above, a recipient may use your +version of this file under either the SpTBXLib License or the MPL v1.1. + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The initial developer of this code is Robert Lee. + +Requirements: +For Delphi/C++Builder 2009 or newer: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org +For Delphi/C++Builder 7-2007: + - Jordan Russell's Toolbar 2000 + http://www.jrsoftware.org + - Troy Wolbrink's TNT Unicode Controls + http://www.tntware.com/delphicontrols/unicode/ + +Development Notes: + - All the theme changes and adjustments are marked with '[Theme-Change]'. + - When an item is hidden the ItemViewer.BoundsRect property is invalid. + - tbicDeleting item notification is fired after the ItemViewer of the + Item is destroyed by TTBView, but the Items array still has the Item. + +TODO: + - Tabbed docking + +History: +8 May 2009 - version 2.4.2 + - Fixed incorrect TabControl behavior, when deleting + the tabs the ActiveTabIndex is incorrectly set if + there are regular Items on the control, thanks to + Jonah for reporting this. + +15 March 2009 - version 2.4.1 + - No changes. + +17 January 2009 - version 2.4 + - No changes. + +26 September 2008 - version 2.3 + - No changes. + +29 July 2008 - version 2.2 + - No changes. + +26 June 2008 - version 2.1 + - No changes. + +3 May 2008 - version 2.0 + - Fixed incorrect close button painting on tab items, + thanks to Miha for reporting this. + +2 April 2008 - version 1.9.5 + - Fixed incorrect TabControl behavior, when deleting the + only visible Tab all the auto-hidden tabs will not + be showed on resize, thanks to Jim for reporting this. + +3 February 2008 - version 1.9.4 + - Fixed AV on TabControl when scrolling tabs, thanks + to Beta Xiong and Yucel Yavuz for reporting this. + - Fixed incorrect TabControl.ScrollState behavior + thanks to Michele for reporting this. + +19 January 2008 - version 1.9.3 + - Fixed recursion on TSpTBXTabToolbar.RightAlignItems, + thanks to Jim for reporting this. + +26 December 2007 - version 1.9.2 + - Minor bug fixes. + +1 December 2007 - version 1.9.1 + - Added OnTabClosing event to TSpTBXTabItem. + - Fixed incorrect tab items painting when TabPosition was + ttpBottom, thanks to Marko Savolainen for reporting this. + +20 November 2007 - version 1.9 + - Added TabBackgroundBorders property to TSpTBXTabSet and + TSpTBXTabControl, when set to true the tabs area is + painted with borders. + - Added TabCloseButton and TabCloseButtonImageIndex properties + to SpTBXTabSet and TSpTBXTabControl to control the close + button visibility on the tab items. + - Added TabMaxSize property to SpTBXTabSet and TSpTBXTabControl + to control the maximum size of the tab items. + - Improved tab scrolling, thanks to Kevin Lu for + reporting this. + +8 February 2007 - version 1.8.3 + - Added accel char handling to TSpTBXTabSet and TSpTBXTabControl + +17 December 2006 - version 1.8.2 + - No changes. + +24 November 2006 - version 1.8.1 + - Fixed incorrect Tab painting when the Default theme was used + and the ThemeType was tttFlat. + +27 August 2006 - version 1.8 + - Fixed incorrect OnActiveTabChanging handling when + ActiveTabIndex is changed on this event, thanks to + Serg Chechenin for reporting this. + +15 June 2006 - version 1.7 + - Fixed incorrect Tab painting when the default theme was used, + the captions were painted in a pushed state, thanks to + Mikalai Arapau for reporting this. + - Fixed incorrect Tab aligning when Autofit was used and the + tab control was parented by a Frame, thanks to + Henk van Kampen for reporting this. + +12 April 2006 - version 1.5 + - Fixed incorrect Tab painting when TabAutofit was true. + +27 February 2006 - version 1.4 + - Fixed flicker when reordering TSpTBXTabSet and TSpTBXTabControl + tabs, thanks to Alexey Naumov for reporting this. + - Fixed incorrect context menu handling in TSpTBXTabSet and + TSpTBXTabControl, thanks to Boris Yankov for reporting this. + - Added OnActiveTabReorder event to TSpTBXTabSet and TSpTBXTabControl. + +10 February 2006 - version 1.3 + - Added TabDragReorder property to TSpTBXTabSet and TSpTBXTabControl, + when this property is true it allows tabs reordering with + drag and drop. + - Added TabAutofit and TabAutofitMaxSize properties to TSpTBXTabSet + and TSpTBXTabControl. When TabAutofit is true the tabs are resized + to fit the tabset. + +28 December 2005 - version 1.2 + - Fixed incorrect TSpTBXTabControl background painting on some themes. + - Fixed incorrect OnActiveTabChange call when the component is being + loaded, thanks to Leroy Casterline for reporting this. + - Fixed incorrect tab scrolling when an item is deleted, thanks to + Daniel Rikowski for reporting this. + +18 October 2005 - version 1.1 + - Fixed incorrect TSpTBXTabItem painting on some themes. + - Added Margins property to TSpTBXPageControl. + +18 August 2005 - version 1.0 + - Added TabVisible property to TSpTBXTabSet and TSpTBXPageControl. + - Added OnActiveTabChanging event to TSpTBXTabSet and TSpTBXPageControl. + +10 June 2005 - version 0.9 + - SpTBXLib may now alternatively, at your option, be used and/or + distributed under the terms of the SpTBXLib License. + Please see the updated LICENSE.TXT file for more information. + - Fixed AV in TSpTBXTabSet and TSpTBXPageControl when used in a Frame + with TabPosition setted to dpBottom, thanks to Cyril Velter for the fix. + +20 May 2005 - version 0.8 + - Fixed tab scrolling of TSpTBXTabSet and TSpTBXPageControl, the tabs + were not allowed to scroll when one single tab was visible, thanks + to Anders Olsson for the fix. + - Added MakeVisible method to the TSpTBXTabSet and TSpTBXPageControl, + it scrolls the tabset, if necessary, to ensure a Tab is in view. + +16 February 2005 - version 0.7 + - No changes. + +23 December 2004 - version 0.6 + - Fixed TSpTBXTabControl reordering bug. + - Changed the order of the TSpTBXTabThemeType enumerated type. + - Added ActivePage property to the TSpTBXTabControl. + - Added Caption, ImageIndex, TabVisible and PopupMenu properties + to TSpTBXTabControl. + +30 August 2004 - version 0.5 + - No changes. + +21 July 2004 - version 0.4 + - Fixed TSpTBXTabControl design time bug, it was allowing to drop + components when ActiveTabIndex = -1 + - Fixed TSpTBXTabSet and TSpTBXTabControl design time bug, the + hidden items were not streamed to the DFM. + - Changed TSpTBXTabControl.OnTabClick event for OnActiveTabChange. + - Added GetPage method to TSpTBXTabControl to get the TSpTBXTabSheet + linked to a TSpTBXTabItem. + +12 July 2004 - version 0.3.1 + - Fixed nasty AV when setting TBXSwitcher.EnableXPStyles to false, + thanks to Alfred for reporting this. + Note: TBXThemeManager unloads the theme library and the theme + parts when some conditions are met, we must handle extra theme + parts outside TBXThemeManager space. + - Fixed incorrect TSpTBXTabSet.ActiveTabIndex property update at + design time. + - Fixed incorrect TSpTBXTabSet painting on some TBX themes, thanks + to Tim for reporting this. + +9 July 2004 - version 0.3 + - Fixed design time AVs when moving or deleting TabSheets. + - Published ThemeType and TabPosition properties for TSpTBXTabItem. + - New component added, TSpTBXTabSet, a fully customizable TabSet + with unicode and toolbar items support. + +28 June 2004 - version 0.2 + - No changes. + +22 June 2004 - version 0.1 + - Initial release. + +==============================================================================} + +interface + +{$BOOLEVAL OFF} // Unit depends on short-circuit boolean evaluation + +uses + Windows, Messages, Classes, SysUtils, Controls, Graphics, ImgList, Forms, + Dialogs, ExtCtrls, TB2Item, TB2Dock, TB2Toolbar, + SpTBXSkins, SpTBXItem, SpTBXControls; + +const + C_SpTBXTabGroupIndex = 7777; + WM_INVALIDATETABBACKGROUND = WM_USER + 7777; + +type + TSpTBXTabEdge = ( + tedNone, // No edge needed + tedLeft, // Left edge of the tab + tedRight // Right edge of the tab + ); + + TSpTBXTabPosition = ( + ttpTop, // Top aligned tabset + ttpBottom // Bottom aligned tabset + ); + + TSpTBXTabCloseButton = ( + tcbNone, // No close button on tabs + tcbActive, // Close button only on active tab + tcbAll // Close button on all the tabs + ); + + TSpTBXTabChangeEvent = procedure(Sender: TObject; TabIndex: Integer) of object; + TSpTBXTabChangingEvent = procedure(Sender: TObject; TabIndex, NewTabIndex: Integer; var Allow: Boolean) of object; + TSpTBXTabClosingEvent = procedure(Sender: TObject; var Allow, CloseAndFree: Boolean) of object; + + TSpTBXTabToolbar = class; + TSpTBXCustomTabSet = class; + TSpTBXCustomTabControl = class; + TSpTBXTabSheet = class; + + TSpTBXTabItemDragObject = class(TSpTBXCustomDragObject) + public + constructor Create(ASourceControl: TControl; AItem: TTBCustomItem); override; + end; + + { TSpTBXTabItem } + + TSpTBXTabItem = class(TSpTBXCustomItem) + private + FSkinType: TSpTBXSkinType; + FOnDrawTabCloseButton: TSpTBXDrawImageEvent; + FOnTabClose: TNotifyEvent; + FOnTabClosing: TSpTBXTabClosingEvent; + function GetTabColor: TColor; + function GetSkinType: TSpTBXSkinType; + procedure SetSkinType(const Value: TSpTBXSkinType); + protected + function DialogChar(CharCode: Word): Boolean; override; + procedure DoDrawTabCloseButton(ACanvas: TCanvas; State: TSpTBXSkinStatesType; + const PaintStage: TSpTBXPaintStage; AImageList: TCustomImageList; + var AImageIndex: Integer; var ARect: TRect; var PaintDefault: Boolean); virtual; + procedure DoTabClose; virtual; + procedure DoTabClosing(var Allow, CloseAndFree: Boolean); virtual; + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + function GetTabToolbar(out TabToolbar: TSpTBXTabToolbar): Boolean; + procedure ToggleControl; override; + property Control; // TabSheet + property TabColor: TColor read GetTabColor; + public + constructor Create(AOwner: TComponent); override; + procedure Click; override; + procedure TabClose; + function GetNextTab(GoForward: Boolean; SearchType: TSpTBXSearchItemViewerType): TSpTBXTabItem; + function IsFirstVisible: Boolean; + function IsFirstVisibleTab: Boolean; + function IsLastVisibleTab: Boolean; + published + property Action; + property Checked; + // Hide DisplayMode + // property DisplayMode default nbdmImageAndText; + property Enabled; + // Hide GroupIndex, all the TabItems must have the same GroupIndex + // property GroupIndex; + property HelpContext; + property ImageIndex; + property Images; + property InheritOptions; + property MaskOptions; + property Options; + property ShortCut; + property Visible; + property OnClick; + property OnSelect; + // TSpTBXCustomItem properties + property Alignment; + property CustomWidth; + property CustomHeight; + property Margins default 4; + property MinHeight; + property MinWidth; + property FontSettings; + property Wrapping default twEndEllipsis; + property OnDrawImage; + property OnDrawItem; + property OnDrawHint; + property OnDrawCaption; + // TSpTBXTabItem properties + property SkinType: TSpTBXSkinType read GetSkinType write SetSkinType default sknSkin; + property OnDrawTabCloseButton: TSpTBXDrawImageEvent read FOnDrawTabCloseButton write FOnDrawTabCloseButton; + property OnTabClose: TNotifyEvent read FOnTabClose write FOnTabClose; + property OnTabClosing: TSpTBXTabClosingEvent read FOnTabClosing write FOnTabClosing; + end; + + TSpTBXTabItemViewer = class(TSpTBXItemViewer) + private + FTabCloseButtonState: TSpTBXSkinStatesType; + function CorrectTabRect(ARect: TRect): TRect; + function GetItem: TSpTBXTabItem; + procedure GetTabCloseButtonImgList(var AImageList: TCustomImageList; var AImageIndex: Integer); + function IsTabCloseButtonVisible: Boolean; + function GetTabPosition: TSpTBXTabPosition; + protected + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); override; + procedure DoDrawButton(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); override; + procedure DoDrawCaption(ACanvas: TCanvas; ClientAreaRect: TRect; State: TSpTBXSkinStatesType; + var ACaption: WideString; var CaptionRect: TRect; var CaptionFormat: Cardinal; + IsTextRotated: Boolean; const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); override; + procedure DoDrawImage(ACanvas: TCanvas; State: TSpTBXSkinStatesType; + const PaintStage: TSpTBXPaintStage; var AImageList: TCustomImageList; + var AImageIndex: Integer; var ARect: TRect; + var PaintDefault: Boolean); override; + procedure DoDrawTabCloseButton(ACanvas: TCanvas; State: TSpTBXSkinStatesType; + const PaintStage: TSpTBXPaintStage; var AImageList: TCustomImageList; + var AImageIndex: Integer; var ARect: TRect; var PaintDefault: Boolean); virtual; + procedure DrawBottomBorder(ACanvas: TCanvas; ARect: TRect); + procedure DrawTab(ACanvas: TCanvas; ARect: TRect; + AEnabled, AChecked, AHoverItem: Boolean; Position: TSpTBXTabPosition; + ASeparator: Boolean = False; AEdge: TSpTBXTabEdge = tedNone); virtual; + procedure DrawItemRightImage(ACanvas: TCanvas; ARect: TRect; ItemInfo: TSpTBXMenuItemInfo); override; + function GetRightImageSize: TSize; override; + function GetRightImageRect: TRect; + function GetTextColor(State: TSpTBXSkinStatesType): TColor; override; + procedure InternalMouseMove(Shift: TShiftState; X, Y: Integer); override; + procedure Leaving; override; + public + function IsOnTabToolbar: Boolean; + property Item: TSpTBXTabItem read GetItem; // Hides the inherited TB2K Item property + property TabCloseButtonState: TSpTBXSkinStatesType read FTabCloseButtonState; + property TabPosition: TSpTBXTabPosition read GetTabPosition; + end; + + { TSpTBXTabToolbar } + + TSpTBXTabToolbar = class(TSpTBXToolbar) + private + FSkinType: TSpTBXSkinType; + FUpdateHidden: Integer; + FTabAutofit: Boolean; + FTabAutofitMaxSize: Integer; + FTabCloseButtonImageIndex: Integer; + FTabCloseButton: TSpTBXTabCloseButton; + FTabDragReorder: Boolean; + FTabBackgroundBorders: Boolean; + FTabColor: TColor; + FTabMaxSize: Integer; + FTabPosition: TSpTBXTabPosition; + procedure Scroll(ToRight: Boolean); + function GetActiveTab: TSpTBXTabItem; + procedure SetActiveTabIndex(Value: Integer); + procedure SetSkinType(const Value: TSpTBXSkinType); + procedure SetTabCloseButton(const Value: TSpTBXTabCloseButton); + procedure SetTabCloseButtonImageIndex(const Value: Integer); + procedure SetTabAutofit(const Value: Boolean); + procedure SetTabAutofitMaxSize(const Value: Integer); + procedure SetTabBackgroundBorders(const Value: Boolean); + procedure SetTabColor(const Value: TColor); + procedure SetTabMaxSize(const Value: Integer); + procedure SetTabPosition(const Value: TSpTBXTabPosition); + procedure CMDesignHitTest(var Message: TCMDesignHitTest); message CM_DESIGNHITTEST; + protected + FHiddenTabs: TSpTBXItemCacheCollection; + FActiveTabIndex: Integer; + FOwnerTabControl: TSpTBXCustomTabSet; + procedure Autofit; + function GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; override; + procedure InternalDrawBackground(ACanvas: TCanvas; ARect: TRect; PaintOnNCArea: Boolean; PaintBorders: Boolean = True); override; + procedure DoItemNotification(Ancestor: TTBCustomItem; Relayed: Boolean; Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); override; + procedure RightAlignItems; override; + + function CanDragCustomize(Button: TMouseButton; Shift: TShiftState; X, Y: Integer): Boolean; override; + procedure DoStartDrag(var DragObject: TDragObject); override; + procedure DragOver(Source: TObject; X: Integer; Y: Integer; State: TDragState; var Accept: Boolean); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure BeginUpdateHidden; + procedure EndUpdateHidden; + function GetTabsCount(VisibleOnly: Boolean): Integer; + procedure InvalidateActiveTab; + procedure InvalidateNC; + procedure MakeVisible(ATab: TSpTBXTabItem); + procedure ScrollLeft; + procedure ScrollRight; + procedure ScrollState(out CanScrollToLeft, CanScrollToRight: Boolean); + procedure TabClose(ATab: TSpTBXTabItem); + published + property ActiveTab: TSpTBXTabItem read GetActiveTab; + property ActiveTabIndex: Integer read FActiveTabIndex write SetActiveTabIndex; + property TabCloseButton: TSpTBXTabCloseButton read FTabCloseButton write SetTabCloseButton default tcbNone; + property TabCloseButtonImageIndex: Integer read FTabCloseButtonImageIndex write SetTabCloseButtonImageIndex default -1; + property TabBackgroundBorders: Boolean read FTabBackgroundBorders write SetTabBackgroundBorders; + property TabAutofit: Boolean read FTabAutofit write SetTabAutofit default False; + property TabAutofitMaxSize: Integer read FTabAutofitMaxSize write SetTabAutofitMaxSize default 200; + property TabColor: TColor read FTabColor write SetTabColor default clBtnFace; + property TabMaxSize: Integer read FTabMaxSize write SetTabMaxSize default -1; + property TabPosition: TSpTBXTabPosition read FTabPosition write SetTabPosition default ttpTop; + property TabDragReorder: Boolean read FTabDragReorder write FTabDragReorder default False; + property SkinType: TSpTBXSkinType read FSkinType write SetSkinType default sknSkin; + end; + + { TSpTBXTabSheet } + + TSpTBXTabSheet = class(TCustomControl) + private + FTabControl: TSpTBXCustomTabControl; + FItem: TSpTBXTabItem; + FItemName: String; + FPrevFocused: TWincontrol; + procedure ReadItemName(Reader: TReader); + procedure WriteItemName(Writer: TWriter); + function GetCaption: WideString; + function GetTabVisible: Boolean; + procedure SetCaption(const Value: WideString); + procedure SetTabVisible(const Value: Boolean); + function GetImageIndex: Integer; + procedure SetImageIndex(const Value: Integer); + procedure CMVisiblechanged(var Message: TMessage); message CM_VISIBLECHANGED; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMWindowPosChanged(var Message: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED; + protected + procedure CreateParams(var Params: TCreateParams); override; + procedure AdjustClientRect(var Rect: TRect); override; + procedure DefineProperties(Filer: TFiler); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure ReadState(Reader: TReader); override; + procedure VisibleChanging; override; + property Align default alClient; + property PrevFocused: TWincontrol read FPrevFocused; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property Item: TSpTBXTabItem read FItem write FItem; + property TabControl: TSpTBXCustomTabControl read FTabControl write FTabControl; + published + property PopupMenu; + property Caption: WideString read GetCaption write SetCaption; + property ImageIndex: Integer read GetImageIndex write SetImageIndex; + property TabVisible: Boolean read GetTabVisible write SetTabVisible default True; + end; + + { TSpTBXTabControl } + + TSpTBXCustomTabSet = class(TSpTBXCompoundItemsControl) + private + FItemMoveCount: Integer; + FItemMoved: TSpTBXTabItem; + FTabVisible: Boolean; + FLoadingActiveIndex: Integer; + FUpdatingIndex: Boolean; + FResizing: Boolean; + FOnDrawBackground: TSpTBXDrawEvent; + FOnActiveTabChange: TSpTBXTabChangeEvent; + FOnActiveTabChanging: TSpTBXTabChangingEvent; + FOnActiveTabReorder: TSpTBXTabChangeEvent; + FOnActiveTabReordering: TSpTBXTabChangingEvent; + procedure ReadHiddenItems(Reader: TReader); + procedure WriteHiddenItems(Writer: TWriter); + function GetActiveTabIndex: Integer; + procedure SetActiveTabIndex(Value: Integer); + function GetSkinType: TSpTBXSkinType; + procedure SetSkinType(const Value: TSpTBXSkinType); + function GetTabAutofit: Boolean; + procedure SetTabAutofit(const Value: Boolean); + function GetTabAutofitMaxSize: Integer; + procedure SetTabAutofitMaxSize(const Value: Integer); + function GetTabBackgroundBorders: Boolean; + procedure SetTabBackgroundBorders(const Value: Boolean); + function GetTabBackgroundColor: TColor; + procedure SetTabBackgroundColor(const Value: TColor); + function GetTabCloseButton: TSpTBXTabCloseButton; + procedure SetTabCloseButton(const Value: TSpTBXTabCloseButton); + function GetTabCloseButtonImageIndex: Integer; + procedure SetTabCloseButtonImageIndex(const Value: Integer); + function GetTabDragReorder: Boolean; + procedure SetTabDragReorder(const Value: Boolean); + function GetTabMaxSize: Integer; + procedure SetTabMaxSize(const Value: Integer); + function GetTabPosition: TSpTBXTabPosition; + procedure SetTabPosition(const Value: TSpTBXTabPosition); + procedure SetTabVisible(const Value: Boolean); + function GetTabToolbar: TSpTBXTabToolbar; + procedure CMColorchanged(var Message: TMessage); message CM_COLORCHANGED; + procedure CMSpTBXControlsInvalidate(var Message: TMessage); message CM_SPTBXCONTROLSINVALIDATE; + procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND; + procedure WMInvalidateTabBackground(var Message: TMessage); message WM_INVALIDATETABBACKGROUND; + procedure WMWindowPosChanged(var Message: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED; + protected + FBackground: TBitmap; + // Painting + procedure DoDrawBackground(ACanvas: TCanvas; ARect: TRect; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); virtual; + function GetFullRepaint: Boolean; virtual; + + // Tabs + function CanActiveTabChange(const TabIndex, NewTabIndex: Integer): Boolean; virtual; + procedure DoActiveTabChange(const TabIndex: Integer); virtual; + function CanActiveTabReorder(const TabIndex, NewTabIndex: Integer): Boolean; virtual; + procedure DoActiveTabReorder(const TabIndex: Integer); virtual; + procedure ItemNotification(Ancestor: TTBCustomItem; Relayed: Boolean; + Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); virtual; // Items change notification + procedure TabInserted(Item: TSpTBXTabItem); virtual; + procedure TabDeleting(Item: TSpTBXTabItem; FreeTabSheet: Boolean = True); virtual; + + // Component + procedure DefineProperties(Filer: TFiler); override; + function GetToolbarClass: TSpTBXToolbarClass; override; + procedure Loaded; override; + + property Color default clBtnFace; + property ParentColor default False; + property ActiveTabIndex: Integer read GetActiveTabIndex write SetActiveTabIndex; + property TabAutofit: Boolean read GetTabAutofit write SetTabAutofit default False; + property TabAutofitMaxSize: Integer read GetTabAutofitMaxSize write SetTabAutofitMaxSize default 200; + property TabBackgroundColor: TColor read GetTabBackgroundColor write SetTabBackgroundColor default clNone; + property TabBackgroundBorders: Boolean read GetTabBackgroundBorders write SetTabBackgroundBorders default False; + property TabCloseButton: TSpTBXTabCloseButton read GetTabCloseButton write SetTabCloseButton default tcbNone; + property TabCloseButtonImageIndex: Integer read GetTabCloseButtonImageIndex write SetTabCloseButtonImageIndex default -1; + property TabDragReorder: Boolean read GetTabDragReorder write SetTabDragReorder default False; + property TabMaxSize: Integer read GetTabMaxSize write SetTabMaxSize default -1; + property TabPosition: TSpTBXTabPosition read GetTabPosition write SetTabPosition default ttpTop; + property TabVisible: Boolean read FTabVisible write SetTabVisible default True; + property SkinType: TSpTBXSkinType read GetSkinType write SetSkinType default sknSkin; + property OnActiveTabChange: TSpTBXTabChangeEvent read FOnActiveTabChange write FOnActiveTabChange; + property OnActiveTabChanging: TSpTBXTabChangingEvent read FOnActiveTabChanging write FOnActiveTabChanging; + property OnActiveTabReorder: TSpTBXTabChangeEvent read FOnActiveTabReorder write FOnActiveTabReorder; + property OnActiveTabReordering: TSpTBXTabChangingEvent read FOnActiveTabReordering write FOnActiveTabReordering; + property OnDrawBackground: TSpTBXDrawEvent read FOnDrawBackground write FOnDrawBackground; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function Add(ACaption: WideString): TSpTBXTabItem; + function Insert(NewIndex: Integer; ACaption: WideString): TSpTBXTabItem; + function DrawBackground(DC: HDC; ARect: TRect): Boolean; + function GetTabSetHeight: Integer; + procedure InvalidateBackground(InvalidateChildren: Boolean = True); override; + procedure MakeVisible(ATab: TSpTBXTabItem); + procedure ScrollLeft; + procedure ScrollRight; + procedure ScrollState(out Left, Right: Boolean); + procedure TabClick(ATab: TSpTBXTabItem); virtual; + property Canvas; + property Toolbar: TSpTBXTabToolbar read GetTabToolbar; + end; + + TSpTBXTabSet = class(TSpTBXCustomTabSet) + published + property Align; + property Anchors; + property BiDiMode; + property Color; + property Constraints; + property DockSite; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentColor; + property ParentBiDiMode; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property Visible; + property OnCanResize; + property OnContextPopup; + property OnDockDrop; + property OnDockOver; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnEnter; + property OnExit; + property OnGetSiteInfo; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnResize; + property OnStartDock; + property OnStartDrag; + property OnUnDock; + // TSpTBXCustomTabSet properties + property ActiveTabIndex; + property Images; + property TabAutofit; + property TabAutofitMaxSize; + property TabBackgroundColor; + property TabBackgroundBorders; + property TabCloseButton; + property TabCloseButtonImageIndex; + property TabDragReorder; + property TabMaxSize; + property TabPosition; + property TabVisible; + property SkinType; + property OnActiveTabChange; + property OnActiveTabChanging; + property OnActiveTabReorder; + property OnActiveTabReordering; + property OnDrawBackground; + end; + + { TSpTBXTabControl } + + TSpTBXCustomTabControl = class(TSpTBXCustomTabSet) + private + FEmptyTabSheet: TSpTBXTabSheet; + procedure RealignTabSheets; + function GetActivePage: TSpTBXTabSheet; + function GetPages(Index: Integer): TSpTBXTabSheet; + function GetPagesCount: Integer; + procedure SetActivePage(const Value: TSpTBXTabSheet); + procedure CMSpTBXControlsInvalidate(var Message: TMessage); message CM_SPTBXCONTROLSINVALIDATE; + procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE; + protected + FPages: TList; + procedure DoActiveTabChange(const ItemIndex: Integer); override; + function GetFullRepaint: Boolean; override; + procedure TabInserted(Item: TSpTBXTabItem); override; + procedure TabDeleting(Item: TSpTBXTabItem; FreeTabSheet: Boolean = True); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetPage(Item: TSpTBXTabItem): TSpTBXTabSheet; + property ActivePage: TSpTBXTabSheet read GetActivePage write SetActivePage; + property Pages[Index: Integer]: TSpTBXTabSheet read GetPages; + property PagesCount: Integer read GetPagesCount; + end; + + TSpTBXTabControl = class(TSpTBXCustomTabControl) + published + property Align; + property Anchors; + property BiDiMode; + property Color; + property Constraints; + property DockSite; + property DragCursor; + property DragKind; + property DragMode; + property Enabled; + property Font; + property ParentColor; + property ParentBiDiMode; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property Visible; + property OnCanResize; + property OnContextPopup; + property OnDockDrop; + property OnDockOver; + property OnDragDrop; + property OnDragOver; + property OnEndDock; + property OnEndDrag; + property OnEnter; + property OnExit; + property OnGetSiteInfo; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnResize; + property OnStartDock; + property OnStartDrag; + property OnUnDock; + // TSpTBXCustomTabControl properties + property ActiveTabIndex; + property Images; + property TabAutofit; + property TabAutofitMaxSize; + property TabBackgroundColor; + property TabBackgroundBorders; + property TabCloseButton; + property TabCloseButtonImageIndex; + property TabDragReorder; + property TabMaxSize; + property TabPosition; + property TabVisible; + property SkinType; + property OnActiveTabChange; + property OnActiveTabChanging; + property OnActiveTabReorder; + property OnActiveTabReordering; + property OnDrawBackground; + end; + +function SpGetNextTabItemViewer(View: TTBView; IV: TTBItemViewer; GoForward: Boolean; SearchType: TSpTBXSearchItemViewerType): TTBItemViewer; +procedure SpDrawXPTab(ACanvas: TCanvas; ARect: TRect; Enabled, Checked, HotTrack, Focused: Boolean; Position: TSpTBXTabPosition; SkinType: TSpTBXSkinType; Edge: TSpTBXTabEdge = tedNone); +procedure SpDrawXPTabControlBackground(ACanvas: TCanvas; ARect: TRect; AColor: TColor; BottomTabs: Boolean; SkinType: TSpTBXSkinType); + +implementation + +uses + Themes, UxTheme, Types; + +type + TTBItemViewerAccess = class(TTBItemViewer); + TSpTBXCustomItemAccess = class(TSpTBXCustomItem); + TSpTBXDockAccess = class(TSpTBXDock); + TSpTBXToolbarAccess = class(TSpTBXToolbar); + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ Helpers } + +function SpGetNextTabItemViewer(View: TTBView; IV: TTBItemViewer; GoForward: Boolean; + SearchType: TSpTBXSearchItemViewerType): TTBItemViewer; +// Returns the left or right Tab item depending on GoForward +// SearchType can be: +// sivtNormal: Normal search +// sivtInmediate: Search for the inmediate ItemViewer +// sivtInmediateSkipNonVisible: Search for the next inmediate ItemViewer, skipping non visible ones +begin + Result := nil; + while Result = nil do begin + IV := SpGetNextItemSameEdge(View, IV, GoForward, SearchType); + if not Assigned(IV) then + Break // Not found, exit + else + if IV.Item is TSpTBXTabItem then begin + Result := IV; // Found Tab + Break; + end + else begin + case SearchType of + sivtInmediate: + Break; // Inmediate not found, exit + sivtInmediateSkipNonVisible: + if IV.Item.Visible then Break; // Inmediate not found and visible, exit + end; + end; + end; +end; + +procedure SpDrawXPTab(ACanvas: TCanvas; ARect: TRect; + Enabled, Checked, HotTrack, Focused: Boolean; Position: TSpTBXTabPosition; + SkinType: TSpTBXSkinType; Edge: TSpTBXTabEdge = tedNone); +var + Part, Flags: Cardinal; + B: TBitmap; + R, FlippedR: TRect; + State: TSpTBXSkinStatesType; +begin + SkinType := SpTBXSkinType(SkinType); + if (SkinType = sknNone) and not Checked then + Exit; + + B := TBitmap.Create; + try + B.Width := ARect.Right - ARect.Left; + B.Height := ARect.Bottom - ARect.Top; + R := Rect(0, 0, B.Width, B.Height); + B.Canvas.Brush.Color := clFuchsia; + B.Canvas.FillRect(R); + B.TransparentColor := clFuchsia; + B.Transparent := True; + + case SkinType of + sknNone: + if Checked then begin + Position := ttpTop; // Don't need to flip + B.Canvas.Brush.Color := ACanvas.Brush.Color; + B.Canvas.FillRect(R); + ExtCtrls.Frame3D(B.Canvas, R, clWindow, clWindowFrame, 1); + ExtCtrls.Frame3D(B.Canvas, R, B.Canvas.Brush.Color, clBtnShadow, 1); + R := Rect(0, 0, B.Width, B.Height); // Frame3D changed R + end; + sknWindows: + begin + case Edge of + tedLeft: Part := TABP_TABITEMLEFTEDGE; + tedRight: Part := TABP_TABITEMRIGHTEDGE; + else + Part := TABP_TABITEM; + end; + + Flags := TIS_NORMAL; + if not Enabled then Flags := TIS_DISABLED + else + if Checked then Flags := TIS_SELECTED + else + if HotTrack then Flags := TIS_HOT; + DrawThemeBackground(ThemeServices.Theme[teTab], B.Canvas.Handle, Part, Flags, R, nil); + end; + sknSkin: + begin + State := CurrentSkin.GetState(Enabled, False, HotTrack, Checked); + CurrentSkin.PaintBackground(B.Canvas, R, skncTab, State, True, True); + end; + end; + + // Flip top to bottom + if Position = ttpBottom then begin + // Unclear why extra "-1" is needed here. + FlippedR := R; + FlippedR.Top := R.Bottom - 1; + FlippedR.Bottom := R.Top - 1; + B.Canvas.CopyRect(R, B.Canvas, FlippedR); + end; + + // Draw focus + if Checked and Focused then begin + InflateRect(R, -3, -3); + SpDrawFocusRect(B.Canvas, R); + end; + + ACanvas.Draw(ARect.Left, ARect.Top, B); + finally + B.Free; + end; +end; + +procedure SpDrawXPTabControlBackground(ACanvas: TCanvas; ARect: TRect; AColor: TColor; + BottomTabs: Boolean; SkinType: TSpTBXSkinType); +var + B: TBitmap; + R: TRect; +begin + SkinType := SpTBXSkinType(SkinType); + B := TBitmap.Create; + try + B.Width := ARect.Right - ARect.Left; + B.Height := ARect.Bottom - ARect.Top; + R := Rect(0, 0, B.Width, B.Height); + + // Draw the top/bottom border + case SkinType of + sknNone: + begin + BottomTabs := False; // Don't flip + B.Canvas.Brush.Color := AColor; + B.Canvas.FillRect(R); + ExtCtrls.Frame3D(B.Canvas, R, clWindow, clWindowFrame, 1); + ExtCtrls.Frame3D(B.Canvas, R, AColor, clBtnShadow, 1); + R := Rect(0, 0, B.Width, B.Height); // Frame3D changed R + end; + sknWindows: + DrawThemeBackground(ThemeServices.Theme[teTab], B.Canvas.Handle, TABP_PANE, 0, R, nil); + sknSkin: + begin + B.Canvas.Brush.Color := clWhite; + B.Canvas.FillRect(R); + CurrentSkin.PaintBackground(B.Canvas, R, skncTabBackground, sknsNormal, True, True); + end; + end; + + // Flip top to bottom + if BottomTabs then begin + // Unclear why extra "-1" is needed here. + R.Top := B.Height - 1; + R.Bottom := -1 + end; + + ACanvas.CopyRect(ARect, B.Canvas, R); + finally + B.Free; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTabItemDragObject } + +constructor TSpTBXTabItemDragObject.Create(ASourceControl: TControl; + AItem: TTBCustomItem); +begin + inherited Create(ASourceControl, AItem); + DragCursorAccept := crDefault; + DragCursorCancel := crDefault; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTabItem } + +constructor TSpTBXTabItem.Create(AOwner: TComponent); +begin + inherited; + DisplayMode := nbdmImageAndText; + GroupIndex := C_SpTBXTabGroupIndex; + Wrapping := twEndEllipsis; + Margins := 4; + FSkinType := sknSkin; +end; + +procedure TSpTBXTabItem.Click; +var + T: TSpTBXTabToolbar; + I: Integer; +begin + // Set the Checked property to True, Autocheck is False + // Checked will call Item.Invalidate, the TabSet.ItemNotification will + // handle the invalidation and set the ActiveTabIndex. + if not Checked and Enabled and Visible then begin + if GetTabToolbar(T) then begin + I := T.Items.IndexOf(Self); + if T.FOwnerTabControl.CanActiveTabChange(T.ActiveTabIndex, I) then + Checked := True; + end; + inherited; + end; +end; + +procedure TSpTBXTabItem.TabClose; +var + NextTab: TSpTBXTabItem; + T: TSpTBXTabToolbar; + CloseAndFree, CanTabClose: Boolean; +begin + if Visible then begin + CanTabClose := True; + CloseAndFree := False; + DoTabClosing(CanTabClose, CloseAndFree); + if CanTabClose then begin + // Check the next visible tab + NextTab := nil; + if Checked and GetTabToolbar(T) then begin + NextTab := GetNextTab(True, sivtInmediateSkipNonVisible); + if not Assigned(NextTab) then + NextTab := GetNextTab(False, sivtInmediateSkipNonVisible); + end; + Visible := False; + DoTabClose; + if CloseAndFree then + Free; // Removes the item from the paren, calls tbicDeleting notification and frees the item + if Assigned(NextTab) then + NextTab.Checked := True; + end; + end; +end; + +function TSpTBXTabItem.DialogChar(CharCode: Word): Boolean; +begin + Result := inherited DialogChar(CharCode); + if Enabled and Visible and IsAccel(CharCode, Caption) then begin + Click; + Result := True; + end; +end; + +procedure TSpTBXTabItem.DoDrawTabCloseButton(ACanvas: TCanvas; + State: TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; + AImageList: TCustomImageList; var AImageIndex: Integer; var ARect: TRect; + var PaintDefault: Boolean); +begin + if Assigned(FOnDrawTabCloseButton) then FOnDrawTabCloseButton(Self, ACanvas, State, PaintStage, + AImageList, AImageIndex, ARect, PaintDefault); +end; + +procedure TSpTBXTabItem.DoTabClose; +begin + if Assigned(FOnTabClose) then FOnTabClose(Self); +end; + +procedure TSpTBXTabItem.DoTabClosing(var Allow, CloseAndFree: Boolean); +begin + if Assigned(FOnTabClosing) then FOnTabClosing(Self, Allow, CloseAndFree); +end; + +function TSpTBXTabItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TSpTBXTabItemViewer; +end; + +function TSpTBXTabItem.GetNextTab(GoForward: Boolean; SearchType: TSpTBXSearchItemViewerType): TSpTBXTabItem; +// Returns the left or right Tab item depending on GoForward, skipping all the non-visible ones. +// If Inmediate is true it will only search for the next inmediate tab +var + T: TSpTBXTabToolbar; + IV: TTBItemViewer; +begin + Result := nil; + + if GetTabToolbar(T) then begin + IV := SpFindItemViewer(T.View, Self); + if Assigned(IV) then begin + IV := SpGetNextTabItemViewer(T.View, IV, GoForward, SearchType); + if Assigned(IV) then + Result := IV.Item as TSpTBXTabItem + end; + end; +end; + +function TSpTBXTabItem.GetTabColor: TColor; +var + T: TSpTBXTabToolbar; +begin + Result := clBtnFace; + if GetTabToolbar(T) then + Result := T.TabColor; +end; + +function TSpTBXTabItem.GetSkinType: TSpTBXSkinType; +var + T: TSpTBXTabToolbar; +begin + if GetTabToolbar(T) then + FSkinType := T.SkinType; + Result := FSkinType; +end; + +procedure TSpTBXTabItem.SetSkinType(const Value: TSpTBXSkinType); +var + T: TSpTBXTabToolbar; +begin + // Don't change the SkinType if the item is inside a TabToolbar + if not GetTabToolbar(T) then begin + FSkinType := Value; + Change(False); + end; +end; + +function TSpTBXTabItem.IsFirstVisible: Boolean; +var + T: TSpTBXTabToolbar; + IV: TTBItemViewer; +begin + Result := False; + if GetTabToolbar(T) then begin + IV := SpFindItemViewer(T.View, Self); + if Assigned(IV) then + Result := T.View.NextSelectable(nil, True) = IV; + end; +end; + +function TSpTBXTabItem.IsFirstVisibleTab: Boolean; +var + T: TSpTBXTabToolbar; +begin + if GetTabToolbar(T) then + Result := not Assigned(GetNextTab(False, sivtNormal)) + else + Result := False; +end; + +function TSpTBXTabItem.IsLastVisibleTab: Boolean; +var + T: TSpTBXTabToolbar; +begin + if GetTabToolbar(T) then + Result := not Assigned(GetNextTab(True, sivtNormal)) + else + Result := False; +end; + +function TSpTBXTabItem.GetTabToolbar(out TabToolbar: TSpTBXTabToolbar): Boolean; +var + C: TComponent; +begin + C := GetParentComponent; + if Assigned(C) and (C is TSpTBXTabToolbar) then + TabToolbar := C as TSpTBXTabToolbar + else + TabToolbar := nil; + Result := Assigned(TabToolbar); +end; + +procedure TSpTBXTabItem.ToggleControl; +begin + // Do nothing, the Control property is the Tabsheet, and its visibility + // is setted by TabSet.ActiveTabIndex +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTabItemViewer } + +procedure TSpTBXTabItemViewer.CalcSize(const Canvas: TCanvas; var AWidth, + AHeight: Integer); +var + TabMaxSize: Integer; +begin + inherited CalcSize(Canvas, AWidth, AHeight); + + if IsOnTabToolbar and not Item.Anchored then begin + TabMaxSize := TSpTBXTabToolbar(View.Window).TabMaxSize; + if TabMaxSize > 0 then + if IsRotated then begin + if AHeight > TabMaxSize then + AHeight := TabMaxSize; + end + else begin + if AWidth > TabMaxSize then + AWidth := TabMaxSize; + end; + end; +end; + +function TSpTBXTabItemViewer.CorrectTabRect(ARect: TRect): TRect; +// Offsets the rect to give a pushed effect on the tabs +begin + Result := ARect; + if not Item.Checked then + case TabPosition of + ttpTop: OffsetRect(Result, 0, 2); + ttpBottom: OffsetRect(Result, 0, -2); + end; +end; + +procedure TSpTBXTabItemViewer.DoDrawButton(ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +var + LeftT, RightT: TTBItemViewer; + IsHoverItem: Boolean; + R: TRect; + Position: TSpTBXTabPosition; + TT: TSpTBXSkinType; +begin + inherited; + + if (PaintStage = pstPrePaint) and PaintDefault then begin + PaintDefault := False; + IsHoverItem := (ItemInfo.State = sknsHotTrack) or (ItemInfo.State = sknsCheckedAndHotTrack); + Position := TabPosition; + + // Match the bottom of the Tab with the bottom of the TabSet + case Position of + ttpTop: ARect.Bottom := ARect.Bottom + 1; + ttpBottom: ARect.Top := ARect.Top - 1; + end; + R := ARect; + TT := SpTBXSkinType(Item.SkinType); + + case TT of + sknNone, sknSkin: + if Item.Checked or (IsHoverItem and (TT <> sknNone)) or + not CurrentSkin.Options(skncTab, sknsNormal).Body.IsEmpty or + not CurrentSkin.Options(skncTab, sknsNormal).Borders.IsEmpty then + begin + case Position of + ttpTop: Inc(R.Bottom, 5); + ttpBottom: Dec(R.Top, 5); + end; + DrawTab(ACanvas, R, Item.Enabled, Item.Checked, IsHoverItem, Position); + end + else begin + // Draw the separators + RightT := SpGetNextTabItemViewer(View, Self, True, sivtInmediateSkipNonVisible); + if Assigned(RightT) and not RightT.Item.Checked then + DrawTab(ACanvas, R, Item.Enabled, Item.Checked, IsHoverItem, Position, True); + end; + sknWindows: + begin + if IsOnTabToolbar then begin + // Find the inmediate left and right tabs + LeftT := SpGetNextTabItemViewer(View, Self, False, sivtInmediateSkipNonVisible); + RightT := SpGetNextTabItemViewer(View, Self, True, sivtInmediateSkipNonVisible); + end + else begin + LeftT := nil; + RightT := nil; + end; + + if Item.Checked then begin + // The left border of the Tab will be painted by the Left tab if + // its the first tab + if Assigned(LeftT) or (Item.IsFirstVisible) then + R.Left := R.Left - 2; + // The right border of the Tab will be painted by the Right tab + if Assigned(RightT) then + R.Right := R.Right + 2; + end + else begin + // Non checked tabs should be smaller + case Position of + ttpTop: Inc(R.Top, 2); + ttpBottom: Dec(R.Bottom, 2); + end; + end; + + // Draw the Tab + DrawTab(ACanvas, R, Item.Enabled, Item.Checked, IsHoverItem, Position); + + // If the Tab is not checked then it should paint the active tab borders + if not Item.Checked then begin + R := ARect; + // Draw the left border + if Assigned(LeftT) and LeftT.Item.Checked then begin + R.Right := R.Left + 2; + R.Left := R.Right - 10; + DrawTab(ACanvas, R, LeftT.Item.Enabled, True, IsHoverItem, Position); + end + else + // Draw the right border + if Assigned(RightT) and RightT.Item.Checked then begin + R.Left := R.Right - 2; + R.Right := R.Left + 10; + DrawTab(ACanvas, R, RightT.Item.Enabled, True, IsHoverItem, Position); + end; + end; + end; + end; + end; +end; + +procedure TSpTBXTabItemViewer.DoDrawCaption(ACanvas: TCanvas; ClientAreaRect: TRect; + State: TSpTBXSkinStatesType; var ACaption: WideString; var CaptionRect: TRect; + var CaptionFormat: Cardinal; IsTextRotated: Boolean; + const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean); +begin + CaptionRect := CorrectTabRect(CaptionRect); // Offset the rect to give a pushed effect on the tabs + + // [Theme-Change] + // The Default theme paints the caption of the pushed button in a down + // state, this only happens when the item is in a toolbarstyle + if (State = sknsPushed) and (SkinManager.CurrentSkinName = 'Default') then + OffsetRect(CaptionRect, -1, -1); + + inherited DoDrawCaption(ACanvas, ClientAreaRect, State, ACaption, CaptionRect, + CaptionFormat, IsTextRotated, PaintStage, PaintDefault); +end; + +procedure TSpTBXTabItemViewer.DoDrawImage(ACanvas: TCanvas; + State: TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; + var AImageList: TCustomImageList; var AImageIndex: Integer; var ARect: TRect; + var PaintDefault: Boolean); +begin + ARect := CorrectTabRect(ARect); // Offset the rect to give a pushed effect on the tabs + inherited DoDrawImage(ACanvas, State, PaintStage, AImageList, AImageIndex, ARect, PaintDefault); +end; + +procedure TSpTBXTabItemViewer.DoDrawTabCloseButton(ACanvas: TCanvas; + State: TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; + var AImageList: TCustomImageList; var AImageIndex: Integer; var ARect: TRect; + var PaintDefault: Boolean); +begin + TSpTBXTabItem(Item).DoDrawTabCloseButton(ACanvas, State, PaintStage, AImageList, AImageIndex, ARect, PaintDefault); +end; + +procedure TSpTBXTabItemViewer.DrawBottomBorder(ACanvas: TCanvas; ARect: TRect); +var + CR, R: TRect; + Edge: TSpTBXTabEdge; + LeftT, RightT: Boolean; + Position: TSpTBXTabPosition; + B: TBitmap; + TT: TSpTBXSkinType; +begin + if not IsOnTabToolbar then Exit; + + TT := SpTBXSkinType(Item.SkinType); + Position := TabPosition; + Edge := tedNone; + CR := ARect; + + case Position of + ttpTop: + Inc(CR.Bottom, 2); + ttpBottom: + begin + // When sknNone the bottom border size is 2 + if TT = sknNone then + Dec(CR.Top, 2) + else + Dec(CR.Top, 2); + end; + end; + + if TT = sknWindows then begin + LeftT := Assigned(SpGetNextTabItemViewer(View, Self, False, sivtInmediateSkipNonVisible)); + RightT := Assigned(SpGetNextTabItemViewer(View, Self, True, sivtInmediateSkipNonVisible)); + + if Item.IsFirstVisible then // Is first IV? + Edge := tedLeft; + + if Edge = tedLeft then begin + CR.Left := CR.Left - 2; + if RightT then + CR.Right := CR.Right + 2; + end + else begin + if LeftT then + CR.Left := CR.Left - 2; + if RightT then + CR.Right := CR.Right + 2; + end; + end; + + B := TBitmap.Create; + try + B.Width := CR.Right - CR.Left; + B.Height := CR.Bottom - CR.Top + 4; // Larger than CR + R := Rect(0, 0, B.Width, B.Height); + DrawTab(B.Canvas, R, True, True, False, Position, False, Edge); + + case Position of + ttpTop: + R := Bounds(0, 0, CR.Right - CR.Left, CR.Bottom - CR.Top); // Copy from Y = 0 + ttpBottom: + R := Bounds(0, 2, CR.Right - CR.Left, CR.Bottom - CR.Top + 2); // Copy from Y = 2 + end; + + ACanvas.CopyRect(CR, B.Canvas, R); + finally + B.Free; + end; +end; + +procedure TSpTBXTabItemViewer.DrawItemRightImage(ACanvas: TCanvas; ARect: TRect; + ItemInfo: TSpTBXMenuItemInfo); +var + PaintDefault: Boolean; + ImgList: TCustomImageList; + ImgIndex: Integer; + PatternColor: TColor; +begin + if IsOnTabToolbar then begin + if not IsTabCloseButtonVisible then + Exit; + + GetTabCloseButtonImgList(ImgList, ImgIndex); + ARect := CorrectTabRect(ARect); // Offset the rect to give a pushed effect on the tabs + + ItemInfo.Pushed := False; + ItemInfo.Checked := False; + if ItemInfo.Enabled then + if FTabCloseButtonState = sknsHotTrack then + ItemInfo.State := sknsHotTrack + else begin + ItemInfo.Enabled := False; + ItemInfo.State := sknsDisabled; + end; + + PaintDefault := True; + DoDrawTabCloseButton(ACanvas, ItemInfo.State, pstPrePaint, ImgList, ImgIndex, ARect, PaintDefault); + if PaintDefault and Assigned(ImgList) and (FTabCloseButtonState = sknsHotTrack) then + if (ImgList = MDIButtonsImgList) or ((ImgIndex >= 0) and (ImgIndex < ImgList.Count)) then + SpDrawXPMenuItem(ACanvas, ARect, ItemInfo); + PaintDefault := True; + if ImgList = MDIButtonsImgList then begin + PatternColor := GetTextColor(ItemInfo.State); + SpDrawGlyphPattern(ACanvas, ARect, ImgIndex, PatternColor); + end + else + DoDrawTabCloseButton(ACanvas, ItemInfo.State, pstPostPaint, ImgList, ImgIndex, ARect, PaintDefault); + if PaintDefault and Assigned(ImgList) and (ImgIndex >= 0) and (ImgIndex < ImgList.Count) then begin + SpDrawXPMenuItemImage(ACanvas, ARect, ItemInfo, ImgList, ImgIndex); + end; + end; +end; + +procedure TSpTBXTabItemViewer.DrawTab(ACanvas: TCanvas; ARect: TRect; AEnabled, + AChecked, AHoverItem: Boolean; Position: TSpTBXTabPosition; + ASeparator: Boolean; AEdge: TSpTBXTabEdge); +begin + if ASeparator then begin + ARect.Left := ARect.Right - 2; + SpDrawXPMenuSeparator(ACanvas, ARect, False, True) + end + else begin + ACanvas.Brush.Color := Item.TabColor; + SpDrawXPTab(ACanvas, ARect, AEnabled, AChecked, AHoverItem, False, Position, Item.SkinType, AEdge); + end; +end; + +function TSpTBXTabItemViewer.GetItem: TSpTBXTabItem; +begin + Result := TSpTBXTabItem(inherited Item); +end; + +function TSpTBXTabItemViewer.GetRightImageRect: TRect; +var + RightGlyphSize: TSize; + R: TRect; +begin + RightGlyphSize := GetRightImageSize; + R := BoundsRect; + + Result.Left := R.Right - 4 - RightGlyphSize.cx; + Result.Right := Result.Left + RightGlyphSize.cx; + Result.Top := (R.Top + R.Bottom - RightGlyphSize.cy) div 2; + Result.Bottom := Result.Top + RightGlyphSize.cy; + + Result := CorrectTabRect(Result); // Offset the rect to give a pushed effect on the tabs +end; + +function TSpTBXTabItemViewer.GetRightImageSize: TSize; +var + ImgList: TCustomImageList; + ImgIndex: Integer; +begin + Result.cx := 0; + Result.cy := 0; + GetTabCloseButtonImgList(ImgList, ImgIndex); + if Assigned(ImgList) then + if ImgList = MDIButtonsImgList then begin + Result.cx := 15; + Result.cy := 15; + end + else if (ImgIndex >= 0) and (ImgIndex < ImgList.Count) then begin + Result.cx := ImgList.Width; + Result.cy := ImgList.Height; + end; +end; + +procedure TSpTBXTabItemViewer.GetTabCloseButtonImgList(var AImageList: TCustomImageList; + var AImageIndex: Integer); +var + T: TSpTBXTabToolbar; +begin + AImageList := nil; + AimageIndex := -1; + if IsOnTabToolbar then begin + T := TSpTBXTabToolbar(View.Window); + if T.TabCloseButton <> tcbNone then begin + AImageList := GetImageList; + AImageIndex := T.TabCloseButtonImageIndex; + if not Assigned(AImageList) or (AImageIndex < 0) or (AImageIndex >= AImageList.Count) then begin + AImageList := MDIButtonsImgList; + AImageIndex := 0; + end; + end; + end; +end; + +function TSpTBXTabItemViewer.GetTabPosition: TSpTBXTabPosition; +begin + if IsOnTabToolbar then + Result := TSpTBXTabToolbar(View.Window).TabPosition + else + Result := ttpTop; +end; + +function TSpTBXTabItemViewer.GetTextColor(State: TSpTBXSkinStatesType): TColor; +begin + Result := Item.FontSettings.Color; + if Result = clNone then begin + if View.Window is TSpTBXTabToolbar then + Result := TSpTBXToolbarAccess(View.Window).GetItemsTextColor(State); + if Result = clNone then + Result := CurrentSkin.GetTextColor(skncTab, State) + end; +end; + +procedure TSpTBXTabItemViewer.InternalMouseMove(Shift: TShiftState; X, + Y: Integer); +var + P: TPoint; + R: TRect; + NewState: TSpTBXSkinStatesType; +begin + inherited; + + if FTabCloseButtonState in [sknsNormal, sknsHotTrack] then begin + if not Item.Enabled then begin + FTabCloseButtonState := sknsDisabled; + Exit; + end; + P := Point(X, Y); + R := GetRightImageRect; + if PtInRect(R, P) then + NewState := sknsHotTrack + else + NewState := sknsNormal; + if NewState <> FTabCloseButtonState then begin + FTabCloseButtonState := NewState; + InvalidateRect(View.Window.Handle, @R, True) + end; + end; +end; + +function TSpTBXTabItemViewer.IsOnTabToolbar: Boolean; +begin + Result := Assigned(View.Window) and (View.Window is TSpTBXTabToolbar); +end; + +function TSpTBXTabItemViewer.IsTabCloseButtonVisible: Boolean; +var + T: TSpTBXTabToolbar; +begin + Result := False; + if IsOnTabToolbar then begin + T := TSpTBXTabToolbar(View.Window); + case T.TabCloseButton of + tcbNone: + Exit; + tcbActive: + if not Item.Checked then Exit; + end; + Result := True; + end; +end; + +procedure TSpTBXTabItemViewer.Leaving; +var + R: TRect; +begin + inherited; + if FTabCloseButtonState = sknsHotTrack then begin + FTabCloseButtonState := sknsNormal; + R := GetRightImageRect; + InvalidateRect(View.Window.Handle, @R, True) + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTabToolbar } + +constructor TSpTBXTabToolbar.Create(AOwner: TComponent); +begin + inherited; + FHiddenTabs := TSpTBXItemCacheCollection.Create(TSpTBXItemCache); + if Owner is TSpTBXCustomTabSet then + FOwnerTabControl := Owner as TSpTBXCustomTabSet + else + FOwnerTabControl := nil; + FActiveTabIndex := -1; + FTabBackgroundBorders := False; + FSkinType := sknSkin; + FTabAutofitMaxSize := 200; + FTabCloseButtonImageIndex := -1; + FTabColor := clBtnFace; + FTabMaxSize := -1; + FTabPosition := ttpTop; +end; + +destructor TSpTBXTabToolbar.Destroy; +begin + FHiddenTabs.Free; + inherited; +end; + +procedure TSpTBXTabToolbar.DoItemNotification(Ancestor: TTBCustomItem; + Relayed: Boolean; Action: TTBItemChangedAction; Index: Integer; + Item: TTBCustomItem); +begin + inherited; + if Action = tbicInvalidateAndResize then begin + // Invalidate the NC area, draw the bottom border of the active tab + if (FUpdateHidden = 0) and not IsItemMoving then + InvalidateNC; + end; +end; + +procedure TSpTBXTabToolbar.BeginUpdateHidden; +begin + if FUpdateHidden < 0 then FUpdateHidden := 0; + if FUpdateHidden = 0 then + SendMessage(Handle, WM_SETREDRAW, 0, 0); + Inc(FUpdateHidden); +end; + +procedure TSpTBXTabToolbar.EndUpdateHidden; +begin + Dec(FUpdateHidden); + if FUpdateHidden < 0 then FUpdateHidden := 0; + if FUpdateHidden = 0 then begin + SendMessage(Handle, WM_SETREDRAW, 1, 0); + InvalidateNC; + end; +end; + +procedure TSpTBXTabToolbar.InternalDrawBackground(ACanvas: TCanvas; ARect: TRect; + PaintOnNCArea: Boolean; PaintBorders: Boolean = True); +var + B: TBitmap; + R, BitmapR, DestR: TRect; + Tab: TSpTBXTabItem; + IV: TTBItemViewer; + T: TSpTBXSkinType; + PrevDelta, NextDelta: Integer; +begin + T := SpTBXSkinType(SkinType); + if PaintOnNCArea and Assigned(FOwnerTabControl) then begin + B := TBitmap.Create; + B.Canvas.Lock; + try + R := ARect; + B.Width := R.Right - R.Left; + B.Height := R.Bottom - R.Top; + + SpDrawXPToolbar(Self, B.Canvas, R, PaintOnNCArea, FTabBackgroundBorders and (T <> sknNone), skncTabToolbar); + + // Draw the bottom border of the active tab + Tab := ActiveTab; + if Assigned(Tab) and Tab.Visible then begin + IV := SpFindItemViewer(View, Tab); + if Assigned(IV) then begin + DestR := IV.BoundsRect; + OffsetRect(DestR, 2, 2); // Add the toolbar margins + TSpTBXTabItemViewer(IV).DrawBottomBorder(B.Canvas, DestR); + end; + if T = sknWindows then begin + if Tab.IsFirstVisible or Assigned(Tab.GetNextTab(False, sivtInmediateSkipNonVisible)) then + PrevDelta := 1 + else + PrevDelta := -1; + if Assigned(Tab.GetNextTab(True, sivtInmediateSkipNonVisible)) then + NextDelta := 1 + else + NextDelta := -1; + if FTabPosition = ttpTop then + ExcludeClipRect(B.Canvas.Handle, DestR.Left - PrevDelta, R.Bottom - 2, DestR.Right + NextDelta, R.Bottom + 4) + else + ExcludeClipRect(B.Canvas.Handle, DestR.Left - PrevDelta, R.Top + 2, DestR.Right + NextDelta, R.Top - 4); + end + else + if FTabPosition = ttpTop then + ExcludeClipRect(B.Canvas.Handle, DestR.Left + 1, R.Bottom - 2, DestR.Right - 1, R.Bottom + 4) + else + ExcludeClipRect(B.Canvas.Handle, DestR.Left + 1, R.Top + 2, DestR.Right -1 , R.Top - 4); + end; + + // Draw the bottom border of the tabs pane + BitmapR := Rect(0, 0, FOwnerTabControl.FBackground.Width, FOwnerTabControl.FBackground.Height); + case FTabPosition of + ttpTop: + begin + DestR := Rect(R.Left, R.Bottom - 2, R.Right, R.Bottom); + BitmapR.Bottom := BitmapR.Top + 2; + end; + ttpBottom: + begin + DestR := Rect(R.Left, R.Top, R.Right, R.Top + 2); + BitmapR.Top := BitmapR.Bottom - 2; + end; + end; + + B.Canvas.CopyRect(DestR, FOwnerTabControl.FBackground.Canvas, BitmapR); + ACanvas.Draw(0, 0, B); + finally + B.Canvas.UnLock; + B.Free; + end; + end + else + SpDrawXPToolbar(Self, ACanvas, ARect, PaintOnNCArea, FTabBackgroundBorders and (T <> sknNone), skncTabToolbar); +end; + +procedure TSpTBXTabToolbar.InvalidateActiveTab; +var + Tab: TSpTBXTabItem; + IV: TTBItemViewer; +begin + Tab := ActiveTab; + if Assigned(Tab) then begin + IV := SpFindItemViewer(View, Tab); + if Assigned(IV) then + View.Invalidate(IV); + end; +end; + +procedure TSpTBXTabToolbar.InvalidateNC; +begin + if (FUpdateHidden = 0) and not (tstResizing in FState) and HandleAllocated then + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_FRAME); +end; + +function TSpTBXTabToolbar.GetActiveTab: TSpTBXTabItem; +var + Item: TTBCustomItem; +begin + Result := nil; + if Assigned(Items) and (FActiveTabIndex > -1) and (Items.Count > 0) and + (FActiveTabIndex < Items.Count) then + begin + Item := Items[FActiveTabIndex]; + if not (csDestroying in Item.ComponentState) and (Item is TSpTBXTabItem) and Assigned(Item.Parent) then + Result := Items[FActiveTabIndex] as TSpTBXTabItem; + end; +end; + +function TSpTBXTabToolbar.GetItemsTextColor(State: TSpTBXSkinStatesType): TColor; +begin + Result := CurrentSkin.GetTextColor(skncTabToolbar, State, SkinType); + // Don't call inherited GetItemsTextColor, let the TabItem decide the color. +end; + +function TSpTBXTabToolbar.GetTabsCount(VisibleOnly: Boolean): Integer; +var + I: Integer; + IV: TTBItemViewer; +begin + Result := 0; + for I := 0 to View.ViewerCount - 1 do begin + IV := View.Viewers[I]; + if IV.Item is TSpTBXTabItem then + if VisibleOnly then begin + if IV.Item.Visible then Inc(Result); + end + else + Inc(Result); + end; +end; + +procedure TSpTBXTabToolbar.Autofit; +var + I, TabsCount, TabsWidth, TabsArea, NonTabsArea, RightAlignWidth: Integer; + IV: TTBItemViewer; + R: TRect; +begin + if not FTabAutofit or (FUpdateHidden > 0) or (Items.Count = 0) then Exit; + + BeginUpdateHidden; + try + // Make all the clipped items visible + for I := 0 to FHiddenTabs.Count - 1 do + FHiddenTabs.Items[I].Item.Visible := True; + FHiddenTabs.Clear; + + View.ValidatePositions; + View.BeginUpdate; + try + TabsCount := 0; + TabsWidth := 0; + NonTabsArea := 0; + RightAlignWidth := 0; + + // Get TabsCount and NonTabsArea + for I := 0 to View.ViewerCount - 1 do begin + IV := View.Viewers[I]; + if IV.Item.Visible then begin + if IV.Item is TSpTBXTabItem then + Inc(TabsCount) + else + if IV.Item is TSpTBXRightAlignSpacerItem then + Inc(RightAlignWidth, 20) + else begin + R := SpGetBoundsRect(IV, Items); + Inc(NonTabsArea, R.Right - R.Left); + end; + end; + end; + + // Get TabsArea + if TabsCount > 0 then begin + TabsArea := CurrentDock.ClientWidth - 4 - NonTabsArea - RightAlignWidth; + TabsWidth := TabsArea div TabsCount; + if TabsWidth > FTabAutofitMaxSize then + TabsWidth := FTabAutofitMaxSize; + end; + + // Get RightAlignWidth + Inc(RightAlignWidth, CurrentDock.Width - ((TabsWidth * TabsCount) + NonTabsArea + RightAlignWidth)); + + // Set TabsWidth and RightAlignWidth to the Items + for I := 0 to View.ViewerCount - 1 do begin + IV := View.Viewers[I]; + if IV.Item.Visible then begin + if IV.Item is TSpTBXTabItem then + TSpTBXTabItem(IV.Item).CustomWidth := TabsWidth + else + if IV.Item is TSpTBXRightAlignSpacerItem then + TSpTBXRightAlignSpacerItem(IV.Item).CustomWidth := RightAlignWidth - GetRightAlignMargin; + end; + end; + finally + View.EndUpdate; + end; + finally + EndUpdateHidden; + end; +end; + +procedure TSpTBXTabToolbar.RightAlignItems; +// Hide the items on resizing +var + I, J, W, H, VisibleTabsCount, iStart, iEnd: Integer; + VisibleWidth, RightAlignedWidth, SpacerW, RightAlignedBorder: Integer; + IV: TTBItemViewer; + Spacer: TSpTBXItemViewer; + RightAlignedList: TList; + IsRotated, IsFirstPartiallyVisible: Boolean; +begin + if (FUpdateHidden > 0) or (csDestroying in ComponentState) or (tstRightAligning in FState) or + not Assigned(CurrentDock) or (Items.Count <= 0) or + not Stretch or (ShrinkMode <> tbsmNone) or + (CurrentDock.Width <= 0) or (CurrentDock.Height <= 0) then + Exit; + + if FTabAutofit then begin + Autofit; + Exit; + end; + + FState := FState + [tstRightAligning]; + View.ValidatePositions; + View.BeginUpdate; + RightAlignedList := TList.Create; + try + IsRotated := CurrentDock.Position in [dpLeft, dpRight]; + // Find the spacer and the right aligned items + Spacer := SpGetRightAlignedItems(View, RightAlignedList, IsRotated, VisibleWidth, RightAlignedWidth); + if Assigned(Spacer) then begin + SpacerW := Spacer.BoundsRect.Right - Spacer.BoundsRect.Left; + RightAlignedBorder := CurrentDock.Width - 2 - RightAlignedWidth + SpacerW; + VisibleWidth := VisibleWidth - SpacerW; + SpacerW := CurrentDock.Width - VisibleWidth - 4; + end + else begin + SpacerW := 0; + RightAlignedBorder := CurrentDock.Width - 2; + end; + + // Show items + VisibleTabsCount := GetTabsCount(True); + IsFirstPartiallyVisible := False; + if VisibleTabsCount = 1 then begin + if VisibleWidth > CurrentDock.Width - 2 then + IsFirstPartiallyVisible := True; + end; + + if not IsFirstPartiallyVisible then begin + + IV := SpFindItemViewer(View, ActiveTab); + if Assigned(IV) and (IV.Item.Visible) then begin + iStart := IV.Index; + iEnd := IV.Index; + end + else begin + iStart := 0; + iEnd := 0; + end; + // Show items from left side of the ActiveTab + for I := iStart downto 0 do begin + IV := View.Viewers[I]; + if not IV.Item.Visible and (RightAlignedList.IndexOf(IV) = -1) then begin + // If the item was hidden and can be showed remove it from the HiddenList + J := FHiddenTabs.IndexOf(IV.Item); + if J > -1 then begin + W := 0; + H := 0; + TTBItemViewerAccess(IV).CalcSize(Canvas, W, H); + VisibleWidth := VisibleWidth + W; + if (VisibleTabsCount = 0) or (VisibleWidth < CurrentDock.Width - 2) then begin + SpacerW := SpacerW - W; + FHiddenTabs.Delete(J); + IV.Item.Visible := True; + Inc(VisibleTabsCount); + end + else + Break; + end; + end; + end; + // Show items from right side of the ActiveTab + for I := iEnd to View.ViewerCount - 1 do begin + IV := View.Viewers[I]; + if not IV.Item.Visible and (RightAlignedList.IndexOf(IV) = -1) then begin + // If the item was hidden and can be showed remove it from the HiddenList + J := FHiddenTabs.IndexOf(IV.Item); + if J > -1 then begin + W := 0; + H := 0; + TTBItemViewerAccess(IV).CalcSize(Canvas, W, H); + VisibleWidth := VisibleWidth + W; + if (VisibleTabsCount = 0) or (VisibleWidth < CurrentDock.Width - 2) then begin + SpacerW := SpacerW - W; + FHiddenTabs.Delete(J); + IV.Item.Visible := True; + Inc(VisibleTabsCount); + end + else + Break; + end; + end; + end; + + // Hide items + if VisibleTabsCount > 1 then + for I := View.ViewerCount - 1 downto 0 do begin + IV := View.Viewers[I]; + if (VisibleTabsCount > 1) and (IV is TSpTBXTabItemViewer) and IV.Item.Visible and (IV.BoundsRect.Right > RightAlignedBorder) then + if RightAlignedList.IndexOf(IV) = -1 then begin + // If the item can't be showed add it to the HiddenList + SpacerW := SpacerW + (IV.BoundsRect.Right - IV.BoundsRect.Left); + FHiddenTabs.Add(IV.Item); + IV.Item.Visible := False; + Dec(VisibleTabsCount); + end; + end; + end; + + // Resize the spacer + if Assigned(Spacer) then + TSpTBXCustomItemAccess(Spacer.Item).CustomWidth := SpacerW; + + View.UpdatePositions; + finally + RightAlignedList.Free; + View.EndUpdate; + FState := FState - [tstRightAligning]; + end; +end; + +procedure TSpTBXTabToolbar.TabClose(ATab: TSpTBXTabItem); +begin + ATab.TabClose; +end; + +procedure TSpTBXTabToolbar.MakeVisible(ATab: TSpTBXTabItem); +var + TabIV, FirstIV, LastIV: TTBItemViewer; + I: Integer; + Spacer: TSpTBXItemViewer; +begin + if (Items.Count > 1) and Assigned(ATab) and (ATab.Visible = False) then begin + TabIV := View.Find(ATab); + FirstIV := View.NextSelectable(nil, True); + + // LastIV minus the right aligned items + Spacer := SpGetFirstRightAlignSpacer(View); + if Assigned(Spacer) then + LastIV := View.NextSelectable(Spacer, False) + else + LastIV := View.NextSelectable(nil, False); + + if Assigned(FirstIV) and Assigned(LastIV) then begin + for I := 0 to View.ViewerCount - 1 do begin + if TabIV.Index >= FirstIV.Index then + ScrollRight + else + ScrollLeft; + if TabIV.Item.Visible then + Break; + end; + end; + end; +end; + +procedure TSpTBXTabToolbar.Scroll(ToRight: Boolean); +var + FirstIV, LastIV: TTBItemViewer; + I, VisibleWidth: Integer; + Spacer: TSpTBXItemViewer; + + function ProcessScroll(IV: TTBItemViewer): Boolean; + var + IVIndex, ClippedIndex, VisibleTabsCount, W, H: Integer; + begin + Result := False; + + ClippedIndex := FHiddenTabs.IndexOf(IV.Item); + if Assigned(IV) and (ClippedIndex > -1) then begin + Result := True; // a clipped tab was found + View.BeginUpdate; + BeginUpdateHidden; + try + VisibleTabsCount := GetTabsCount(True); + // Try to hide all the necessary tabs + W := 0; + H := 0; + TTBItemViewerAccess(IV).CalcSize(Canvas, W, H); + if ToRight then begin + while Assigned(FirstIV) and (VisibleWidth + W >= CurrentDock.ClientWidth - 2) do begin + VisibleWidth := VisibleWidth - (FirstIV.BoundsRect.Right - FirstIV.BoundsRect.Left); + FHiddenTabs.Add(FirstIV.Item); + FirstIV.Item.Visible := False; + FirstIV := SpGetNextTabItemViewer(View, FirstIV, True, sivtNormal); + Dec(VisibleTabsCount); + end; + end + else begin + while Assigned(LastIV) and (VisibleWidth + W >= CurrentDock.ClientWidth - 2) do begin + VisibleWidth := VisibleWidth - (LastIV.BoundsRect.Right - LastIV.BoundsRect.Left); + FHiddenTabs.Add(LastIV.Item); + LastIV.Item.Visible := False; + LastIV := SpGetNextTabItemViewer(View, LastIV, False, sivtNormal); + Dec(VisibleTabsCount); + end; + end; + + // Try to show all the necessary clipped tabs + IVIndex := IV.Index; + while Assigned(IV) and (ClippedIndex > -1) and ((VisibleTabsCount = 0) or (VisibleWidth + W <= CurrentDock.ClientWidth - 2)) do begin + VisibleWidth := VisibleWidth + W; + IV.Item.Visible := True; + FHiddenTabs.Delete(ClippedIndex); + Inc(VisibleTabsCount); + + if ToRight then + Inc(IVIndex) + else + Dec(IVIndex); + + if (IVIndex > -1) and (IVIndex < View.ViewerCount) then begin + IV := View.Viewers[IVIndex]; + ClippedIndex := FHiddenTabs.IndexOf(IV.Item); + W := 0; + H := 0; + TTBItemViewerAccess(IV).CalcSize(Canvas, W, H); + end + else + Break; + end; + finally + EndUpdateHidden; + View.EndUpdate; + if Assigned(Spacer) then + RightAlignItems; + end; + end; + end; + +begin + if (Items.Count > 1) and not FTabAutofit then begin + // Find the first Tab + FirstIV := SpGetNextTabItemViewer(View, nil, True, sivtNormal); + + // Get the VisibleWidth + LastIV := View.NextSelectable(nil, False); + if not Assigned(LastIV) then Exit; + VisibleWidth := LastIV.BoundsRect.Right; + + // LastIV minus the right aligned items + Spacer := SpGetFirstRightAlignSpacer(View); + if Assigned(Spacer) then begin + VisibleWidth := VisibleWidth - (Spacer.BoundsRect.Right - Spacer.BoundsRect.Left); + LastIV := View.NextSelectable(Spacer, False); + end; + if Assigned(LastIV) and not (LastIV.Item is TSpTBXTabItem) then + LastIV := SpGetNextTabItemViewer(View, LastIV, False, sivtNormal); + + if Assigned(FirstIV) and Assigned(LastIV) then begin + if ToRight then begin + // Find the first clipped tab from the right side of the tabset + for I := LastIV.Index + 1 to View.ViewerCount - 1 do + if ProcessScroll(View.Viewers[I]) then + Break; + end + else begin + // Find the first clipped tab from the left side of the tabset + for I := FirstIV.Index - 1 downto 0 do + if ProcessScroll(View.Viewers[I]) then + Break; + end; + end; + + end; +end; + +procedure TSpTBXTabToolbar.ScrollLeft; +begin + Scroll(False); +end; + +procedure TSpTBXTabToolbar.ScrollRight; +begin + Scroll(True); +end; + +procedure TSpTBXTabToolbar.ScrollState(out CanScrollToLeft, CanScrollToRight: Boolean); +var + FirstIV, LastIV: TTBItemViewer; + I, ClippedIndex: Integer; + Spacer: TSpTBXItemViewer; +begin + CanScrollToLeft := False; + CanScrollToRight := False; + if (FHiddenTabs.Count > 0) and not FTabAutofit then begin + // Find the first Tab + FirstIV := SpGetNextTabItemViewer(View, nil, True, sivtNormal); + + if Assigned(FirstIV) then begin + // Find the first clipped tab from the left side of the tabset + for I := FirstIV.Index - 1 downto 0 do begin + ClippedIndex := FHiddenTabs.IndexOf(View.Viewers[I].Item); + if ClippedIndex > -1 then begin + CanScrollToLeft := True; + Break; + end; + end; + end; + + // LastIV minus the right aligned items + Spacer := SpGetFirstRightAlignSpacer(View); + if Assigned(Spacer) then + LastIV := View.NextSelectable(Spacer, False) + else + LastIV := View.NextSelectable(nil, False); + // Find the first clipped tab from the right side of the tabset + if Assigned(LastIV) then begin + for I := LastIV.Index + 1 to View.ViewerCount - 1 do begin + ClippedIndex := FHiddenTabs.IndexOf(View.Viewers[I].Item); + if ClippedIndex > -1 then begin + CanScrollToRight := True; + Break; + end; + end; + end; + end; +end; + +procedure TSpTBXTabToolbar.SetActiveTabIndex(Value: Integer); +var + ATab, APrevTab: TSpTBXTabItem; + I: Integer; +begin + if not Assigned(FOwnerTabControl) then Exit; + + if (Value > -1) and (Value < Items.Count) and not (csDestroying in Items[Value].ComponentState) then begin + if not (Items[Value] is TSpTBXTabItem) then + Value := FActiveTabIndex; + end + else + Value := -1; + + if (Value <> FActiveTabIndex) and FOwnerTabControl.CanActiveTabChange(FActiveTabIndex, Value) then + begin + I := FActiveTabIndex; + FActiveTabIndex := Value; + + // Hide the previous TabSheet + if (I > -1) and (I < Items.Count) and not (csDestroying in Items[I].ComponentState) and + (Items[I] is TSpTBXTabItem) then + begin + APrevTab := Items[I] as TSpTBXTabItem; + APrevTab.Checked := False; + if Assigned(APrevTab.Control) then + APrevTab.Control.Visible := False; + end; + + // Check the item and invalidate NC + if FActiveTabIndex > -1 then begin + // Show the TabSheet + ATab := Items[FActiveTabIndex] as TSpTBXTabItem; + ATab.Checked := True; + if Assigned(ATab.Control) then begin + ATab.Control.Visible := True; + ATab.Control.BringToFront; + end; + MakeVisible(ATab); + end; + + FOwnerTabControl.DoActiveTabChange(FActiveTabIndex); + InvalidateNC; + end; +end; + +procedure TSpTBXTabToolbar.SetTabCloseButton(const Value: TSpTBXTabCloseButton); +begin + if FTabCloseButton <> Value then begin + FTabCloseButton := Value; + View.InvalidatePositions; + RightAlignItems; + InvalidateNC; + end; +end; + +procedure TSpTBXTabToolbar.SetTabCloseButtonImageIndex(const Value: Integer); +begin + if FTabCloseButtonImageIndex <> Value then begin + FTabCloseButtonImageIndex := Value; + Invalidate; + end; +end; + +procedure TSpTBXTabToolbar.SetTabAutofit(const Value: Boolean); +begin + if FTabAutofit <> Value then begin + FTabAutofit := Value; + if FTabAutofit then begin + Autofit; + InvalidateNC; + end; + end; +end; + +procedure TSpTBXTabToolbar.SetTabAutofitMaxSize(const Value: Integer); +begin + if FTabAutofitMaxSize <> Value then begin + FTabAutofitMaxSize := Value; + if FTabAutofit then Autofit; + end; +end; + +procedure TSpTBXTabToolbar.SetTabBackgroundBorders(const Value: Boolean); +begin + if FTabBackgroundBorders <> Value then begin + FTabBackgroundBorders := Value; + InvalidateNC; + end; +end; + +procedure TSpTBXTabToolbar.SetTabColor(const Value: TColor); +begin + if (FTabColor <> Value) then begin + FTabColor := Value; + if FSkinType <> sknSkin then begin + Invalidate; + InvalidateNC; + end; + end; +end; + +procedure TSpTBXTabToolbar.SetTabMaxSize(const Value: Integer); +begin + if FTabMaxSize <> Value then begin + FTabMaxSize := Value; + View.InvalidatePositions; + RightAlignItems; + InvalidateNC; + end; +end; + +procedure TSpTBXTabToolbar.SetTabPosition(const Value: TSpTBXTabPosition); +begin + if FTabPosition <> Value then + FTabPosition := Value; +end; + +procedure TSpTBXTabToolbar.SetSkinType(const Value: TSpTBXSkinType); +begin + if FSkinType <> Value then begin + FSkinType := Value; + Invalidate; + InvalidateNC; + end; +end; + +procedure TSpTBXTabToolbar.CMDesignHitTest(var Message: TCMDesignHitTest); +var + P: TPoint; + IV: TTBItemViewer; + Shift: TShiftState; +begin + // Allow left-clicks on TabItems at design time + Shift := KeysToShiftState(Message.Keys); + if (csDesigning in ComponentState) and (ssLeft in Shift) and Assigned(View) then begin + P := SmallPointToPoint(Message.Pos); + IV := View.ViewerFromPoint(P); + if Assigned(IV) and Assigned(IV.Item) and (IV.Item is TSpTBXTabItem) then + IV.Item.Click; + end; + + inherited; +end; + +function TSpTBXTabToolbar.CanDragCustomize(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer): Boolean; +var + IV: TTBItemViewer; + TabIV: TSpTBXTabItemViewer; +begin + Result := False; + FBeginDragIV := nil; + + if not (csDesigning in ComponentState) and (Button = mbLeft) then begin + IV := SpGetItemViewerFromPoint(Items, View, Point(X, Y)); + if Assigned(IV) and (IV is TSpTBXTabItemViewer) and Assigned(IV.Item) and IV.Item.Enabled and IV.Item.Visible then begin + // Close the tab if the close button is pressed + TabIV := TSpTBXTabItemViewer(IV); + if (TabIV.TabCloseButtonState = sknsHotTrack) and TabIV.IsTabCloseButtonVisible then begin + Result := True; // Bypass the inherited mouse down + TabIV.Item.TabClose; + end + else begin + // Click the item on mouse down + if not IV.Item.Checked then begin + Result := True; // Bypass the inherited mouse down + IV.Item.Click; + if Assigned(OnMouseDown) then OnMouseDown(Self, Button, Shift, X, Y); + end; + // Drag reorder + if FTabDragReorder and not IsCustomizing and IV.Item.Checked then begin + Result := True; // Bypass the inherited mouse down + FBeginDragIV := IV; + BeginDrag(False, 2); + end; + end; + end + else + Result := inherited CanDragCustomize(Button, Shift, X, Y); + end; +end; + +procedure TSpTBXTabToolbar.DoStartDrag(var DragObject: TDragObject); +begin + if FTabDragReorder and Assigned(FBeginDragIV) and Assigned(FBeginDragIV.Item) and (FBeginDragIV is TSpTBXTabItemViewer) then begin + DragObject := TSpTBXTabItemDragObject.Create(Self, FBeginDragIV.Item); + inherited DoStartDrag(DragObject); + end + else + inherited DoStartDrag(DragObject); +end; + +procedure TSpTBXTabToolbar.DragOver(Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); +var + D: TSpTBXTabItemDragObject; + DestIV, RightAlignIV: TTBItemViewer; + OrigItem: TTBCustomItem; + OrigPos, DestPos, RightAlignPos: Integer; +begin + inherited DragOver(Source, X, Y, State, Accept); + + if FTabDragReorder and Assigned(Source) and (Source is TSpTBXTabItemDragObject) then begin + D := Source as TSpTBXTabItemDragObject; + OrigItem := D.SouceItem; + OrigPos := OrigItem.Parent.IndexOf(OrigItem); + + // Move the dragging item in the toolbar + if OrigItem.Parent = Items then begin + Accept := True; + SpGetDropPosItemViewer(Items, View, Point(X, Y), OrigPos, DestIV, DestPos); + RightAlignIV := SpGetFirstRightAlignSpacer(View); + if Assigned(RightAlignIV) then + RightAlignPos := Items.IndexOf(RightAlignIV.Item) + else + RightAlignPos := -1; + if (OrigPos <> DestPos) and (DestPos > -1) and (DestPos < Items.Count) and (OrigItem <> DestIV.Item) and + not ((RightAlignPos > -1) and (DestPos >= RightAlignPos)) then + begin + if FOwnerTabControl.CanActiveTabReorder(OrigPos, DestPos) then begin + BeginItemMove; + View.BeginUpdate; + try + // The item is the active tab, we need to update the ActiveTabIndex + // Just set the internal value because the page didn't change + FActiveTabIndex := DestPos; + Items.Move(OrigPos, DestPos); + FOwnerTabControl.DoActiveTabReorder(DestPos); + finally + View.EndUpdate; + EndItemMove; + InvalidateNC; + end; + end; + end; + end; + end; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXTabSheet } + +procedure TSpTBXTabSheet.AdjustClientRect(var Rect: TRect); +var + Margin, XPMargin: Integer; +begin + inherited AdjustClientRect(Rect); + + if Assigned(FTabControl) then begin + Margin := 2; + XPMargin := 2; + // [Theme-Change] + // WinXP theme needs to have 4 pixel margin + if SpTBXSkinType(FTabControl.SkinType) = sknWindows then + XPMargin := Margin + 2; + + Inc(Rect.Left, Margin); + Dec(Rect.Right, XPMargin); + case FTabControl.TabPosition of + ttpTop: dec(Rect.Bottom, XPMargin); + ttpBottom: inc(Rect.Top, XPMargin); + end; + end; +end; + +constructor TSpTBXTabSheet.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle + [csAcceptsControls, csOpaque, csSetCaption]; + Align := alClient; + Visible := False; +end; + +procedure TSpTBXTabSheet.CreateParams(var Params: TCreateParams); +begin + inherited CreateParams(Params); + if not (csDesigning in ComponentState) then + with Params do + Params.Style := Params.Style or WS_CLIPCHILDREN; +end; + +procedure TSpTBXTabSheet.DefineProperties(Filer: TFiler); +begin + inherited; + Filer.DefineProperty('TabItem', ReadItemName, WriteItemName, True); +end; + +destructor TSpTBXTabSheet.Destroy; +begin + // If the Item <> nil it means the tabsheet was removed from the form at + // designtime or freed at runtime. + // If that happens TabDeleting was not called, we should call it before + // the tabsheet is destroyed to free the Item and delete it from the + // FPages list. + if Assigned(FItem) then + if Assigned(FTabControl) and not (csDestroying in FTabControl.ComponentState) then + FTabControl.TabDeleting(FItem, False); + + FTabControl := nil; + FItem := nil; + inherited; +end; + +procedure TSpTBXTabSheet.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if Operation = opRemove then + if AComponent = FPrevFocused then FPrevFocused := nil; +end; + +procedure TSpTBXTabSheet.VisibleChanging; +begin + if not (csDesigning in ComponentState) then + if Visible then begin + // TabSheet will be hidden, save the focused control + if Assigned(FPrevFocused) then FPrevFocused.RemoveFreeNotification(Self); + SpIsFocused(Self, FPrevFocused); + if Assigned(FPrevFocused) then FPrevFocused.FreeNotification(Self); + end; + + inherited; +end; + +procedure TSpTBXTabSheet.CMVisiblechanged(var Message: TMessage); +begin + if not (csDesigning in ComponentState) then + if Visible then begin + // TabSheet was showed. + // Focus the previous focused control, or focus the first child + if Assigned(FPrevFocused) then begin + if SpCanFocus(FPrevFocused) then + FPrevFocused.SetFocus; + FPrevFocused.RemoveFreeNotification(Self); + FPrevFocused := nil; + end + else + SpFocusFirstChild(Self); + end; + + inherited; +end; + +function TSpTBXTabSheet.GetCaption: WideString; +begin + if Assigned(FItem) then Result := FItem.Caption + else Result := ''; +end; + +function TSpTBXTabSheet.GetImageIndex: Integer; +begin + if Assigned(FItem) then Result := FItem.ImageIndex + else Result := -1; +end; + +function TSpTBXTabSheet.GetTabVisible: Boolean; +begin + if Assigned(FItem) then Result := FItem.Visible + else Result := False; +end; + +procedure TSpTBXTabSheet.SetCaption(const Value: WideString); +begin + if Assigned(FItem) then FItem.Caption := Value; +end; + +procedure TSpTBXTabSheet.SetImageIndex(const Value: Integer); +begin + if Assigned(FItem) then FItem.ImageIndex := Value; +end; + +procedure TSpTBXTabSheet.SetTabVisible(const Value: Boolean); +begin + if Assigned(FItem) then FItem.Visible := Value; +end; + +procedure TSpTBXTabSheet.ReadItemName(Reader: TReader); +begin + case Reader.NextValue of + vaLString, vaString: + FItemName := Reader.ReadString; + else + FItemName := Reader.ReadWideString; + end; +end; + +procedure TSpTBXTabSheet.WriteItemName(Writer: TWriter); +begin + if Assigned(Item) then + FItemName := Item.Name; + Writer.WriteWideString(FItemName); +end; + +procedure TSpTBXTabSheet.ReadState(Reader: TReader); +var + C: TComponent; + TC: TSpTBXCustomTabControl; +begin + // The TabSheet is being created from the DFM stream + // We must set the initial values of TabControl, Item and add itself to + // the Pages list of the parent TabControl. + + inherited ReadState(Reader); + if Reader.Parent is TSpTBXCustomTabControl then begin + // Set TabControl + TC := TSpTBXCustomTabControl(Reader.Parent); + TabControl := TC; + // Set Item and add Self to TabControl.Pages + if not Assigned(FItem) and (FItemName <> '') then begin + C := Owner.FindComponent(FItemName); + if Assigned(C) and (C is TSpTBXTabItem) then begin + FItem := C as TSpTBXTabItem; + FItem.Control := Self; + if TC.FPages.IndexOf(Self) = -1 then + TC.FPages.Add(Self); + end; + end; + end; +end; + +procedure TSpTBXTabSheet.WMEraseBkgnd(var Message: TWMEraseBkgnd); +var + R: TRect; +begin + if Assigned(FTabControl) and Visible then begin + if not DoubleBuffered or (TMessage(Message).wParam = TMessage(Message).lParam) then begin + R := ClientRect; + if FTabControl.TabVisible then begin + case FTabControl.TabPosition of + ttpTop: dec(R.Top, 4); + ttpBottom: inc(R.Bottom, 4); + end; + end; + FTabControl.DrawBackground(Message.DC, R); + end; + end; + Message.Result := 1; +end; + +procedure TSpTBXTabSheet.WMWindowPosChanged(var Message: TWMWindowPosChanged); +begin + inherited; + SpInvalidateSpTBXControl(Self, True, True); +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomTabSet } + +constructor TSpTBXCustomTabSet.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle + [csAcceptsControls, csOpaque]; + + FTabVisible := True; + FBackground := TBitmap.Create; + + Width := 289; + Height := FDock.Height + 2; + ParentColor := False; + Color := clBtnFace; + + FToolbar.Items.RegisterNotification(ItemNotification); +end; + +destructor TSpTBXCustomTabSet.Destroy; +begin + FToolbar.Items.UnRegisterNotification(ItemNotification); + FreeAndNil(FBackground); + inherited; +end; + +procedure TSpTBXCustomTabSet.DefineProperties(Filer: TFiler); +begin + inherited; + Filer.DefineProperty('HiddenItems', ReadHiddenItems, WriteHiddenItems, True); +end; + +procedure TSpTBXCustomTabSet.ReadHiddenItems(Reader: TReader); +begin + if Reader.ReadValue = vaCollection then + Reader.ReadCollection(Toolbar.FHiddenTabs); +end; + +procedure TSpTBXCustomTabSet.WriteHiddenItems(Writer: TWriter); +begin + Writer.WriteCollection(Toolbar.FHiddenTabs); +end; + +procedure TSpTBXCustomTabSet.Loaded; +var + I: Integer; + CacheCollection: TSpTBXItemCacheCollection; + Cache: TSpTBXItemCache; + C: TComponent; +begin + ActiveTabIndex := FLoadingActiveIndex; + + inherited; + // Read the HiddenTabs collection, and fill the Item property of the + // collection items reading the Name from the DFM + CacheCollection := Toolbar.FHiddenTabs; + if Assigned(CacheCollection) then + for I := CacheCollection.Count - 1 downto 0 do begin + Cache := CacheCollection[I]; + if not Assigned(Cache.Item) then begin + if Cache.Name = '' then + CacheCollection.Delete(I) + else begin + C := Owner.FindComponent(Cache.Name); + if Assigned(C) and (C is TTBCustomItem) then begin + Cache.Item := C as TTBCustomItem; + // If the Item is visible then the entry is not valid, delete it + if Cache.Item.Visible then + CacheCollection.Delete(I); + end; + end; + end; + end; + + if TabAutofit then + Toolbar.Autofit; +end; + +function TSpTBXCustomTabSet.GetToolbarClass: TSpTBXToolbarClass; +begin + Result := TSpTBXTabToolbar; +end; + +function TSpTBXCustomTabSet.GetFullRepaint: Boolean; +begin + Result := True; +end; + +function TSpTBXCustomTabSet.Add(ACaption: WideString): TSpTBXTabItem; +var + I: Integer; + SpacerIV: TSpTBXItemViewer; +begin + Result := TSpTBXTabItem.Create(Self); + try + Result.Caption := ACaption; + SpacerIV := SpGetFirstRightAlignSpacer(View); + + if Assigned(SpacerIV) then begin + I := Items.IndexOf(SpacerIV.Item); + if I > -1 then + Items.Insert(I, Result); + end + else + Items.Add(Result); + except + Result.Free; + Result := nil; + end; +end; + +function TSpTBXCustomTabSet.Insert(NewIndex: Integer; ACaption: WideString): TSpTBXTabItem; +begin + Result := TSpTBXTabItem.Create(Self); + try + Result.Caption := ACaption; + Items.Insert(NewIndex, Result); + except + Result.Free; + Result := nil; + end; +end; + +procedure TSpTBXCustomTabSet.TabClick(ATab: TSpTBXTabItem); +begin + ATab.Click; // calls TabToolbar.DoTabClick and Self.DoTabClick +end; + +function TSpTBXCustomTabSet.CanActiveTabChange(const TabIndex, NewTabIndex: Integer): Boolean; +begin + Result := True; + if not (csLoading in ComponentState) then + if (NewTabIndex > -1) and not Items[NewTabIndex].Checked then + if Assigned(FOnActiveTabChanging) then FOnActiveTabChanging(Self, TabIndex, NewTabIndex, Result); +end; + +procedure TSpTBXCustomTabSet.DoActiveTabChange(const TabIndex: Integer); +begin + if not (csLoading in ComponentState) then + if Assigned(FOnActiveTabChange) then FOnActiveTabChange(Self, TabIndex); +end; + +function TSpTBXCustomTabSet.CanActiveTabReorder(const TabIndex, NewTabIndex: Integer): Boolean; +begin + Result := True; + if Assigned(FOnActiveTabReordering) then FOnActiveTabReordering(Self, TabIndex, NewTabIndex, Result); +end; + +procedure TSpTBXCustomTabSet.DoActiveTabReorder(const TabIndex: Integer); +begin + if Assigned(FOnActiveTabReorder) then FOnActiveTabReorder(Self, TabIndex); +end; + +procedure TSpTBXCustomTabSet.MakeVisible(ATab: TSpTBXTabItem); +begin + if Assigned(FToolbar) then Toolbar.MakeVisible(ATab); +end; + +procedure TSpTBXCustomTabSet.ScrollLeft; +begin + if Assigned(FToolbar) then Toolbar.ScrollLeft; +end; + +procedure TSpTBXCustomTabSet.ScrollRight; +begin + if Assigned(FToolbar) then Toolbar.ScrollRight; +end; + +procedure TSpTBXCustomTabSet.ScrollState(out Left, Right: Boolean); +begin + if Assigned(FToolbar) then Toolbar.ScrollState(Left, Right); +end; + +function TSpTBXCustomTabSet.GetActiveTabIndex: Integer; +begin + if Assigned(FToolbar) then + Result := Toolbar.ActiveTabIndex + else + Result := -1; +end; + +procedure TSpTBXCustomTabSet.SetActiveTabIndex(Value: Integer); +begin + // When the component is reading from the DFM the Items are not created. + // We must save the value setted at design time and use it when the + // form is finally loaded. + if csReading in ComponentState then + FLoadingActiveIndex := Value + else + if Assigned(FToolbar) then + Toolbar.ActiveTabIndex := Value; +end; + +function TSpTBXCustomTabSet.GetTabCloseButton: TSpTBXTabCloseButton; +begin + if Assigned(FToolbar) then + Result := Toolbar.TabCloseButton + else + Result := tcbNone; +end; + +procedure TSpTBXCustomTabSet.SetTabCloseButton(const Value: TSpTBXTabCloseButton); +begin + if Assigned(FToolbar) then + Toolbar.TabCloseButton := Value; +end; + +function TSpTBXCustomTabSet.GetTabCloseButtonImageIndex: Integer; +begin + if Assigned(FToolbar) then + Result := Toolbar.TabCloseButtonImageIndex + else + Result := -1; +end; + +procedure TSpTBXCustomTabSet.SetTabCloseButtonImageIndex(const Value: Integer); +begin + if Assigned(FToolbar) then + Toolbar.TabCloseButtonImageIndex := Value; +end; + +function TSpTBXCustomTabSet.GetTabAutofit: Boolean; +begin + if Assigned(FToolbar) then + Result := Toolbar.TabAutofit + else + Result := False; +end; + +procedure TSpTBXCustomTabSet.SetTabAutofit(const Value: Boolean); +begin + if Assigned(FToolbar) then + Toolbar.TabAutofit := Value; +end; + +function TSpTBXCustomTabSet.GetTabAutofitMaxSize: Integer; +begin + if Assigned(FToolbar) then + Result := Toolbar.TabAutofitMaxSize + else + Result := -1; +end; + +procedure TSpTBXCustomTabSet.SetTabAutofitMaxSize(const Value: Integer); +begin + if Assigned(FToolbar) then + Toolbar.TabAutofitMaxSize := Value; +end; + +function TSpTBXCustomTabSet.GetTabBackgroundBorders: Boolean; +begin + if Assigned(FToolbar) then + Result := Toolbar.TabBackgroundBorders + else + Result := True; +end; + +procedure TSpTBXCustomTabSet.SetTabBackgroundBorders(const Value: Boolean); +begin + if Assigned(FToolbar) then Toolbar.TabBackgroundBorders := Value +end; + +function TSpTBXCustomTabSet.GetTabBackgroundColor: TColor; +begin + if Assigned(FToolbar) then + Result := FToolbar.Color + else + Result := clNone; +end; + +procedure TSpTBXCustomTabSet.SetTabBackgroundColor(const Value: TColor); +begin + if Assigned(FToolbar) then FToolbar.Color := Value +end; + +function TSpTBXCustomTabSet.GetTabDragReorder: Boolean; +begin + Result := False; + if Assigned(FToolbar) then + Result := Toolbar.TabDragReorder; +end; + +procedure TSpTBXCustomTabSet.SetTabDragReorder(const Value: Boolean); +begin + if Assigned(FToolbar) then + Toolbar.TabDragReorder := Value; +end; + +function TSpTBXCustomTabSet.GetTabMaxSize: Integer; +begin + Result := -1; + if Assigned(FToolbar) then + Result := Toolbar.TabMaxSize; +end; + +procedure TSpTBXCustomTabSet.SetTabMaxSize(const Value: Integer); +begin + if Assigned(FToolbar) then + Toolbar.TabMaxSize := Value; +end; + +function TSpTBXCustomTabSet.GetTabToolbar: TSpTBXTabToolbar; +begin + Result := FToolbar as TSpTBXTabToolbar; +end; + +function TSpTBXCustomTabSet.GetSkinType: TSpTBXSkinType; +begin + if Assigned(FToolbar) then + Result := Toolbar.SkinType + else + Result := sknNone; +end; + +procedure TSpTBXCustomTabSet.SetSkinType(const Value: TSpTBXSkinType); +begin + if Assigned(FToolbar) then begin + Toolbar.SkinType := Value; + InvalidateBackground; + end; +end; + +function TSpTBXCustomTabSet.GetTabPosition: TSpTBXTabPosition; +begin + if Assigned(FToolbar) then + Result := Toolbar.TabPosition + else + Result := ttpTop; +end; + +procedure TSpTBXCustomTabSet.SetTabPosition(const Value: TSpTBXTabPosition); +var + T: TSpTBXTabToolbar; +begin + if Assigned(FToolbar) and Assigned(FDock) then begin + T := Toolbar; + if T.TabPosition <> Value then begin + T.Visible := False; + T.Parent := nil; + T.TabPosition := Value; + case Value of + ttpTop: FDock.Position := dpTop; + ttpBottom: FDock.Position := dpBottom; + end; + T.CurrentDock := FDock; + T.Visible := True; + + InvalidateBackground; + end; + end; +end; + +procedure TSpTBXCustomTabSet.SetTabVisible(const Value: Boolean); +begin + if FTabVisible <> Value then begin + FTabVisible := Value; + if Assigned(FDock) then + FDock.Visible := Value; + end; +end; + +function TSpTBXCustomTabSet.GetTabSetHeight: Integer; +begin + if Assigned(FDock) then + Result := FDock.Height + else + Result := 0; +end; + +procedure TSpTBXCustomTabSet.DoDrawBackground(ACanvas: TCanvas; + ARect: TRect; const PaintStage: TSpTBXPaintStage; + var PaintDefault: Boolean); +begin + if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACanvas, ARect, PaintStage, PaintDefault); +end; + +function TSpTBXCustomTabSet.DrawBackground(DC: HDC; ARect: TRect): Boolean; +var + ACanvas: TCanvas; + PaintDefault: Boolean; + R: TRect; +begin + Result := False; + if (csDestroying in ComponentState) or not Assigned(FDock) or + not Assigned(FBackground) or IsRectEmpty(ARect) then Exit; + + ACanvas := TCanvas.Create; + try + ACanvas.Handle := DC; + R := Rect(0, 0, ARect.Right - ARect.Left, ARect.Bottom - ARect.Top); + + if (FBackground.Width = R.Right) and (FBackground.Height = R.Bottom) and not Assigned(FOnDrawBackground) then + ACanvas.Draw(ARect.Left, ARect.Top, FBackground) + else begin + FBackground.Width := R.Right; + FBackground.Height := R.Bottom; + FBackground.Canvas.Brush.Color := clWhite; + FBackground.Canvas.FillRect(R); + + PaintDefault := True; + DoDrawBackground(FBackground.Canvas, R, pstPrePaint, PaintDefault); + if PaintDefault then + SpDrawXPTabControlBackground(FBackground.Canvas, R, Color, TabPosition = ttpBottom, SkinType); + PaintDefault := True; + DoDrawBackground(FBackground.Canvas, R, pstPostPaint, PaintDefault); + + ACanvas.Draw(ARect.Left, ARect.Top, FBackground); + end; + + Result := True; + finally + ACanvas.Handle := 0; + ACanvas.Free; + end; +end; + +procedure TSpTBXCustomTabSet.InvalidateBackground(InvalidateChildren: Boolean); +begin + // Force background repaint + if not (csDestroying in ComponentState) and Assigned(FToolbar) then begin + if Assigned(FBackground) then + FBackground.Width := 1; + SpInvalidateSpTBXControl(Self, InvalidateChildren, FResizing); + end; +end; + +procedure TSpTBXCustomTabSet.ItemNotification(Ancestor: TTBCustomItem; + Relayed: Boolean; Action: TTBItemChangedAction; Index: Integer; + Item: TTBCustomItem); +var + I: Integer; + Tab: TSpTBXTabItem; +begin + inherited; + + if Assigned(FToolbar) and not Relayed and not FToolbar.IsItemMoving then + case Action of + tbicSubitemsBeginUpdate: + begin + // When a Tab item is moved (TTBCustomItem.Move) + // tbicDeleting and tbicInserted change actions are fired + // but we don't want the associated TabSheet to be recreated + // because the children will be destroyed. + // When a TTBCustomItem is moved it is not recreated, it simply + // deletes and reinserts its reference in the items array. + // We need to find out if the item is being moved and stop the + // TabSheet recreation. + // The action sequence for a move operation is the following: + // tbicSubitemsBeginUpdate (FItemMoveCount = 1) + // tbicDeleting (FItemMoveCount = 2) + // tbicSubitemsBeginUpdate (FItemMoveCount = 1) + // tbicInserted (FItemMoveCount = 0) + // tbicSubitemsEndUpdate (FItemMoveCount = 0) + // tbicSubitemsEndUpdate (FItemMoveCount = 0) + FItemMoveCount := 1; + FItemMoved := nil; + end; + tbicSubitemsEndUpdate: + begin + // Destroy the TabSheet if the sequence was: + // tbicSubitemsBeginUpdate - tbicDeleting - tbicSubitemsEndUpdate + if FItemMoveCount = 2 then + TabDeleting(FItemMoved); + FItemMoveCount := 0; + FItemMoved := nil; + end; + tbicInserted: + if Assigned(Item) then begin + // Update the index if a new item is inserted before the ActiveTabIndex + I := Items.IndexOf(Item); + if (I > -1) and (I <= ActiveTabIndex) then begin + FUpdatingIndex := True; + try + // Don't change the ActiveTabIndex, just set the internal value + // because the page didn't change + Toolbar.FActiveTabIndex := Toolbar.FActiveTabIndex + 1; + finally + FUpdatingIndex := False; + end; + end; + if (Item is TSpTBXTabItem) then + TabInserted(Item as TSpTBXTabItem); + InvalidateBackground; + FItemMoveCount := 0; + FItemMoved := nil; + end; + tbicDeleting: + // The ItemViewer of the Item is not valid, it was destroyed by TTBView + // The Items array still has the Item. + if not (csDestroying in ComponentState) and Assigned(Item) then begin + FUpdatingIndex := True; + try + Tab := nil; + I := Items.IndexOf(Item); + if I > -1 then begin + if I < ActiveTabIndex then + // Don't change the ActiveTabIndex, just set the internal value + // because the page didn't change + Toolbar.FActiveTabIndex := Toolbar.FActiveTabIndex - 1 + else + if I = ActiveTabIndex then + if I = 0 then begin + if (Items.Count > 1) and (Items[1] is TSpTBXTabItem) then begin + // The first tab was deleted, change the internal value of + // Update the checked tab on WM_INVALIDATETABBACKGROUND + Tab := Items[1] as TSpTBXTabItem; + Tab.Click; + end + else + Toolbar.FActiveTabIndex := -1; + end + else begin + Dec(I); // Prev tab + if (I > -1) and (I < Items.Count) and (Items[I] is TSpTBXTabItem) then + SetActiveTabIndex(I) + else + Toolbar.FActiveTabIndex := -1; + end; + end; + + if (Item is TSpTBXTabItem) then + if FItemMoveCount = 1 then begin + FItemMoveCount := 2; + FItemMoved := Item as TSpTBXTabItem; + end + else begin + FItemMoveCount := 0; + TabDeleting(Item as TSpTBXTabItem); + end; + + if (csDesigning in ComponentState) or Assigned(Tab) then + PostMessage(Handle, WM_INVALIDATETABBACKGROUND, 0, 0) + else + InvalidateBackground; + finally + FUpdatingIndex := False; + end; + end; + tbicInvalidate: + // When the Item.Checked property changes we must reset the ActiveTabIndex + if not FUpdatingIndex and Assigned(Item) and (Item is TSpTBXTabItem) and + Item.Checked and Item.Enabled then + begin + I := Items.IndexOf(Item); + if I <> ActiveTabIndex then begin + FUpdatingIndex := True; + try + SetActiveTabIndex(I); + finally + FUpdatingIndex := False; + end; + end; + end; + end; +end; + +procedure TSpTBXCustomTabSet.TabDeleting(Item: TSpTBXTabItem; + FreeTabSheet: Boolean); +begin + if not (csDestroying in ComponentState) then + ScrollLeft; +end; + +procedure TSpTBXCustomTabSet.TabInserted(Item: TSpTBXTabItem); +var + I: Integer; + IV: TTBItemViewer; +begin + if not (csLoading in ComponentState) and Assigned(Item) and (Item is TSpTBXTabItem) then + if Items.Count = 1 then + Item.Click // Select the first Tab + else begin + // If the item is inserted after a hidden tab, we should also hide it + I := Items.IndexOf(Item) - 1; + if I > -1 then + if Toolbar.FHiddenTabs.IndexOf(Items[I]) > -1 then begin + IV := View.Find(Item); + if Assigned(IV) then begin + Toolbar.BeginUpdateHidden; + try + Toolbar.FHiddenTabs.Add(Item); + Item.Visible := False; + finally + Toolbar.EndUpdateHidden; + end; + end; + end; + end; +end; + +procedure TSpTBXCustomTabSet.CMColorchanged(var Message: TMessage); +begin + inherited; + if Assigned(FToolbar) then begin + Toolbar.TabColor := Color; + InvalidateBackground; + end; +end; + +procedure TSpTBXCustomTabSet.CMSpTBXControlsInvalidate(var Message: TMessage); +begin + InvalidateBackground; + Message.Result := 1; +end; + +procedure TSpTBXCustomTabSet.WMEraseBkgnd(var Message: TMessage); +var + R: TRect; +begin + if not DoubleBuffered or (Message.wParam = Message.lParam) then begin + if not (csDestroying in ComponentState) and GetFullRepaint then begin + R := ClientRect; + if FTabVisible then begin + case TabPosition of + ttpTop: Inc(R.Top, GetTabSetHeight - 2); + ttpBottom: Dec(R.Bottom, GetTabSetHeight - 2); + end; + end; + DrawBackground(TWMEraseBkgnd(Message).DC, R); + end; + end; + Message.Result := 1; +end; + +procedure TSpTBXCustomTabSet.WMInvalidateTabBackground(var Message: TMessage); +var + Tab: TSpTBXTabItem; + I: Integer; +begin + if Assigned(FToolbar) then begin + Tab := Toolbar.ActiveTab; + if Assigned(Tab) then begin + I := Items.IndexOf(Tab); + FUpdatingIndex := True; + try + Toolbar.FActiveTabIndex := -1; + SetActiveTabIndex(I); + finally + FUpdatingIndex := False; + end; + end; + if HandleAllocated then + RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN); + end; +end; + +procedure TSpTBXCustomTabSet.WMWindowPosChanged(var Message: TWMWindowPosChanged); +begin + FResizing := True; + inherited; + if GetFullRepaint then + InvalidateBackground; + FResizing := False; +end; + +//WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM +{ TSpTBXCustomTabControl } + +constructor TSpTBXCustomTabControl.Create(AOwner: TComponent); +begin + inherited; +// ControlStyle := ControlStyle - [csAcceptsControls]; + FPages := TList.Create; + + // FEmptyTabSheet is used to hide the rest of the TabSheets + // when ActiveTabIndex = -1 at design time. + FEmptyTabSheet := TSpTBXTabSheet.Create(Self); + FEmptyTabSheet.Parent := Self; + FEmptyTabSheet.TabControl := Self; + FEmptyTabSheet.Item := nil; + FEmptyTabSheet.Visible := True; + FEmptyTabSheet.BringToFront; + FEmptyTabSheet.ControlStyle := FEmptyTabSheet.ControlStyle - [csAcceptsControls]; + + Width := 289; + Height := 193; +end; + +destructor TSpTBXCustomTabControl.Destroy; +begin + FPages.Free; + inherited; +end; + +procedure TSpTBXCustomTabControl.DoActiveTabChange(const ItemIndex: Integer); +begin + if ItemIndex = -1 then begin + FEmptyTabSheet.Visible := True; + FEmptyTabSheet.BringToFront; + end + else + FEmptyTabSheet.Visible := False; + inherited; +end; + +procedure TSpTBXCustomTabControl.RealignTabSheets; +var + I, C: Integer; +begin + if HandleAllocated then begin + C := PagesCount; + for I := 0 to C - 1 do + Pages[I].Realign; + end; +end; + +function TSpTBXCustomTabControl.GetFullRepaint: Boolean; +begin + if not (csDestroying in ComponentState) then + Result := not Assigned(FPages) or (FPages.Count = 0) or not Assigned(FToolbar) or + not Assigned(Toolbar.ActiveTab) or not Toolbar.ActiveTab.Checked + else + Result := False; +end; + +function TSpTBXCustomTabControl.GetPage(Item: TSpTBXTabItem): TSpTBXTabSheet; +var + I: Integer; +begin + Result := nil; + I := Items.IndexOf(Item); + if (I > - 1) and Assigned(Item.Control) and (Item.Control is TSpTBXTabSheet) then + Result := Item.Control as TSpTBXTabSheet; +end; + +function TSpTBXCustomTabControl.GetActivePage: TSpTBXTabSheet; +begin + if ActiveTabIndex > -1 then + Result := GetPage(Items[ActiveTabIndex] as TSpTBXTabItem) + else + Result := nil; +end; + +procedure TSpTBXCustomTabControl.SetActivePage(const Value: TSpTBXTabSheet); +var + I: Integer; +begin + if Assigned(Value) and (FPages.IndexOf(Value) > -1) and Assigned(FToolbar) then begin + I := FToolbar.Items.IndexOf(Value.Item); + if I > -1 then ActiveTabIndex := I; + end; +end; + +function TSpTBXCustomTabControl.GetPages(Index: Integer): TSpTBXTabSheet; +begin + Result := TSpTBXTabSheet(FPages[Index]); +end; + +function TSpTBXCustomTabControl.GetPagesCount: Integer; +begin + Result := FPages.Count; +end; + +procedure TSpTBXCustomTabControl.TabInserted(Item: TSpTBXTabItem); +var + T: TSpTBXTabSheet; + I: Integer; +begin + // Create a TabSheet and Link it to the TabItem, only if the Item is created + // at DesignTime. + // If the Item is created from the DFM stream then the TabSheet will be + // automatically created, because it will also be streamed, but it won't be + // linked to the Item, this is done in TabSheet.ReadState + + if (csLoading in ComponentState) or not Assigned(Item) then Exit; + + for I := 0 to FPages.Count - 1 do begin + T := TSpTBXTabSheet(FPages[I]); + if T.Item = Item then begin + Exit; + raise Exception.Create('TabSheet Already Exists'); + end; + end; + + // Find unique name + I := 1; + while Owner.FindComponent('SpTBXTabSheet' + IntToStr(I)) <> nil do + inc(I); + + // The Form will be the owner, it will stream the tabsheet to the DFM + T := TSpTBXTabSheet.Create(Owner); + T.Name := 'SpTBXTabSheet' + IntToStr(I); + T.Parent := Self; + T.TabControl := Self; + T.Item := Item; + Item.Control := T; + T.SendToBack; + FPages.Add(T); + + inherited; +end; + +procedure TSpTBXCustomTabControl.TabDeleting(Item: TSpTBXTabItem; + FreeTabSheet: Boolean); +var + I: Integer; + T: TSpTBXTabSheet; +begin + inherited; + // The Toolbar will free the Items, and the Form will free the TabSheets + if (csDestroying in ComponentState) or not Assigned(Item) then Exit; + + for I := 0 to FPages.Count - 1 do begin + T := TSpTBXTabSheet(FPages[I]); + if Assigned(T) and Assigned(T.Item) and (T.Item = Item) then begin + FPages[I] := nil; + FPages.Delete(I); + if FreeTabSheet then begin + T.Item := nil; + T.Free; + end + else begin + // TabSheet deleted at design time, free the linked Item + T.Item.Free; + T.Item := nil; + end; + Break; + end; + end; +end; + +procedure TSpTBXCustomTabControl.CMSpTBXControlsInvalidate(var Message: TMessage); +var + I, C: Integer; +begin + // Force TabControl and TabSheets background repaint + inherited; + if not (csDestroying in ComponentState) and Assigned(FToolbar) then begin + C := PagesCount; + for I := 0 to C - 1 do + SpInvalidateSpTBXControl(Pages[I], True, True); + end; + Message.Result := 1; +end; + +procedure TSpTBXCustomTabControl.WMSpSkinChange(var Message: TMessage); +begin + inherited; + RealignTabSheets; +end; + +end. diff --git a/official/2.2.2+2.4.2/SpTBXLib/SpTBXLib-LICENSE.txt b/official/2.2.2+2.4.2/SpTBXLib/SpTBXLib-LICENSE.txt new file mode 100644 index 0000000..bfea00e --- /dev/null +++ b/official/2.2.2+2.4.2/SpTBXLib/SpTBXLib-LICENSE.txt @@ -0,0 +1,57 @@ +SpTBXLib License v1.0 +===================== + +"Author" herein refers to Robert Lee. +"Software" refers to all files bearing this notice, as well as any other +files and source code included with SpTBXLib and all content in them, +regardless of whether any modifications have been made. + +Except where otherwise noted, all of the documentation and Software included +in the SpTBXLib package is copyrighted by Robert Lee (the Author). + +Copyright (C) 2004-2008 Robert Lee. All rights reserved. + +This notice is only applicable to SpTBXLib package. + +Use and distribution of the software is permitted provided that all of the +following terms are accepted: + +1. Registration (payment) of the Software is required, such payment is made + to the Author of the Software. For information on registering see the + Registration.txt file or this web page: + http://www.silverpointdevelopment.com/sptbxlib/registration.htm + +2. The Software is provided "as-is," without any express or implied + warranty. In no event shall the Author be held liable for any damages + arising from the use of the Software. + +3. All redistributions of the Software's files must be in their original, + unmodified form. Distributions of modified versions of the files is not + permitted without express written permission of the Author. + +4. The origin of this Software must not be misrepresented; you must not + claim your authorship. + +5. None of the Software's files may be redistributed for profit or as part + of another software package without express written permission of the + Author. + +6. You are permitted to Compile the Software into any kind of applications. + ("Compile" here refers to the automatic process of translating the + Software's source code into executable machine code by a compiler such + as the one included with Borland's Delphi or C++Builder.) + +7. Redistribution of any of the Software's files in object form (including + but not limited to .DCU and .OBJ formats) is strictly prohibited without + express written permission of the Author. + +8. Full backward compatibility in future versions of the Software is not + guaranteed. In no event shall the Author be held liable for any + inconvenience or damages arising from lack of backward compatibility. + +If you do not agree to all of the above terms, you are not permitted to +use the Software in any way, and all copies of it must be deleted from your +system(s). + +Robert Lee +http://www.silverpointdevelopment.com \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/.cvsignore b/official/2.2.2+2.4.2/TB2K/DemoProj/.cvsignore new file mode 100644 index 0000000..9783b61 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/.cvsignore @@ -0,0 +1,5 @@ +*.dcu +*.exe +*.hpp +*.obj +*.tds diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.cfg b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.cfg new file mode 100644 index 0000000..6b67b6f --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.cfg @@ -0,0 +1,33 @@ +-$A+ +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J+ +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$Y- +-$Z1 +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W+ +-M +-$M16384,1048576 +-K$00400000 diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.dof b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.dof new file mode 100644 index 0000000..d8a22f2 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.dof @@ -0,0 +1,29 @@ +[Compiler] +A=1 +B=0 +C=1 +D=1 +E=0 +F=0 +G=1 +H=1 +I=1 +J=1 +K=0 +L=1 +M=0 +N=1 +O=1 +P=1 +Q=0 +R=0 +S=0 +T=0 +U=0 +V=1 +W=0 +X=1 +Y=0 +Z=1 +ShowHints=1 +ShowWarnings=1 diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.dpr b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.dpr new file mode 100644 index 0000000..1697c6c --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.dpr @@ -0,0 +1,22 @@ +program Demo; + +uses + Forms, + Demo1 in 'Demo1.pas' {Form1}; + +{$R *.RES} + +{$IFDEF CLR} +[STAThread] // All VCL.NET projects that use Toolbar2000 must include this +{$ENDIF} +begin + Application.Initialize; + {$IFDEF CONDITIONALEXPRESSIONS} + {$IF CompilerVersion >= 18.5} + Application.MainFormOnTaskbar := True; + {$IFEND} + {$ENDIF} + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.res b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.res new file mode 100644 index 0000000..a8371ab Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo.res differ diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/Demo1.dfm b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo1.dfm new file mode 100644 index 0000000..2ebc239 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo1.dfm differ diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/Demo1.pas b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo1.pas new file mode 100644 index 0000000..77c64b9 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/Demo1.pas @@ -0,0 +1,254 @@ +unit Demo1; + +{ + Toolbar2000 demo project + + $jrsoftware: tb2k/DemoProj/Demo1.pas,v 1.9 2006/03/12 23:11:58 jr Exp $ +} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, ExtCtrls, Menus, ActnList, ImgList, ComCtrls, + TB2Item, TB2ExtItems, TB2Dock, TB2Toolbar, TB2MRU; + +type + TForm1 = class(TForm) + ActionList: TActionList; + actNew: TAction; + actOpen: TAction; + actSave: TAction; + actSaveAs: TAction; + actPageSetup: TAction; + actPrint: TAction; + actExit: TAction; + actUndo: TAction; + actCut: TAction; + actCopy: TAction; + actPaste: TAction; + actDelete: TAction; + actSelectAll: TAction; + actTimeDate: TAction; + actWordWrap: TAction; + actSetFont: TAction; + actFind: TAction; + actFindNext: TAction; + actReplace: TAction; + actHelpTopics: TAction; + actAbout: TAction; + actTestButton: TAction; + actTestEdit: TTBEditAction; + DockTop: TTBDock; + MenuToolbar: TTBToolbar; + ImageList: TTBImageList; + FMenu: TTBSubmenuItem; + FNew: TTBItem; + FOpen: TTBItem; + FSave: TTBItem; + FSaveAs: TTBItem; + FPageSetup: TTBItem; + FPrint: TTBItem; + FExit: TTBItem; + EMenu: TTBSubmenuItem; + EUndo: TTBItem; + ECut: TTBItem; + ECopy: TTBItem; + EPaste: TTBItem; + EDelete: TTBItem; + ESelectAll: TTBItem; + ETimeDate: TTBItem; + EWordWrap: TTBItem; + ESetFont: TTBItem; + SMenu: TTBSubmenuItem; + SFind: TTBItem; + SFindNext: TTBItem; + SReplace: TTBItem; + HMenu: TTBSubmenuItem; + HHelpTopics: TTBItem; + HAbout: TTBItem; + FMRU: TTBMRUListItem; + NBSeparatorItem3: TTBSeparatorItem; + NBSeparatorItem4: TTBSeparatorItem; + TestEdit: TTBEditItem; + MainToolbar: TTBToolbar; + NewButton: TTBItem; + OpenButton: TTBItem; + SaveButton: TTBItem; + DockBottom: TTBDock; + DockLeft: TTBDock; + DockRight: TTBDock; + BottomToolbar: TTBToolbar; + PopupMenuBarButton: TTBItem; + PopupToolbarButton: TTBItem; + Memo1: TMemo; + ContextPopupMenu: TTBPopupMenu; + StatusBar: TStatusBar; + ToolbarPopupMenu: TTBPopupMenu; + MRUList: TTBMRUList; + PrintButton: TTBItem; + CutButton: TTBItem; + CopyButton: TTBItem; + PasteButton: TTBItem; + UndoButton: TTBSubmenuItem; + actPrintPreview: TAction; + TBItem1: TTBItem; + FormatToolbar: TTBToolbar; + BoldItem: TTBItem; + ItalicItem: TTBItem; + UnderlineItem: TTBItem; + TBSeparatorItem1: TTBSeparatorItem; + AlignLeftItem: TTBItem; + CenterItem: TTBItem; + AlignRightItem: TTBItem; + TBSeparatorItem2: TTBSeparatorItem; + BulletsItem: TTBItem; + NBItem34: TTBItem; + NBSeparatorItem6: TTBSeparatorItem; + NBItem35: TTBItem; + NBItem36: TTBItem; + NBItem37: TTBItem; + NBItem38: TTBItem; + NBSeparatorItem7: TTBSeparatorItem; + NBItem39: TTBItem; + ComboBox1: TComboBox; + TBControlItem1: TTBControlItem; + TBSeparatorItem3: TTBSeparatorItem; + TBControlItem2: TTBControlItem; + ComboBox2: TComboBox; + actBold: TAction; + actItalic: TAction; + actUnderline: TAction; + actAlignLeft: TAction; + actCenter: TAction; + actAlignRight: TAction; + TBSeparatorItem4: TTBSeparatorItem; + actRedo: TAction; + RedoButton: TTBSubmenuItem; + TBItem2: TTBItem; + TBItem3: TTBItem; + TBItem4: TTBItem; + ERedo: TTBItem; + VMenu: TTBSubmenuItem; + VToolbars: TTBSubmenuItem; + VTStandard: TTBVisibilityToggleItem; + VTFormatting: TTBVisibilityToggleItem; + VTBottom: TTBVisibilityToggleItem; + VStatusBar: TTBItem; + actBullets: TAction; + procedure FormCreate(Sender: TObject); + procedure ItemClick(Sender: TObject); + procedure PopupMenuBarButtonClick(Sender: TObject); + procedure PopupToolbarButtonClick(Sender: TObject); + procedure MRUListClick(Sender: TObject; const Filename: String); + procedure AlignClick(Sender: TObject); + procedure BulletsItemClick(Sender: TObject); + procedure BoldItemClick(Sender: TObject); + procedure ItalicItemClick(Sender: TObject); + procedure UnderlineItemClick(Sender: TObject); + procedure VStatusBarClick(Sender: TObject); + procedure VMenuClick(Sender: TObject); + private + { Private declarations } + procedure OnHint(Sender: TObject); + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses + {$IFDEF CLR} Types, {$ENDIF} + CommCtrl, TB2Version; + +{$R *.DFM} + +procedure TForm1.FormCreate(Sender: TObject); +begin + Memo1.Text := 'Running on ' + Toolbar2000VersionPropText; + Application.OnHint := OnHint; +end; + +procedure TForm1.OnHint(Sender: TObject); +begin + StatusBar.Panels[0].Text := Application.Hint; +end; + +procedure TForm1.ItemClick(Sender: TObject); +begin + Application.MessageBox( {$IFNDEF CLR} PChar {$ENDIF} + ('You selected:'#13#10#13#10 + (Sender as TComponent).Name), + 'OnClick handler', MB_OK or MB_ICONINFORMATION); +end; + +procedure TForm1.MRUListClick(Sender: TObject; const Filename: String); +begin + Application.MessageBox( {$IFNDEF CLR} PChar {$ENDIF} + (Format('You selected "%s" from the MRU list.', [Filename])), + 'MRUListClick', MB_OK or MB_ICONINFORMATION); +end; + +procedure TForm1.VMenuClick(Sender: TObject); +begin + VStatusBar.Checked := StatusBar.Visible; +end; + +procedure TForm1.VStatusBarClick(Sender: TObject); +begin + { Force the StatusBar to always be at the bottom of the form. Without this + line of code, the status bar sometimes may appear above the bottom dock. + This is not a bug in Toolbar2000, but rather is due to the design of the + VCL's alignment system. } + StatusBar.Top := ClientHeight; + + { Toggle the status bar's visibility } + StatusBar.Visible := not StatusBar.Visible; +end; + +procedure TForm1.AlignClick(Sender: TObject); +begin + AlignLeftItem.Checked := (Sender = actAlignLeft); + CenterItem.Checked := (Sender = actCenter); + AlignRightItem.Checked := (Sender = actAlignRight); +end; + +procedure TForm1.BulletsItemClick(Sender: TObject); +begin + BulletsItem.Checked := not BulletsItem.Checked; +end; + +procedure TForm1.BoldItemClick(Sender: TObject); +begin + BoldItem.Checked := not BoldItem.Checked; +end; + +procedure TForm1.ItalicItemClick(Sender: TObject); +begin + ItalicItem.Checked := not ItalicItem.Checked; +end; + +procedure TForm1.UnderlineItemClick(Sender: TObject); +begin + UnderlineItem.Checked := not UnderlineItem.Checked; +end; + +procedure TForm1.PopupMenuBarButtonClick(Sender: TObject); +var + P: TPoint; +begin + P := Memo1.ClientToScreen(Point(8, 8)); + MenuToolbar.Items.Popup(P.X, P.Y, True); +end; + +procedure TForm1.PopupToolbarButtonClick(Sender: TObject); +var + P: TPoint; +begin + P := Memo1.ClientToScreen(Point(8, 8)); + MainToolbar.Items.Popup(P.X, P.Y, True); +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.bpr b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.bpr new file mode 100644 index 0000000..9800232 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.bpr @@ -0,0 +1,179 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.04.04 +# --------------------------------------------------------------------------- +PROJECT = DemoBCB.exe +OBJFILES = Demo1.obj DemoBCB.obj +RESFILES = DemoBCB.res +RESDEPEN = $(RESFILES) Demo1.dfm +LIBFILES = +LIBRARIES = vcl40.lib +SPARELIBS = vcl40.lib +PACKAGES = +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .; +PATHASM = .; +PATHPAS = .; +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = +SYSDEFINES = _RTLDLL;NO_STRICT +# --------------------------------------------------------------------------- +CFLAG1 = -I$(BCB)\include;$(BCB)\include\vcl -Od -Hc -H=$(BCB)\lib\vcl40.csm -w -Ve -r- \ + -a8 -k -y -v -vi- -c -b- -w-par -w-inl -Vx -tW -tWM \ + -D$(SYSDEFINES);$(USERDEFINES) +PFLAGS = -U$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ + -I$(BCB)\include;$(BCB)\include\vcl -$YD -$W -$O- -v -JPHNE -M +RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl +AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zd +LFLAGS = -L$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) -aa -Tpe -x \ + -Gn -v +# --------------------------------------------------------------------------- +ALLOBJ = c0w32.obj Memmgr.Lib sysinit.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +InMemoryExe=0 +ShowInfoMsgs=0 + +!endif + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< +# --------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.cpp b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.cpp new file mode 100644 index 0000000..b4ea3e5 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.cpp @@ -0,0 +1,22 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +USERES("DemoBCB.res"); +USEFORMNS("Demo1.pas", Demo1, Form1); +//--------------------------------------------------------------------------- +WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) +{ + try + { + Application->Initialize(); + Application->CreateForm(__classid(TForm1), &Form1); + Application->Run(); + } + catch (Exception &exception) + { + Application->ShowException(&exception); + } + return 0; +} +//--------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.res b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.res new file mode 100644 index 0000000..32b522d Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB.res differ diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.bpr b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.bpr new file mode 100644 index 0000000..28a1267 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.bpr @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.cpp b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.cpp new file mode 100644 index 0000000..c762f01 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.cpp @@ -0,0 +1,34 @@ +//--------------------------------------------------------------------------- + +#include +#pragma hdrstop +//--------------------------------------------------------------------------- +USEFORMNS("Demo1.pas", Demo1, Form1); +//--------------------------------------------------------------------------- +WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) +{ + try + { + Application->Initialize(); + Application->CreateForm(__classid(TForm1), &Form1); + Application->Run(); + } + catch (Exception &exception) + { + Application->ShowException(&exception); + } + catch (...) + { + try + { + throw Exception(""); + } + catch (Exception &exception) + { + Application->ShowException(&exception); + } + } + return 0; +} +//--------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.res b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.res new file mode 100644 index 0000000..e468bf9 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/DemoProj/DemoBCB6.res differ diff --git a/official/2.2.2+2.4.2/TB2K/GPL-LICENSE.txt b/official/2.2.2+2.4.2/TB2K/GPL-LICENSE.txt new file mode 100644 index 0000000..45645b4 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/GPL-LICENSE.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/official/2.2.2+2.4.2/TB2K/Glyphs.zip b/official/2.2.2+2.4.2/TB2K/Glyphs.zip new file mode 100644 index 0000000..6070442 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Glyphs.zip differ diff --git a/official/2.2.2+2.4.2/TB2K/LICENSE.txt b/official/2.2.2+2.4.2/TB2K/LICENSE.txt new file mode 100644 index 0000000..47c1846 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/LICENSE.txt @@ -0,0 +1,17 @@ +All files included in the Toolbar2000 archive are Copyright (C) 1998-2008 +Jordan Russell. + +Use and/or distribution of the files requires compliance with the +"Toolbar2000 License", found in TB2k-LICENSE.txt or at: + + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + +Alternatively, at your option, the files may be used and/or distributed under +the terms of the "GNU General Public License", found in GPL-LICENSE.txt or at: + + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + +NOTE: If you choose the GPL license option, your application as a whole must +also be licensed under the GPL. (Refer to section 2b of the GPL license.) +Therefore, you cannot choose the GPL license option if your application is +proprietary/closed-source. diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Acc.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Acc.dcu new file mode 100644 index 0000000..6ed78b5 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Acc.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Anim.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Anim.dcu new file mode 100644 index 0000000..3f45d75 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Anim.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Common.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Common.dcu new file mode 100644 index 0000000..3a492fb Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Common.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Consts.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Consts.dcu new file mode 100644 index 0000000..06ebf4f Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Consts.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Dock.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Dock.dcu new file mode 100644 index 0000000..4b62ab0 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Dock.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnConvertOptions.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnConvertOptions.dcu new file mode 100644 index 0000000..c9f9a16 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnConvertOptions.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnConverter.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnConverter.dcu new file mode 100644 index 0000000..b464c8f Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnConverter.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnItemEditor.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnItemEditor.dcu new file mode 100644 index 0000000..adf0e78 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2DsgnItemEditor.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2ExtItems.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2ExtItems.dcu new file mode 100644 index 0000000..62c4610 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2ExtItems.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Hook.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Hook.dcu new file mode 100644 index 0000000..0696d5b Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Hook.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Item.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Item.dcu new file mode 100644 index 0000000..88ee3c7 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Item.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2MDI.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2MDI.dcu new file mode 100644 index 0000000..e211bd9 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2MDI.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2MRU.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2MRU.dcu new file mode 100644 index 0000000..420f815 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2MRU.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Reg.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Reg.dcu new file mode 100644 index 0000000..92f35ed Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Reg.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2ToolWindow.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2ToolWindow.dcu new file mode 100644 index 0000000..8c15b33 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2ToolWindow.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Toolbar.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Toolbar.dcu new file mode 100644 index 0000000..9dc08aa Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Toolbar.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Ver.inc b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Ver.inc new file mode 100644 index 0000000..f96696b --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Ver.inc @@ -0,0 +1,64 @@ +{ $jrsoftware: tb2k/Source/TB2Ver.inc,v 1.11 2008/09/13 21:06:45 jr Exp $ } + +{ Determine Delphi/C++Builder version } +{$IFNDEF VER90} { if it's not Delphi 2.0 } + {$IFNDEF VER93} { and it's not C++Builder 1.0 } + {$DEFINE JR_D3} { then it must be at least Delphi 3 or C++Builder 3 } + {$IFNDEF VER100} { if it's not Delphi 3.0 } + {$IFNDEF VER120} { Delphi 4/5's command line compiler doesn't like the ObjExportAll directive, so don't include it on Delphi 4/5 } + {$IFNDEF VER130} + {$ObjExportAll On} { <- needed for compatibility with run-time packages in C++Builder 3+ } + {$ENDIF} + {$ENDIF} + {$IFNDEF VER110} { and it's not C++Builder 3.0 } + {$DEFINE JR_D4} { then it must be at least Delphi 4 or C++Builder 4 } + {$IFNDEF VER120} {$IFNDEF VER125} { if it's not Delphi 4 or C++Builder 4 } + {$DEFINE JR_D5} { then it must be at least Delphi 5 or C++Builder 5 } + {$IFNDEF VER130} { if it's not Delphi 5 or C++Builder 5 } + {$DEFINE JR_D6} { then it must be at least Delphi 6 or C++Builder 6 } + {$IFNDEF VER140} { if it's not Delphi 6 or C++Builder 6 } + {$DEFINE JR_D7} { then it must be at least Delphi 7 } + {$IFNDEF VER150} { if it's not Delphi 7 } + {$DEFINE JR_D8} { then it must be at least Delphi 8 } + {$IFNDEF VER160} { if it's not Delphi 8 } + {$DEFINE JR_D9} { then it must be at least Delphi 9 (2005) } + {$IFNDEF VER170} { if it's not Delphi 9 (2005) } + {$DEFINE JR_D10} { then it must be at least Delphi 10 (2006) } + { Delphi 11 (2007) is an odd case: it defines VER180 and VER185 on Win32, and VER190 on .NET } + {$IFDEF VER185} { if it's Win32 Delphi 11 (2007) exactly } + {$DEFINE JR_D11} { then it must be at least Delphi 11 (2007) } + {$ENDIF} + {$IFNDEF VER180} { if it's neither Delphi 10 (2006) nor Win32 Delphi 11 (2007) } + {$DEFINE JR_D11} { then it must be at least Delphi 11 (2007) } + {$IFNDEF VER190} { if it's not .NET Delphi 11 (2007) } + {$DEFINE JR_D12} { then it must be at least Delphi 12 (2009) } + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +{$IFDEF JR_D6} + {$IF SizeOf(Char) > 1} + {$DEFINE JR_WIDESTR} { defined if String type = WideString } + {$IFEND} + {$IF not Defined(CLR) and (SizeOf(Pointer) <> 4)} + {$MESSAGE WARN 'This version of Toolbar2000 has not been tested on 64-bit Delphi for Win32'} + {$IFEND} +{$ENDIF} + +{$ALIGN ON} +{$BOOLEVAL OFF} +{$LONGSTRINGS ON} +{$TYPEDADDRESS OFF} +{$WRITEABLECONST ON} +{$IFDEF JR_D6} + {$WARN SYMBOL_PLATFORM OFF} +{$ENDIF} diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Version.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Version.dcu new file mode 100644 index 0000000..50de38d Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/TB2Version.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.bpl b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.bpl new file mode 100644 index 0000000..f1d3538 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.bpl differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.dcp b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.dcp new file mode 100644 index 0000000..7c0da47 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.dcp differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.dcu new file mode 100644 index 0000000..69bb054 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2k_d12.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.bpl b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.bpl new file mode 100644 index 0000000..45c9caf Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.bpl differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.dcp b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.dcp new file mode 100644 index 0000000..66c0f83 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.dcp differ diff --git a/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.dcu b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.dcu new file mode 100644 index 0000000..9638efd Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Lib/D12/tb2kdsgn_d12.dcu differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/.cvsignore b/official/2.2.2+2.4.2/TB2K/Packages/.cvsignore new file mode 100644 index 0000000..b86ea9b --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/.cvsignore @@ -0,0 +1,10 @@ +*.bdsproj.local +*.bpl +*.cfg +*.dcu +*.dcuil +*.hpp +*.identcache +*.lib +*.obj +*.rsp diff --git a/official/2.2.2+2.4.2/TB2K/Packages/BuildPackages_D12.groupproj b/official/2.2.2+2.4.2/TB2K/Packages/BuildPackages_D12.groupproj new file mode 100644 index 0000000..5cf3560 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/BuildPackages_D12.groupproj @@ -0,0 +1,48 @@ + + + {77727181-BF85-4972-B742-2E2510006578} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb4.bpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb4.bpk new file mode 100644 index 0000000..71a7b35 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb4.bpk @@ -0,0 +1,183 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.04.04 +# --------------------------------------------------------------------------- +PROJECT = tb2k_cb4.bpl +OBJFILES = ..\Source\TB2Common.obj ..\Source\TB2Consts.obj ..\Source\TB2Dock.obj \ + ..\Source\TB2ExtItems.obj ..\Source\TB2Item.obj ..\Source\TB2Toolbar.obj \ + ..\Source\TB2Version.obj ..\Source\TB2Hook.obj ..\Source\TB2ToolWindow.obj \ + ..\Source\TB2MRU.obj ..\Source\TB2Anim.obj ..\Source\TB2MDI.obj \ + ..\Source\TB2Acc.obj tb2k_cb4.obj +RESFILES = +RESDEPEN = $(RESFILES) +LIBFILES = +LIBRARIES = +SPARELIBS = Vcl40.lib +PACKAGES = vcl40.bpi +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .; +PATHASM = .; +PATHPAS = .;..\Source +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = +SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES +# --------------------------------------------------------------------------- +CFLAG1 = -I..\Source;$(BCB)\include;$(BCB)\include\vcl -Od -Hc -H=$(BCB)\lib\vcl40.csm \ + -w -Ve -r- -a8 -k -y -v -vi- -c -b- -w-par -w-inl -Vx -tWM \ + -D$(SYSDEFINES);$(USERDEFINES) +PFLAGS = -U..\Source;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ + -I..\Source;$(BCB)\include;$(BCB)\include\vcl -$YD -$J- -v -JPHNE -M +RFLAGS = -i..\Source;$(BCB)\include;$(BCB)\include\vcl +AFLAGS = /i..\Source /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zd +LFLAGS = -L..\Source;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ + -D"Toolbar2000 Components (Jordan Russell)" -aa -Tpp -Gpr -x -Gn -Gl -Gi -v +# --------------------------------------------------------------------------- +ALLOBJ = c0pkg32.obj Memmgr.Lib $(PACKAGES) sysinit.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +InMemoryExe=0 +ShowInfoMsgs=0 + +!endif + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< +# --------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb4.cpp b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb4.cpp new file mode 100644 index 0000000..65d5caa --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb4.cpp @@ -0,0 +1,29 @@ +// $jrsoftware: tb2k/Packages/tb2k_cb4.cpp,v 1.9 2003/07/04 22:53:21 jr Exp $ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +USEPACKAGE("vcl40.bpi"); +USEUNIT("..\Source\TB2Common.pas"); +USEUNIT("..\Source\TB2Consts.pas"); +USEUNIT("..\Source\TB2Dock.pas"); +USEUNIT("..\Source\TB2ExtItems.pas"); +USEUNIT("..\Source\TB2Item.pas"); +USEUNIT("..\Source\TB2Toolbar.pas"); +USEUNIT("..\Source\TB2Version.pas"); +USEUNIT("..\Source\TB2Hook.pas"); +USEUNIT("..\Source\TB2ToolWindow.pas"); +USEUNIT("..\Source\TB2MRU.pas"); +USEUNIT("..\Source\TB2Anim.pas"); +USEUNIT("..\Source\TB2MDI.pas"); +USEUNIT("..\Source\TB2Acc.pas"); +//--------------------------------------------------------------------------- +#pragma package(smart_init) +//--------------------------------------------------------------------------- +// Package source. +//--------------------------------------------------------------------------- +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +//--------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb5.bpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb5.bpk new file mode 100644 index 0000000..21efbe7 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb5.bpk @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb5.cpp b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb5.cpp new file mode 100644 index 0000000..33d2c2b --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb5.cpp @@ -0,0 +1,29 @@ +// $jrsoftware: tb2k/Packages/tb2k_cb5.cpp,v 1.9 2003/07/04 22:53:21 jr Exp $ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +USEPACKAGE("vcl50.bpi"); +USEUNIT("..\Source\TB2Common.pas"); +USEUNIT("..\Source\TB2Consts.pas"); +USEUNIT("..\Source\TB2Dock.pas"); +USEUNIT("..\Source\TB2ExtItems.pas"); +USEUNIT("..\Source\TB2Item.pas"); +USEUNIT("..\Source\TB2Toolbar.pas"); +USEUNIT("..\Source\TB2Version.pas"); +USEUNIT("..\Source\TB2Hook.pas"); +USEUNIT("..\Source\TB2ToolWindow.pas"); +USEUNIT("..\Source\TB2MRU.pas"); +USEUNIT("..\Source\TB2Anim.pas"); +USEUNIT("..\Source\TB2MDI.pas"); +USEUNIT("..\Source\TB2Acc.pas"); +//--------------------------------------------------------------------------- +#pragma package(smart_init) +//--------------------------------------------------------------------------- +// Package source. +//--------------------------------------------------------------------------- +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +//--------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb6.bpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb6.bpk new file mode 100644 index 0000000..580309c --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb6.bpk @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + +[Linker] +LibPrefix= +LibSuffix= +LibVersion= + + \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb6.cpp b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb6.cpp new file mode 100644 index 0000000..79fe10f --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_cb6.cpp @@ -0,0 +1,14 @@ +// $jrsoftware: tb2k/Packages/tb2k_cb6.cpp,v 1.2 2002/11/14 18:07:19 jr Exp $ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +#pragma package(smart_init) +//--------------------------------------------------------------------------- +// Package source. +//--------------------------------------------------------------------------- +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +//--------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.bdsproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.bdsproj new file mode 100644 index 0000000..5915d11 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.bdsproj @@ -0,0 +1,175 @@ + + + + + + + + + + + + tb2k_d10.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + True + + + + 0 + 44 + False + 1 + False + False + False + 16384 + 1048576 + 1069547520 + Toolbar2000 Components (Jordan Russell) + + + + ..\Lib\D10 + + + + + + + False + + + + + + False + + + True + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.dpk new file mode 100644 index 0000000..450237d --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.dpk @@ -0,0 +1,48 @@ +package tb2k_d10; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3FC00000} +{$DESCRIPTION 'Toolbar2000 Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD OFF} + +requires + vcl; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas'; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d10.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.dpk new file mode 100644 index 0000000..4ff1052 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.dpk @@ -0,0 +1,49 @@ +package tb2k_d11; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3FC00000} +{$DESCRIPTION 'Toolbar2000 Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD OFF} +{$DEFINE DEBUG} + +requires + rtl, + vcl; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas'; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.dproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.dproj new file mode 100644 index 0000000..7237486 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.dproj @@ -0,0 +1,60 @@ + + + {42085cda-8f18-4859-a681-a3109ff5e295} + tb2k_d11.dpk + Debug + AnyCPU + DCC32 + tb2k_d11.bpl + + + 7.0 + False + False + 0 + RELEASE + All + 3FC00000 + ..\Lib\D11 + ..\Lib\D11 + ..\Lib\D11 + ..\Lib\D11 + + + 7.0 + DEBUG + All + 3FC00000 + ..\Lib\D11 + ..\Lib\D11 + ..\Lib\D11 + ..\Lib\D11 + + + Delphi.Personality + Package + +FalseTrueFalseFalseFalseTrueToolbar2000 Components (Jordan Russell)FalseFalse1000FalseFalseFalseFalseFalse103312521.0.0.01.0.0.0tb2k_d11.dpk + + + + + MainSource + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d11.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.dpk new file mode 100644 index 0000000..41f57e6 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.dpk @@ -0,0 +1,48 @@ +package tb2k_d12; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3FC00000} +{$DESCRIPTION 'Toolbar2000 Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD OFF} + +requires + rtl, + vcl; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas'; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.dproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.dproj new file mode 100644 index 0000000..98a3b0a --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.dproj @@ -0,0 +1,131 @@ + + + {1EA50D74-2EC7-4FC2-AA38-747CD0E9BCCA} + tb2k_d12.dpk + 12.0 + Debug + DCC32 + + + true + + + true + Base + true + + + true + Base + true + + + ..\Lib\D12 + ..\Lib\D12 + true + false + ..\Lib\D12 + ..\Lib\D12 + ..\Lib\D12 + ..\Lib\D12 + true + Toolbar2000 Components (Jordan Russell) + 3FC00000 + 1 + true + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias) + x86 + ..\Lib\D12\tb2k_d12.bpl + false + false + true + false + false + false + + + false + RELEASE;$(DCC_Define) + 0 + false + + + DEBUG;$(DCC_Define) + + + + MainSource + + + + + + + + + + + + + + + + + + Base + + + Cfg_2 + Base + + + Cfg_1 + Base + + + + + Delphi.Personality.12 + Package + + + + tb2k_d12.dpk + + + False + True + False + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + 12 + + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.res new file mode 100644 index 0000000..1bf5a8c Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d12.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d4.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d4.dpk new file mode 100644 index 0000000..c4b03d9 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d4.dpk @@ -0,0 +1,47 @@ +package tb2k_d4; + +{$R *.RES} +{$ALIGN ON} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3FC00000} +{$DESCRIPTION 'Toolbar2000 Components (Jordan Russell)'} +{$IMPLICITBUILD ON} + +requires + vcl40; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas'; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d4.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d4.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d4.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d5.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d5.dpk new file mode 100644 index 0000000..28e5be4 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d5.dpk @@ -0,0 +1,48 @@ +package tb2k_d5; + +{$R *.RES} +{$ALIGN ON} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3FC00000} +{$DESCRIPTION 'Toolbar2000 Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl50; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas'; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d5.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d5.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d5.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d6.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d6.dpk new file mode 100644 index 0000000..ea37a26 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d6.dpk @@ -0,0 +1,48 @@ +package tb2k_d6; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3FC00000} +{$DESCRIPTION 'Toolbar2000 Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas'; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d6.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d6.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d6.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d7.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d7.dpk new file mode 100644 index 0000000..bc6fb9c --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d7.dpk @@ -0,0 +1,48 @@ +package tb2k_d7; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3FC00000} +{$DESCRIPTION 'Toolbar2000 Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas'; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d7.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d7.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d7.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d9.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d9.dpk new file mode 100644 index 0000000..56949e2 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d9.dpk @@ -0,0 +1,48 @@ +package tb2k_d9; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3FC00000} +{$DESCRIPTION 'Toolbar2000 Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas'; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d9.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d9.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_d9.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn10.bdsproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn10.bdsproj new file mode 100644 index 0000000..89d1181 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn10.bdsproj @@ -0,0 +1,197 @@ + + + + + + + + + + + + tb2k_dn10.dpk + + + 7.0 + + + 0 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Borland.Vcl.Windows;WinProcs=Borland.Vcl.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + False + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + + + + 0 + 0 + False + 1 + True + False + False + 4096 + 1048576 + 1061158912 + Toolbar2000 .NET Components (Jordan Russell) + + + + ..\Lib\DN10 + $(BDSPROJECTSDIR)\Bpl + $(BDSPROJECTSDIR)\Bpl + + + + + False + + + + + + False + + + True + False + + + + $00000000 + + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn10.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn10.dpk new file mode 100644 index 0000000..001eaf6 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn10.dpk @@ -0,0 +1,120 @@ +package tb2k_dn10; + +{$ALIGN 0} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F400000} +{$DESCRIPTION 'Toolbar2000 .NET Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD OFF} + +requires + System.Drawing, + Borland.Delphi, + Borland.Vcl, + Borland.VclRtl; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas', + TB2OleMarshal in '..\Source\TB2OleMarshal.pas'; + +[assembly: AssemblyDescription('')] +[assembly: AssemblyConfiguration('')] +[assembly: AssemblyCompany('')] +[assembly: AssemblyProduct('')] +[assembly: AssemblyCopyright('')] +[assembly: AssemblyTrademark('')] +[assembly: AssemblyCulture('')] + + +// The Delphi compiler controls the AssemblyTitleAttribute via the ExeDescription. +// You can set this in the IDE via the Project Options. +// Manually setting the AssemblyTitle attribute below will override the IDE +// setting. +// [assembly: AssemblyTitle('')] + + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +//[assembly: AssemblyVersion('1.0.*')] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile('mykey.snk')], provided your output +// directory is the project directory (the default). +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile('')] +[assembly: AssemblyKeyName('')] + +// +// Use the attributes below to control the COM visibility of your assembly. By +// default the entire assembly is visible to COM. Setting ComVisible to false +// is the recommended default for your assembly. To then expose a class and interface +// to COM set ComVisible to true on each one. It is also recommended to add a +// Guid attribute. +// + +[assembly: ComVisible(False)] +//[assembly: Guid('')] +//[assembly: TypeLibVersion(1, 0)] + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn11.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn11.dpk new file mode 100644 index 0000000..836af2d --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn11.dpk @@ -0,0 +1,120 @@ +package tb2k_dn11; + +{$ALIGN 0} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F400000} +{$DESCRIPTION 'Toolbar2000 .NET Components (Jordan Russell)'} +{$RUNONLY} +{$IMPLICITBUILD OFF} +{$DEFINE DEBUG} + +requires + Borland.Delphi, + Borland.VclRtl, + Borland.Vcl; + +contains + TB2Version in '..\Source\TB2Version.pas', + TB2Toolbar in '..\Source\TB2Toolbar.pas', + TB2Consts in '..\Source\TB2Consts.pas', + TB2Dock in '..\Source\TB2Dock.pas', + TB2ExtItems in '..\Source\TB2ExtItems.pas', + TB2Item in '..\Source\TB2Item.pas', + TB2Common in '..\Source\TB2Common.pas', + TB2Hook in '..\Source\TB2Hook.pas', + TB2ToolWindow in '..\Source\TB2ToolWindow.pas', + TB2MRU in '..\Source\TB2MRU.pas', + TB2Anim in '..\Source\TB2Anim.pas', + TB2MDI in '..\Source\TB2MDI.pas', + TB2Acc in '..\Source\TB2Acc.pas', + TB2OleMarshal in '..\Source\TB2OleMarshal.pas'; + +[assembly: AssemblyDescription('')] +[assembly: AssemblyConfiguration('')] +[assembly: AssemblyCompany('')] +[assembly: AssemblyProduct('')] +[assembly: AssemblyCopyright('')] +[assembly: AssemblyTrademark('')] +[assembly: AssemblyCulture('')] + + +// The Delphi compiler controls the AssemblyTitleAttribute via the ExeDescription. +// You can set this in the IDE via the Project Options. +// Manually setting the AssemblyTitle attribute below will override the IDE +// setting. +// [assembly: AssemblyTitle('')] + + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +//[assembly: AssemblyVersion('1.0.*')] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile('mykey.snk')], provided your output +// directory is the project directory (the default). +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile('')] +[assembly: AssemblyKeyName('')] + +// +// Use the attributes below to control the COM visibility of your assembly. By +// default the entire assembly is visible to COM. Setting ComVisible to false +// is the recommended default for your assembly. To then expose a class and interface +// to COM set ComVisible to true on each one. It is also recommended to add a +// Guid attribute. +// + +[assembly: ComVisible(False)] +//[assembly: Guid('')] +//[assembly: TypeLibVersion(1, 0)] + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn11.dproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn11.dproj new file mode 100644 index 0000000..e347261 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2k_dn11.dproj @@ -0,0 +1,82 @@ + + + {e64e9cd0-bdee-45e5-a97a-7e85f9f52092} + Debug + AnyCPU + DCCIL + tb2k_dn11.dll + tb2k_dn11.dpk + + + 7.0 + False + False + 0 + RELEASE + 3F400000 + False + ..\Lib\DN11 + ..\Lib\DN11 + ..\Lib\DN11 + + + 7.0 + True + True + DEBUG + 3F400000 + False + ..\Lib\DN11 + ..\Lib\DN11 + ..\Lib\DN11 + + + DelphiDotNet.Personality + + +FalseTrueFalseFalseFalseTrueToolbar2000 .NET Components (Jordan Russell)TrueFalse1000FalseFalseFalseFalseFalse103312521.0.0.01.0.0.0tb2k_dn11.dpk + + + + Borland.VclRtl + 11.0.5000.9245 + Borland.VclRtl.dll + Borland.VclRtl.dll + False + + + Borland.Vcl + 11.0.5000.9245 + Borland.Vcl.dll + Borland.Vcl.dll + False + + + Borland.Delphi + 11.0.5000.9245 + Borland.Delphi.dll + Borland.Delphi.dll + False + + + + + MainSource + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb4.bpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb4.bpk new file mode 100644 index 0000000..e3fe08e --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb4.bpk @@ -0,0 +1,181 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.04.04 +# --------------------------------------------------------------------------- +PROJECT = tb2kdsgn_cb4.bpl +OBJFILES = ..\Source\TB2DsgnConverter.obj ..\Source\TB2DsgnItemEditor.obj \ + ..\Source\TB2DsgnConvertOptions.obj ..\Source\TB2Reg.obj tb2kdsgn_cb4.obj +RESFILES = ..\Source\TB2Reg.dcr +RESDEPEN = $(RESFILES) ..\Source\TB2DsgnConverter.dfm ..\Source\TB2DsgnItemEditor.dfm \ + ..\Source\TB2DsgnConvertOptions.dfm +LIBFILES = +LIBRARIES = +SPARELIBS = Vcl40.lib +PACKAGES = vcl40.bpi dclstd40.bpi tb2k_cb4.bpi +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .; +PATHASM = .; +PATHPAS = .;..\Source +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = +SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES +# --------------------------------------------------------------------------- +CFLAG1 = -I..\Source;$(BCB)\include;$(BCB)\include\vcl -Od -Hc -H=$(BCB)\lib\vcl40.csm \ + -w -Ve -r- -a8 -k -y -v -vi- -c -b- -w-par -w-inl -Vx -tWM \ + -D$(SYSDEFINES);$(USERDEFINES) +PFLAGS = -U..\Source;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ + -I..\Source;$(BCB)\include;$(BCB)\include\vcl -$YD -$J- -v -JPHNE -M -LUdclstd40 +RFLAGS = -i..\Source;$(BCB)\include;$(BCB)\include\vcl +AFLAGS = /i..\Source /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zd +LFLAGS = -L..\Source;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ + -D"Toolbar2000 Design Package (Jordan Russell)" -aa -Tpp -Gpd -x -Gn -Gl -Gi -v +# --------------------------------------------------------------------------- +ALLOBJ = c0pkg32.obj Memmgr.Lib $(PACKAGES) sysinit.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +InMemoryExe=0 +ShowInfoMsgs=0 + +!endif + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< +# --------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb4.cpp b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb4.cpp new file mode 100644 index 0000000..08b9d21 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb4.cpp @@ -0,0 +1,23 @@ +// $jrsoftware: tb2k/Packages/tb2kdsgn_cb4.cpp,v 1.4 2002/11/14 18:15:59 jr Exp $ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +USEPACKAGE("vcl40.bpi"); +USEFORMNS("..\Source\TB2DsgnConverter.pas", Tb2dsgnconverter, TBConverterForm); +USEFORMNS("..\Source\TB2DsgnItemEditor.pas", Tb2dsgnitemeditor, TBItemEditForm); +USEFORMNS("..\Source\TB2DsgnConvertOptions.pas", Tb2dsgnconvertoptions, TBConvertOptionsForm); +USEUNIT("..\Source\TB2Reg.pas"); +USERES("..\Source\TB2Reg.dcr"); +USEPACKAGE("dclstd40.bpi"); +USEPACKAGE("tb2k_cb4.bpi"); +//--------------------------------------------------------------------------- +#pragma package(smart_init) +//--------------------------------------------------------------------------- +// Package source. +//--------------------------------------------------------------------------- +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +//--------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb5.bpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb5.bpk new file mode 100644 index 0000000..2950fbf --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb5.bpk @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb5.cpp b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb5.cpp new file mode 100644 index 0000000..ba1bbd8 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb5.cpp @@ -0,0 +1,23 @@ +// $jrsoftware: tb2k/Packages/tb2kdsgn_cb5.cpp,v 1.4 2002/11/14 18:15:59 jr Exp $ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +USEPACKAGE("vcl50.bpi"); +USEFORMNS("..\Source\TB2DsgnConverter.pas", Tb2dsgnconverter, TBConverterForm); +USEFORMNS("..\Source\TB2DsgnItemEditor.pas", Tb2dsgnitemeditor, TBItemEditForm); +USEFORMNS("..\Source\TB2DsgnConvertOptions.pas", Tb2dsgnconvertoptions, TBConvertOptionsForm); +USEUNIT("..\Source\TB2Reg.pas"); +USERES("..\Source\TB2Reg.dcr"); +USEPACKAGE("dclstd50.bpi"); +USEPACKAGE("tb2k_cb5.bpi"); +//--------------------------------------------------------------------------- +#pragma package(smart_init) +//--------------------------------------------------------------------------- +// Package source. +//--------------------------------------------------------------------------- +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +//--------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb6.bpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb6.bpk new file mode 100644 index 0000000..1223631 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb6.bpk @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + +[Linker] +LibPrefix= +LibSuffix= +LibVersion= + + \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb6.cpp b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb6.cpp new file mode 100644 index 0000000..6fabfa6 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_cb6.cpp @@ -0,0 +1,18 @@ +// $jrsoftware: tb2k/Packages/tb2kdsgn_cb6.cpp,v 1.2 2002/11/14 18:07:19 jr Exp $ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +USEFORMNS("..\Source\TB2DsgnConverter.pas", Tb2dsgnconverter, TBConverterForm); +USEFORMNS("..\Source\TB2DsgnItemEditor.pas", Tb2dsgnitemeditor, TBItemEditForm); +USEFORMNS("..\Source\TB2DsgnConvertOptions.pas", Tb2dsgnconvertoptions, TBConvertOptionsForm); +//--------------------------------------------------------------------------- +#pragma package(smart_init) +//--------------------------------------------------------------------------- +// Package source. +//--------------------------------------------------------------------------- +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +//--------------------------------------------------------------------------- + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.bdsproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.bdsproj new file mode 100644 index 0000000..e208fd9 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.bdsproj @@ -0,0 +1,175 @@ + + + + + + + + + + + + tb2kdsgn_d10.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + True + + + + 0 + 44 + False + 1 + False + False + False + 16384 + 1048576 + 1065353216 + Toolbar2000 Design Package (Jordan Russell) + + + + + + + + + + + False + + + + + + False + + + True + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.dpk new file mode 100644 index 0000000..6286adf --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.dpk @@ -0,0 +1,42 @@ +package tb2kdsgn_d10; + +{$R *.res} +{$R '..\Source\TB2Reg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F800000} +{$DESCRIPTION 'Toolbar2000 Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD OFF} + +requires + vcl, + dclstd, + tb2k_d10; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas' {TBItemEditForm}, + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas' {TBConverterForm}, + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas' {TBConvertOptionsForm}; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d10.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.dpk new file mode 100644 index 0000000..6ea006f --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.dpk @@ -0,0 +1,43 @@ +package tb2kdsgn_d11; + +{$R *.res} +{$R '..\Source\TB2Reg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F800000} +{$DESCRIPTION 'Toolbar2000 Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD OFF} +{$DEFINE DEBUG} + +requires + rtl, + vcl, + dclstd, + tb2k_d11; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas' {TBItemEditForm}, + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas' {TBConverterForm}, + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas' {TBConvertOptionsForm}; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.dproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.dproj new file mode 100644 index 0000000..454a446 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.dproj @@ -0,0 +1,52 @@ + + + {e51188c3-1c1e-47eb-b42e-bb80872f9ae7} + tb2kdsgn_d11.dpk + Debug + AnyCPU + DCC32 + tb2kdsgn_d11.bpl + + + 7.0 + False + False + 0 + RELEASE + All + 3F800000 + + + 7.0 + DEBUG + All + 3F800000 + + + Delphi.Personality + Package + +FalseTrueFalseFalseTrueFalseToolbar2000 Design Package (Jordan Russell)FalseFalse1000FalseFalseFalseFalseFalse103312521.0.0.01.0.0.0tb2kdsgn_d11.dpk + + + + + MainSource + + +
TBConverterForm
+
+ +
TBConvertOptionsForm
+
+ +
TBItemEditForm
+
+ + + + + + +
+
\ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d11.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.bpi b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.bpi new file mode 100644 index 0000000..92e703b Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.bpi differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.dpk new file mode 100644 index 0000000..b3ebd84 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.dpk @@ -0,0 +1,42 @@ +package tb2kdsgn_d12; + +{$R *.res} +{$R '..\Source\TB2Reg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F800000} +{$DESCRIPTION 'Toolbar2000 Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD OFF} + +requires + rtl, + vcl, + dclstd, + tb2k_d12; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas' {TBItemEditForm}, + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas' {TBConverterForm}, + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas' {TBConvertOptionsForm}; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.dproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.dproj new file mode 100644 index 0000000..ea19959 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.dproj @@ -0,0 +1,129 @@ + + + {D9827544-06D4-4C36-9AA3-5858B2C844EA} + tb2kdsgn_d12.dpk + 12.0 + Debug + DCC32 + + + true + + + true + Base + true + + + true + Base + true + + + ..\Lib\D12 + ..\Lib\D12;$(DCC_UnitSearchPath) + ..\Lib\D12 + ..\Lib\D12 + 3F800000 + ..\Lib\D12\tb2kdsgn_d12.bpl + 1 + true + x86 + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias) + Toolbar2000 Design Package (Jordan Russell) + false + false + true + true + false + true + false + false + + + false + RELEASE;$(DCC_Define) + 0 + false + + + DEBUG;$(DCC_Define) + + + + MainSource + + + + + + + + +
TBItemEditForm
+
+ +
TBConverterForm
+
+ +
TBConvertOptionsForm
+
+ + + Base + + + Cfg_2 + Base + + + Cfg_1 + Base + +
+ + + Delphi.Personality.12 + Package + + + + tb2kdsgn_d12.dpk + + + False + True + False + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + 12 + +
diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.hpp b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.hpp new file mode 100644 index 0000000..0e40bac --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.hpp @@ -0,0 +1,101 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Tb2kdsgn_d12.pas' rev: 20.00 + +#ifndef Tb2kdsgn_d12HPP +#define Tb2kdsgn_d12HPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Tb2kdsgn_d12 +{ +//-- type declarations ------------------------------------------------------- +//-- var, const, procedure --------------------------------------------------- + +} /* namespace Tb2kdsgn_d12 */ +using namespace Tb2kdsgn_d12; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // Tb2kdsgn_d12HPP diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.lib b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.lib new file mode 100644 index 0000000..42898df Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.lib differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.res new file mode 100644 index 0000000..1bf5a8c Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d12.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d4.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d4.dpk new file mode 100644 index 0000000..b9c2f4e --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d4.dpk @@ -0,0 +1,42 @@ +package tb2kdsgn_d4; + +{$R *.RES} +{$R '..\Source\TB2Reg.dcr'} +{$ALIGN ON} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F800000} +{$DESCRIPTION 'Toolbar2000 Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + vcl40, + dclstd40, + tb2k_d4; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas' {TBItemEditForm}, + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas' {TBConverterForm}, + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas' {TBConvertOptionsForm}; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d4.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d4.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d4.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d5.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d5.dpk new file mode 100644 index 0000000..bb80ebc --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d5.dpk @@ -0,0 +1,42 @@ +package tb2kdsgn_d5; + +{$R *.RES} +{$R '..\Source\TB2Reg.dcr'} +{$ALIGN ON} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F800000} +{$DESCRIPTION 'Toolbar2000 Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + vcl50, + dclstd50, + tb2k_d5; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas' {TBItemEditForm}, + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas' {TBConverterForm}, + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas' {TBConvertOptionsForm}; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d5.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d5.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d5.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d6.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d6.dpk new file mode 100644 index 0000000..da87e9e --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d6.dpk @@ -0,0 +1,42 @@ +package tb2kdsgn_d6; + +{$R *.res} +{$R '..\Source\TB2Reg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F800000} +{$DESCRIPTION 'Toolbar2000 Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + dclstd, + tb2k_d6; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas' {TBItemEditForm}, + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas' {TBConverterForm}, + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas' {TBConvertOptionsForm}; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d6.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d6.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d6.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d7.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d7.dpk new file mode 100644 index 0000000..805b074 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d7.dpk @@ -0,0 +1,42 @@ +package tb2kdsgn_d7; + +{$R *.res} +{$R '..\Source\TB2Reg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F800000} +{$DESCRIPTION 'Toolbar2000 Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + dclstd, + tb2k_d7; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas' {TBItemEditForm}, + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas' {TBConverterForm}, + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas' {TBConvertOptionsForm}; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d7.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d7.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d7.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d9.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d9.dpk new file mode 100644 index 0000000..ca4e64a --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d9.dpk @@ -0,0 +1,42 @@ +package tb2kdsgn_d9; + +{$R *.res} +{$R '..\Source\TB2Reg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F800000} +{$DESCRIPTION 'Toolbar2000 Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + dclstd, + tb2k_d9; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas' {TBItemEditForm}, + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas' {TBConverterForm}, + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas' {TBConvertOptionsForm}; + +end. + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d9.res b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d9.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_d9.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn10.bdsproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn10.bdsproj new file mode 100644 index 0000000..149e279 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn10.bdsproj @@ -0,0 +1,188 @@ + + + + + + + + + + + + tb2kdsgn_dn10.dpk + + + 7.0 + + + 0 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Borland.Vcl.Windows;WinProcs=Borland.Vcl.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + Borland.Vcl.Design + False + + True + True + True + True + True + False + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + + + + 0 + 0 + False + 1 + True + False + False + 4096 + 1048576 + 1056964608 + Toolbar2000 .NET Design Package (Jordan Russell) + + + + + $(BDSPROJECTSDIR)\Bpl + $(BDSPROJECTSDIR)\Bpl + + + + + True + + + + + + False + + + True + False + + + + $00000000 + + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + + + + + + + + + + + diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn10.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn10.dpk new file mode 100644 index 0000000..418a15d --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn10.dpk @@ -0,0 +1,111 @@ +package tb2kdsgn_dn10; + +{$ALIGN 0} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F000000} +{$DESCRIPTION 'Toolbar2000 .NET Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD OFF} + +requires + System.Drawing, + Borland.Delphi, + Borland.Studio.Vcl.Design, + Borland.Vcl.Design.Standard, + tb2k_dn10; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas', + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas', + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas'; + +[assembly: AssemblyDescription('')] +[assembly: AssemblyConfiguration('')] +[assembly: AssemblyCompany('')] +[assembly: AssemblyProduct('')] +[assembly: AssemblyCopyright('')] +[assembly: AssemblyTrademark('')] +[assembly: AssemblyCulture('')] + + +// The Delphi compiler controls the AssemblyTitleAttribute via the ExeDescription. +// You can set this in the IDE via the Project Options. +// Manually setting the AssemblyTitle attribute below will override the IDE +// setting. +// [assembly: AssemblyTitle('')] + + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +//[assembly: AssemblyVersion('1.0.*')] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile('mykey.snk')], provided your output +// directory is the project directory (the default). +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile('')] +[assembly: AssemblyKeyName('')] + +// +// Use the attributes below to control the COM visibility of your assembly. By +// default the entire assembly is visible to COM. Setting ComVisible to false +// is the recommended default for your assembly. To then expose a class and interface +// to COM set ComVisible to true on each one. It is also recommended to add a +// Guid attribute. +// + +[assembly: ComVisible(False)] +//[assembly: Guid('')] +//[assembly: TypeLibVersion(1, 0)] + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn11.dpk b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn11.dpk new file mode 100644 index 0000000..b36d21b --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn11.dpk @@ -0,0 +1,112 @@ +package tb2kdsgn_dn11; + +{$ALIGN 0} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $3F000000} +{$DESCRIPTION 'Toolbar2000 .NET Design Package (Jordan Russell)'} +{$DESIGNONLY} +{$IMPLICITBUILD OFF} +{$DEFINE DEBUG} + +requires + Borland.Delphi, + Borland.Vcl, + Borland.VclRtl, + Borland.Vcl.Design.Standard, + tb2k_dn11; + +contains + TB2Reg in '..\Source\TB2Reg.pas', + TB2DsgnItemEditor in '..\Source\TB2DsgnItemEditor.pas', + TB2DsgnConverter in '..\Source\TB2DsgnConverter.pas', + TB2DsgnConvertOptions in '..\Source\TB2DsgnConvertOptions.pas'; + +[assembly: AssemblyDescription('')] +[assembly: AssemblyConfiguration('')] +[assembly: AssemblyCompany('')] +[assembly: AssemblyProduct('')] +[assembly: AssemblyCopyright('')] +[assembly: AssemblyTrademark('')] +[assembly: AssemblyCulture('')] + + +// The Delphi compiler controls the AssemblyTitleAttribute via the ExeDescription. +// You can set this in the IDE via the Project Options. +// Manually setting the AssemblyTitle attribute below will override the IDE +// setting. +// [assembly: AssemblyTitle('')] + + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +//[assembly: AssemblyVersion('1.0.*')] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile('mykey.snk')], provided your output +// directory is the project directory (the default). +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile('')] +[assembly: AssemblyKeyName('')] + +// +// Use the attributes below to control the COM visibility of your assembly. By +// default the entire assembly is visible to COM. Setting ComVisible to false +// is the recommended default for your assembly. To then expose a class and interface +// to COM set ComVisible to true on each one. It is also recommended to add a +// Guid attribute. +// + +[assembly: ComVisible(False)] +//[assembly: Guid('')] +//[assembly: TypeLibVersion(1, 0)] + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn11.dproj b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn11.dproj new file mode 100644 index 0000000..621b653 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Packages/tb2kdsgn_dn11.dproj @@ -0,0 +1,82 @@ + + + {be3d3497-f4e5-4f7b-a5f7-0ad1f00fddb2} + Debug + AnyCPU + DCCIL + tb2kdsgn_dn11.dll + tb2kdsgn_dn11.dpk + + + 7.0 + False + False + 0 + RELEASE + 3F000000 + False + Borland.Vcl.Design + + + 7.0 + True + True + DEBUG + 3F000000 + False + Borland.Vcl.Design + + + DelphiDotNet.Personality + + +FalseTrueFalseFalseTrueFalseToolbar2000 .NET Design Package (Jordan Russell)TrueFalse1000FalseFalseFalseFalseFalse103312521.0.0.01.0.0.0tb2kdsgn_dn11.dpk + + + + Borland.VclRtl + 11.0.5000.9245 + Borland.VclRtl.dll + Borland.VclRtl.dll + False + + + Borland.Vcl + 11.0.5000.9245 + Borland.Vcl.dll + Borland.Vcl.dll + False + + + tb2k_dn11 + 0.0.0.0 + tb2k_dn11.dll + tb2k_dn11.dll + False + + + Borland.Delphi + 11.0.5000.9245 + Borland.Delphi.dll + Borland.Delphi.dll + False + + + Borland.Vcl.Design.Standard + 11.0.5000.9245 + Borland.Vcl.Design.Standard.dll + Borland.Vcl.Design.Standard.dll + False + + + + + MainSource + + + + + + + + \ No newline at end of file diff --git a/official/2.2.2+2.4.2/TB2K/README.txt b/official/2.2.2+2.4.2/TB2K/README.txt new file mode 100644 index 0000000..c8c520e --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/README.txt @@ -0,0 +1,22 @@ +=========================================================================== + Toolbar2000 README +=========================================================================== + +Thank you for downloading Toolbar2000. + +For details on installing and using Toolbar2000, please refer to the +Toolbar2000 help file - tb2k.chm. To open it, double-click it in Windows +Explorer. + +This file is in HTML Help format. If you are using an older version of +Windows that does not come with HTML Help, it can be downloaded at: + + http://msdn.microsoft.com/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp + +You will also need Internet Explorer 4.0 or later (5.0 is preferred), +downloadable from: + + http://www.microsoft.com/ie/ + + +- Jordan Russell (www.jrsoftware.org) diff --git a/official/2.2.2+2.4.2/TB2K/Source/.cvsignore b/official/2.2.2+2.4.2/TB2K/Source/.cvsignore new file mode 100644 index 0000000..a328cf4 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/.cvsignore @@ -0,0 +1,5 @@ +*.dcu +*.dcuil +*.obj +*.hpp +_* diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TB2DsgnEditorImages.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TB2DsgnEditorImages.bmp new file mode 100644 index 0000000..2419979 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TB2DsgnEditorImages.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBBackground.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBBackground.bmp new file mode 100644 index 0000000..ce49b5b Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBBackground.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBBackground16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBBackground16.bmp new file mode 100644 index 0000000..05dc86b Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBBackground16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBDock.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBDock.bmp new file mode 100644 index 0000000..d711a0f Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBDock.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBDock16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBDock16.bmp new file mode 100644 index 0000000..a6ff48d Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBDock16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBEditItem.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBEditItem.bmp new file mode 100644 index 0000000..08036fa Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBEditItem.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBGroupItem.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBGroupItem.bmp new file mode 100644 index 0000000..0932b29 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBGroupItem.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBImageList.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBImageList.bmp new file mode 100644 index 0000000..9754808 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBImageList.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBImageList16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBImageList16.bmp new file mode 100644 index 0000000..289b503 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBImageList16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBItemContainer.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBItemContainer.bmp new file mode 100644 index 0000000..5794333 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBItemContainer.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBItemContainer16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBItemContainer16.bmp new file mode 100644 index 0000000..82417d0 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBItemContainer16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIHandler.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIHandler.bmp new file mode 100644 index 0000000..5e5f87d Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIHandler.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIHandler16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIHandler16.bmp new file mode 100644 index 0000000..809e478 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIHandler16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIWindowItem.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIWindowItem.bmp new file mode 100644 index 0000000..431011f Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMDIWindowItem.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUList.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUList.bmp new file mode 100644 index 0000000..ccd304e Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUList.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUList16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUList16.bmp new file mode 100644 index 0000000..48654a6 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUList16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUListItem.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUListItem.bmp new file mode 100644 index 0000000..b8b5f41 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBMRUListItem.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBPopupMenu.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBPopupMenu.bmp new file mode 100644 index 0000000..2a485e5 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBPopupMenu.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBPopupMenu16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBPopupMenu16.bmp new file mode 100644 index 0000000..b3504ed Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBPopupMenu16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolWindow.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolWindow.bmp new file mode 100644 index 0000000..48981e5 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolWindow.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolWindow16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolWindow16.bmp new file mode 100644 index 0000000..bc2712f Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolWindow16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolbar.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolbar.bmp new file mode 100644 index 0000000..557096b Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolbar.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolbar16.bmp b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolbar16.bmp new file mode 100644 index 0000000..80c1d66 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/Icons/TTBToolbar16.bmp differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Acc.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Acc.pas new file mode 100644 index 0000000..bcfd73b --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Acc.pas @@ -0,0 +1,1393 @@ +unit TB2Acc; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Acc.pas,v 1.9 2008/04/19 05:31:00 jr Exp $ + + This unit is used internally to implement the IAccessible interface on + TTBView and TTBItemViewer for Microsoft Active Accessibility support. +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + {$IFDEF CLR} System.Runtime.InteropServices, {$ENDIF} + TB2Item; + +type + { Our declaration for IAccessible } + {$IFNDEF CLR} + TTBVariant = OleVariant; + ITBAccessible = interface(IDispatch) + ['{618736E0-3C3D-11CF-810C-00AA00389B71}'] + function get_accParent(out ppdispParent: IDispatch): HRESULT; stdcall; + function get_accChildCount(out pcountChildren: Integer): HRESULT; stdcall; + function get_accChild(varChild: TTBVariant; out ppdispChild: IDispatch): HRESULT; stdcall; + function get_accName(varChild: TTBVariant; out pszName: WideString): HRESULT; stdcall; + function get_accValue(varChild: TTBVariant; out pszValue: WideString): HRESULT; stdcall; + function get_accDescription(varChild: TTBVariant; out pszDescription: WideString): HRESULT; stdcall; + function get_accRole(varChild: TTBVariant; out pvarRole: TTBVariant): HRESULT; stdcall; + function get_accState(varChild: TTBVariant; out pvarState: TTBVariant): HRESULT; stdcall; + function get_accHelp(varChild: TTBVariant; out pszHelp: WideString): HRESULT; stdcall; + function get_accHelpTopic(out pszHelpFile: WideString; varChild: TTBVariant; out pidTopic: Integer): HRESULT; stdcall; + function get_accKeyboardShortcut(varChild: TTBVariant; out pszKeyboardShortcut: WideString): HRESULT; stdcall; + function get_accFocus(out pvarID: TTBVariant): HRESULT; stdcall; + function get_accSelection(out pvarChildren: TTBVariant): HRESULT; stdcall; + function get_accDefaultAction(varChild: TTBVariant; out pszDefaultAction: WideString): HRESULT; stdcall; + function accSelect(flagsSelect: Integer; varChild: TTBVariant): HRESULT; stdcall; + function accLocation(out pxLeft: Integer; out pyTop: Integer; out pcxWidth: Integer; + out pcyHeight: Integer; varChild: TTBVariant): HRESULT; stdcall; + function accNavigate(navDir: Integer; varStart: TTBVariant; out pvarEnd: TTBVariant): HRESULT; stdcall; + function accHitTest(xLeft: Integer; yTop: Integer; out pvarID: TTBVariant): HRESULT; stdcall; + function accDoDefaultAction(varChild: TTBVariant): HRESULT; stdcall; + function put_accName(varChild: TTBVariant; const pszName: WideString): HRESULT; stdcall; + function put_accValue(varChild: TTBVariant; const pszValue: WideString): HRESULT; stdcall; + end; + {$ELSE} + TTBVariant = TObject; + [ComImport, + GuidAttribute('618736E0-3C3D-11CF-810C-00AA00389B71'), + InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)] + ITBAccessible = interface + [PreserveSig] + function get_accParent([out, MarshalAs(UnmanagedType.IDispatch)] out ppdispParent): HRESULT; + [PreserveSig] + function get_accChildCount(out pcountChildren: Integer): HRESULT; + [PreserveSig] + function get_accChild(varChild: TTBVariant; [out, MarshalAs(UnmanagedType.IDispatch)] out ppdispChild): HRESULT; + [PreserveSig] + function get_accName(varChild: TTBVariant; out pszName: WideString): HRESULT; + [PreserveSig] + function get_accValue(varChild: TTBVariant; out pszValue: WideString): HRESULT; + [PreserveSig] + function get_accDescription(varChild: TTBVariant; out pszDescription: WideString): HRESULT; + [PreserveSig] + function get_accRole(varChild: TTBVariant; out pvarRole: TTBVariant): HRESULT; + [PreserveSig] + function get_accState(varChild: TTBVariant; out pvarState: TTBVariant): HRESULT; + [PreserveSig] + function get_accHelp(varChild: TTBVariant; out pszHelp: WideString): HRESULT; + [PreserveSig] + function get_accHelpTopic(out pszHelpFile: WideString; varChild: TTBVariant; out pidTopic: Integer): HRESULT; + [PreserveSig] + function get_accKeyboardShortcut(varChild: TTBVariant; out pszKeyboardShortcut: WideString): HRESULT; + [PreserveSig] + function get_accFocus(out pvarID: TTBVariant): HRESULT; + [PreserveSig] + function get_accSelection(out pvarChildren: TTBVariant): HRESULT; + [PreserveSig] + function get_accDefaultAction(varChild: TTBVariant; out pszDefaultAction: WideString): HRESULT; + [PreserveSig] + function accSelect(flagsSelect: Integer; varChild: TTBVariant): HRESULT; + [PreserveSig] + function accLocation(out pxLeft: Integer; out pyTop: Integer; out pcxWidth: Integer; + out pcyHeight: Integer; varChild: TTBVariant): HRESULT; + [PreserveSig] + function accNavigate(navDir: Integer; varStart: TTBVariant; out pvarEnd: TTBVariant): HRESULT; + [PreserveSig] + function accHitTest(xLeft: Integer; yTop: Integer; out pvarID: TTBVariant): HRESULT; + [PreserveSig] + function accDoDefaultAction(varChild: TTBVariant): HRESULT; + [PreserveSig] + function put_accName(varChild: TTBVariant; const pszName: WideString): HRESULT; + [PreserveSig] + function put_accValue(varChild: TTBVariant; const pszValue: WideString): HRESULT; + end; + {$ENDIF} + + TTBCustomAccObject = class(TTBBaseAccObject) + private + {$IFNDEF CLR} + FPrevious, FNext: TTBCustomAccObject; + {$ENDIF} + public + {$IFNDEF CLR} + constructor Create; + destructor Destroy; override; + {$ENDIF} + end; + + {$IFDEF CLR} + { Note: Without ComVisible(true), attempts to return objects in IAccessible's + IDispatch-type out parameters fail with InvalidCastException } + [ComVisible(true)] + {$ENDIF} + TTBViewAccObject = class(TTBCustomAccObject, ITBAccessible) + private + FView: TTBView; + function Check(const varChild: TTBVariant; var ErrorCode: HRESULT): Boolean; + { ITBAccessible } + function accDoDefaultAction(varChild: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function accHitTest(xLeft: Integer; yTop: Integer; out pvarID: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function accLocation(out pxLeft: Integer; out pyTop: Integer; out pcxWidth: Integer; + out pcyHeight: Integer; varChild: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function accNavigate(navDir: Integer; varStart: TTBVariant; out pvarEnd: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function accSelect(flagsSelect: Integer; varChild: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accChild(varChild: TTBVariant; out ppdispChild {$IFNDEF CLR}: IDispatch{$ENDIF}): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accChildCount(out pcountChildren: Integer): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accDefaultAction(varChild: TTBVariant; out pszDefaultAction: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accDescription(varChild: TTBVariant; out pszDescription: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accFocus(out pvarID: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accHelp(varChild: TTBVariant; out pszHelp: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accHelpTopic(out pszHelpFile: WideString; varChild: TTBVariant; out pidTopic: Integer): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accKeyboardShortcut(varChild: TTBVariant; out pszKeyboardShortcut: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accName(varChild: TTBVariant; out pszName: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accParent(out ppdispParent {$IFNDEF CLR}: IDispatch{$ENDIF}): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accRole(varChild: TTBVariant; out pvarRole: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accSelection(out pvarChildren: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accState(varChild: TTBVariant; out pvarState: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accValue(varChild: TTBVariant; out pszValue: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function put_accName(varChild: TTBVariant; const pszName: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function put_accValue(varChild: TTBVariant; const pszValue: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + {$IFDEF CLR} + strict protected + procedure Finalize; override; + {$ENDIF} + public + constructor Create(AView: TTBView); + {$IFNDEF CLR} + destructor Destroy; override; + {$ENDIF} + procedure ClientIsDestroying; override; + end; + + {$IFDEF CLR} + [ComVisible(true)] + {$ENDIF} + TTBItemViewerAccObject = class(TTBCustomAccObject, ITBAccessible) + private + FViewer: TTBItemViewer; + function Check(const varChild: TTBVariant; var ErrorCode: HRESULT): Boolean; + function IsActionable: Boolean; + function IsAvailable: Boolean; + function IsFocusable: Boolean; + { ITBAccessible } + function accDoDefaultAction(varChild: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function accHitTest(xLeft: Integer; yTop: Integer; out pvarID: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function accLocation(out pxLeft: Integer; out pyTop: Integer; out pcxWidth: Integer; + out pcyHeight: Integer; varChild: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function accNavigate(navDir: Integer; varStart: TTBVariant; out pvarEnd: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function accSelect(flagsSelect: Integer; varChild: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accChild(varChild: TTBVariant; out ppdispChild {$IFNDEF CLR}: IDispatch{$ENDIF}): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accChildCount(out pcountChildren: Integer): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accDefaultAction(varChild: TTBVariant; out pszDefaultAction: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accDescription(varChild: TTBVariant; out pszDescription: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accFocus(out pvarID: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accHelp(varChild: TTBVariant; out pszHelp: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accHelpTopic(out pszHelpFile: WideString; varChild: TTBVariant; out pidTopic: Integer): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accKeyboardShortcut(varChild: TTBVariant; out pszKeyboardShortcut: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accName(varChild: TTBVariant; out pszName: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accParent(out ppdispParent {$IFNDEF CLR}: IDispatch{$ENDIF}): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accRole(varChild: TTBVariant; out pvarRole: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accSelection(out pvarChildren: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accState(varChild: TTBVariant; out pvarState: TTBVariant): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function get_accValue(varChild: TTBVariant; out pszValue: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function put_accName(varChild: TTBVariant; const pszName: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + function put_accValue(varChild: TTBVariant; const pszValue: WideString): HRESULT; {$IFNDEF CLR}stdcall;{$ENDIF} + {$IFDEF CLR} + strict protected + procedure Finalize; override; + {$ENDIF} + public + constructor Create(AViewer: TTBItemViewer); + {$IFNDEF CLR} + destructor Destroy; override; + {$ENDIF} + procedure ClientIsDestroying; override; + procedure HandleAccSelect(const AExecute: Boolean); + end; + +procedure CallNotifyWinEvent(event: DWORD; hwnd: HWND; idObject: DWORD; + idChild: Longint); +function InitializeOleAcc: Boolean; + +{$IFNDEF CLR} +var + LresultFromObjectFunc: function(const riid: TGUID; wParam: WPARAM; + pUnk: IUnknown): LRESULT; stdcall; + AccessibleObjectFromWindowFunc: function(hwnd: HWND; dwId: DWORD; + const riid: TGUID; out ppvObject): HRESULT; stdcall; +{$ELSE} +function LresultFromObjectFunc([in, MarshalAs(UnmanagedType.LPStruct)] riid: TGUID; + wParam: WPARAM; [in, MarshalAs(UnmanagedType.IUnknown)] pUnk: TObject): LRESULT; +function AccessibleObjectFromWindowFunc(hwnd: HWND; dwId: DWORD; + [in, MarshalAs(UnmanagedType.LPStruct)] riid: TGUID; + [MarshalAs(UnmanagedType.Interface)] out ppvObject): HRESULT; +{$ENDIF} + +var + { For debugging purposes only: } + ViewAccObjectInstances: Integer = 0; + ItemViewerAccObjectInstances: Integer = 0; + +implementation + +uses + {$IFDEF CLR} System.Security, System.Threading, Types, {$ENDIF} + {$IFNDEF CLR} {$IFDEF JR_D6} Variants, {$ENDIF} {$ENDIF} + ActiveX, Menus, TB2Common; + +const + { Constants from OleAcc.h } + ROLE_SYSTEM_MENUBAR = $2; + ROLE_SYSTEM_CLIENT = $a; + ROLE_SYSTEM_MENUPOPUP = $b; + ROLE_SYSTEM_MENUITEM = $c; + ROLE_SYSTEM_SEPARATOR = $15; + ROLE_SYSTEM_TOOLBAR = $16; + ROLE_SYSTEM_PUSHBUTTON = $2b; + ROLE_SYSTEM_BUTTONMENU = $39; + + STATE_SYSTEM_HASPOPUP = $40000000; + + NAVDIR_UP = 1; + NAVDIR_DOWN = 2; + NAVDIR_LEFT = 3; + NAVDIR_RIGHT = 4; + NAVDIR_NEXT = 5; + NAVDIR_PREVIOUS = 6; + NAVDIR_FIRSTCHILD = 7; + NAVDIR_LASTCHILD = 8; + + SELFLAG_TAKEFOCUS = 1; + +type + {$IFNDEF CLR} + TControlAccess = class(TControl); + {$ENDIF} + TTBViewAccess = class(TTBView); + TTBCustomItemAccess = class(TTBCustomItem); + TTBItemViewerAccess = class(TTBItemViewer); + +{$IFNDEF CLR} +var + LastAccObject: TTBCustomAccObject; { last object in the linked list } + LastAccObjectCritSect: TRTLCriticalSection; + + NotifyWinEventInited: BOOL; + NotifyWinEventFunc: procedure(event: DWORD; hwnd: HWND; idObject: Longint; + idChild: Longint); stdcall; +{$ENDIF} + +{$IFDEF CLR} +[SuppressUnmanagedCodeSecurity, DllImport('oleacc.dll', CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'LresultFromObject')] +function LresultFromObjectFunc; external; +[SuppressUnmanagedCodeSecurity, DllImport('oleacc.dll', CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'AccessibleObjectFromWindow')] +function AccessibleObjectFromWindowFunc; external; +{$ENDIF} + +procedure CallNotifyWinEvent(event: DWORD; hwnd: HWND; idObject: DWORD; + idChild: Longint); +begin + {$IFNDEF CLR} + if not NotifyWinEventInited then begin + NotifyWinEventFunc := GetProcAddress(GetModuleHandle(user32), 'NotifyWinEvent'); + InterlockedExchange(Integer(NotifyWinEventInited), Ord(True)); + end; + if Assigned(NotifyWinEventFunc) then + NotifyWinEventFunc(event, hwnd, Longint(idObject), idChild); + {$ELSE} + { NotifyWinEvent is supported on all platforms .NET supports } + NotifyWinEvent(event, hwnd, Longint(idObject), idChild); + {$ENDIF} +end; + +var + OleAccInited: Integer; + OleAccAvailable: BOOL; + +function InitializeOleAcc: Boolean; +var + M: HMODULE; +begin + if OleAccInited = 0 then begin + M := {$IFDEF JR_D5} SafeLoadLibrary {$ELSE} LoadLibrary {$ENDIF} ('oleacc.dll'); + if M <> 0 then begin + {$IFNDEF CLR} + LresultFromObjectFunc := GetProcAddress(M, 'LresultFromObject'); + AccessibleObjectFromWindowFunc := GetProcAddress(M, 'AccessibleObjectFromWindow'); + if Assigned(LresultFromObjectFunc) and + Assigned(AccessibleObjectFromWindowFunc) then + {$ENDIF} + OleAccAvailable := True; + end; + InterlockedExchange(OleAccInited, 1); + end; + Result := OleAccAvailable; +end; + +{$IFNDEF CLR} +function AccObjectFromWindow(const Wnd: HWND; out ADisp: IDispatch): HRESULT; +begin + Result := AccessibleObjectFromWindowFunc(Wnd, OBJID_WINDOW, IDispatch, ADisp); + if Result <> S_OK then + ADisp := nil; +end; +{$ELSE} +function AccObjectFromWindow(const Wnd: HWND; out ADisp): HRESULT; +begin + Result := AccessibleObjectFromWindowFunc(Wnd, OBJID_WINDOW, + TypeOf(IDispatch).GUID, ADisp); + if Result <> S_OK then + ADisp := nil; +end; +{$ENDIF} + +{$IFNDEF CLR} +procedure DisconnectAccObjects; +{ This procedure calls CoDisconnectObject() on all acc. objects still + allocated. This is needed to prevent potential AV's when TB2k is compiled + into a DLL, since a DLL may be freed by the application while an MSAA + client still holds acc. object references. } +var + Obj, PrevObj: TTBCustomAccObject; +begin + Obj := LastAccObject; + while Assigned(Obj) do begin + { Make a copy of Obj.FPrevious since CoDisconnectObject may cause Obj + to be freed } + PrevObj := Obj.FPrevious; + { CoDisconnectObject should cause remote MSAA clients to release all + references to the object, thus destroying it (assuming the local + application doesn't have references of its own). } + CoDisconnectObject(Obj, 0); + Obj := PrevObj; + end; +end; +{$ELSE} +{ DisconnectAccObjects isn't implemented on .NET because: + - I'm not sure it's needed (the case mentioned above doesn't apply). + - Keeping references to objects in a global linked list would prevent the GC + from ever reclaiming the unused ones. + - The current implementation of TTBStandardOleMarshalObject.DisconnectObject + always returns E_NOTIMPL, so CoDisconnectObject would fail. + - Windows Forms doesn't appear to do it. (Its accessible objects are + derived from StandardOleMarshalObject, and they don't appear to override + the default E_NOTIMPL handling.) } +{$ENDIF} + +function GetAltKeyName: String; +{ This silly function is needed since ShortCutToText(VK_MENU) fails on Delphi + and C++Builder versions <= 4 } +{$IFNDEF CLR} +var + ScanCode: UINT; + KeyName: array[0..255] of Char; +begin + ScanCode := MapVirtualKey(VK_MENU, 0) shl 16; + if (ScanCode <> 0) and + (GetKeyNameText(ScanCode, KeyName, SizeOf(KeyName) div SizeOf(KeyName[0])) > 0) then + Result := KeyName + else + Result := 'Alt'; { shouldn't get here, but just in case... } +end; +{$ELSE} +begin + Result := ShortCutToText(VK_MENU); +end; +{$ENDIF} + +function VarIsInteger(const AVar: TTBVariant): Boolean; +{ Returns True if the specified variant is of type VT_I4, the only integer + type used/allowed in MSAA } +begin + {$IFNDEF CLR} + Result := (VarType(AVar) = varInteger); + {$ELSE} + Result := Assigned(AVar) and (System.Type.GetTypeCode(AVar.GetType) = TypeCode.Int32); + {$ENDIF} +end; + +procedure AssignObjectToVar(var AVariant: TTBVariant; const AObject: TTBBaseAccObject); +{ Creates a VT_DISPATCH-type variant that references AObject } +begin + {$IFNDEF CLR} + AVariant := IDispatch(AObject); + {$ELSE} + AVariant := AObject; + {$ENDIF} +end; + +{ TTBCustomAccObject } + +{$IFNDEF CLR} +constructor TTBCustomAccObject.Create; +begin + inherited Create; + { Add Self to linked list of objects } + EnterCriticalSection(LastAccObjectCritSect); + try + FPrevious := LastAccObject; + if Assigned(FPrevious) then + FPrevious.FNext := Self; + LastAccObject := Self; + finally + LeaveCriticalSection(LastAccObjectCritSect); + end; +end; +{$ENDIF} + +{$IFNDEF CLR} +destructor TTBCustomAccObject.Destroy; +begin + { Remove Self from linked list of objects } + EnterCriticalSection(LastAccObjectCritSect); + try + if LastAccObject = Self then + LastAccObject := FPrevious; + if Assigned(FPrevious) then + FPrevious.FNext := FNext; + if Assigned(FNext) then + FNext.FPrevious := FPrevious; + finally + LeaveCriticalSection(LastAccObjectCritSect); + end; + inherited; +end; +{$ENDIF} + +{ TTBViewAccObject } + +constructor TTBViewAccObject.Create(AView: TTBView); +begin + inherited Create; + FView := AView; + InterlockedIncrement(ViewAccObjectInstances); +end; + +{$IFNDEF CLR} +destructor TTBViewAccObject.Destroy; +begin + InterlockedDecrement(ViewAccObjectInstances); + if Assigned(FView) then begin + TTBViewAccess(FView).FAccObjectInstance := nil; + FView := nil; + end; + inherited; +end; +{$ELSE} +procedure TTBViewAccObject.Finalize; +begin + InterlockedDecrement(ViewAccObjectInstances); + inherited; +end; +{$ENDIF} + +procedure TTBViewAccObject.ClientIsDestroying; +begin + FView := nil; +end; + +function TTBViewAccObject.Check(const varChild: TTBVariant; + var ErrorCode: HRESULT): Boolean; +begin + if FView = nil then begin + ErrorCode := E_FAIL; + Result := False; + end + else if not VarIsInteger(varChild) or (Integer(varChild) <> CHILDID_SELF) then begin + ErrorCode := E_INVALIDARG; + Result := False; + end + else + Result := True; +end; + +function TTBViewAccObject.accDoDefaultAction(varChild: TTBVariant): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBViewAccObject.accHitTest(xLeft, yTop: Integer; + out pvarID: TTBVariant): HRESULT; +var + ViewWnd, W: HWND; + R: TRect; + P: TPoint; + D: {$IFNDEF CLR} IDispatch {$ELSE} TObject {$ENDIF}; + V: TTBItemViewer; +begin + try + if FView = nil then begin + Result := E_FAIL; + Exit; + end; + ViewWnd := FView.Window.Handle; + GetWindowRect(ViewWnd, R); + P.X := xLeft; + P.Y := yTop; + if PtInRect(R, P) then begin + P := FView.Window.ScreenToClient(P); + W := ChildWindowFromPointEx(ViewWnd, P, CWP_SKIPINVISIBLE); + if (W <> 0) and (W <> ViewWnd) then begin + { Point is inside a child window (most likely belonging to a + TTBControlItem) } + Result := AccObjectFromWindow(W, D); + pvarID := D; + end + else begin + V := FView.ViewerFromPoint(P); + if Assigned(V) then + AssignObjectToVar(pvarID, V.GetAccObject) + else + pvarID := TTBVariant(Integer(CHILDID_SELF)); + Result := S_OK; + end; + end + else + Result := S_FALSE; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.accLocation(out pxLeft, pyTop, pcxWidth, + pcyHeight: Integer; varChild: TTBVariant): HRESULT; +var + R: TRect; +begin + try + if not Check(varChild, Result) then + Exit; + GetWindowRect(FView.Window.Handle, R); + pxLeft := R.Left; + pyTop := R.Top; + pcxWidth := R.Right - R.Left; + pcyHeight := R.Bottom - R.Top; + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.accNavigate(navDir: Integer; varStart: TTBVariant; + out pvarEnd: TTBVariant): HRESULT; +var + I: Integer; +begin + try + if not Check(varStart, Result) then + Exit; + Result := S_FALSE; + case navDir of + NAVDIR_FIRSTCHILD: begin + for I := 0 to FView.ViewerCount-1 do + if FView.Viewers[I].IsAccessible then begin + AssignObjectToVar(pvarEnd, FView.Viewers[I].GetAccObject); + Result := S_OK; + Break; + end; + end; + NAVDIR_LASTCHILD: begin + for I := FView.ViewerCount-1 downto 0 do + if FView.Viewers[I].IsAccessible then begin + AssignObjectToVar(pvarEnd, FView.Viewers[I].GetAccObject); + Result := S_OK; + Break; + end; + end; + end; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.accSelect(flagsSelect: Integer; + varChild: TTBVariant): HRESULT; +begin + Result := DISP_E_MEMBERNOTFOUND; +end; + +function TTBViewAccObject.get_accChild(varChild: TTBVariant; + out ppdispChild {$IFNDEF CLR}: IDispatch{$ENDIF}): HRESULT; +var + I, J: Integer; + Viewer: TTBItemViewer; + Ctl: TControl; +begin + try + if FView = nil then begin + Result := E_FAIL; + Exit; + end; + if not VarIsInteger(varChild) then begin + Result := E_INVALIDARG; + Exit; + end; + I := Integer(varChild); + if I = CHILDID_SELF then begin + ppdispChild := Self; + Result := S_OK; + end + else begin + { Convert a one-based child index (I) into a real viewer index (J) } + J := 0; + while J < FView.ViewerCount do begin + if FView.Viewers[J].IsAccessible then begin + if I = 1 then Break; + Dec(I); + end; + Inc(J); + end; + if J >= FView.ViewerCount then begin + { 'I' was either negative or too high } + Result := E_INVALIDARG; + Exit; + end; + Viewer := FView.Viewers[J]; + if Viewer.Item is TTBControlItem then begin + { For windowed controls, return the window's accessible object instead + of the item viewer's } + Ctl := TTBControlItem(Viewer.Item).Control; + if (Ctl is TWinControl) and TWinControl(Ctl).HandleAllocated then begin + Result := AccObjectFromWindow(TWinControl(Ctl).Handle, ppdispChild); + Exit; + end; + end; + ppdispChild := Viewer.GetAccObject; + Result := S_OK; + end; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.get_accChildCount(out pcountChildren: Integer): HRESULT; +var + Count, I: Integer; +begin + try + if Assigned(FView) then begin + Count := 0; + for I := 0 to FView.ViewerCount-1 do + if FView.Viewers[I].IsAccessible then + Inc(Count); + pCountChildren := Count; + Result := S_OK; + end + else + Result := E_FAIL; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.get_accDefaultAction(varChild: TTBVariant; + out pszDefaultAction: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBViewAccObject.get_accDescription(varChild: TTBVariant; + out pszDescription: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBViewAccObject.get_accFocus(out pvarID: TTBVariant): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBViewAccObject.get_accHelp(varChild: TTBVariant; + out pszHelp: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBViewAccObject.get_accHelpTopic(out pszHelpFile: WideString; + varChild: TTBVariant; out pidTopic: Integer): HRESULT; +begin + pidTopic := 0; { Delphi doesn't implicitly clear Integer 'out' parameters } + Result := S_FALSE; +end; + +function TTBViewAccObject.get_accKeyboardShortcut(varChild: TTBVariant; + out pszKeyboardShortcut: WideString): HRESULT; +begin + try + if not Check(varChild, Result) then + Exit; + if vsMenuBar in FView.Style then begin + pszKeyboardShortcut := GetAltKeyName; + Result := S_OK; + end + else + Result := S_FALSE; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.get_accName(varChild: TTBVariant; + out pszName: WideString): HRESULT; +var + S: String; +begin + try + if not Check(varChild, Result) then + Exit; + if Assigned(FView.ParentView) and Assigned(FView.ParentView.OpenViewer) then + S := StripAccelChars(TTBItemViewerAccess(FView.ParentView.OpenViewer).GetCaptionText); + if S = '' then + {$IFNDEF CLR} + S := TControlAccess(FView.Window).Caption; + {$ELSE} + S := FView.Window.GetText; + {$ENDIF} + pszName := S; + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.get_accParent(out ppdispParent {$IFNDEF CLR}: IDispatch{$ENDIF}): HRESULT; +begin + try + if Assigned(FView) then begin + if Assigned(FView.ParentView) and Assigned(FView.ParentView.OpenViewer) then begin + ppdispParent := FView.ParentView.OpenViewer.GetAccObject; + Result := S_OK; + end + else + Result := AccObjectFromWindow(FView.Window.Handle, ppdispParent); + end + else + Result := E_FAIL; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.get_accRole(varChild: TTBVariant; + out pvarRole: TTBVariant): HRESULT; +var + Role: Integer; +begin + try + if not Check(varChild, Result) then + Exit; + if FView.IsPopup then + Role := ROLE_SYSTEM_MENUPOPUP + else begin + if vsMenuBar in FView.Style then + Role := ROLE_SYSTEM_MENUBAR + else + Role := ROLE_SYSTEM_TOOLBAR; + end; + pvarRole := TTBVariant(Role); + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.get_accSelection(out pvarChildren: TTBVariant): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBViewAccObject.get_accState(varChild: TTBVariant; + out pvarState: TTBVariant): HRESULT; +begin + try + if not Check(varChild, Result) then + Exit; + pvarState := TTBVariant(Integer(0)); + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBViewAccObject.get_accValue(varChild: TTBVariant; + out pszValue: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBViewAccObject.put_accName(varChild: TTBVariant; + const pszName: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBViewAccObject.put_accValue(varChild: TTBVariant; + const pszValue: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +{ TTBItemViewerAccObject } + +constructor TTBItemViewerAccObject.Create(AViewer: TTBItemViewer); +begin + inherited Create; + FViewer := AViewer; + InterlockedIncrement(ItemViewerAccObjectInstances); +end; + +{$IFNDEF CLR} +destructor TTBItemViewerAccObject.Destroy; +begin + InterlockedDecrement(ItemViewerAccObjectInstances); + if Assigned(FViewer) then begin + TTBItemViewerAccess(FViewer).FAccObjectInstance := nil; + FViewer := nil; + end; + inherited; +end; +{$ELSE} +procedure TTBItemViewerAccObject.Finalize; +begin + InterlockedDecrement(ItemViewerAccObjectInstances); + inherited; +end; +{$ENDIF} + +procedure TTBItemViewerAccObject.ClientIsDestroying; +begin + FViewer := nil; +end; + +function TTBItemViewerAccObject.Check(const varChild: TTBVariant; + var ErrorCode: HRESULT): Boolean; +begin + if FViewer = nil then begin + ErrorCode := E_FAIL; + Result := False; + end + else if not VarIsInteger(varChild) or (Integer(varChild) <> CHILDID_SELF) then begin + ErrorCode := E_INVALIDARG; + Result := False; + end + else + Result := True; +end; + +function TTBItemViewerAccObject.IsActionable: Boolean; +{ Returns True if 'doDefaultAction' may be performed on the viewer, i.e. if + it's visible/off-edge/clipped, enabled & selectable, and the view is + focusable. } +begin + Result := FViewer.IsAccessible and IsAvailable and IsFocusable; +end; + +function TTBItemViewerAccObject.IsAvailable: Boolean; +{ Returns True if the viewer's item is enabled and selectable } +begin + Result := FViewer.Item.Enabled and + (tbisSelectable in TTBCustomItemAccess(FViewer.Item).ItemStyle); +end; + +function TTBItemViewerAccObject.IsFocusable: Boolean; +{ Returns True if viewers on the view can be 'focused' (i.e. the view's window + doesn't have the csDesigning state, the window is visible and enabled, and + the application is active). } + + function IsWindowAndParentsEnabled(W: HWND): Boolean; + begin + Result := True; + repeat + if not IsWindowEnabled(W) then begin + Result := False; + Break; + end; + W := GetParent(W); + until W = 0; + end; + +var + ViewWnd, ActiveWnd: HWND; +begin + Result := False; + if csDesigning in FViewer.View.Window.ComponentState then + Exit; + ViewWnd := FViewer.View.Window.Handle; + if IsWindowVisible(ViewWnd) and IsWindowAndParentsEnabled(ViewWnd) then begin + if vsModal in FViewer.View.State then + Result := True + else begin + ActiveWnd := GetActiveWindow; + if (ActiveWnd <> 0) and + ((ActiveWnd = ViewWnd) or IsChild(ActiveWnd, ViewWnd)) then + Result := True; + end; + end; +end; + +procedure TTBItemViewerAccObject.HandleAccSelect(const AExecute: Boolean); +begin + if Assigned(FViewer) and + ((AExecute and IsActionable) or (not AExecute and IsFocusable)) then begin + FViewer.View.Selected := FViewer; + FViewer.View.ScrollSelectedIntoView; + if vsModal in FViewer.View.State then begin + if AExecute then + FViewer.View.ExecuteSelected(False); + end + else if (FViewer.View.ParentView = nil) and (GetCapture = 0) then begin + if AExecute then + FViewer.View.EnterToolbarLoop([tbetExecuteSelected, tbetFromMSAA]) + else + FViewer.View.EnterToolbarLoop([tbetFromMSAA]); + end; + end; +end; + +function TTBItemViewerAccObject.accDoDefaultAction(varChild: TTBVariant): HRESULT; +begin + try + if not Check(varChild, Result) then + Exit; + { NOTE: This must be kept in synch with get_accDefaultAction } + if IsActionable then begin + Result := S_OK; + if FViewer.View.OpenViewer = FViewer then begin + FViewer.View.CancelChildPopups; + { Like standard menus, cancel the modal loop when a top-level menu + is closed } + if (vsModal in FViewer.View.State) and not FViewer.View.IsPopup then + FViewer.View.EndModal; + end + else begin + FViewer.View.Selected := FViewer; + FViewer.View.ScrollSelectedIntoView; + TTBItemViewerAccess(FViewer).PostAccSelect(True); + end; + end + else + { Note: Standard menus return DISP_E_MEMBERNOTFOUND in this case but + that doesn't make much sense. The member is there but just isn't + currently available. } + Result := E_FAIL; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.accHitTest(xLeft, yTop: Integer; + out pvarID: TTBVariant): HRESULT; +var + P: TPoint; +begin + try + if FViewer = nil then begin + Result := E_FAIL; + Exit; + end; + P := FViewer.View.Window.ScreenToClient(Point(xLeft, yTop)); + if PtInRect(FViewer.BoundsRect, P) then begin + pvarID := TTBVariant(Integer(CHILDID_SELF)); + Result := S_OK; + end + else + Result := S_FALSE; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.accLocation(out pxLeft, pyTop, pcxWidth, + pcyHeight: Integer; varChild: TTBVariant): HRESULT; +var + R: TRect; + P: TPoint; +begin + try + if not Check(varChild, Result) then + Exit; + R := FViewer.BoundsRect; + P := FViewer.View.Window.ClientToScreen(Point(0, 0)); + OffsetRect(R, P.X, P.Y); + pxLeft := R.Left; + pyTop := R.Top; + pcxWidth := R.Right - R.Left; + pcyHeight := R.Bottom - R.Top; + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.accNavigate(navDir: Integer; varStart: TTBVariant; + out pvarEnd: TTBVariant): HRESULT; +var + I, J: Integer; + View: TTBView; +begin + try + if not Check(varStart, Result) then + Exit; + Result := S_FALSE; + if (navDir = NAVDIR_FIRSTCHILD) or (navDir = NAVDIR_LASTCHILD) then begin + { Return the child view's acc. object } + View := FViewer.View.OpenViewerView; + if Assigned(View) then begin + AssignObjectToVar(pvarEnd, View.GetAccObject); + Result := S_OK; + end; + end + else begin + I := FViewer.View.IndexOf(FViewer); + if I >= 0 then begin + case navDir of + NAVDIR_UP, NAVDIR_LEFT, NAVDIR_PREVIOUS: + for J := I-1 downto 0 do + if FViewer.View.Viewers[J].IsAccessible then begin + AssignObjectToVar(pvarEnd, FViewer.View.Viewers[J].GetAccObject); + Result := S_OK; + Break; + end; + NAVDIR_DOWN, NAVDIR_RIGHT, NAVDIR_NEXT: + for J := I+1 to FViewer.View.ViewerCount-1 do + if FViewer.View.Viewers[J].IsAccessible then begin + AssignObjectToVar(pvarEnd, FViewer.View.Viewers[J].GetAccObject); + Result := S_OK; + Break; + end; + end; + end; + end; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.accSelect(flagsSelect: Integer; + varChild: TTBVariant): HRESULT; +begin + try + if not Check(varChild, Result) then + Exit; + if flagsSelect <> SELFLAG_TAKEFOCUS then begin + Result := E_INVALIDARG; + Exit; + end; + if IsFocusable and (FViewer.Show or FViewer.Clipped) then begin + FViewer.View.Selected := FViewer; + FViewer.View.ScrollSelectedIntoView; + if not(vsModal in FViewer.View.State) and + (FViewer.View.ParentView = nil) then + TTBItemViewerAccess(FViewer).PostAccSelect(False); + end + else + Result := E_FAIL; + { ^ what Office XP returns when you try focusing an off-edge item } + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accChild(varChild: TTBVariant; + out ppdispChild {$IFNDEF CLR}: IDispatch{$ENDIF}): HRESULT; +var + View: TTBView; +begin + try + if FViewer = nil then begin + Result := E_FAIL; + Exit; + end; + Result := E_INVALIDARG; + if VarIsInteger(varChild) then begin + if Integer(varChild) = CHILDID_SELF then begin + ppdispChild := Self; + Result := S_OK; + end + else if Integer(varChild) = 1 then begin + { Return the child view's acc. object } + View := FViewer.View.OpenViewerView; + if Assigned(View) then begin + ppdispChild := View.GetAccObject; + Result := S_OK; + end; + end; + end; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accChildCount(out pcountChildren: Integer): HRESULT; +begin + try + if FViewer = nil then begin + Result := E_FAIL; + Exit; + end; + { Return 1 if the viewer has a child view } + if FViewer.View.OpenViewer = FViewer then + pCountChildren := 1 + else + pCountChildren := 0; + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accDefaultAction(varChild: TTBVariant; + out pszDefaultAction: WideString): HRESULT; +begin + try + if not Check(varChild, Result) then + Exit; + if IsActionable then begin + { I'm not sure if these should be localized, or even if any screen + readers make use of this text... + NOTE: This must be kept in synch with accDoDefaultAction } + if FViewer.View.OpenViewer = FViewer then + pszDefaultAction := 'Close' + else if tbisSubmenu in TTBCustomItemAccess(FViewer.Item).ItemStyle then + pszDefaultAction := 'Open' + else if FViewer.View.IsPopup or (vsMenuBar in FViewer.View.Style) then + pszDefaultAction := 'Execute' + else + pszDefaultAction := 'Press'; + Result := S_OK; + end + else + Result := S_FALSE; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accDescription(varChild: TTBVariant; + out pszDescription: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBItemViewerAccObject.get_accFocus(out pvarID: TTBVariant): HRESULT; +begin + try + if FViewer = nil then begin + Result := E_FAIL; + Exit; + end; + if (vsModal in FViewer.View.State) and + (FViewer.View.Selected = FViewer) then begin + pvarID := TTBVariant(Integer(CHILDID_SELF)); + Result := S_OK; + end + else + Result := S_FALSE; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accHelp(varChild: TTBVariant; + out pszHelp: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBItemViewerAccObject.get_accHelpTopic(out pszHelpFile: WideString; + varChild: TTBVariant; out pidTopic: Integer): HRESULT; +begin + pidTopic := 0; { Delphi doesn't implicitly clear Integer 'out' parameters } + Result := S_FALSE; +end; + +function TTBItemViewerAccObject.get_accKeyboardShortcut(varChild: TTBVariant; + out pszKeyboardShortcut: WideString): HRESULT; +var + C: Char; +begin + try + if not Check(varChild, Result) then + Exit; + Result := S_FALSE; + if TTBItemViewerAccess(FViewer).CaptionShown then begin + C := FindAccelChar(TTBItemViewerAccess(FViewer).GetCaptionText); + if C <> #0 then begin + C := CharToLower(C); { like standard menus, always use lowercase... } + if FViewer.View.IsPopup then + pszKeyboardShortcut := C + else begin + { Prefix 'Alt+' } + pszKeyboardShortcut := GetAltKeyName + '+' + C; + end; + Result := S_OK; + end; + end; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accName(varChild: TTBVariant; + out pszName: WideString): HRESULT; +var + C, S: String; +begin + try + if not Check(varChild, Result) then + Exit; + C := StripAccelChars(TTBItemViewerAccess(FViewer).GetCaptionText); + if not FViewer.IsToolbarStyle then + S := FViewer.Item.GetShortCutText; + if S = '' then + pszName := C + else + pszName := C + #9 + S; + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accParent(out ppdispParent {$IFNDEF CLR}: IDispatch{$ENDIF}): HRESULT; +begin + try + if Assigned(FViewer) then begin + ppdispParent := FViewer.View.GetAccObject; + Result := S_OK; + end + else + Result := E_FAIL; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accRole(varChild: TTBVariant; + out pvarRole: TTBVariant): HRESULT; +begin + try + if not Check(varChild, Result) then + Exit; + pvarRole := TTBVariant(Integer(TTBItemViewerAccess(FViewer).GetAccRole)); + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accSelection(out pvarChildren: TTBVariant): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBItemViewerAccObject.get_accState(varChild: TTBVariant; + out pvarState: TTBVariant): HRESULT; +var + Flags: Integer; +begin + try + if not Check(varChild, Result) then + Exit; + Flags := 0; + if FViewer.View.Selected = FViewer then begin + Flags := Flags or STATE_SYSTEM_HOTTRACKED; + if vsModal in FViewer.View.State then + Flags := Flags or STATE_SYSTEM_FOCUSED; + if FViewer.View.MouseOverSelected and FViewer.View.Capture then + { ^ based on "IsPushed :=" code in TTBView.DrawItem } + Flags := Flags or STATE_SYSTEM_PRESSED; + end; + if tbisSubmenu in TTBCustomItemAccess(FViewer.Item).ItemStyle then + Flags := Flags or STATE_SYSTEM_HASPOPUP; + if FViewer.Show or FViewer.Clipped then begin + if IsFocusable then + Flags := Flags or STATE_SYSTEM_FOCUSABLE; + end + else begin + { Mark off-edge items as invisible, like Office } + Flags := Flags or STATE_SYSTEM_INVISIBLE; + end; + if not IsAvailable then + Flags := Flags or STATE_SYSTEM_UNAVAILABLE; + if FViewer.Item.Checked then + Flags := Flags or STATE_SYSTEM_CHECKED; + pvarState := TTBVariant(Flags); + Result := S_OK; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.get_accValue(varChild: TTBVariant; + out pszValue: WideString): HRESULT; +begin + try + if not Check(varChild, Result) then + Exit; + if TTBItemViewerAccess(FViewer).GetAccValue(pszValue) then + Result := S_OK + else begin + { When S_FALSE is returned, the Inspect tool wants NULL in pszValue. + On Delphi for Win32, '' is NULL. On .NET, we have to assign nil. } + pszValue := {$IFNDEF CLR} '' {$ELSE} nil {$ENDIF}; + Result := S_FALSE; + end; + except + Result := E_UNEXPECTED; + end; +end; + +function TTBItemViewerAccObject.put_accName(varChild: TTBVariant; + const pszName: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +function TTBItemViewerAccObject.put_accValue(varChild: TTBVariant; + const pszValue: WideString): HRESULT; +begin + Result := S_FALSE; +end; + +{$IFNDEF CLR} +{ Note: This COM initialization code based on code from DBTables } +var + SaveInitProc: Pointer; + NeedToUninitialize: Boolean; + +procedure InitCOM; +begin + if SaveInitProc <> nil then TProcedure(SaveInitProc); + NeedToUninitialize := SUCCEEDED(CoInitialize(nil)); +end; + +initialization + InitializeCriticalSection(LastAccObjectCritSect); + if not IsLibrary then begin + SaveInitProc := InitProc; + InitProc := @InitCOM; + end; +finalization + DisconnectAccObjects; + if NeedToUninitialize then + CoUninitialize; + DeleteCriticalSection(LastAccObjectCritSect); +{$ENDIF} +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Anim.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Anim.pas new file mode 100644 index 0000000..96d9756 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Anim.pas @@ -0,0 +1,323 @@ +unit TB2Anim; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Anim.pas,v 1.13 2008/09/19 16:41:00 jr Exp $ +} + +interface + +{$I TB2Ver.inc} +{$Q-} + +uses + Windows, Messages, SysUtils, Classes; + +const + WM_TB2K_ANIMATIONENDED = WM_USER + $556; + +type + TTBAnimationDirection = set of (tbadLeft, tbadRight, tbadDown, tbadUp); + +procedure TBStartAnimation(const AWnd: HWND; const ABlend: Boolean; + const ADirection: TTBAnimationDirection); +procedure TBUpdateAnimation; +procedure TBEndAnimation(const Wnd: HWND); +function TBIsAnimationInProgress: Boolean; + +implementation + +uses + {$IFDEF CLR} System.Security, System.Runtime.InteropServices, System.Threading, {$ENDIF} + TB2Common; + +{ Notes to self: + - It originally had the NOMIRRORBITMAP flag on the BitBlt calls, because + Windows 2000's AnimateWindow function has it. But it had to be removed + because on Windows 98 with the Standard VGA or VMware video driver, it + caused no bits to be blitted, even though Windows 98 is supposed to + support NOMIRRORBITMAP according to the documentation. I don't think it's + necessary anyway. +} + +const + DCX_USESTYLE = $10000; + WS_EX_LAYERED = $80000; + NOMIRRORBITMAP = $80000000; + ULW_ALPHA = 2; + +type + PAnimateThreadFuncData = ^TAnimateThreadFuncData; + TAnimateThreadFuncData = record + FRunning: Boolean; + FWnd: HWND; + FTime: Integer; + FBlending: Boolean; + FStartStep, FCurStep: Integer; + FStartTime, FLastFrameTime: DWORD; + FWndDC, FBmpDC: HDC; + FBmp: HBITMAP; + FScreenClientRect: TRect; + FSize: TSize; + FLastPos: TPoint; + FDirection: TTBAnimationDirection; + end; + { Delphi.NET 2007 note: Because TRect/TSize/TPoint are wrongly declared as + 'packed', fields of these types must be preceded by an Integer- or + IntPtr-sized field to ensure correct alignment and avoid an alignment + fault on IA-64. } + +{$IFNDEF CLR} +var + UpdateLayeredWindowProc: function(Handle: HWND; hdcDest: HDC; + pptDst: PPoint; _psize: PSize; hdcSrc: HDC; pptSrc: PPoint; + crKey: COLORREF; var pblend: TBLENDFUNCTION; dwFlags: DWORD): BOOL; stdcall; +{$ELSE} +{ We can't use Borland.Vcl.Windows' UpdateLayeredWindow because the "pblend" + parameter is misdeclared (see QC #25130) } +[SuppressUnmanagedCodeSecurity, DllImport(user32, CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'UpdateLayeredWindow')] +function UpdateLayeredWindowProc(Handle: HWND; hdcDest: HDC; const pptDst: TPoint; + const _psize: TSize; hdcSrc: HDC; const pptSrc: TPoint; + crKey: COLORREF; [in] var pblend: TBLENDFUNCTION; dwFlags: DWORD): BOOL; overload; external; +[SuppressUnmanagedCodeSecurity, DllImport(user32, CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'UpdateLayeredWindow')] +function UpdateLayeredWindowProc(Handle: HWND; hdcDest: HDC; pptDst: IntPtr; + _psize: IntPtr; hdcSrc: HDC; pptSrc: IntPtr; + crKey: COLORREF; [in] var pblend: TBLENDFUNCTION; dwFlags: DWORD): BOOL; overload; external; +{$ENDIF} + +threadvar + AnimateData: TAnimateThreadFuncData; + +procedure FinalizeAnimation; +begin + {$IFNDEF CLR} + with PAnimateThreadFuncData(@AnimateData)^ do begin + {$ELSE} + with AnimateData do begin + {$ENDIF} + FRunning := False; + if FBmpDC <> 0 then begin + if FBlending then + SetWindowLong(FWnd, GWL_EXSTYLE, + GetWindowLong(FWnd, GWL_EXSTYLE) and not WS_EX_LAYERED) + else + SetWindowRgn(FWnd, 0, False); + BitBlt(FWndDC, 0, 0, FSize.cx, FSize.cy, FBmpDC, 0, 0, SRCCOPY); + DeleteDC(FBmpDC); + FBmpDC := 0; + end; + if FBmp <> 0 then begin + DeleteObject(FBmp); + FBmp := 0; + end; + if FWndDC <> 0 then begin + ReleaseDC(FWnd, FWndDC); + FWndDC := 0; + end; + if FWnd <> 0 then begin + SendNotifyMessage(FWnd, WM_TB2K_ANIMATIONENDED, 0, 0); + FWnd := 0; + end; + end; +end; + +function TBIsAnimationInProgress: Boolean; +begin + Result := AnimateData.FRunning; +end; + +procedure TBEndAnimation(const Wnd: HWND); +begin + if AnimateData.FRunning and + ((Wnd = 0) or (AnimateData.FWnd = Wnd)) then + FinalizeAnimation; +end; + +procedure TBStartAnimation(const AWnd: HWND; const ABlend: Boolean; + const ADirection: TTBAnimationDirection); +var + ZeroPt: TPoint; + R: TRect; + Blend: TBlendFunction; + Rgn: HRGN; +begin + FinalizeAnimation; + + ZeroPt.X := 0; + ZeroPt.Y := 0; + + try + {$IFNDEF CLR} + { Note: The pointer cast avoids GetTls calls for every field access } + with PAnimateThreadFuncData(@AnimateData)^ do begin + {$ELSE} + with AnimateData do begin + {$ENDIF} + FWnd := AWnd; + FBlending := ABlend and {$IFNDEF CLR} Assigned(UpdateLayeredWindowProc) + {$ELSE} (Win32MajorVersion >= 5) {$ENDIF}; + FDirection := ADirection; + GetCursorPos(FLastPos); + GetClientRect(FWnd, FScreenClientRect); + MapWindowPoints(FWnd, 0, FScreenClientRect, 2); + GetWindowRect(FWnd, R); + FWndDC := GetDCEx(FWnd, 0, DCX_WINDOW or DCX_CACHE {or DCX_USESTYLE ?}); + if FWndDC = 0 then + RaiseLastOSError; + FSize.cx := R.Right - R.Left; + FSize.cy := R.Bottom - R.Top; + FBmp := CreateCompatibleBitmap(FWndDC, FSize.cx, FSize.cy {or $01000000 ?}); + if FBmp = 0 then + RaiseLastOSError; + FBmpDC := CreateCompatibleDC(FWndDC); + if FBmpDC = 0 then + RaiseLastOSError; + // AnimateWindow calls SetLayout, but I'm not sure that we need to. + //if Assigned(SetLayoutProc) then + // SetLayoutProc(FBmpDC, 0); + SelectObject(FBmpDC, FBmp); + //SetBoundsRect(FBmpDC, nil, DCB_RESET or DCB_ENABLE); + SendMessage(FWnd, WM_PRINT, WPARAM(FBmpDC), PRF_NONCLIENT or PRF_CLIENT or + PRF_ERASEBKGND or PRF_CHILDREN); + //GetBoundsRect + if FBlending then begin + SetWindowLong(FWnd, GWL_EXSTYLE, GetWindowLong(FWnd, GWL_EXSTYLE) or WS_EX_LAYERED); + FTime := 175; { actually more like ~147 because FCurStep starts at 40 } + FCurStep := 40; + Blend.BlendOp := AC_SRC_OVER; + Blend.BlendFlags := 0; + Blend.SourceConstantAlpha := FCurStep; + Blend.AlphaFormat := 0; + Win32Check(UpdateLayeredWindowProc(FWnd, 0, {$IFNDEF CLR}@{$ENDIF} R.TopLeft, + {$IFNDEF CLR}@{$ENDIF} FSize, FBmpDC, {$IFNDEF CLR}@{$ENDIF} ZeroPt, + 0, Blend, ULW_ALPHA)); + end + else begin + FTime := 150; + FCurStep := 0; + Rgn := CreateRectRgn(0, 0, 0, 0); + if not BOOL(SetWindowRgn(FWnd, Rgn, False)) then + DeleteObject(Rgn); { just in case } + end; + FStartStep := FCurStep; + FStartTime := GetTickCount; + FLastFrameTime := FStartTime; + { These are the same flags AnimateWindow uses. SWP_ASYNCWINDOWPOS is + needed or else it doesn't "save bits" properly. + Note: SWP_ASYNCWINDOWPOS seems to have no effect on Windows 95 & NT 4.0, + so bits behind the window are not saved & restored correctly. } + SetWindowPos(FWnd, 0, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE or + SWP_NOZORDER or SWP_NOACTIVATE or SWP_SHOWWINDOW or SWP_NOREDRAW or + SWP_NOOWNERZORDER or SWP_ASYNCWINDOWPOS); + FRunning := True; + end; + except + FinalizeAnimation; + raise; + end; +end; + +procedure TBUpdateAnimation; +var + ThisFrameTime: DWORD; + ElapsedTime, NewStep: Integer; + P: TPoint; + Blend: TBlendFunction; + X, Y: Integer; + Rgn: HRGN; +begin + {$IFNDEF CLR} + with PAnimateThreadFuncData(@AnimateData)^ do begin + {$ELSE} + with AnimateData do begin + {$ENDIF} + if not FRunning then + Exit; + + { If 10 msec hasn't passed since the last call, exit. We don't want to + monopolize the CPU. } + ThisFrameTime := GetTickCount; + if ThisFrameTime - FLastFrameTime < 10 then + Exit; + FLastFrameTime := ThisFrameTime; + + ElapsedTime := ThisFrameTime - FStartTime; + if (ElapsedTime < 0) or (ElapsedTime >= FTime) then begin + FinalizeAnimation; + Exit; + end; + NewStep := FStartStep + ((255 * ElapsedTime) div FTime); + if (NewStep < 0) or (NewStep >= 255) then begin + FinalizeAnimation; + Exit; + end; + + GetCursorPos(P); + if (P.X <> FLastPos.X) or (P.Y <> FLastPos.Y) then begin + if PtInRect(FScreenClientRect, P) then begin + FinalizeAnimation; + Exit; + end; + FLastPos := P; + end; + + if NewStep > FCurStep then begin + FCurStep := NewStep; + if FBlending then begin + Blend.BlendOp := AC_SRC_OVER; + Blend.BlendFlags := 0; + Blend.SourceConstantAlpha := NewStep; + Blend.AlphaFormat := 0; + UpdateLayeredWindowProc(FWnd, 0, nil, nil, 0, nil, 0, Blend, ULW_ALPHA); + end + else begin + if tbadDown in FDirection then + Y := MulDiv(FSize.cy, NewStep, 255) - FSize.cy + else if tbadUp in FDirection then + Y := FSize.cy - MulDiv(FSize.cy, NewStep, 255) + else + Y := 0; + if tbadRight in FDirection then + X := MulDiv(FSize.cx, NewStep, 255) - FSize.cx + else if tbadLeft in FDirection then + X := FSize.cx - MulDiv(FSize.cx, NewStep, 255) + else + X := 0; + Rgn := CreateRectRgn(X, Y, X + FSize.cx, Y + FSize.cy); + if not BOOL(SetWindowRgn(FWnd, Rgn, False)) then + DeleteObject(Rgn); { just in case } + BitBlt(FWndDC, X, Y, FSize.cx, FSize.cy, FBmpDC, 0, 0, SRCCOPY); + end; + end; + end; +end; + +initialization + {$IFNDEF CLR} + UpdateLayeredWindowProc := GetProcAddress(GetModuleHandle(user32), + 'UpdateLayeredWindow'); + {$ENDIF} +finalization + FinalizeAnimation; +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Common.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Common.pas new file mode 100644 index 0000000..e94bb9d --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Common.pas @@ -0,0 +1,1571 @@ +unit TB2Common; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Common.pas,v 1.48 2008/09/17 19:46:30 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, Classes, SysUtils, Messages, Controls, Forms; + +type + THandleWMPrintNCPaintProc = procedure(Wnd: HWND; DC: HDC; AppData: TObject); + TPaintHandlerProc = procedure(var Message: TWMPaint) of object; + + { The type of item a TList holds; it differs between Win32 and .NET VCL } + TListItemType = {$IFNDEF CLR} Pointer {$ELSE} TObject {$ENDIF}; + + {$IFNDEF CLR} + ClipToLongint = Longint; + {$ENDIF} + +function AddToFrontOfList(var List: TList; Item: TObject): Boolean; +function AddToList(var List: TList; Item: TObject): Boolean; +function ApplicationIsActive: Boolean; +function AreFlatMenusEnabled: Boolean; +function AreKeyboardCuesEnabled: Boolean; +procedure CallLockSetForegroundWindow(const ALock: Boolean); +function CallTrackMouseEvent(const Wnd: HWND; const Flags: DWORD): Boolean; +function CharToLower(const C: Char): Char; +{$IFDEF CLR} +function ClipToLongint(const I: Int64): Longint; inline; +{$ENDIF} +function CreateHalftoneBrush: HBRUSH; +function CreateMonoBitmap(const AWidth, AHeight: Integer; + const ABits: array of Byte): HBITMAP; +function CreateRotatedFont(DC: HDC): HFONT; +procedure DoubleBufferedRepaint(const Wnd: HWND); +procedure DrawHalftoneInvertRect(const DC: HDC; const NewRect, OldRect: TRect; + const NewSize, OldSize: TSize); +procedure DrawRotatedText(const DC: HDC; AText: String; const ARect: TRect; + const AFormat: Cardinal); +procedure DrawSmallWindowCaption(const Wnd: HWND; const DC: HDC; + const ARect: TRect; const AText: String; const AActive: Boolean); +function DrawTextStr(const DC: HDC; const AText: String; var ARect: TRect; + const AFormat: UINT): Integer; +function EscapeAmpersands(const S: String): String; +procedure FillRectWithGradient(const DC: HDC; const R: TRect; + const StartColor, EndColor: TColorRef; const HorizontalDirection: Boolean); +function FindAccelChar(const S: String): Char; +{$IFNDEF JR_D5} +procedure FreeAndNil(var Obj); +{$ENDIF} +function GetInputLocaleCodePage: UINT; +function GetMenuShowDelay: Integer; +function GetMessagePosAsPoint: TPoint; +function GetRectOfMonitorContainingPoint(const P: TPoint; const WorkArea: Boolean): TRect; +function GetRectOfMonitorContainingRect(const R: TRect; const WorkArea: Boolean): TRect; +function GetRectOfMonitorContainingWindow(const W: HWND; const WorkArea: Boolean): TRect; +function GetRectOfPrimaryMonitor(const WorkArea: Boolean): TRect; +function GetSystemNonClientMetrics(var Metrics: TNonClientMetrics): Boolean; +function GetSystemParametersInfoBool(const Param: UINT; const Default: BOOL): BOOL; +function GetTextExtentPoint32Str(const DC: HDC; const AText: String; + out ASize: TSize): BOOL; +function GetTextHeight(const DC: HDC): Integer; +function GetTextWidth(const DC: HDC; S: String; const Prefix: Boolean): Integer; +procedure HandleWMPrint(const Wnd: HWND; var Message: TMessage; + const NCPaintFunc: THandleWMPrintNCPaintProc; const AppData: TObject); +procedure HandleWMPrintClient(const PaintHandlerProc: TPaintHandlerProc; + const Message: {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); +function IsWindowsXP: Boolean; +procedure InitTrackMouseEvent; +{$IFNDEF JR_D6} +function InvalidPoint(const At: TPoint): Boolean; +{$ENDIF} +function IsFillRectWithGradientAvailable: Boolean; +function Max(A, B: Integer): Integer; +function Min(A, B: Integer): Integer; +{$IFNDEF CLR} +function MethodsEqual(const M1, M2: TMethod): Boolean; +{$ENDIF} +function NeedToPlaySound(const Alias: String): Boolean; +procedure PlaySystemSound(const Alias: String); +procedure ProcessPaintMessages; +{$IFNDEF JR_D6} +procedure RaiseLastOSError; +{$ENDIF} +procedure RemoveMessages(const AMin, AMax: Integer); +procedure RemoveFromList(var List: TList; Item: TObject); +procedure SelectNCUpdateRgn(Wnd: HWND; DC: HDC; Rgn: HRGN); +function StripAccelChars(const S: String): String; +function StripTrailingPunctuation(const S: String): String; +function TextOutStr(const DC: HDC; const X, Y: Integer; + const AText: String): BOOL; +function UsingMultipleMonitors: Boolean; + +const + PopupMenuWindowNCSize = 3; + DT_HIDEPREFIX = $00100000; + +implementation + +uses + {$IFDEF CLR} Types, System.Security, System.Runtime.InteropServices, + System.Text, MultiMon, {$ENDIF} + MMSYSTEM, TB2Version; + +function ApplicationIsActive: Boolean; +{ Returns True if the application is in the foreground } +begin + Result := GetActiveWindow <> 0; +end; + +type + {$IFNDEF CLR} + PPrintEnumProcData = ^TPrintEnumProcData; + TPrintEnumProcData = record + {$ELSE} + TPrintEnumProcData = class + private + {$ENDIF} + PrintChildren: Boolean; + ParentWnd: HWND; + DC: HDC; + PrintFlags: LPARAM; + {$IFDEF CLR} + function PrintEnumProc(Wnd: HWND; LParam: LPARAM): BOOL; + {$ENDIF} + end; + +{$IFNDEF CLR} +function PrintEnumProc(Wnd: HWND; LParam: LPARAM): BOOL; stdcall; +{$ELSE} +function TPrintEnumProcData.PrintEnumProc(Wnd: HWND; LParam: LPARAM): BOOL; +{$ENDIF} +var + R: TRect; + SaveIndex: Integer; +begin + Result := True; { continue enumerating } + {$IFNDEF CLR} + with PPrintEnumProcData(LParam)^ do + {$ENDIF} + begin + { Skip window if it isn't a child/owned window of ParentWnd or isn't visible } + if (HWND(GetWindowLong(Wnd, GWL_HWNDPARENT)) <> ParentWnd) or + (GetWindowLong(Wnd, GWL_STYLE) and WS_VISIBLE = 0) then + { ^ don't use IsWindowVisible since it returns False if the window's + parent window is not visible } + Exit; + GetWindowRect(Wnd, R); + MapWindowPoints(0, ParentWnd, R, 2); + SaveIndex := SaveDC(DC); + { Like Windows, offset the window origin to the top-left coordinates of + the child/owned window } + MoveWindowOrg(DC, R.Left, R.Top); + { Like Windows, intersect the clipping region with the entire rectangle of + the child/owned window } + OffsetRect(R, -R.Left, -R.Top); + IntersectClipRect(DC, R.Left, R.Top, R.Right, R.Bottom); + { Send a WM_PRINT message to the child/owned window } + SendMessage(Wnd, WM_PRINT, WPARAM(DC), PrintFlags); + { Restore the DC's state, in case the WM_PRINT handler didn't put things + back the way it found them } + RestoreDC(DC, SaveIndex); + end; +end; + +procedure HandleWMPrint(const Wnd: HWND; var Message: TMessage; + const NCPaintFunc: THandleWMPrintNCPaintProc; const AppData: TObject); +{ note: AppData is an application-defined value which is passed to NCPaintFunc } +var + DC: HDC; + SaveIndex, SaveIndex2: Integer; + R: TRect; + P: TPoint; + Data: TPrintEnumProcData; +begin + if (Message.LParam and PRF_CHECKVISIBLE = 0) or IsWindowVisible(Wnd) then begin + DC := HDC(Message.WParam); + SaveIndex2 := SaveDC(DC); + try + if Message.LParam and PRF_NONCLIENT <> 0 then begin + SaveIndex := SaveDC(DC); + if Assigned(NCPaintFunc) then + NCPaintFunc(Wnd, DC, AppData); + RestoreDC(DC, SaveIndex); + end; + { Calculate the difference between the top-left corner of the window + and the top-left corner of its client area } + GetWindowRect(Wnd, R); + P.X := 0; P.Y := 0; + ClientToScreen(Wnd, P); + Dec(P.X, R.Left); Dec(P.Y, R.Top); + if Message.LParam and PRF_CLIENT <> 0 then begin + { Like Windows, the flags PRF_ERASEBKGND, PRF_CHILDREN, and PRF_OWNED + are ignored if PRF_CLIENT isn't also specified } + if Message.LParam and PRF_ERASEBKGND <> 0 then begin + { Send WM_ERASEBKGND } + SaveIndex := SaveDC(DC); + if Message.LParam and PRF_NONCLIENT <> 0 then + MoveWindowOrg(DC, P.X, P.Y); + SendMessage(Wnd, WM_ERASEBKGND, Message.WParam, 0); + RestoreDC(DC, SaveIndex); + end; + { Send WM_PRINTCLIENT } + SaveIndex := SaveDC(DC); + if Message.LParam and PRF_NONCLIENT <> 0 then + MoveWindowOrg(DC, P.X, P.Y); + SendMessage(Wnd, WM_PRINTCLIENT, Message.WParam, 0); + RestoreDC(DC, SaveIndex); + { Like Windows, always offset child/owned windows by the size of the + client area even if PRF_NONCLIENT isn't specified (a bug?) } + MoveWindowOrg(DC, P.X, P.Y); + {$IFDEF CLR} + Data := TPrintEnumProcData.Create; + {$ENDIF} + Data.ParentWnd := Wnd; + Data.DC := DC; + { Send WM_PRINT to child/owned windows } + if Message.LParam and PRF_CHILDREN <> 0 then begin + Data.PrintChildren := True; + Data.PrintFlags := (Message.LParam or (PRF_NONCLIENT or PRF_CLIENT or + PRF_ERASEBKGND or PRF_CHILDREN)) and not PRF_CHECKVISIBLE; + {$IFNDEF CLR} + EnumChildWindows(Wnd, @PrintEnumProc, LPARAM(@Data)); + {$ELSE} + EnumChildWindows(Wnd, Data.PrintEnumProc, 0); + {$ENDIF} + end; + if Message.LParam and PRF_OWNED <> 0 then begin + Data.PrintChildren := False; + Data.PrintFlags := Message.LParam; + {$IFNDEF CLR} + EnumWindows(@PrintEnumProc, LPARAM(@Data)); + {$ELSE} + EnumWindows(Data.PrintEnumProc, 0); + {$ENDIF} + end; + end; + finally + RestoreDC(DC, SaveIndex2); + end; + Message.Result := 1; + end + else begin + { Like Windows, return 0 when the PRF_CHECKVISIBLE flag is specified and + the window is not visible } + Message.Result := 0; + end; +end; + +procedure HandleWMPrintClient(const PaintHandlerProc: TPaintHandlerProc; + const Message: {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); +var + DC: HDC; + Msg: TWMPaint; + SaveIndex: Integer; +begin + {$IFNDEF CLR} + DC := HDC(Message.WParam); + {$ELSE} + DC := Message.DC; + Msg := TWMPaint.Create; + {$ENDIF} + Msg.Msg := WM_PAINT; + Msg.DC := DC; + {$IFNDEF CLR} + Msg.Unused := 0; + {$ENDIF} + Msg.Result := 0; + SaveIndex := SaveDC(DC); + try + PaintHandlerProc(Msg); + finally + RestoreDC(DC, SaveIndex); + end; +end; + +function GetTextHeight(const DC: HDC): Integer; +var + TextMetric: TTextMetric; +begin + GetTextMetrics(DC, TextMetric); + Result := TextMetric.tmHeight; +end; + +function StripAccelChars(const S: String): String; +var + I: Integer; +begin + Result := S; + I := 1; + while I <= Length(Result) do begin + {$IFNDEF JR_WIDESTR} + if not(Result[I] in LeadBytes) then begin + {$ENDIF} + if Result[I] = '&' then + Delete(Result, I, 1); + Inc(I); + {$IFNDEF JR_WIDESTR} + end + else + Inc(I, 2); + {$ENDIF} + end; +end; + +function EscapeAmpersands(const S: String): String; +{ Replaces any '&' characters with '&&' } +var + I: Integer; +begin + Result := S; + I := 1; + while I <= Length(Result) do begin + {$IFNDEF JR_WIDESTR} + if not(Result[I] in LeadBytes) then begin + {$ENDIF} + if Result[I] = '&' then begin + Inc(I); + Insert('&', Result, I); + end; + Inc(I); + {$IFNDEF JR_WIDESTR} + end + else + Inc(I, 2); + {$ENDIF} + end; +end; + +function StripTrailingPunctuation(const S: String): String; +{ Removes any colon (':') or ellipsis ('...') from the end of S and returns + the resulting string } +var + L: Integer; +begin + Result := S; + L := Length(Result); + if (L > 1) and (Result[L] = ':') {$IFNDEF JR_WIDESTR} and (ByteType(Result, L) = mbSingleByte) {$ENDIF} then + SetLength(Result, L-1) + else if (L > 3) and (Result[L-2] = '.') and (Result[L-1] = '.') and + (Result[L] = '.') {$IFNDEF JR_WIDESTR} and (ByteType(Result, L-2) = mbSingleByte) {$ENDIF} then + SetLength(Result, L-3); +end; + +function GetTextWidth(const DC: HDC; S: String; const Prefix: Boolean): Integer; +{ Returns the width of the specified string using the font currently selected + into DC. If Prefix is True, it first removes "&" characters as necessary. } +var + Size: TSize; +begin + { This procedure is 10x faster than using DrawText with the DT_CALCRECT flag } + if Prefix then + S := StripAccelChars(S); + GetTextExtentPoint32Str(DC, S, Size); + Result := Size.cx; +end; + +procedure ProcessPaintMessages; +{ Dispatches all pending WM_PAINT messages. In effect, this is like an + 'UpdateWindow' on all visible windows } +var + Msg: TMsg; +begin + while PeekMessage(Msg, 0, WM_PAINT, WM_PAINT, PM_NOREMOVE) do begin + case Integer(GetMessage(Msg, 0, WM_PAINT, WM_PAINT)) of + -1: Break; { if GetMessage failed } + 0: begin + { Repost WM_QUIT messages } + PostQuitMessage(ClipToLongint(Msg.wParam)); + Break; + end; + end; + DispatchMessage(Msg); + end; +end; + +procedure RemoveMessages(const AMin, AMax: Integer); +{ Removes any messages with the specified ID from the queue } +var + Msg: TMsg; +begin + while PeekMessage(Msg, 0, AMin, AMax, PM_REMOVE) do begin + if Msg.message = WM_QUIT then begin + { Repost WM_QUIT messages } + PostQuitMessage(ClipToLongint(Msg.wParam)); + Break; + end; + end; +end; + +procedure SelectNCUpdateRgn(Wnd: HWND; DC: HDC; Rgn: HRGN); +var + R: TRect; + NewClipRgn: HRGN; +begin + if (Rgn <> 0) and (Rgn <> 1) then begin + GetWindowRect(Wnd, R); + if SelectClipRgn(DC, Rgn) = ERROR then begin + NewClipRgn := CreateRectRgnIndirect(R); + SelectClipRgn(DC, NewClipRgn); + DeleteObject(NewClipRgn); + end; + OffsetClipRgn(DC, -R.Left, -R.Top); + end; +end; + +function AddToList(var List: TList; Item: TObject): Boolean; +{ Returns True if Item didn't already exist in the list } +begin + if List = nil then + List := TList.Create; + Result := List.IndexOf(Item) = -1; + if Result then + List.Add(Item); +end; + +function AddToFrontOfList(var List: TList; Item: TObject): Boolean; +{ Returns True if Item didn't already exist in the list } +begin + if List = nil then + List := TList.Create; + Result := List.IndexOf(Item) = -1; + if Result then + List.Insert(0, Item); +end; + +procedure RemoveFromList(var List: TList; Item: TObject); +begin + if Assigned(List) then begin + List.Remove(Item); + if List.Count = 0 then begin + List.Free; + List := nil; + end; + end; +end; + +const + DefaultMenuShowDelay = 400; +{$IFNDEF CLR} +var + RegMenuShowDelay: Integer; + RegMenuShowDelayInited: BOOL = False; +function GetMenuShowDelay: Integer; + function ReadMenuShowDelayFromRegistry: Integer; + var + K: HKEY; + Typ, DataSize: DWORD; + Data: array[0..31] of Char; + Res: Longint; + E: Integer; + begin + Result := DefaultMenuShowDelay; + if RegOpenKeyEx(HKEY_CURRENT_USER, 'Control Panel\Desktop', 0, + KEY_QUERY_VALUE, K) = ERROR_SUCCESS then begin + DataSize := SizeOf(Data); + Res := RegQueryValueEx(K, 'MenuShowDelay', nil, @Typ, @Data, @DataSize); + RegCloseKey(K); + if Res <> ERROR_FILE_NOT_FOUND then begin + if (Res <> ERROR_SUCCESS) or (Typ <> REG_SZ) then + Result := 0 + else begin + Val(Data, Result, E); + if E <> 0 then Result := 0; + end; + end; + end; + end; +begin + if Lo(GetVersion) >= 4 then begin + if not SystemParametersInfo(106{SPI_GETMENUSHOWDELAY}, 0, @Result, 0) then begin + { SPI_GETMENUSHOWDELAY is only supported by Windows NT 4.0 and Windows 98. + On Windows 95, it must use the registry to retrieve this setting. } + if not RegMenuShowDelayInited then begin + RegMenuShowDelay := ReadMenuShowDelayFromRegistry; + InterlockedExchange(Integer(RegMenuShowDelayInited), Ord(True)); + end; + Result := RegMenuShowDelay; + end; + if Result < 0 then Result := 0; + end + else + Result := DefaultMenuShowDelay; +end; +{$ELSE} +function GetMenuShowDelay: Integer; +begin + { Since .NET requires Windows 98 or later, we can assume that + SPI_GETMENUSHOWDELAY is available } + if not SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, Result, 0) then + Result := DefaultMenuShowDelay; +end; +{$ENDIF} + +function AreFlatMenusEnabled: Boolean; +{ Returns True if "flat menus" are enabled. Always returns False on pre-XP + Windows versions. } +const + SPI_GETFLATMENU = $1022; +begin + { Interestingly, on Windows 2000, SystemParametersInfo(SPI_GETFLATMENU, ...) + succeeds and can return True in pvParam^ if the proper bit is set in + UserPreferencesMask. Since flat menus are not really used on Windows + 2000, call IsWindowsXP first to see if we're running at least XP. } + Result := IsWindowsXP and GetSystemParametersInfoBool(SPI_GETFLATMENU, False); +end; + +function AreKeyboardCuesEnabled: Boolean; +{ Returns True if "keyboard cues" are enabled. Always returns True on + pre-2000 Windows versions. } +const + SPI_GETKEYBOARDCUES = $100A; +begin + Result := (Win32MajorVersion < 5) or + GetSystemParametersInfoBool(SPI_GETKEYBOARDCUES, True); +end; + +function CreateFrameRectRgn(const ARect: TRect; const ASize: TSize): HRGN; +var + R: TRect; + InsideRgn: HRGN; +begin + if IsRectEmpty(ARect) then begin + { The rectangle is empty, so simply return a normalized empty region } + SetRectEmpty(R); + Result := CreateRectRgnIndirect(R); + end + else begin + Result := CreateRectRgnIndirect(ARect); + if Result <> 0 then begin + { Now hollow out the resulting region so that only a frame is left } + R := ARect; + InflateRect(R, -ASize.cx, -ASize.cy); + { If ASize is greater than the size of ARect, then InflateRect will + return a non-normalized rectangle larger than ARect. Test for this + condition by calling IsRectEmpty. } + if not IsRectEmpty(R) then begin + InsideRgn := CreateRectRgnIndirect(R); + if InsideRgn <> 0 then begin + CombineRgn(Result, Result, InsideRgn, RGN_XOR); + DeleteObject(InsideRgn); + end; + end; + end; + end; +end; + +procedure DrawInvertRect(const DC: HDC; const NewRect, OldRect: TRect; + const NewSize, OldSize: TSize; const Brush: HBRUSH); +{ Draws a dragging outline, hiding the old one if necessary. NewRect and/or + OldRect may be empty. } +var + SaveIndex: Integer; + UpdateRgn, OldRgn: HRGN; + R: TRect; +begin + { Create region containing the new rectangle } + UpdateRgn := CreateFrameRectRgn(NewRect, NewSize); + if UpdateRgn <> 0 then begin + { Combine that region with a region containing the old rectangle } + OldRgn := CreateFrameRectRgn(OldRect, OldSize); + if OldRgn <> 0 then begin + CombineRgn(UpdateRgn, OldRgn, UpdateRgn, RGN_XOR); + DeleteObject(OldRgn); + end; + + { Save the DC state so that the clipping region can be restored } + SaveIndex := SaveDC(DC); + try + { Draw the updated region } + SelectClipRgn(DC, UpdateRgn); + GetClipBox(DC, R); + SelectObject(DC, Brush); + PatBlt(DC, R.Left, R.Top, R.Right-R.Left, R.Bottom-R.Top, PATINVERT); + finally + RestoreDC(DC, SaveIndex); + end; + + DeleteObject(UpdateRgn); + end; +end; + +function CreateMonoBitmap(const AWidth, AHeight: Integer; + const ABits: array of Byte): HBITMAP; +begin + {$IFNDEF CLR} + Result := CreateBitmap(AWidth, AHeight, 1, 1, @ABits[0]); + {$ELSE} + { For some reason there isn't an overloaded version of CreateBitmap that + takes a TBytes parameter, so we have to use two calls } + Result := CreateBitmap(AWidth, AHeight, 1, 1, nil); + SetBitmapBits(Result, Length(ABits), ABits); + {$ENDIF} +end; + +function CreateHalftoneBrush: HBRUSH; +const + GrayPattern: array[0..15] of Byte = ( + $55, 0, $AA, 0, $55, 0, $AA, 0, $55, 0, $AA, 0, $55, 0, $AA, 0); +var + GrayBitmap: HBITMAP; +begin + GrayBitmap := CreateMonoBitmap(8, 8, GrayPattern); + Result := CreatePatternBrush(GrayBitmap); + DeleteObject(GrayBitmap); +end; + +procedure DrawHalftoneInvertRect(const DC: HDC; const NewRect, OldRect: TRect; + const NewSize, OldSize: TSize); +var + Brush: HBRUSH; +begin + Brush := CreateHalftoneBrush; + try + DrawInvertRect(DC, NewRect, OldRect, NewSize, OldSize, Brush); + finally + DeleteObject(Brush); + end; +end; + +var + GradientFillAvailable: Boolean; +{$IFNDEF CLR} +type + { Note: TTriVertex is unusable on Delphi 7 and earlier (COLOR16 is + misdeclared as a Shortint instead of a Word). } + TNewTriVertex = record + x: Longint; + y: Longint; + Red: Word; + Green: Word; + Blue: Word; + Alpha: Word; + end; +var + GradientFillFunc: function(DC: HDC; var Vertex: TNewTriVertex; + NumVertex: ULONG; Mesh: Pointer; NumMesh, Mode: ULONG): BOOL; stdcall; +{$ENDIF} + +procedure InitGradientFillFunc; +{$IFNDEF CLR} +var + M: HMODULE; +{$ENDIF} +begin + if (Win32MajorVersion >= 5) or + ((Win32MajorVersion = 4) and (Win32MinorVersion >= 10)) then begin + {$IFNDEF CLR} + M := {$IFDEF JR_D5} SafeLoadLibrary {$ELSE} LoadLibrary {$ENDIF} ('msimg32.dll'); + if M <> 0 then begin + GradientFillFunc := GetProcAddress(M, 'GradientFill'); + if Assigned(GradientFillFunc) then + GradientFillAvailable := True; + end; + {$ELSE} + GradientFillAvailable := True; + {$ENDIF} + end; +end; + +function IsFillRectWithGradientAvailable: Boolean; +begin + Result := GradientFillAvailable; +end; + +procedure FillRectWithGradient(const DC: HDC; const R: TRect; + const StartColor, EndColor: TColorRef; const HorizontalDirection: Boolean); +var + Vertexes: array[0..1] of {$IFNDEF CLR} TNewTriVertex {$ELSE} TTriVertex {$ENDIF}; + GradientRect: TGradientRect; + Mode: ULONG; +begin + if not GradientFillAvailable then + Exit; + Vertexes[0].x := R.Left; + Vertexes[0].y := R.Top; + Vertexes[0].Red := GetRValue(StartColor) shl 8; + Vertexes[0].Blue := GetBValue(StartColor) shl 8; + Vertexes[0].Green := GetGValue(StartColor) shl 8; + Vertexes[0].Alpha := 0; + Vertexes[1].x := R.Right; + Vertexes[1].y := R.Bottom; + Vertexes[1].Red := GetRValue(EndColor) shl 8; + Vertexes[1].Blue := GetBValue(EndColor) shl 8; + Vertexes[1].Green := GetGValue(EndColor) shl 8; + Vertexes[1].Alpha := 0; + GradientRect.UpperLeft := 0; + GradientRect.LowerRight := 1; + if HorizontalDirection then + Mode := GRADIENT_FILL_RECT_H + else + Mode := GRADIENT_FILL_RECT_V; + {$IFNDEF CLR} + GradientFillFunc(DC, Vertexes[0], 2, @GradientRect, 1, Mode); + {$ELSE} + GradientFill(DC, Vertexes, 2, GradientRect, 1, Mode); + {$ENDIF} +end; + +procedure DrawSmallWindowCaption(const Wnd: HWND; const DC: HDC; + const ARect: TRect; const AText: String; const AActive: Boolean); +{ Draws a (non-themed) small window caption bar. + On Windows Vista, a custom routine is used to work around an ugly bug in + DrawCaption that causes the text to be painted at the wrong coordinates. + Note: The value of the AText parameter may be ignored depending on which + routine is chosen. } + + procedure FillBackground; + const + CaptionBkColors: array[Boolean, Boolean] of Integer = + ((COLOR_INACTIVECAPTION, COLOR_ACTIVECAPTION), + (COLOR_GRADIENTINACTIVECAPTION, COLOR_GRADIENTACTIVECAPTION)); + var + LeftColor, RightColor: TColorRef; + begin + if GetSystemParametersInfoBool(SPI_GETGRADIENTCAPTIONS, False) and + IsFillRectWithGradientAvailable then begin + LeftColor := GetSysColor(CaptionBkColors[False, AActive]); + RightColor := GetSysColor(CaptionBkColors[True, AActive]); + if LeftColor <> RightColor then begin + FillRectWithGradient(DC, ARect, LeftColor, RightColor, True); + Exit; + end; + end; + FillRect(DC, ARect, GetSysColorBrush(CaptionBkColors[False, AActive])); + end; + +const + CaptionTextColors: array[Boolean] of Integer = + (COLOR_INACTIVECAPTIONTEXT, COLOR_CAPTIONTEXT); +var + Flags: UINT; + TextRect: TRect; + NonClientMetrics: TNonClientMetrics; + CaptionFont, SaveFont: HFONT; + SaveBkMode: Integer; + SaveTextColor: TColorRef; +begin + if ARect.Right <= ARect.Left then + Exit; + + { Prior to Windows Vista, continue to use DrawCaption. Don't want to risk + introducing new bugs on old OSes, plus on Windows 98, it's several times + faster than our custom routine. } + if Win32MajorVersion < 6 then begin + Flags := DC_TEXT or DC_SMALLCAP; + if AActive then + Flags := Flags or DC_ACTIVE; + if GetSystemParametersInfoBool(SPI_GETGRADIENTCAPTIONS, False) then + Flags := Flags or DC_GRADIENT; + DrawCaption(Wnd, DC, ARect, Flags); + end + else begin + FillBackground; + TextRect := ARect; + Inc(TextRect.Left, GetSystemMetrics(SM_CXEDGE)); + if (TextRect.Right > TextRect.Left) and + GetSystemNonClientMetrics(NonClientMetrics) then begin + CaptionFont := CreateFontIndirect(NonClientMetrics.lfSmCaptionFont); + if CaptionFont <> 0 then begin + SaveFont := SelectObject(DC, CaptionFont); + SaveBkMode := SetBkMode(DC, TRANSPARENT); + SaveTextColor := SetTextColor(DC, GetSysColor(CaptionTextColors[AActive])); + try + DrawTextStr(DC, AText, TextRect, DT_SINGLELINE or DT_NOPREFIX or + DT_VCENTER or DT_END_ELLIPSIS); + finally + SetTextColor(DC, SaveTextColor); + SetBkMode(DC, SaveBkMode); + SelectObject(DC, SaveFont); + DeleteObject(CaptionFont); + end; + end; + end; + end; +end; + +procedure DoubleBufferedRepaint(const Wnd: HWND); +var + ClientRect, ClipRect, R: TRect; + WndDC, BmpDC: HDC; + Bmp: HBITMAP; + SaveIndex: Integer; +begin + if IsWindowVisible(Wnd) and GetClientRect(Wnd, ClientRect) and + not IsRectEmpty(ClientRect) then begin + ValidateRect(Wnd, nil); + BmpDC := 0; + Bmp := 0; + WndDC := GetDC(Wnd); + if WndDC <> 0 then begin + try + { Only repaint the area that intersects the clipping rectangle } + if (GetClipBox(WndDC, ClipRect) <> Windows.ERROR) and + IntersectRect(R, ClientRect, ClipRect) then begin + Bmp := CreateCompatibleBitmap(WndDC, R.Right - R.Left, R.Bottom - R.Top); + if Bmp <> 0 then begin + BmpDC := CreateCompatibleDC(WndDC); + if BmpDC <> 0 then begin + SelectObject(BmpDC, Bmp); + SaveIndex := SaveDC(BmpDC); + SetWindowOrgEx(BmpDC, R.Left, R.Top, nil); + SendMessage(Wnd, WM_ERASEBKGND, WPARAM(BmpDC), 0); + SendMessage(Wnd, WM_PAINT, WPARAM(BmpDC), 0); + RestoreDC(BmpDC, SaveIndex); + BitBlt(WndDC, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, + BmpDC, 0, 0, SRCCOPY); + Exit; + end; + end; + end; + finally + if BmpDC <> 0 then DeleteDC(BmpDC); + if Bmp <> 0 then DeleteObject(Bmp); + ReleaseDC(Wnd, WndDC); + end; + end; + end; + { Fall back to invalidating if we didn't or couldn't double-buffer } + InvalidateRect(Wnd, nil, True); +end; + +{$IFNDEF CLR} +function MethodsEqual(const M1, M2: TMethod): Boolean; +begin + Result := (M1.Code = M2.Code) and (M1.Data = M2.Data); +end; +{$ENDIF} + +function GetRectOfPrimaryMonitor(const WorkArea: Boolean): TRect; +begin + if not WorkArea or not SystemParametersInfo(SPI_GETWORKAREA, 0, + {$IFNDEF CLR}@{$ENDIF} Result, 0) then + Result := Rect(0, 0, Screen.Width, Screen.Height); +end; + +{$IFNDEF CLR} +{ On Delphi for Win32, we don't use the MultiMon unit because its stubs for + MonitorFromRect and MonitorFromPoint are seriously bugged on Delphi 4. } +type + HMONITOR = type THandle; + TMonitorInfo = record + cbSize: DWORD; + rcMonitor: TRect; + rcWork: TRect; + dwFlags: DWORD; + end; +const + MONITOR_DEFAULTTONEAREST = $2; +var + MultiMonApis: record + MonitorFromRect: function(const lprcScreenCoords: TRect; dwFlags: DWORD): HMONITOR; stdcall; + MonitorFromPoint: function(ptScreenCoords: TPoint; dwFlags: DWORD): HMONITOR; stdcall; + MonitorFromWindow: function(hWnd: HWND; dwFlags: DWORD): HMONITOR; stdcall; + GetMonitorInfo: function(hMonitor: HMONITOR; var lpMonitorInfo: TMonitorInfo): BOOL; stdcall; + end; + MultiMonApisAvailable: Boolean; + +procedure InitMultiMonApis; +var + User32Handle: THandle; +begin + User32Handle := GetModuleHandle(user32); + MultiMonApis.MonitorFromRect := GetProcAddress(User32Handle, 'MonitorFromRect'); + MultiMonApis.MonitorFromPoint := GetProcAddress(User32Handle, 'MonitorFromPoint'); + MultiMonApis.MonitorFromWindow := GetProcAddress(User32Handle, 'MonitorFromWindow'); + MultiMonApis.GetMonitorInfo := GetProcAddress(User32Handle, 'GetMonitorInfoA'); + MultiMonApisAvailable := Assigned(MultiMonApis.MonitorFromRect) and + Assigned(MultiMonApis.MonitorFromPoint) and + Assigned(MultiMonApis.MonitorFromWindow) and + Assigned(MultiMonApis.GetMonitorInfo); +end; +{$ENDIF} + +function UsingMultipleMonitors: Boolean; +{ Returns True if the system has more than one display monitor configured. } +const + SM_CMONITORS = 80; +begin + { Note: On a single monitor Windows 95 or NT 4 system, GetSystemMetrics will + return 0 since those OSes do not support multiple monitors. On later + versions it returns 1. } + Result := {$IFNDEF CLR} MultiMonApisAvailable and {$ENDIF} + (GetSystemMetrics(SM_CMONITORS) > 1); +end; + +function GetRectOfMonitor(const M: HMONITOR; const WorkArea: Boolean; + var R: TRect): Boolean; +var + MonitorInfo: TMonitorInfo; +begin + {$IFNDEF CLR} + MonitorInfo.cbSize := SizeOf(MonitorInfo); + {$ELSE} + MonitorInfo.cbSize := Marshal.SizeOf(TypeOf(TMonitorInfo)); + {$ENDIF} + Result := {$IFNDEF CLR}MultiMonApis.{$ENDIF} GetMonitorInfo(M, MonitorInfo); + if Result then begin + if not WorkArea then + R := MonitorInfo.rcMonitor + else + R := MonitorInfo.rcWork; + end; +end; + +function GetRectOfMonitorContainingRect(const R: TRect; + const WorkArea: Boolean): TRect; +{ Returns the work area of the monitor which the rectangle R intersects with + the most, or the monitor nearest R if no monitors intersect. } +var + M: HMONITOR; +begin + if UsingMultipleMonitors then begin + M := {$IFNDEF CLR}MultiMonApis.{$ENDIF} MonitorFromRect(R, MONITOR_DEFAULTTONEAREST); + if GetRectOfMonitor(M, WorkArea, Result) then + Exit; + end; + Result := GetRectOfPrimaryMonitor(WorkArea); +end; + +function GetRectOfMonitorContainingPoint(const P: TPoint; + const WorkArea: Boolean): TRect; +{ Returns the screen area of the monitor containing the point P, or the monitor + nearest P if P isn't in any monitor's work area. } +var + M: HMONITOR; +begin + if UsingMultipleMonitors then begin + M := {$IFNDEF CLR}MultiMonApis.{$ENDIF} MonitorFromPoint(P, MONITOR_DEFAULTTONEAREST); + if GetRectOfMonitor(M, WorkArea, Result) then + Exit; + end; + Result := GetRectOfPrimaryMonitor(WorkArea); +end; + +function GetRectOfMonitorContainingWindow(const W: HWND; + const WorkArea: Boolean): TRect; +var + M: HMONITOR; +begin + if UsingMultipleMonitors then begin + M := {$IFNDEF CLR}MultiMonApis.{$ENDIF} MonitorFromWindow(W, MONITOR_DEFAULTTONEAREST); + if GetRectOfMonitor(M, WorkArea, Result) then + Exit; + end; + Result := GetRectOfPrimaryMonitor(WorkArea); +end; + +{$IFNDEF CLR} +var + TrackMouseEventInited: BOOL; + TrackMouseEventFunc: function(var EventTrack: TTrackMouseEvent): BOOL; stdcall; + +procedure InitTrackMouseEvent; +var + TrackMouseEventComCtlModule: THandle; +begin + { First look for TrackMouseEvent which is available on Windows 98 & NT 4 only. + If it doesn't exist, look for _TrackMouseEvent which is available on + Windows 95 if IE 3.0 or later is installed. } + if not TrackMouseEventInited then begin + TrackMouseEventFunc := GetProcAddress(GetModuleHandle(user32), + 'TrackMouseEvent'); + if @TrackMouseEventFunc = nil then begin + TrackMouseEventComCtlModule := + {$IFDEF JR_D5} SafeLoadLibrary {$ELSE} LoadLibrary {$ENDIF} (comctl32); + if TrackMouseEventComCtlModule <> 0 then + TrackMouseEventFunc := GetProcAddress(TrackMouseEventComCtlModule, + '_TrackMouseEvent'); + end; + InterlockedExchange(Integer(TrackMouseEventInited), Ord(True)); + end; +end; +{$ELSE} +procedure InitTrackMouseEvent; +begin +end; +{$ENDIF} + +function CallTrackMouseEvent(const Wnd: HWND; const Flags: DWORD): Boolean; +var + Track: TTrackMouseEvent; +begin + {$IFNDEF CLR} + Result := False; + if Assigned(TrackMouseEventFunc) then begin + Track.cbSize := SizeOf(Track); + Track.dwFlags := Flags; + Track.hwndTrack := Wnd; + Track.dwHoverTime := 0; + Result := TrackMouseEventFunc(Track); + end; + {$ELSE} + { .NET doesn't run on 95, so we can assume TrackMouseEvent is available } + Track.cbSize := Marshal.SizeOf(TypeOf(TTrackMouseEvent)); + Track.dwFlags := Flags; + Track.hwndTrack := Wnd; + Track.dwHoverTime := 0; + Result := TrackMouseEvent(Track); + {$ENDIF} +end; + +{$IFNDEF CLR} +var + LockSetForegroundWindowFunc: function(uLockCode: UINT): BOOL; stdcall; +{$ELSE} +[SuppressUnmanagedCodeSecurity, DllImport(user32, CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'LockSetForegroundWindow')] +function LockSetForegroundWindowFunc(uLockCode: UINT): BOOL; external; +{$ENDIF} + +procedure CallLockSetForegroundWindow(const ALock: Boolean); +const + LSFW_LOCK = 1; + LSFW_UNLOCK = 2; +begin + {$IFNDEF CLR} + if Assigned(LockSetForegroundWindowFunc) then begin + {$ELSE} + if (Win32MajorVersion >= 5) or + ((Win32MajorVersion = 4) and (Win32MinorVersion >= 90)) then begin + {$ENDIF} + if ALock then + LockSetForegroundWindowFunc(LSFW_LOCK) + else + LockSetForegroundWindowFunc(LSFW_UNLOCK); + end; +end; + +{$IFNDEF JR_D5} +procedure FreeAndNil(var Obj); +var + P: TObject; +begin + P := TObject(Obj); + TObject(Obj) := nil; + P.Free; +end; +{$ENDIF} + +{$IFNDEF JR_D6} +procedure RaiseLastOSError; +begin + RaiseLastWin32Error; +end; +{$ENDIF} + +{$IFDEF CLR} +{ On .NET, when calling DrawText, GetTextExtentPoint32, or TextOut we can't + rely on the marshaller's automatic A/W function selection because they take + a character count. If we passed the result of Length(), as the VCL + incorrectly does in many places, the behavior would be incorrect on DBCS + Windows 9x/Me systems because when a Unicode string is downconverted to ANSI + the character count can increase (i.e. one Unicode character can become two + ANSI characters). + Below we define our own "A" function prototypes that take byte array + parameters, allowing us to pass the result of AnsiEncoding.GetBytes straight + to the functions without any conversion. (Borland's "A" prototypes use + "string" type parameters.) } +[SuppressUnmanagedCodeSecurity, DllImport(user32, CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'DrawTextA')] +function _DrawTextA(hDC: HDC; [in] lpString: TBytes; nCount: Integer; + var lpRect: TRect; uFormat: UINT): Integer; external; +[SuppressUnmanagedCodeSecurity, DllImport(gdi32, CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'GetTextExtentPoint32A')] +function _GetTextExtentPoint32A(DC: HDC; [in] Str: TBytes; Count: Integer; + out Size: TSize): BOOL; external; +[SuppressUnmanagedCodeSecurity, DllImport(gdi32, CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'TextOutA')] +function _TextOutA(DC: HDC; X, Y: Integer; [in] Str: TBytes; + Count: Integer): BOOL; external; +{$ENDIF} + +function DrawTextStr(const DC: HDC; const AText: String; var ARect: TRect; + const AFormat: UINT): Integer; +{$IFNDEF CLR} +begin + Result := DrawText(DC, PChar(AText), Length(AText), ARect, AFormat); +end; +{$ELSE} +var + AnsiStr: TBytes; +begin + if Marshal.SystemDefaultCharSize = 1 then begin + AnsiStr := AnsiEncoding.GetBytes(AText); + Result := _DrawTextA(DC, AnsiStr, Length(AnsiStr), ARect, AFormat); + end + else + Result := DrawTextW(DC, AText, Length(AText), ARect, AFormat); +end; +{$ENDIF} + +function GetTextExtentPoint32Str(const DC: HDC; const AText: String; + out ASize: TSize): BOOL; +{$IFNDEF CLR} +begin + Result := GetTextExtentPoint32(DC, PChar(AText), Length(AText), ASize); +end; +{$ELSE} +var + AnsiStr: TBytes; +begin + if Marshal.SystemDefaultCharSize = 1 then begin + AnsiStr := AnsiEncoding.GetBytes(AText); + Result := _GetTextExtentPoint32A(DC, AnsiStr, Length(AnsiStr), ASize); + end + else + Result := GetTextExtentPoint32W(DC, AText, Length(AText), ASize); +end; +{$ENDIF} + +function TextOutStr(const DC: HDC; const X, Y: Integer; + const AText: String): BOOL; +{$IFNDEF CLR} +begin + Result := TextOut(DC, X, Y, PChar(AText), Length(AText)); +end; +{$ELSE} +var + AnsiStr: TBytes; +begin + if Marshal.SystemDefaultCharSize = 1 then begin + AnsiStr := AnsiEncoding.GetBytes(AText); + Result := _TextOutA(DC, X, Y, AnsiStr, Length(AnsiStr)); + end + else + Result := TextOutW(DC, X, Y, AText, Length(AText)); +end; +{$ENDIF} + +threadvar + FontExistsResult: Boolean; + +{$IFNDEF CLR} +function FontExistsCallback(const lplf: TLogFont; const lptm: TTextMetric; + dwType: DWORD; lpData: LPARAM): Integer; stdcall; +{$ELSE} +function FontExistsCallback([in] var lplf: TLogFont; [in] var lptm: TTextMetric; + dwType: DWORD; lpData: LPARAM): Integer; +{$ENDIF} +begin + FontExistsResult := True; + Result := 0; +end; + +function FontExists(const DC: HDC; const FaceName: String): Boolean; +begin + FontExistsResult := False; + EnumFonts(DC, {$IFNDEF CLR}PChar{$ENDIF}(FaceName), @FontExistsCallback, + {$IFNDEF CLR} nil {$ELSE} 0 {$ENDIF}); + Result := FontExistsResult; +end; + +function CreateRotatedFont(DC: HDC): HFONT; +{ Creates a font based on the DC's current font, but rotated 270 degrees } +var + LogFont: TLogFont; + TM: TTextMetric; + VerticalFontName: String; +begin + if GetObject(GetCurrentObject(DC, OBJ_FONT), + {$IFNDEF CLR} + SizeOf(LogFont), @LogFont + {$ELSE} + Marshal.SizeOf(TypeOf(TLogFont)), LogFont + {$ENDIF} + ) = 0 then begin + { just in case... } + Result := 0; + Exit; + end; + LogFont.lfEscapement := 2700; + LogFont.lfOrientation := 2700; + LogFont.lfOutPrecision := OUT_TT_ONLY_PRECIS; { needed for Win9x } + + { Don't let a random TrueType font be substituted when MS Sans Serif or + Microsoft Sans Serif are used. On Windows 2000 and later, hard-code Tahoma + because Arial can't display Japanese or Thai Unicode characters (on Windows + 2000 at least). On earlier versions, hard-code Arial since NT 4.0 doesn't + ship with Tahoma, and 9x doesn't do Unicode. } + {$IFNDEF CLR} + if (StrIComp(LogFont.lfFaceName, 'MS Sans Serif') = 0) or + (StrIComp(LogFont.lfFaceName, 'Microsoft Sans Serif') = 0) then begin + if Win32MajorVersion >= 5 then + StrPCopy(LogFont.lfFaceName, 'Tahoma') + else + StrPCopy(LogFont.lfFaceName, 'Arial'); + {$ELSE} + if SameText(LogFont.lfFaceName, 'MS Sans Serif', loInvariantLocale) or + SameText(LogFont.lfFaceName, 'Microsoft Sans Serif', loInvariantLocale) then begin + if Win32MajorVersion >= 5 then + LogFont.lfFaceName := 'Tahoma' + else + LogFont.lfFaceName := 'Arial'; + {$ENDIF} + { Set lfHeight to the actual height of the current font. This is needed + to work around a Windows 98 issue: on a clean install of the OS, + SPI_GETNONCLIENTMETRICS returns -5 for lfSmCaptionFont.lfHeight. This is + wrong; it should return -11 for an 8 pt font. With normal, unrotated text + this actually displays correctly, since MS Sans Serif doesn't support + sizes below 8 pt. However, when we change to a TrueType font like Arial, + this becomes a problem because it'll actually create a font that small. } + if GetTextMetrics(DC, TM) then begin + { If the original height was negative, keep it negative } + if LogFont.lfHeight <= 0 then + LogFont.lfHeight := -(TM.tmHeight - TM.tmInternalLeading) + else + LogFont.lfHeight := TM.tmHeight; + end; + end; + + { Use a vertical font if available so that Asian characters aren't drawn + sideways } + VerticalFontName := String('@') + LogFont.lfFaceName; + if FontExists(DC, VerticalFontName) then begin + {$IFNDEF CLR} + StrPLCopy(LogFont.lfFaceName, VerticalFontName, + (SizeOf(LogFont.lfFaceName) div SizeOf(LogFont.lfFaceName[0])) - 1); + {$ELSE} + LogFont.lfFaceName := VerticalFontName; + {$ENDIF} + end; + + Result := CreateFontIndirect(LogFont); +end; + +procedure DrawRotatedText(const DC: HDC; AText: String; const ARect: TRect; + const AFormat: Cardinal); +{ Like DrawText, but draws the text at a 270 degree angle. + The only format flag this function respects is DT_HIDEPREFIX. Text is always + drawn centered. } +var + RotatedFont, SaveFont: HFONT; + TextMetrics: TTextMetric; + X, Y, P, I, SU, FU: Integer; + SaveAlign: UINT; + SavePen, Pen: HPEN; +begin + RotatedFont := CreateRotatedFont(DC); + SaveFont := SelectObject(DC, RotatedFont); + + GetTextMetrics(DC, TextMetrics); + X := ARect.Left + ((ARect.Right - ARect.Left) - TextMetrics.tmHeight) div 2; + Y := ARect.Top + ((ARect.Bottom - ARect.Top) - GetTextWidth(DC, AText, True)) div 2; + + { Find the index of the character that should be underlined. Delete '&' + characters from the string. Like DrawText, only the last prefixed character + will be underlined. } + P := 0; + I := 1; + while I <= Length(AText) do begin + {$IFNDEF JR_WIDESTR} + if AText[I] in LeadBytes then + Inc(I) + else + {$ENDIF} + if AText[I] = '&' then begin + Delete(AText, I, 1); + { If the '&' was the last character, don't underline anything } + if I > Length(AText) then + P := 0 + else if AText[I] <> '&' then + P := I; + end; + Inc(I); + end; + + SaveAlign := SetTextAlign(DC, TA_BOTTOM); + TextOutStr(DC, X, Y, AText); + SetTextAlign(DC, SaveAlign); + { Underline } + if (P > 0) and (AFormat and DT_HIDEPREFIX = 0) then begin + SU := GetTextWidth(DC, Copy(AText, 1, P-1), False); + FU := SU + GetTextWidth(DC, AText[P], False); + Inc(X, TextMetrics.tmDescent - 2); + Pen := CreatePen(PS_SOLID, 1, GetTextColor(DC)); + SavePen := SelectObject(DC, Pen); + MoveToEx(DC, X, Y + SU, nil); + LineTo(DC, X, Y + FU); + SelectObject(DC, SavePen); + DeleteObject(Pen); + end; + + SelectObject(DC, SaveFont); + DeleteObject(RotatedFont); +end; + +function NeedToPlaySound(const Alias: String): Boolean; +{ This function checks the registry to see if the specified sound event alias + is assigned to a file. + The purpose of having this function is so it can avoid calls to PlaySound if + possible, because on Windows 2000 there is an annoying 1/3 second delay on + the first call to PlaySound. + Windows Explorer actually uses this same technique when playing sounds for + the Start menu. } +var + KeyName: String; + K: HKEY; + {$IFNDEF CLR} + Data: array[0..3] of WideChar; + {$ELSE} + Data: TBytes; + DataType: DWORD; + {$ENDIF} + DataSize: DWORD; + ErrorCode: Longint; +begin + if (Win32MajorVersion < 5) or (Win32Platform <> VER_PLATFORM_WIN32_NT) then begin + { No need to check pre-Windows 2000 versions since their PlaySound + functions don't have the delay; always return True. } + Result := True; + Exit; + end; + Result := False; + KeyName := 'AppEvents\Schemes\Apps\.Default\' + Alias + '\.Current'; + if RegOpenKeyEx(HKEY_CURRENT_USER, {$IFNDEF CLR}PChar{$ENDIF}(KeyName), + 0, KEY_QUERY_VALUE, K) = ERROR_SUCCESS then begin + try + {$IFNDEF CLR} + DataSize := SizeOf(Data); + { Note: Use the 'W' version of RegQueryValueEx for more speed } + ErrorCode := RegQueryValueExW(K, nil, nil, nil, @Data, @DataSize); + if ((ErrorCode = ERROR_SUCCESS) and (Data[0] <> #0)) or + (ErrorCode = ERROR_MORE_DATA) then + Result := True; + {$ELSE} + DataSize := 4 * SizeOf(WideChar); + SetLength(Data, DataSize); + ErrorCode := RegQueryValueExW(K, nil, nil, DataType, Data, DataSize); + if ((ErrorCode = ERROR_SUCCESS) and (Data[0] or Data[1] <> 0)) or + (ErrorCode = ERROR_MORE_DATA) then + Result := True; + {$ENDIF} + finally + RegCloseKey(K); + end; + end; +end; + +procedure PlaySystemSound(const Alias: String); +const + SND_SYSTEM = $00200000; +var + Flags: DWORD; +begin + Flags := SND_ALIAS or SND_ASYNC or SND_NODEFAULT; + if Win32Platform <> VER_PLATFORM_WIN32_NT then + Flags := Flags or SND_NOSTOP; { On 9x, native menus' sounds are NOSTOP } + if Win32MajorVersion >= 6 then + Flags := Flags or SND_SYSTEM; + PlaySound({$IFNDEF CLR}PChar{$ENDIF}(Alias), 0, Flags); +end; + +function Max(A, B: Integer): Integer; +begin + if A >= B then + Result := A + else + Result := B; +end; + +function Min(A, B: Integer): Integer; +begin + if A <= B then + Result := A + else + Result := B; +end; + +function FindAccelChar(const S: String): Char; +{ Finds the last accelerator key in S. Returns #0 if no accelerator key was + found. '&&' is ignored. } +{$IFNDEF CLR} +var + P: PChar; +begin + P := PChar(S); + Result := #0; + while True do begin + P := AnsiStrScan(P, '&'); + if P = nil then Break; + Inc(P); + if P^ <> '&' then begin + if P^ = #0 then Break; + Result := P^; + end; + Inc(P); + end; +end; +{$ELSE} +var + Len, I: Integer; +begin + Result := #0; + Len := Length(S); + if Len > 0 then begin { ensures S isn't nil } + I := 1; + while True do begin + I := System.String(S).IndexOf('&', I - 1) + 1; + if (I = 0) or (I >= Len) then + Break; + Inc(I); + if S[I] <> '&' then + Result := S[I]; + Inc(I); + end; + end; +end; +{$ENDIF} + +function IsWindowsXP: Boolean; +begin + Result := (Win32Platform = VER_PLATFORM_WIN32_NT) and + ((Win32MajorVersion > 5) or + ((Win32MajorVersion = 5) and (Win32MinorVersion >= 1))); +end; + +function GetInputLocaleCodePage: UINT; +{ Returns the code page identifier of the active input locale, or CP_ACP if + for some unknown reason it couldn't be determined. } +var + {$IFNDEF CLR} + Buf: array[0..15] of Char; + {$ELSE} + Buf: StringBuilder; + {$ENDIF} + ErrorCode: Integer; +begin + {$IFNDEF CLR} + if GetLocaleInfo(GetKeyboardLayout(0) and $FFFF, LOCALE_IDEFAULTANSICODEPAGE, + Buf, SizeOf(Buf) div SizeOf(Buf[0])) > 0 then begin + Buf[High(Buf)] := #0; { ensure null termination, just in case... } + Val(Buf, Result, ErrorCode); + {$ELSE} + Buf := StringBuilder.Create(16); + if GetLocaleInfo(GetKeyboardLayout(0) and $FFFF, LOCALE_IDEFAULTANSICODEPAGE, + Buf, Buf.Capacity) > 0 then begin + Val(Buf.ToString, Result, ErrorCode); + {$ENDIF} + { Just to be *completely* safe, verify that the code page returned by + GetLocaleInfo actually exists. The result of this function may be fed + into WideCharToMultiByte, and we don't want WideCharToMultiByte to fail + entirely because of a bad code page. } + if (ErrorCode <> 0) or not IsValidCodePage(Result) then + Result := CP_ACP; + end + else + Result := CP_ACP; +end; + +function GetMessagePosAsPoint: TPoint; +var + Pos: DWORD; +begin + Pos := GetMessagePos; + Result.X := Smallint(Pos and $FFFF); + Result.Y := Smallint(Pos shr 16); +end; + +function GetSystemNonClientMetrics(var Metrics: TNonClientMetrics): Boolean; +{$IFNDEF CLR} +begin + Metrics.cbSize := SizeOf(Metrics); + Result := SystemParametersInfo(SPI_GETNONCLIENTMETRICS, SizeOf(Metrics), + @Metrics, 0); +end; +{$ELSE} +begin + {$IFDEF JR_D11} + { On Delphi.NET 2007, Forms.GetNonClientMetrics is marked deprecated } + Metrics.cbSize := Marshal.SizeOf(TypeOf(TNonClientMetrics)); + Result := SystemParametersInfo(SPI_GETNONCLIENTMETRICS, Metrics.cbSize, + Metrics, 0); + {$ELSE} + Result := Forms.GetNonClientMetrics(Metrics); + {$ENDIF} +end; +{$ENDIF} + +function GetSystemParametersInfoBool(const Param: UINT; const Default: BOOL): BOOL; +{ Returns the value of the specified BOOL-type system parameter, or Default + if the function fails } +begin + if not SystemParametersInfo(Param, 0, {$IFNDEF CLR}@{$ENDIF} Result, 0) then + Result := Default; +end; + +{$IFDEF CLR} +{ Use our own declaration for CharLowerBuffA that takes a byte array directly + instead of StringBuilder } +[SuppressUnmanagedCodeSecurity, DllImport(user32, CharSet = CharSet.Ansi, SetLastError = True, EntryPoint = 'CharLowerBuffA')] +function _CharLowerBuffA([in, out] lpsz: TBytes; cchLength: DWORD): DWORD; external; +{$ENDIF} + +function CharToLower(const C: Char): Char; +{ Converts a single character to lowercase using the current code page } +{$IFNDEF CLR} +begin + Result := Char(CharLower(Pointer(Word(C)))); +end; +{$ELSE} +var + AnsiBytes: TBytes; +begin + { Note: On .NET we can't use LowerCase()/String.ToLower() because it uses + linguistic casing rules -- on a Turkish locale "I" is NOT mapped to "i". + This would break accelerator keys when running English apps. With + CharLower, "I" is always mapped to "i". } + if Marshal.SystemDefaultCharSize = 1 then begin + { On Windows 9x/Me we have to use CharLowerBuff since the character may be + two bytes when downconverted to ANSI. And we have to handle the + Unicode->ANSI conversion ourself so that we know the correct length to + pass to the function. } + AnsiBytes := AnsiEncoding.GetBytes(C); + _CharLowerBuffA(AnsiBytes, Length(AnsiBytes)); + Result := AnsiEncoding.GetChars(AnsiBytes)[0]; + end + else + Result := Char(Word(CharLowerW(IntPtr(Word(C))))); +end; +{$ENDIF} + +{$IFNDEF JR_D6} +function InvalidPoint(const At: TPoint): Boolean; +begin + Result := (At.X = -1) and (At.Y = -1); +end; +{$ENDIF} + +{$IFDEF CLR} +function ClipToLongint(const I: Int64): Longint; inline; +{ On Delphi.NET 2007, casting a LPARAM (THandle) directly into a Longint can + raise an overflow exception (possibly a bug?). By passing the LPARAM to + this function, which acts like a Longint(Int64()) cast, the exception can + be avoided. } +begin + Result := Longint(I); +end; +{$ENDIF} + +initialization + InitGradientFillFunc; + {$IFNDEF CLR} + InitMultiMonApis; + LockSetForegroundWindowFunc := GetProcAddress(GetModuleHandle(user32), + 'LockSetForegroundWindow'); + {$ENDIF} +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Consts.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Consts.pas new file mode 100644 index 0000000..fb29db0 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Consts.pas @@ -0,0 +1,34 @@ +unit TB2Consts; +{ $jrsoftware: tb2k/Source/TB2Consts.pas,v 1.8 2006/03/12 23:11:58 jr Exp $ } + +interface + +{$I TB2Ver.inc} + +resourcestring + { Exceptions } + STBToolbarIndexOutOfBounds = 'Toolbar item index out of range'; + STBToolbarItemReinserted = 'Toolbar item already inserted'; + STBToolbarItemParentInvalid = 'Toolbar item cannot be inserted into container of type %s'; + STBViewerNotFound = 'An item viewer associated the specified item could not be found'; + + { TTBChevronItem } + STBChevronItemMoreButtonsHint = 'More Buttons|'; + + { TTBMRUListItem } + STBMRUListItemDefCaption = '(MRU List)'; + + { TTBMDIWindowItem } + STBMDIWindowItemDefCaption = '(Window List)'; + + { TTBDock exception messages } + STBDockParentNotAllowed = 'A TTBDock control cannot be placed inside a tool window or another TTBDock'; + STBDockCannotChangePosition = 'Cannot change Position of a TTBDock if it already contains controls'; + + { TTBCustomDockableWindow exception messages } + STBToolwinNameNotSet = 'Cannot save dockable window''s position because Name property is not set'; + STBToolwinDockedToNameNotSet = 'Cannot save dockable window''s position because DockedTo''s Name property not set'; + +implementation + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Dock.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Dock.pas new file mode 100644 index 0000000..cbc94b1 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Dock.pas @@ -0,0 +1,5670 @@ +unit TB2Dock; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Dock.pas,v 1.127 2008/09/17 20:12:25 jr Exp $ +} + +interface + +{x$DEFINE TB2Dock_DisableLock} +{ Remove the 'x' to enable the define. It will disable calls to + LockWindowUpdate, which it calls to disable screen updates while dragging. + You may want to temporarily enable the define while debugging so you are able + to see your code window while stepping through the dragging routines. } + +{$I TB2Ver.inc} + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, IniFiles; + +type + TTBCustomForm = {$IFDEF JR_D3} TCustomForm {$ELSE} TForm {$ENDIF}; + + { TTBDock } + + TTBDockBoundLinesValues = (blTop, blBottom, blLeft, blRight); + TTBDockBoundLines = set of TTBDockBoundLinesValues; + TTBDockPosition = (dpTop, dpBottom, dpLeft, dpRight); + TTBDockType = (dtNotDocked, dtFloating, dtTopBottom, dtLeftRight); + TTBDockableTo = set of TTBDockPosition; + + TTBCustomDockableWindow = class; + TTBBasicBackground = class; + + TTBInsertRemoveEvent = procedure(Sender: TObject; Inserting: Boolean; + Bar: TTBCustomDockableWindow) of object; + TTBRequestDockEvent = procedure(Sender: TObject; Bar: TTBCustomDockableWindow; + var Accept: Boolean) of object; + + TTBDock = class(TCustomControl) + private + { Property values } + FPosition: TTBDockPosition; + FAllowDrag: Boolean; + FBoundLines: TTBDockBoundLines; + FBackground: TTBBasicBackground; + FBkgOnToolbars: Boolean; + FFixAlign: Boolean; + FCommitNewPositions: Boolean; + FLimitToOneRow: Boolean; + FOnInsertRemoveBar: TTBInsertRemoveEvent; + FOnRequestDock: TTBRequestDockEvent; + {$IFNDEF JR_D4} + FOnResize: TNotifyEvent; + {$ENDIF} + + { Internal } + FDisableArrangeToolbars: Integer; { Increment to disable ArrangeToolbars } + FArrangeToolbarsNeeded: Boolean; + FNonClientWidth, FNonClientHeight: Integer; + DockList: TList; { List of the toolbars docked, and those floating and have LastDock + pointing to the dock. Items are casted in TTBCustomDockableWindow's. } + DockVisibleList: TList; { Similar to DockList, but lists only docked and visible toolbars } + + { Property access methods } + //function GetVersion: TToolbar97Version; + procedure SetAllowDrag(Value: Boolean); + procedure SetBackground(Value: TTBBasicBackground); + procedure SetBackgroundOnToolbars(Value: Boolean); + procedure SetBoundLines(Value: TTBDockBoundLines); + procedure SetFixAlign(Value: Boolean); + procedure SetPosition(Value: TTBDockPosition); + //procedure SetVersion(const Value: TToolbar97Version); + + function GetToolbarCount: Integer; + function GetToolbars(Index: Integer): TTBCustomDockableWindow; + + { Internal } + procedure BackgroundChanged(Sender: TObject); + procedure ChangeDockList(const Insert: Boolean; const Bar: TTBCustomDockableWindow); + procedure ChangeWidthHeight(const NewWidth, NewHeight: Integer); + procedure CommitPositions; + procedure DrawNCArea(const DrawToDC: Boolean; const ADC: HDC; + const Clip: HRGN); + function GetDesignModeRowOf(const XY: Integer): Integer; + function HasVisibleToolbars: Boolean; + procedure RelayMsgToFloatingBars({$IFNDEF CLR}var{$ELSE}const{$ENDIF} Message: TMessage); + function ToolbarVisibleOnDock(const AToolbar: TTBCustomDockableWindow): Boolean; + procedure ToolbarVisibilityChanged(const Bar: TTBCustomDockableWindow; + const ForceRemove: Boolean); + + { Messages } + procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR; + procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY; + procedure CMSysColorChange(var Message: TMessage); message CM_SYSCOLORCHANGE; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMMove(var Message: TWMMove); message WM_MOVE; + {$IFNDEF JR_D4} + procedure WMSize(var Message: TWMSize); message WM_SIZE; + {$ENDIF} + procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE; + procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT; + procedure WMPrint(var Message: TMessage); message WM_PRINT; + procedure WMPrintClient(var Message: {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); message WM_PRINTCLIENT; + procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND; + protected + procedure AlignControls(AControl: TControl; var Rect: TRect); override; + procedure CreateParams(var Params: TCreateParams); override; + procedure DrawBackground(DC: HDC; const DrawRect: TRect); virtual; + function GetPalette: HPALETTE; override; + procedure InvalidateBackgrounds; + procedure Loaded; override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure SetParent(AParent: TWinControl); override; + procedure Paint; override; + function UsingBackground: Boolean; virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + procedure ArrangeToolbars; + procedure BeginUpdate; + procedure EndUpdate; + function GetCurrentRowSize(const Row: Integer; var AFullSize: Boolean): Integer; + function GetHighestRow(const HighestEffective: Boolean): Integer; + function GetMinRowSize(const Row: Integer; + const ExcludeControl: TTBCustomDockableWindow): Integer; + + property CommitNewPositions: Boolean read FCommitNewPositions write FCommitNewPositions; + property NonClientWidth: Integer read FNonClientWidth; + property NonClientHeight: Integer read FNonClientHeight; + property ToolbarCount: Integer read GetToolbarCount; + property Toolbars[Index: Integer]: TTBCustomDockableWindow read GetToolbars; + published + property AllowDrag: Boolean read FAllowDrag write SetAllowDrag default True; + property Background: TTBBasicBackground read FBackground write SetBackground; + property BackgroundOnToolbars: Boolean read FBkgOnToolbars write SetBackgroundOnToolbars default True; + property BoundLines: TTBDockBoundLines read FBoundLines write SetBoundLines default []; + property Color default clBtnFace; + property FixAlign: Boolean read FFixAlign write SetFixAlign default False; + property LimitToOneRow: Boolean read FLimitToOneRow write FLimitToOneRow default False; + property PopupMenu; + property Position: TTBDockPosition read FPosition write SetPosition default dpTop; + //property Version: TToolbar97Version read GetVersion write SetVersion stored False; + property Visible; + + {$IFDEF JR_D5} + property OnContextPopup; + {$ENDIF} + property OnInsertRemoveBar: TTBInsertRemoveEvent read FOnInsertRemoveBar write FOnInsertRemoveBar; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnRequestDock: TTBRequestDockEvent read FOnRequestDock write FOnRequestDock; + {$IFDEF JR_D4} + property OnResize; + {$ELSE} + property OnResize: TNotifyEvent read FOnResize write FOnResize; + {$ENDIF} + end; + + { TTBFloatingWindowParent - internal } + + TTBToolWindowNCRedrawWhatElement = (twrdBorder, twrdCaption, twrdCloseButton); + TTBToolWindowNCRedrawWhat = set of TTBToolWindowNCRedrawWhatElement; + + TTBFloatingWindowParentClass = class of TTBFloatingWindowParent; + TTBFloatingWindowParent = class(TCustomForm) + private + FCloseButtonDown: Boolean; { True if Close button is currently depressed } + FDockableWindow: TTBCustomDockableWindow; + FParentForm: TTBCustomForm; + FShouldShow: Boolean; + + procedure CallRecreateWnd; + function GetCaptionRect(const AdjustForBorder, MinusCloseButton: Boolean): TRect; + function GetCloseButtonRect(const AdjustForBorder: Boolean): TRect; + procedure SetCloseButtonState(Pushed: Boolean); + procedure RedrawNCArea(const RedrawWhat: TTBToolWindowNCRedrawWhat); + + procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED; + procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY; + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + procedure WMActivate(var Message: TWMActivate); message WM_ACTIVATE; + procedure WMClose(var Message: TWMClose); message WM_CLOSE; + procedure WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo); message WM_GETMINMAXINFO; + procedure WMMouseActivate(var Message: TWMMouseActivate); message WM_MOUSEACTIVATE; + procedure WMMove(var Message: TWMMove); message WM_MOVE; + procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE; + procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; + procedure WMNCLButtonDblClk(var Message: TWMNCLButtonDblClk); message WM_NCLBUTTONDBLCLK; + procedure WMNCLButtonDown(var Message: TWMNCLButtonDown); message WM_NCLBUTTONDOWN; + procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT; + procedure WMNCRButtonUp(var Message: TWMNCRButtonUp); message WM_NCRBUTTONUP; + procedure WMPrint(var Message: TMessage); message WM_PRINT; + procedure WMPrintClient(var Message: {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); message WM_PRINTCLIENT; + protected + procedure AlignControls(AControl: TControl; var Rect: TRect); override; + procedure CreateParams(var Params: TCreateParams); override; + procedure DrawNCArea(const DrawToDC: Boolean; const ADC: HDC; + const Clip: HRGN; RedrawWhat: TTBToolWindowNCRedrawWhat); dynamic; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + property DockableWindow: TTBCustomDockableWindow read FDockableWindow; + property CloseButtonDown: Boolean read FCloseButtonDown; + public + property ParentForm: TTBCustomForm read FParentForm; + end; + + { TTBCustomDockableWindow } + + TTBDockChangingEvent = procedure(Sender: TObject; Floating: Boolean; + DockingTo: TTBDock) of object; + TTBDragHandleStyle = (dhDouble, dhNone, dhSingle); + TTBDockMode = (dmCanFloat, dmCannotFloat, dmCannotFloatOrChangeDocks); + TTBFloatingMode = (fmOnTopOfParentForm, fmOnTopOfAllForms); + TTBSizeHandle = (twshLeft, twshRight, twshTop, twshTopLeft, + twshTopRight, twshBottom, twshBottomLeft, twshBottomRight); + { ^ must be in same order as HTLEFT..HTBOTTOMRIGHT } + TTBPositionExtraData = {$IFNDEF CLR} Pointer {$ELSE} TObject {$ENDIF}; + TTBPositionReadIntProc = function(const ToolbarName, Value: String; const Default: Longint; + const ExtraData: TTBPositionExtraData): Longint; + TTBPositionReadStringProc = function(const ToolbarName, Value, Default: String; + const ExtraData: TTBPositionExtraData): String; + TTBPositionWriteIntProc = procedure(const ToolbarName, Value: String; const Data: Longint; + const ExtraData: TTBPositionExtraData); + TTBPositionWriteStringProc = procedure(const ToolbarName, Value, Data: String; + const ExtraData: TTBPositionExtraData); + TTBReadPositionData = record + ReadIntProc: TTBPositionReadIntProc; + ReadStringProc: TTBPositionReadStringProc; + ExtraData: TTBPositionExtraData; + end; + TTBWritePositionData = record + WriteIntProc: TTBPositionWriteIntProc; + WriteStringProc: TTBPositionWriteStringProc; + ExtraData: TTBPositionExtraData; + end; + TTBDockableWindowStyles = set of (tbdsResizeEightCorner, tbdsResizeClipCursor); + TTBShrinkMode = (tbsmNone, tbsmWrap, tbsmChevron); + + TTBCustomDockableWindow = class(TCustomControl) + private + { Property variables } + FAutoResize: Boolean; + FDockPos, FDockRow, FEffectiveDockPos, FEffectiveDockRow: Integer; + FDocked: Boolean; + FCurrentDock, FDefaultDock, FLastDock: TTBDock; + FCurrentSize: Integer; + FFloating: Boolean; + FOnClose, FOnDockChanged, FOnMove, FOnRecreated, + FOnRecreating, {$IFNDEF JR_D4} FOnResize, {$ENDIF} + FOnVisibleChanged: TNotifyEvent; + FOnCloseQuery: TCloseQueryEvent; + FOnDockChanging, FOnDockChangingHidden: TTBDockChangingEvent; + FActivateParent, FHideWhenInactive, FCloseButton, FCloseButtonWhenDocked, + FFullSize, FResizable, FShowCaption, FStretch, FUseLastDock: Boolean; + FBorderStyle: TBorderStyle; + FDockMode: TTBDockMode; + FDragHandleStyle: TTBDragHandleStyle; + FDockableTo: TTBDockableTo; + FFloatingMode: TTBFloatingMode; + FSmoothDrag: Boolean; + FDockableWindowStyles: TTBDockableWindowStyles; + FLastRowSize: Integer; + FInsertRowBefore: Boolean; + + { Misc. } + FUpdatingBounds, { Incremented while internally changing the bounds. This allows + it to move the toolbar freely in design mode and prevents the + SizeChanging protected method from begin called } + FDisableArrange, { Incremented to disable Arrange } + FDisableOnMove, { Incremented to prevent WM_MOVE handler from calling the OnMoved handler } + FHidden: Integer; { Incremented while the toolbar is temporarily hidden } + FArrangeNeeded, FMoved: Boolean; + FInactiveCaption: Boolean; { True when the caption of the toolbar is currently the inactive color } + FFloatingPosition: TPoint; + FDockForms: TList; + FSavedAtRunTime: Boolean; + //FNonClientWidth, FNonClientHeight: Integer; + FDragMode, FDragSplitting, FDragCanSplit: Boolean; + FSmoothDragging: Boolean; + + { When floating. These are not used in design mode } + FCloseButtonDown: Boolean; { True if Close button is currently depressed } + FCloseButtonHover: Boolean; + FFloatParent: TTBFloatingWindowParent; { Run-time only: The actual Parent of the toolbar when it is floating } + + { Property access methods } + //function GetVersion: TToolbar97Version; + function GetNonClientWidth: Integer; + function GetNonClientHeight: Integer; + function IsLastDockStored: Boolean; + function IsWidthAndHeightStored: Boolean; + procedure SetAutoResize(Value: Boolean); + procedure SetBorderStyle(Value: TBorderStyle); + procedure SetCloseButton(Value: Boolean); + procedure SetCloseButtonWhenDocked(Value: Boolean); + procedure SetCurrentDock(Value: TTBDock); + procedure SetDefaultDock(Value: TTBDock); + procedure SetDockPos(Value: Integer); + procedure SetDockRow(Value: Integer); + procedure SetDragHandleStyle(Value: TTBDragHandleStyle); + procedure SetFloating(Value: Boolean); + procedure SetFloatingMode(Value: TTBFloatingMode); + procedure SetFloatingPosition(Value: TPoint); + procedure SetFullSize(Value: Boolean); + procedure SetLastDock(Value: TTBDock); + procedure SetResizable(Value: Boolean); + procedure SetShowCaption(Value: Boolean); + procedure SetStretch(Value: Boolean); + procedure SetUseLastDock(Value: Boolean); + //procedure SetVersion(const Value: TToolbar97Version); + + { Internal } + procedure CancelNCHover; + procedure DrawDraggingOutline(const DC: HDC; const NewRect, OldRect: TRect; + const NewDocking, OldDocking: Boolean); + procedure RedrawNCArea; + procedure SetCloseButtonState(Pushed: Boolean); + procedure ShowNCContextMenu(const PosX, PosY: Smallint); + procedure Moved; + function GetShowingState: Boolean; + procedure UpdateCaptionState; + procedure UpdateTopmostFlag; + procedure UpdateVisibility; + procedure ReadSavedAtRunTime(Reader: TReader); + procedure WriteSavedAtRunTime(Writer: TWriter); + + { Messages } + procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED; + procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; + procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; + procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED; + procedure CMVisibleChanged(var Message: TMessage); message CM_VISIBLECHANGED; + {$IFDEF JR_D5} + procedure WMContextMenu(var Message: TWMContextMenu); message WM_CONTEXTMENU; + {$ENDIF} + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMMove(var Message: TWMMove); message WM_MOVE; + procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE; + procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE; + procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; + procedure WMNCMouseLeave(var Message: TMessage); message $2A2 {WM_NCMOUSELEAVE}; + procedure WMNCMouseMove(var Message: TWMNCMouseMove); message WM_NCMOUSEMOVE; + procedure WMNCLButtonDblClk(var Message: TWMNCLButtonDblClk); message WM_NCLBUTTONDBLCLK; + procedure WMNCLButtonDown(var Message: TWMNCLButtonDown); message WM_NCLBUTTONDOWN; + procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT; + procedure WMNCRButtonUp(var Message: TWMNCRButtonUp); message WM_NCRBUTTONUP; + procedure WMPrint(var Message: TMessage); message WM_PRINT; + procedure WMPrintClient(var Message: {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); message WM_PRINTCLIENT; + procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR; + {$IFNDEF JR_D4} + procedure WMSize(var Message: TWMSize); message WM_SIZE; + {$ENDIF} + protected + property ActivateParent: Boolean read FActivateParent write FActivateParent default True; + property AutoResize: Boolean read FAutoResize write SetAutoResize default True; + property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle; + property Color default clBtnFace; + property CloseButton: Boolean read FCloseButton write SetCloseButton default True; + property CloseButtonDown: Boolean read FCloseButtonDown; + property CloseButtonHover: Boolean read FCloseButtonHover; + property CloseButtonWhenDocked: Boolean read FCloseButtonWhenDocked write SetCloseButtonWhenDocked default False; + property DefaultDock: TTBDock read FDefaultDock write SetDefaultDock; + property DockableTo: TTBDockableTo read FDockableTo write FDockableTo default [dpTop, dpBottom, dpLeft, dpRight]; + property DockableWindowStyles: TTBDockableWindowStyles read FDockableWindowStyles write FDockableWindowStyles; + property DockMode: TTBDockMode read FDockMode write FDockMode default dmCanFloat; + property DragHandleStyle: TTBDragHandleStyle read FDragHandleStyle write SetDragHandleStyle default dhSingle; + property FloatingMode: TTBFloatingMode read FFloatingMode write SetFloatingMode default fmOnTopOfParentForm; + property FullSize: Boolean read FFullSize write SetFullSize default False; + property InactiveCaption: Boolean read FInactiveCaption; + property HideWhenInactive: Boolean read FHideWhenInactive write FHideWhenInactive default True; + property Resizable: Boolean read FResizable write SetResizable default True; + property ShowCaption: Boolean read FShowCaption write SetShowCaption default True; + property SmoothDrag: Boolean read FSmoothDrag write FSmoothDrag default True; + property Stretch: Boolean read FStretch write SetStretch default False; + property UseLastDock: Boolean read FUseLastDock write SetUseLastDock default True; + //property Version: TToolbar97Version read GetVersion write SetVersion stored False; + + property OnClose: TNotifyEvent read FOnClose write FOnClose; + property OnCloseQuery: TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery; + property OnDockChanged: TNotifyEvent read FOnDockChanged write FOnDockChanged; + property OnDockChanging: TTBDockChangingEvent read FOnDockChanging write FOnDockChanging; + property OnDockChangingHidden: TTBDockChangingEvent read FOnDockChangingHidden write FOnDockChangingHidden; + property OnMove: TNotifyEvent read FOnMove write FOnMove; + property OnRecreated: TNotifyEvent read FOnRecreated write FOnRecreated; + property OnRecreating: TNotifyEvent read FOnRecreating write FOnRecreating; + {$IFNDEF JR_D4} + property OnResize: TNotifyEvent read FOnResize write FOnResize; + {$ENDIF} + property OnVisibleChanged: TNotifyEvent read FOnVisibleChanged write FOnVisibleChanged; + + { Overridden methods } + procedure CreateParams(var Params: TCreateParams); override; + procedure DefineProperties(Filer: TFiler); override; + function GetPalette: HPALETTE; override; + procedure Loaded; override; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + function PaletteChanged(Foreground: Boolean): Boolean; override; + procedure SetParent(AParent: TWinControl); override; + + { Methods accessible to descendants } + procedure Arrange; + function CalcNCSizes: TPoint; virtual; + procedure ChangeSize(AWidth, AHeight: Integer); + function ChildControlTransparent(Ctl: TControl): Boolean; dynamic; + procedure Close; + procedure ControlExistsAtPos(const P: TPoint; var ControlExists: Boolean); virtual; + function DoArrange(CanMoveControls: Boolean; PreviousDockType: TTBDockType; + NewFloating: Boolean; NewDock: TTBDock): TPoint; virtual; abstract; + procedure DoDockChangingHidden(NewFloating: Boolean; DockingTo: TTBDock); dynamic; + procedure DoubleClick; + procedure DrawNCArea(const DrawToDC: Boolean; const ADC: HDC; + const Clip: HRGN); virtual; + procedure GetBaseSize(var ASize: TPoint); virtual; abstract; + function GetDockedCloseButtonRect(LeftRight: Boolean): TRect; virtual; + function GetFloatingWindowParentClass: TTBFloatingWindowParentClass; dynamic; + procedure GetMinShrinkSize(var AMinimumSize: Integer); virtual; + procedure GetMinMaxSize(var AMinClientWidth, AMinClientHeight, + AMaxClientWidth, AMaxClientHeight: Integer); virtual; + function GetShrinkMode: TTBShrinkMode; virtual; + procedure InitializeOrdering; dynamic; + function IsAutoResized: Boolean; + procedure ResizeBegin(SizeHandle: TTBSizeHandle); dynamic; + procedure ResizeEnd; dynamic; + procedure ResizeTrack(var Rect: TRect; const OrigRect: TRect); dynamic; + procedure ResizeTrackAccept; dynamic; + procedure SizeChanging(const AWidth, AHeight: Integer); virtual; + public + property Docked: Boolean read FDocked; + property Canvas; + property CurrentDock: TTBDock read FCurrentDock write SetCurrentDock stored False; + property CurrentSize: Integer read FCurrentSize write FCurrentSize; + property DockPos: Integer read FDockPos write SetDockPos default -1; + property DockRow: Integer read FDockRow write SetDockRow default 0; + property DragMode: Boolean read FDragMode; + property DragSplitting: Boolean read FDragSplitting; + property EffectiveDockPos: Integer read FEffectiveDockPos; + property EffectiveDockRow: Integer read FEffectiveDockRow; + property Floating: Boolean read FFloating write SetFloating default False; + property FloatingPosition: TPoint read FFloatingPosition write SetFloatingPosition; + property LastDock: TTBDock read FLastDock write SetLastDock stored IsLastDockStored; + property NonClientWidth: Integer read GetNonClientWidth; + property NonClientHeight: Integer read GetNonClientHeight; + + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetParentComponent: TComponent; override; + function HasParent: Boolean; override; + procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override; + + procedure AddDockForm(const Form: TTBCustomForm); + procedure AddDockedNCAreaToSize(var S: TPoint; const LeftRight: Boolean); + procedure AddFloatingNCAreaToSize(var S: TPoint); + procedure BeginMoving(const InitX, InitY: Integer); + procedure BeginSizing(const ASizeHandle: TTBSizeHandle); + procedure BeginUpdate; + procedure DoneReadingPositionData(const Data: TTBReadPositionData); dynamic; + procedure EndUpdate; + procedure GetDockedNCArea(var TopLeft, BottomRight: TPoint; + const LeftRight: Boolean); + function GetFloatingBorderSize: TPoint; virtual; + procedure GetFloatingNCArea(var TopLeft, BottomRight: TPoint); + function IsMovable: Boolean; + procedure MoveOnScreen(const OnlyIfFullyOffscreen: Boolean); + procedure ReadPositionData(const Data: TTBReadPositionData); dynamic; + procedure RemoveDockForm(const Form: TTBCustomForm); + procedure WritePositionData(const Data: TTBWritePositionData); dynamic; + published + property Height stored IsWidthAndHeightStored; + property Width stored IsWidthAndHeightStored; + end; + + TTBBasicBackground = class(TComponent) + protected + procedure Draw(DC: HDC; const DrawRect: TRect); virtual; abstract; + function GetPalette: HPALETTE; virtual; abstract; + procedure RegisterChanges(Proc: TNotifyEvent); virtual; abstract; + procedure SysColorChanged; virtual; abstract; + procedure UnregisterChanges(Proc: TNotifyEvent); virtual; abstract; + function UsingBackground: Boolean; virtual; abstract; + end; + + TTBBackground = class(TTBBasicBackground) + private + FBitmap, FBitmapCache: TBitmap; + FBkColor: TColor; + FNotifyList: TList; + FTransparent: Boolean; + procedure BitmapChanged(Sender: TObject); + procedure SetBitmap(Value: TBitmap); + procedure SetBkColor(Value: TColor); + procedure SetTransparent(Value: Boolean); + protected + procedure Draw(DC: HDC; const DrawRect: TRect); override; + function GetPalette: HPALETTE; override; + procedure RegisterChanges(Proc: TNotifyEvent); override; + procedure SysColorChanged; override; + procedure UnregisterChanges(Proc: TNotifyEvent); override; + function UsingBackground: Boolean; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property Bitmap: TBitmap read FBitmap write SetBitmap; + property BkColor: TColor read FBkColor write SetBkColor default clBtnFace; + property Transparent: Boolean read FTransparent write SetTransparent default False; + end; + +procedure TBRegLoadPositions(const OwnerComponent: TComponent; + const RootKey: DWORD; const BaseRegistryKey: String); +procedure TBRegSavePositions(const OwnerComponent: TComponent; + const RootKey: DWORD; const BaseRegistryKey: String); +procedure TBIniLoadPositions(const OwnerComponent: TComponent; + const Filename, SectionNamePrefix: String); overload; +procedure TBIniLoadPositions(const OwnerComponent: TComponent; + const IniFile: TCustomIniFile; const SectionNamePrefix: String); overload; +procedure TBIniSavePositions(const OwnerComponent: TComponent; + const Filename, SectionNamePrefix: String); overload; +procedure TBIniSavePositions(const OwnerComponent: TComponent; + const IniFile: TCustomIniFile; const SectionNamePrefix: String); overload; + +procedure TBCustomLoadPositions(const OwnerComponent: TComponent; + const ReadIntProc: TTBPositionReadIntProc; + const ReadStringProc: TTBPositionReadStringProc; + const ExtraData: TTBPositionExtraData); +procedure TBCustomSavePositions(const OwnerComponent: TComponent; + const WriteIntProc: TTBPositionWriteIntProc; + const WriteStringProc: TTBPositionWriteStringProc; + const ExtraData: TTBPositionExtraData); + +function TBGetDockTypeOf(const Control: TTBDock; const Floating: Boolean): TTBDockType; +function TBGetToolWindowParentForm(const ToolWindow: TTBCustomDockableWindow): + TTBCustomForm; +function TBValidToolWindowParentForm(const ToolWindow: TTBCustomDockableWindow): + TTBCustomForm; + +implementation + +uses + {$IFDEF CLR} Types, System.Runtime.InteropServices, {$ENDIF} + Registry, Consts, Menus, + TB2Common, TB2Hook, TB2Consts; + +type + TControlAccess = class(TControl); + +const + DockedBorderSize = 2; + DockedBorderSize2 = DockedBorderSize*2; + DragHandleSizes: array[Boolean, TTBDragHandleStyle] of Integer = + ((9, 0, 6), (14, 14, 14)); + DragHandleXOffsets: array[Boolean, TTBDragHandleStyle] of Integer = + ((2, 0, 1), (3, 0, 5)); + HT_TB2k_Border = 2000; + HT_TB2k_Close = 2001; + HT_TB2k_Caption = 2002; + + DefaultBarWidthHeight = 8; + + ForceDockAtTopRow = 0; + ForceDockAtLeftPos = -8; + + PositionLeftOrRight = [dpLeft, dpRight]; + + twrdAll = [Low(TTBToolWindowNCRedrawWhatElement)..High(TTBToolWindowNCRedrawWhatElement)]; + + { Constants for TTBCustomDockableWindow registry values/data. + Don't localize any of these names! } + rvRev = 'Rev'; + rdCurrentRev = 2000; + rvVisible = 'Visible'; + rvDockedTo = 'DockedTo'; + rdDockedToFloating = '+'; + rvLastDock = 'LastDock'; + rvDockRow = 'DockRow'; + rvDockPos = 'DockPos'; + rvFloatLeft = 'FloatLeft'; + rvFloatTop = 'FloatTop'; + +threadvar + FloatingToolWindows: TList; + + +{ Misc. functions } + +function GetSmallCaptionHeight: Integer; +{ Returns height of the caption of a small window } +begin + Result := GetSystemMetrics(SM_CYSMCAPTION); +end; + +function GetMDIParent(const Form: TTBCustomForm): TTBCustomForm; +{ Returns the parent of the specified MDI child form. But, if Form isn't a + MDI child, it simply returns Form. } +var + I, J: Integer; +begin + Result := Form; + if Form = nil then Exit; + if {$IFDEF JR_D3} (Form is TForm) and {$ENDIF} + (TForm(Form).FormStyle = fsMDIChild) then + for I := 0 to Screen.FormCount-1 do + with Screen.Forms[I] do begin + if FormStyle <> fsMDIForm then Continue; + for J := 0 to MDIChildCount-1 do + if MDIChildren[J] = Form then begin + Result := Screen.Forms[I]; + Exit; + end; + end; +end; + +function TBGetDockTypeOf(const Control: TTBDock; const Floating: Boolean): TTBDockType; +begin + if Floating then + Result := dtFloating + else + if Control = nil then + Result := dtNotDocked + else begin + if not(Control.Position in PositionLeftOrRight) then + Result := dtTopBottom + else + Result := dtLeftRight; + end; +end; + +function TBGetToolWindowParentForm(const ToolWindow: TTBCustomDockableWindow): TTBCustomForm; +var + Ctl: TWinControl; +begin + Result := nil; + Ctl := ToolWindow; + while Assigned(Ctl.Parent) do begin + if Ctl.Parent is TTBCustomForm then + Result := TTBCustomForm(Ctl.Parent); + Ctl := Ctl.Parent; + end; + { ^ for compatibility with ActiveX controls, that code is used instead of + GetParentForm because it returns nil unless the form is the *topmost* + parent } + if Result is TTBFloatingWindowParent then + Result := TTBFloatingWindowParent(Result).ParentForm; +end; + +function TBValidToolWindowParentForm(const ToolWindow: TTBCustomDockableWindow): TTBCustomForm; +begin + Result := TBGetToolWindowParentForm(ToolWindow); + if Result = nil then + raise EInvalidOperation.{$IFDEF JR_D3}CreateFmt{$ELSE}CreateResFmt{$ENDIF} + (SParentRequired, [ToolWindow.Name]); +end; + +procedure SetWindowOwner(const Wnd, NewOwnerWnd: HWND); +begin + SetWindowLong(Wnd, GWL_HWNDPARENT, + {$IFDEF JR_D11} LONG_PTR {$ELSE} Longint {$ENDIF} (NewOwnerWnd)); +end; + +procedure ToolbarHookProc(Code: THookProcCode; Wnd: HWND; WParam: WPARAM; LParam: LPARAM); +var + I: Integer; + ToolWindow: TTBCustomDockableWindow; + WindowPos: {$IFNDEF CLR} PWindowPos {$ELSE} TWindowPos {$ENDIF}; + Form: TTBCustomForm; +begin + case Code of + hpSendActivate, + hpSendActivateApp: begin + if Assigned(FloatingToolWindows) then + for I := 0 to FloatingToolWindows.Count-1 do + { Hide or restore toolbars when a form or the application is + deactivated or activated, and/or update their caption state + (active/inactive) } + TTBCustomDockableWindow(FloatingToolWindows[I]).UpdateVisibility; + end; + hpSendWindowPosChanged: begin + if Assigned(FloatingToolWindows) then begin + {$IFNDEF CLR} + WindowPos := PWindowPos(LParam); + {$ELSE} + WindowPos := TWindowPos(Marshal.PtrToStructure(IntPtr(LParam), TypeOf(TWindowPos))); + {$ENDIF} + for I := 0 to FloatingToolWindows.Count-1 do begin + ToolWindow := TTBCustomDockableWindow(FloatingToolWindows[I]); + if (ToolWindow.FFloatingMode = fmOnTopOfParentForm) and ToolWindow.HandleAllocated then begin + { Call UpdateVisibility if parent form's visibility has + changed, or if it has been minimized or restored } + if ((WindowPos.flags and (SWP_SHOWWINDOW or SWP_HIDEWINDOW) <> 0) or + (WindowPos.flags and SWP_FRAMECHANGED <> 0)) then begin + Form := TBGetToolWindowParentForm(ToolWindow); + if Assigned(Form) and Form.HandleAllocated and ((Wnd = Form.Handle) or IsChild(Wnd, Form.Handle)) then + ToolWindow.UpdateVisibility; + end; + end; + end; + end; + end; + hpPreDestroy: begin + if Assigned(FloatingToolWindows) then + for I := 0 to FloatingToolWindows.Count-1 do begin + with TTBCustomDockableWindow(FloatingToolWindows[I]) do + { It must remove the form window's ownership of the tool window + *before* the form gets destroyed, otherwise Windows will destroy + the tool window's handle. } + if Assigned(Parent) and Parent.HandleAllocated and + (HWND(GetWindowLong(Parent.Handle, GWL_HWNDPARENT)) = Wnd) then + SetWindowOwner(Parent.Handle, Application.Handle); + { ^ Restore GWL_HWNDPARENT back to Application.Handle } + end; + end; + end; +end; + +type + {$IFNDEF CLR} + PFindWindowData = ^TFindWindowData; + TFindWindowData = record + {$ELSE} + TFindWindowData = class + private + {$ENDIF} + TaskActiveWindow, TaskFirstWindow, TaskFirstTopMost: HWND; + {$IFDEF CLR} + function DoFindWindow(Wnd: HWND; Param: LPARAM): BOOL; + {$ENDIF} + end; + +{$IFNDEF CLR} +function DoFindWindow(Wnd: HWND; Param: LPARAM): BOOL; stdcall; +{$ELSE} +function TFindWindowData.DoFindWindow(Wnd: HWND; Param: LPARAM): BOOL; +{$ENDIF} +begin + {$IFNDEF CLR} + with PFindWindowData(Param)^ do + {$ENDIF} + if (Wnd <> TaskActiveWindow) and (Wnd <> Application.Handle) and + IsWindowVisible(Wnd) and IsWindowEnabled(Wnd) then begin + if GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOPMOST = 0 then begin + if TaskFirstWindow = 0 then TaskFirstWindow := Wnd; + end + else begin + if TaskFirstTopMost = 0 then TaskFirstTopMost := Wnd; + end; + end; + Result := True; +end; + +function FindTopLevelWindow(ActiveWindow: HWND): HWND; +var + FindData: TFindWindowData; +begin + {$IFDEF CLR} + FindData := TFindWindowData.Create; + {$ENDIF} + with FindData do begin + TaskActiveWindow := ActiveWindow; + TaskFirstWindow := 0; + TaskFirstTopMost := 0; + {$IFNDEF CLR} + EnumThreadWindows(GetCurrentThreadID, @DoFindWindow, LPARAM(@FindData)); + {$ELSE} + EnumThreadWindows(GetCurrentThreadID, DoFindWindow, 0); + {$ENDIF} + if TaskFirstWindow <> 0 then + Result := TaskFirstWindow + else + Result := TaskFirstTopMost; + end; +end; + +function IsAncestorOfWindow(const ParentWnd: HWND; Wnd: HWND): Boolean; +{ Returns True if Wnd is a child of, is owned by, or is the same window as + ParentWnd } +begin + while Wnd <> 0 do begin + if Wnd = ParentWnd then begin + Result := True; + Exit; + end; + Wnd := GetParent(Wnd); + end; + Result := False; +end; + +procedure RecalcNCArea(const Ctl: TWinControl); +begin + if Ctl.HandleAllocated then + SetWindowPos(Ctl.Handle, 0, 0, 0, 0, 0, SWP_FRAMECHANGED or + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER); +end; + +procedure InvalidateAll(const Ctl: TWinControl); +{ Invalidate both non-client and client area, and erase. } +begin + if Ctl.HandleAllocated then + RedrawWindow(Ctl.Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE or + RDW_ERASE or RDW_NOCHILDREN); +end; + +type + TSetCloseButtonStateProc = procedure(Pushed: Boolean) of object; + +function CloseButtonLoop(const Wnd: HWND; const ButtonRect: TRect; + const SetCloseButtonStateProc: TSetCloseButtonStateProc): Boolean; + function MouseInButton: Boolean; + var + P: TPoint; + begin + GetCursorPos(P); + Result := PtInRect(ButtonRect, P); + end; +var + Msg: TMsg; +begin + Result := False; + + SetCloseButtonStateProc(MouseInButton); + + SetCapture(Wnd); + + try + while GetCapture = Wnd do begin + case Integer(GetMessage(Msg, 0, 0, 0)) of + -1: Break; { if GetMessage failed } + 0: begin + { Repost WM_QUIT messages } + PostQuitMessage(ClipToLongint(Msg.wParam)); + Break; + end; + end; + + case Msg.Message of + WM_KEYDOWN, WM_KEYUP: + { Ignore all keystrokes while in a close button loop } + ; + WM_MOUSEMOVE: begin + { Note to self: WM_MOUSEMOVE messages should never be dispatched + here to ensure no hints get shown } + SetCloseButtonStateProc(MouseInButton); + end; + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK: + { Make sure it doesn't begin another loop } + Break; + WM_LBUTTONUP: begin + if MouseInButton then + Result := True; + Break; + end; + WM_RBUTTONDOWN..WM_MBUTTONDBLCLK: + { Ignore all other mouse up/down messages } + ; + else + TranslateMessage(Msg); + DispatchMessage(Msg); + end; + end; + finally + if GetCapture = Wnd then + ReleaseCapture; + SetCloseButtonStateProc(False); + end; +end; + + +{ TTBDock - internal } + +constructor TTBDock.Create(AOwner: TComponent); +begin + inherited; + + ControlStyle := ControlStyle + [csAcceptsControls, csMenuEvents] - + [csClickEvents, csCaptureMouse, csOpaque]; + FAllowDrag := True; + FBkgOnToolbars := True; + DockList := TList.Create; + DockVisibleList := TList.Create; + Color := clBtnFace; + Position := dpTop; +end; + +procedure TTBDock.CreateParams(var Params: TCreateParams); +begin + inherited; + { Disable complete redraws when size changes. CS_H/VREDRAW cause flicker + and are not necessary for this control at run time } + if not(csDesigning in ComponentState) then + with Params.WindowClass do + Style := Style and not(CS_HREDRAW or CS_VREDRAW); +end; + +destructor TTBDock.Destroy; +begin + if Assigned(FBackground) then + FBackground.UnregisterChanges(BackgroundChanged); + inherited; + DockVisibleList.Free; + DockList.Free; +end; + +procedure TTBDock.SetParent(AParent: TWinControl); +begin + if (AParent is TTBCustomDockableWindow) or (AParent is TTBDock) then + raise EInvalidOperation.Create(STBDockParentNotAllowed); + + inherited; +end; + +procedure TTBDock.BeginUpdate; +begin + Inc(FDisableArrangeToolbars); +end; + +procedure TTBDock.EndUpdate; +begin + Dec(FDisableArrangeToolbars); + if FArrangeToolbarsNeeded and (FDisableArrangeToolbars = 0) then + ArrangeToolbars; +end; + +function TTBDock.HasVisibleToolbars: Boolean; +var + I: Integer; +begin + Result := False; + for I := 0 to DockList.Count-1 do + if ToolbarVisibleOnDock(TTBCustomDockableWindow(DockList[I])) then begin + Result := True; + Break; + end; +end; + +function TTBDock.ToolbarVisibleOnDock(const AToolbar: TTBCustomDockableWindow): Boolean; +begin + Result := (AToolbar.Parent = Self) and + (AToolbar.Visible or (csDesigning in AToolbar.ComponentState)); +end; + +function TTBDock.GetCurrentRowSize(const Row: Integer; + var AFullSize: Boolean): Integer; +var + I, J: Integer; + T: TTBCustomDockableWindow; +begin + Result := 0; + AFullSize := False; + if Row < 0 then Exit; + for I := 0 to DockList.Count-1 do begin + T := TTBCustomDockableWindow(DockList[I]); + if (T.FEffectiveDockRow = Row) and ToolbarVisibleOnDock(T) then begin + AFullSize := T.FullSize; + if not(Position in PositionLeftOrRight) then + J := T.Height + else + J := T.Width; + if J > Result then + Result := J; + end; + end; +end; + +function TTBDock.GetMinRowSize(const Row: Integer; + const ExcludeControl: TTBCustomDockableWindow): Integer; +var + I, J: Integer; + T: TTBCustomDockableWindow; +begin + Result := 0; + if Row < 0 then Exit; + for I := 0 to DockList.Count-1 do begin + T := TTBCustomDockableWindow(DockList[I]); + if (T <> ExcludeControl) and (T.FEffectiveDockRow = Row) and + ToolbarVisibleOnDock(T) then begin + J := T.FLastRowSize; + if J > Result then + Result := J; + end; + end; +end; + +function TTBDock.GetDesignModeRowOf(const XY: Integer): Integer; +{ Similar to GetRowOf, but is a little different to accomidate design mode + better } +var + HighestRowPlus1, R, CurY, CurRowSize: Integer; + FullSize: Boolean; +begin + Result := 0; + HighestRowPlus1 := GetHighestRow(True)+1; + CurY := 0; + for R := 0 to HighestRowPlus1 do begin + Result := R; + if R = HighestRowPlus1 then Break; + CurRowSize := GetCurrentRowSize(R, FullSize); + if CurRowSize = 0 then Continue; + Inc(CurY, CurRowSize); + if XY < CurY then + Break; + end; +end; + +function TTBDock.GetHighestRow(const HighestEffective: Boolean): Integer; +{ Returns highest used row number, or -1 if no rows are used } +var + I, J: Integer; +begin + Result := -1; + for I := 0 to DockList.Count-1 do + with TTBCustomDockableWindow(DockList[I]) do begin + if HighestEffective then + J := FEffectiveDockRow + else + J := FDockRow; + if J > Result then + Result := J; + end; +end; + +procedure TTBDock.ChangeWidthHeight(const NewWidth, NewHeight: Integer); +{ Same as setting Width/Height directly, but does not lose Align position. + Specifically, it ensures that a bottom-aligned dock stays above a + bottom-aligned TStatusBar when the only toolbar on the dock is undocked + and then redocked. } +begin + case Align of + alNone, alTop, alLeft: + SetBounds(Left, Top, NewWidth, NewHeight); + alBottom: + SetBounds(Left, Top-NewHeight+Height, NewWidth, NewHeight); + alRight: + SetBounds(Left-NewWidth+Width, Top, NewWidth, NewHeight); + end; +end; + +procedure TTBDock.AlignControls(AControl: TControl; var Rect: TRect); +begin + ArrangeToolbars; +end; + +function CompareDockRowPos(Item1, Item2: TListItemType): Integer; +begin + Result := TTBCustomDockableWindow(Item1).FDockRow - TTBCustomDockableWindow(Item2).FDockRow; + if Result = 0 then + Result := TTBCustomDockableWindow(Item1).FDockPos - TTBCustomDockableWindow(Item2).FDockPos; +end; + +procedure TTBDock.ArrangeToolbars; +{ The main procedure to arrange all the toolbars docked to it } +type + TPosDataRec = record + Row, ActualRow, PrecSpace, FullSize, MinimumSize, Size, Overlap, Pos: Integer; + ShrinkMode: TTBShrinkMode; + NeedArrange: Boolean; + end; +var + NewDockList: TList; + PosData: array of TPosDataRec; + + function IndexOfDraggingToolbar(const List: TList): Integer; + { Returns index of toolbar in List that's currently being dragged, or -1 } + var + I: Integer; + begin + for I := 0 to List.Count-1 do + if TTBCustomDockableWindow(List[I]).FDragMode then begin + Result := I; + Exit; + end; + Result := -1; + end; + + function ShiftLeft(const Row, StartIndex, MaxSize: Integer): Integer; + { Removes PrecSpace pixels from toolbars at or before StartIndex until the + right edge of the toolbar at StartIndex is <= MaxSize. + Returns the total number of PrecSpace pixels removed from toolbars. } + var + PixelsOffEdge, I, J: Integer; + begin + Result := 0; + PixelsOffEdge := -MaxSize; + for I := 0 to StartIndex do begin + if PosData[I].Row = Row then begin + Inc(PixelsOffEdge, PosData[I].PrecSpace); + Inc(PixelsOffEdge, PosData[I].Size); + end; + end; + if PixelsOffEdge > 0 then + for I := StartIndex downto 0 do begin + if PosData[I].Row = Row then begin + J := PixelsOffEdge; + if PosData[I].PrecSpace < J then + J := PosData[I].PrecSpace; + Dec(PosData[I].PrecSpace, J); + Dec(PixelsOffEdge, J); + Inc(Result, J); + if PixelsOffEdge = 0 then + Break; + end; + end; + end; + + function GetNextToolbar(const GoForward: Boolean; const Row: Integer; + const StartIndex: Integer): Integer; + var + I: Integer; + begin + Result := -1; + I := StartIndex; + while True do begin + if GoForward then begin + Inc(I); + if I >= NewDockList.Count then + Break; + end + else begin + Dec(I); + if I < 0 then + Break; + end; + if PosData[I].Row = Row then begin + Result := I; + Break; + end; + end; + end; + +var + LeftRight: Boolean; + EmptySize, HighestRow, R, CurPos, CurRowPixel, I, J, K, L, ClientW, + ClientH, MaxSize, TotalSize, PixelsPastMaxSize, Offset, CurRealPos, DragIndex, + MinRealPos, DragIndexPos, ToolbarsOnRow, CurRowSize: Integer; + T: TTBCustomDockableWindow; + S: TPoint; + RowIsEmpty: Boolean; +label FoundNextToolbar; +begin + if (FDisableArrangeToolbars > 0) or (csLoading in ComponentState) then begin + FArrangeToolbarsNeeded := True; + Exit; + end; + + NewDockList := nil; + Inc(FDisableArrangeToolbars); + try + { Work around VCL alignment bug when docking toolbars taller or wider than + the client height or width of the form. } + {if not(csDesigning in ComponentState) and HandleAllocated then + SetWindowPos(Handle, HWND_TOP, 0, 0, 0, 0, + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);} + + LeftRight := Position in PositionLeftOrRight; + + if not HasVisibleToolbars then begin + EmptySize := Ord(FFixAlign); + if csDesigning in ComponentState then + EmptySize := 9; + if not LeftRight then + ChangeWidthHeight(Width, EmptySize) + else + ChangeWidthHeight(EmptySize, Height); + Exit; + end; + + { It can't read the ClientWidth and ClientHeight properties because they + attempt to create a handle, which requires Parent to be set. "ClientW" + and "ClientH" are calculated instead. } + ClientW := Width - FNonClientWidth; + if ClientW < 0 then ClientW := 0; + ClientH := Height - FNonClientHeight; + if ClientH < 0 then ClientH := 0; + + { Remove toolbars from DockList & DockVisibleList that are destroying, so + that no methods on these toolbars will be called. + This is needed because in certain rare cases ArrangeToolbars can be + indirectly called while a docked toolbar is being destroyed. } + for I := DockList.Count-1 downto 0 do begin + T := TTBCustomDockableWindow(DockList[I]); + if csDestroying in T.ComponentState then begin + DockList.Delete(I); + DockVisibleList.Remove(T); + end; + end; + + { If LimitToOneRow is True, only use the first row } + if FLimitToOneRow then + for I := 0 to DockList.Count-1 do + with TTBCustomDockableWindow(DockList[I]) do + FDockRow := 0; + + { Copy DockList to NewDockList, and ensure it is in correct ordering + according to DockRow/DockPos } + NewDockList := TList.Create; + NewDockList.Count := DockList.Count; + for I := 0 to NewDockList.Count-1 do + NewDockList[I] := DockList[I]; + I := IndexOfDraggingToolbar(NewDockList); + NewDockList.Sort(CompareDockRowPos); + DragIndex := IndexOfDraggingToolbar(NewDockList); + if (I <> -1) and TTBCustomDockableWindow(NewDockList[DragIndex]).FDragSplitting then begin + { When splitting, don't allow the toolbar being dragged to change + positions in the dock list } + NewDockList.Move(DragIndex, I); + DragIndex := I; + end; + DockVisibleList.Sort(CompareDockRowPos); + { Find highest row number } + HighestRow := GetHighestRow(False); + + { Create a temporary array that holds new position data for the toolbars } + SetLength(PosData, NewDockList.Count); + for I := 0 to NewDockList.Count-1 do begin + T := TTBCustomDockableWindow(NewDockList[I]); + PosData[I].ActualRow := T.FDockRow; + if ToolbarVisibleOnDock(T) then + PosData[I].Row := T.FDockRow + else + PosData[I].Row := -1; + PosData[I].Pos := T.FDockPos; + end; + + { Find FInsertRowBefore=True and FullSize=True toolbars and make sure there + aren't any other toolbars on the same row. If there are, shift them down + a row. } + for L := 0 to 1 do begin + R := 0; + while R <= HighestRow do begin + for I := 0 to NewDockList.Count-1 do begin + T := TTBCustomDockableWindow(NewDockList[I]); + if (PosData[I].ActualRow = R) and + (((L = 0) and T.FInsertRowBefore and not LimitToOneRow) or + ((L = 1) and T.FullSize)) then + for J := 0 to NewDockList.Count-1 do + if (J <> I) and (PosData[J].ActualRow = R) then begin + for K := 0 to NewDockList.Count-1 do begin + if K <> I then begin + if PosData[K].ActualRow >= R then + Inc(PosData[K].ActualRow); + if PosData[K].Row >= R then + Inc(PosData[K].Row); + end; + end; + Inc(HighestRow); + Break; + end; + end; + Inc(R); + end; + end; + + { Remove blank rows. + Note that rows that contain only invisible or currently floating toolbars + are intentionally not removed, so that when the toolbars are shown again, + they stay on their own row. } + R := 0; + while R <= HighestRow do begin + RowIsEmpty := True; + for I := 0 to NewDockList.Count-1 do + if PosData[I].ActualRow = R then begin + RowIsEmpty := False; + Break; + end; + if RowIsEmpty then begin + { Shift all ones higher than R back one } + for I := 0 to NewDockList.Count-1 do begin + if PosData[I].ActualRow > R then + Dec(PosData[I].ActualRow); + if PosData[I].Row > R then + Dec(PosData[I].Row); + end; + Dec(HighestRow); + end + else + Inc(R); + end; + + { Calculate positions and sizes of each row } + R := 0; + while R <= HighestRow do begin + if not LeftRight then + MaxSize := ClientW + else + MaxSize := ClientH; + + { Set initial sizes } + TotalSize := 0; + ToolbarsOnRow := 0; + MinRealPos := 0; + for I := 0 to NewDockList.Count-1 do begin + if PosData[I].Row = R then begin + T := TTBCustomDockableWindow(NewDockList[I]); + T.GetBaseSize(S); + if not LeftRight then + J := S.X + T.NonClientWidth + else + J := S.Y + T.NonClientHeight; + PosData[I].FullSize := J; + PosData[I].Size := J; + PosData[I].ShrinkMode := T.GetShrinkMode; + PosData[I].MinimumSize := 0; + T.GetMinShrinkSize(PosData[I].MinimumSize); + if PosData[I].MinimumSize > PosData[I].FullSize then + { don't allow minimum shrink size to be less than full size } + PosData[I].MinimumSize := PosData[I].FullSize; + if PosData[I].ShrinkMode = tbsmChevron then + Inc(MinRealPos, PosData[I].MinimumSize) + else + Inc(MinRealPos, PosData[I].FullSize); + { If the toolbar isn't the first toolbar on the row, and the toolbar + would go off the edge even after it's shrunk, then move it onto a + row of its own } + if (ToolbarsOnRow > 0) and (MinRealPos > MaxSize) and + not LimitToOneRow then begin + for K := I to NewDockList.Count-1 do begin + if PosData[K].ActualRow >= R then + Inc(PosData[K].ActualRow); + if PosData[K].Row >= R then + Inc(PosData[K].Row); + end; + Inc(HighestRow); + Break; + end; + Inc(TotalSize, J); + Inc(ToolbarsOnRow); + end; + end; + PixelsPastMaxSize := TotalSize - MaxSize; + + { Set initial arrangement; don't shrink toolbars yet } + DragIndexPos := 0; + CurPos := 0; + CurRealPos := 0; + MinRealPos := 0; + for I := 0 to NewDockList.Count-1 do begin + T := TTBCustomDockableWindow(NewDockList[I]); + if PosData[I].Row = R then begin + if (CurPos = 0) and (T.FullSize or T.Stretch) then + { Force to left } + J := 0 + else + J := T.FDockPos; + if I = DragIndex then + DragIndexPos := J; + { Don't let this toolbar overlap preceding toolbars by more than + the sum of their minimum sizes } + if J < MinRealPos then + J := MinRealPos; + if J > CurPos then begin + { There's a gap between the left edge or previous toolbar and + this toolbar } + if PixelsPastMaxSize <= 0 then begin + PosData[I].PrecSpace := J - CurPos; + CurPos := J; + end + else + { Don't allow a gap if exceeding MaxSize } + J := CurPos; + end + else begin + if J < CurRealPos then + PosData[I].Overlap := CurRealPos - J; + end; + + Inc(CurPos, PosData[I].Size); + CurRealPos := J + PosData[I].Size; + Inc(MinRealPos, PosData[I].MinimumSize); + end; + end; + + { If we aren't exceeding MaxSize, allow the toolbar being dragged + to push other toolbars to the left } + if (PixelsPastMaxSize < 0) and (DragIndex <> -1) and + (PosData[DragIndex].Row = R) then begin + I := GetNextToolbar(False, R, DragIndex); + if I <> -1 then begin + J := ShiftLeft(R, I, DragIndexPos); + if J > 0 then begin + { Ensure that toolbars that follow the toolbar being dragged stay + at the same place by increasing PrecSpace on the next toolbar } + I := GetNextToolbar(True, R, DragIndex); + if I <> -1 then + Inc(PosData[I].PrecSpace, J); + end; + end; + end; + + { If any toolbars are going off the edge of the dock, try to make them + at least partially visible by shifting preceding toolbars left } + I := GetNextToolbar(False, R, NewDockList.Count); + if I <> -1 then + ShiftLeft(R, I, MaxSize); + + { Shrink toolbars that overlap other toolbars (Overlaps[x] > 0) } + if PixelsPastMaxSize > 0 then begin + Offset := 0; + for I := 0 to NewDockList.Count-1 do begin + if PosData[I].Row <> R then + Continue; + T := TTBCustomDockableWindow(NewDockList[I]); + if (ToolbarsOnRow > 1) and T.FDragMode then + T.FDragCanSplit := True; + Inc(Offset, PosData[I].Overlap); + if Offset > PixelsPastMaxSize then + Offset := PixelsPastMaxSize; + if Offset > 0 then + for J := I-1 downto 0 do begin + if PosData[J].Row <> R then + Continue; + { How much can we shrink this toolbar J to get toolbar I to + its preferred position? } + if PosData[J].ShrinkMode = tbsmChevron then + L := Offset + else + L := 0; + K := -(PosData[J].Size - L - PosData[J].MinimumSize); { the number of pixels that exceed the minimum size } + if K > 0 then + { Don't shrink a toolbar below its minimum allowed size } + Dec(L, K); + Dec(PosData[J].Size, L); + Dec(PixelsPastMaxSize, L); + Dec(Offset, L); + if (Offset = 0) or + { This is needed so toolbars can push other toolbars to the + right when splitting: } + (J = DragIndex) then + Break; + end; + end; + end; + + { Still exceeding MaxSize? Make sure the rightmost toolbar(s) are + at least partially visible with a width of MinimumSize } + if PixelsPastMaxSize > 0 then begin + for I := NewDockList.Count-1 downto 0 do begin + if (PosData[I].Row <> R) or (PosData[I].ShrinkMode = tbsmNone) or + ((PosData[I].ShrinkMode = tbsmWrap) and (ToolbarsOnRow > 1)) then + Continue; + J := PosData[I].Size - PosData[I].MinimumSize; + if J > 0 then begin { can we shrink this toolbar any? } + if J > PixelsPastMaxSize then + J := PixelsPastMaxSize; + Dec(PosData[I].Size, J); + Dec(PixelsPastMaxSize, J); + end; + if PixelsPastMaxSize = 0 then + Break; + end; + end; + + { Set Poses, and adjust size of FullSize & Stretch toolbars } + CurPos := 0; + for I := 0 to NewDockList.Count-1 do begin + T := TTBCustomDockableWindow(NewDockList[I]); + if PosData[I].Row = R then begin + if T.FullSize or T.Stretch then begin + { Remove any preceding space from this toolbar } + Inc(PosData[I].Size, PosData[I].PrecSpace); + PosData[I].PrecSpace := 0; + end; + Inc(CurPos, PosData[I].PrecSpace); + if T.FullSize then begin + { Claim all space } + if PosData[I].Size < MaxSize then + PosData[I].Size := MaxSize; + end + else if T.Stretch then begin + { Steal any preceding space from the next toolbar } + for J := I+1 to NewDockList.Count-1 do + if PosData[J].Row = R then begin + Inc(PosData[I].Size, PosData[J].PrecSpace); + PosData[J].PrecSpace := 0; + goto FoundNextToolbar; + end; + { or claim any remaining space } + if PosData[I].Size < MaxSize - CurPos then + PosData[I].Size := MaxSize - CurPos; + FoundNextToolbar: + end; + PosData[I].Pos := CurPos; + Inc(CurPos, PosData[I].Size); + end; + end; + + Inc(R); + end; + + for I := 0 to NewDockList.Count-1 do begin + T := TTBCustomDockableWindow(NewDockList[I]); + T.FEffectiveDockRow := PosData[I].ActualRow; + T.FEffectiveDockPos := PosData[I].Pos; + { If FCommitNewPositions is True, update all the toolbars' DockPos and + DockRow properties to match the actual positions. + Also update the ordering of DockList to match NewDockList } + if FCommitNewPositions then begin + T.FDockRow := T.FEffectiveDockRow; + T.FDockPos := T.FEffectiveDockPos; + DockList[I] := NewDockList[I]; + end; + end; + + { Now actually move the toolbars } + CurRowPixel := 0; + for R := 0 to HighestRow do begin + CurRowSize := -1; + for I := 0 to NewDockList.Count-1 do begin + T := TTBCustomDockableWindow(NewDockList[I]); + if PosData[I].Row = R then begin + K := T.FCurrentSize; + T.FCurrentSize := PosData[I].Size; + if PosData[I].Size >= PosData[I].FullSize then begin + T.FCurrentSize := 0; + { Reason: so that if new items are added to a non-shrunk toolbar + at run-time (causing its width to increase), the toolbar won't + shrink unnecessarily } + end; + if (PosData[I].ShrinkMode <> tbsmNone) and (T.FCurrentSize <> K) then begin + { If Size is changing and we are to display a chevron or wrap, + call DoArrange to get an accurate row size } + S := T.DoArrange(False, TBGetDockTypeOf(Self, False), False, Self); + { Force a rearrange in case the actual size isn't changing but the + chevron visibility might have changed (which can happen if + items are added to a FullSize=True toolbar at run-time) } + PosData[I].NeedArrange := True; + end + else begin + if (PosData[I].ShrinkMode = tbsmWrap) and (PosData[I].Size < PosData[I].FullSize) then begin + { Preserve existing height (or width) on a wrapped toolbar + whose size isn't changing now } + S.X := T.Width - T.NonClientWidth; + S.Y := T.Height - T.NonClientHeight; + end + else + T.GetBaseSize(S); + end; + if not LeftRight then + K := S.Y + else + K := S.X; + T.FLastRowSize := K; + if K > CurRowSize then + CurRowSize := K; + end; + end; + if CurRowSize <> -1 then + Inc(CurRowSize, DockedBorderSize2) + else + CurRowSize := 0; + for I := 0 to NewDockList.Count-1 do begin + T := TTBCustomDockableWindow(NewDockList[I]); + if PosData[I].Row = R then begin + Inc(T.FUpdatingBounds); + try + K := T.FCurrentSize; + if PosData[I].NeedArrange then + T.FArrangeNeeded := True; + if not LeftRight then + T.SetBounds(PosData[I].Pos, CurRowPixel, PosData[I].Size, CurRowSize) + else + T.SetBounds(CurRowPixel, PosData[I].Pos, CurRowSize, PosData[I].Size); + if T.FArrangeNeeded then + { ^ don't arrange again if SetBounds call already caused one } + T.Arrange; + { Restore FCurrentSize since TTBToolbarView.DoUpdatePositions + clears it } + T.FCurrentSize := K; + finally + Dec(T.FUpdatingBounds); + end; + end; + end; + Inc(CurRowPixel, CurRowSize); + end; + + { Set the size of the dock } + if not LeftRight then + ChangeWidthHeight(Width, CurRowPixel + FNonClientHeight) + else + ChangeWidthHeight(CurRowPixel + FNonClientWidth, Height); + finally + Dec(FDisableArrangeToolbars); + FArrangeToolbarsNeeded := False; + FCommitNewPositions := False; + NewDockList.Free; + end; +end; + +procedure TTBDock.CommitPositions; +{ Copies docked toolbars' EffectiveDockRow and EffectiveDockPos properties + into DockRow and DockPos respectively. + Note that this does not reorder DockList like ArrangeToolbars does when + FCommitNewPositions=True. } +var + I: Integer; + T: TTBCustomDockableWindow; +begin + for I := 0 to DockVisibleList.Count-1 do begin + T := TTBCustomDockableWindow(DockVisibleList[I]); + T.FDockRow := T.FEffectiveDockRow; + T.FDockPos := T.FEffectiveDockPos; + end; +end; + +procedure TTBDock.ChangeDockList(const Insert: Boolean; + const Bar: TTBCustomDockableWindow); +{ Inserts or removes Bar from DockList } +var + I: Integer; +begin + I := DockList.IndexOf(Bar); + if Insert then begin + if I = -1 then begin + Bar.FreeNotification(Self); + DockList.Add(Bar); + end; + end + else begin + if I <> -1 then + DockList.Delete(I); + end; + ToolbarVisibilityChanged(Bar, False); +end; + +procedure TTBDock.ToolbarVisibilityChanged(const Bar: TTBCustomDockableWindow; + const ForceRemove: Boolean); +var + Modified, VisibleOnDock: Boolean; + I: Integer; +begin + Modified := False; + I := DockVisibleList.IndexOf(Bar); + VisibleOnDock := not ForceRemove and ToolbarVisibleOnDock(Bar); + if VisibleOnDock then begin + if I = -1 then begin + DockVisibleList.Add(Bar); + Modified := True; + end; + end + else begin + if I <> -1 then begin + DockVisibleList.Remove(Bar); + Modified := True; + end; + end; + + if Modified then begin + ArrangeToolbars; + + if Assigned(FOnInsertRemoveBar) then + FOnInsertRemoveBar(Self, VisibleOnDock, Bar); + end; +end; + +procedure TTBDock.Loaded; +begin + inherited; + { Rearranging is disabled while the component is loading, so now that it's + loaded, rearrange it. } + ArrangeToolbars; +end; + +procedure TTBDock.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if Operation = opRemove then begin + if AComponent = FBackground then + Background := nil + else if AComponent is TTBCustomDockableWindow then begin + DockList.Remove(AComponent); + DockVisibleList.Remove(AComponent); + end; + end; +end; + +function TTBDock.GetPalette: HPALETTE; +begin + if UsingBackground and Assigned(FBackground) then + { ^ by default UsingBackground returns False if FBackground isn't assigned, + but UsingBackground may be overridden and return True when it isn't } + Result := FBackground.GetPalette + else + Result := 0; +end; + +procedure TTBDock.WMEraseBkgnd(var Message: TWMEraseBkgnd); +var + R, R2: TRect; + P1, P2: TPoint; + SaveIndex: Integer; +begin + { Draw the Background if there is one, otherwise use default erasing + behavior } + if UsingBackground then begin + R := ClientRect; + R2 := R; + { Make up for nonclient area } + P1 := ClientToScreen(Point(0, 0)); + P2 := Parent.ClientToScreen(BoundsRect.TopLeft); + Dec(R2.Left, Left + (P1.X-P2.X)); + Dec(R2.Top, Top + (P1.Y-P2.Y)); + SaveIndex := SaveDC(Message.DC); + IntersectClipRect(Message.DC, R.Left, R.Top, R.Right, R.Bottom); + DrawBackground(Message.DC, R2); + RestoreDC(Message.DC, SaveIndex); + Message.Result := 1; + end + else + inherited; +end; + +procedure TTBDock.Paint; +var + R: TRect; +begin + inherited; + { Draw dotted border in design mode } + if csDesigning in ComponentState then begin + R := ClientRect; + with Canvas do begin + Pen.Style := psDot; + Pen.Color := clBtnShadow; + Brush.Style := bsClear; + Rectangle(R.Left, R.Top, R.Right, R.Bottom); + Pen.Style := psSolid; + end; + end; +end; + +procedure TTBDock.WMMove(var Message: TWMMove); +begin + inherited; + if UsingBackground then + InvalidateBackgrounds; +end; + +{$IFNDEF JR_D4} +procedure TTBDock.WMSize(var Message: TWMSize); +begin + inherited; + if not(csLoading in ComponentState) and Assigned(FOnResize) then + FOnResize(Self); +end; +{$ENDIF} + +procedure TTBDock.WMNCCalcSize(var Message: TWMNCCalcSize); + + procedure ApplyToRect(var R: TRect); + begin + if blTop in BoundLines then Inc(R.Top); + if blBottom in BoundLines then Dec(R.Bottom); + if blLeft in BoundLines then Inc(R.Left); + if blRight in BoundLines then Dec(R.Right); + end; + +{$IFDEF CLR} +var + Params: TNCCalcSizeParams; +{$ENDIF} +begin + inherited; + { note to self: non-client size is stored in FNonClientWidth & + FNonClientHeight } + {$IFNDEF CLR} + ApplyToRect(Message.CalcSize_Params.rgrc[0]); + {$ELSE} + Params := Message.CalcSize_Params; + ApplyToRect(Params.rgrc0); + Message.CalcSize_Params := Params; + {$ENDIF} +end; + +procedure TTBDock.DrawNCArea(const DrawToDC: Boolean; const ADC: HDC; + const Clip: HRGN); + + procedure DrawLine(const DC: HDC; const X1, Y1, X2, Y2: Integer); + begin + MoveToEx(DC, X1, Y1, nil); LineTo(DC, X2, Y2); + end; +var + RW, R, R2, RC: TRect; + DC: HDC; + HighlightPen, ShadowPen, SavePen: HPEN; + FillBrush: HBRUSH; +label SkipFillRect; +begin + { This works around WM_NCPAINT problem described at top of source code } + {no! R := Rect(0, 0, Width, Height);} + GetWindowRect(Handle, RW); + R := RW; + OffsetRect(R, -R.Left, -R.Top); + + if not DrawToDC then + DC := GetWindowDC(Handle) + else + DC := ADC; + try + { Use update region } + if not DrawToDC then + SelectNCUpdateRgn(Handle, DC, Clip); + + { Draw BoundLines } + R2 := R; + if (BoundLines <> []) and + ((csDesigning in ComponentState) or HasVisibleToolbars) then begin + HighlightPen := CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNHIGHLIGHT)); + ShadowPen := CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW)); + SavePen := SelectObject(DC, ShadowPen); + if blTop in BoundLines then begin + DrawLine(DC, R.Left, R.Top, R.Right, R.Top); + Inc(R2.Top); + end; + if blLeft in BoundLines then begin + DrawLine(DC, R.Left, R.Top, R.Left, R.Bottom); + Inc(R2.Left); + end; + SelectObject(DC, HighlightPen); + if blBottom in BoundLines then begin + DrawLine(DC, R.Left, R.Bottom-1, R.Right, R.Bottom-1); + Dec(R2.Bottom); + end; + if blRight in BoundLines then begin + DrawLine(DC, R.Right-1, R.Top, R.Right-1, R.Bottom); + Dec(R2.Right); + end; + SelectObject(DC, SavePen); + DeleteObject(ShadowPen); + DeleteObject(HighlightPen); + end; + Windows.GetClientRect(Handle, RC); + if not IsRectEmpty(RC) then begin + { ^ ExcludeClipRect can't be passed rectangles that have (Bottom < Top) or + (Right < Left) since it doesn't treat them as empty } + MapWindowPoints(Handle, 0, RC, 2); + OffsetRect(RC, -RW.Left, -RW.Top); + if EqualRect(RC, R2) then + { Skip FillRect because there would be nothing left after ExcludeClipRect } + goto SkipFillRect; + ExcludeClipRect(DC, RC.Left, RC.Top, RC.Right, RC.Bottom); + end; + FillBrush := CreateSolidBrush(ColorToRGB(Color)); + FillRect(DC, R2, FillBrush); + DeleteObject(FillBrush); + SkipFillRect: + finally + if not DrawToDC then + ReleaseDC(Handle, DC); + end; +end; + +procedure TTBDock.WMNCPaint(var Message: TMessage); +begin + DrawNCArea(False, 0, HRGN(Message.WParam)); +end; + +procedure DockNCPaintProc(Wnd: HWND; DC: HDC; AppData: TObject); +begin + TTBDock(AppData).DrawNCArea(True, DC, 0); +end; + +procedure TTBDock.WMPrint(var Message: TMessage); +begin + HandleWMPrint(Handle, Message, DockNCPaintProc, Self); +end; + +procedure TTBDock.WMPrintClient(var Message: + {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); +begin + HandleWMPrintClient(PaintHandler, Message); +end; + +procedure TTBDock.CMSysColorChange(var Message: TMessage); +begin + inherited; + if Assigned(FBackground) then + FBackground.SysColorChanged; +end; + +procedure TTBDock.RelayMsgToFloatingBars({$IFNDEF CLR}var{$ELSE}const{$ENDIF} Message: TMessage); +var + I: Integer; + T: TTBCustomDockableWindow; +begin + for I := 0 to DockList.Count-1 do begin + T := TTBCustomDockableWindow(DockList[I]); + { Note: We must be careful about relaying WM_SYSCOMMAND. We can't send it + to classes that don't have special handling for it (as indicated by the + csMenuEvents style, which TTBToolWindow lacks) because the VCL's + default handling would send it back to the main form, resulting in + infinite recursion. } + if ((Message.Msg <> WM_SYSCOMMAND) or (csMenuEvents in T.ControlStyle)) and + T.Floating and T.CanFocus then begin + Message.Result := T.Perform(Message.Msg, Message.WParam, Message.LParam); + if Message.Result <> 0 then + Exit; + end; + end; +end; + +procedure TTBDock.WMSysCommand(var Message: TWMSysCommand); +begin + { Relay WM_SYSCOMMAND messages to floating toolbars which were formerly + docked. That way, items on floating menu bars can be accessed with Alt. } + if Message.CmdType and $FFF0 = SC_KEYMENU then + RelayMsgToFloatingBars({$IFNDEF CLR} TMessage(Message) {$ELSE} Message.OriginalMessage {$ENDIF}); +end; + +procedure TTBDock.CMDialogKey(var Message: TCMDialogKey); +begin + RelayMsgToFloatingBars({$IFNDEF CLR} TMessage(Message) {$ELSE} Message.OriginalMessage {$ENDIF}); + if Message.Result = 0 then + inherited; +end; + +procedure TTBDock.CMDialogChar(var Message: TCMDialogChar); +begin + RelayMsgToFloatingBars({$IFNDEF CLR} TMessage(Message) {$ELSE} Message.OriginalMessage {$ENDIF}); + if Message.Result = 0 then + inherited; +end; + +{ TTBDock - property access methods } + +procedure TTBDock.SetAllowDrag(Value: Boolean); +var + I: Integer; +begin + if FAllowDrag <> Value then begin + FAllowDrag := Value; + for I := 0 to ControlCount-1 do + if Controls[I] is TTBCustomDockableWindow then + RecalcNCArea(TTBCustomDockableWindow(Controls[I])); + end; +end; + +function TTBDock.UsingBackground: Boolean; +begin + Result := Assigned(FBackground) and FBackground.UsingBackground; +end; + +procedure TTBDock.DrawBackground(DC: HDC; const DrawRect: TRect); +begin + FBackground.Draw(DC, DrawRect); +end; + +procedure TTBDock.InvalidateBackgrounds; +{ Called after background is changed } +var + I: Integer; + T: TTBCustomDockableWindow; +begin + Invalidate; + { Synchronize child toolbars also } + for I := 0 to DockList.Count-1 do begin + T := TTBCustomDockableWindow(DockList[I]); + if ToolbarVisibleOnDock(T) then + { Invalidate both non-client and client area } + InvalidateAll(T); + end; +end; + +procedure TTBDock.SetBackground(Value: TTBBasicBackground); +begin + if FBackground <> Value then begin + if Assigned(FBackground) then + FBackground.UnregisterChanges(BackgroundChanged); + FBackground := Value; + if Assigned(Value) then begin + Value.FreeNotification(Self); + Value.RegisterChanges(BackgroundChanged); + end; + InvalidateBackgrounds; + end; +end; + +procedure TTBDock.BackgroundChanged(Sender: TObject); +begin + InvalidateBackgrounds; +end; + +procedure TTBDock.SetBackgroundOnToolbars(Value: Boolean); +begin + if FBkgOnToolbars <> Value then begin + FBkgOnToolbars := Value; + InvalidateBackgrounds; + end; +end; + +procedure TTBDock.SetBoundLines(Value: TTBDockBoundLines); +var + X, Y: Integer; + B: TTBDockBoundLines; +begin + if FBoundLines <> Value then begin + FBoundLines := Value; + X := 0; + Y := 0; + B := BoundLines; { optimization } + if blTop in B then Inc(Y); + if blBottom in B then Inc(Y); + if blLeft in B then Inc(X); + if blRight in B then Inc(X); + FNonClientWidth := X; + FNonClientHeight := Y; + RecalcNCArea(Self); + end; +end; + +procedure TTBDock.SetFixAlign(Value: Boolean); +begin + if FFixAlign <> Value then begin + FFixAlign := Value; + ArrangeToolbars; + end; +end; + +procedure TTBDock.SetPosition(Value: TTBDockPosition); +begin + if (FPosition <> Value) and (ControlCount <> 0) then + raise EInvalidOperation.Create(STBDockCannotChangePosition); + FPosition := Value; + case Position of + dpTop: Align := alTop; + dpBottom: Align := alBottom; + dpLeft: Align := alLeft; + dpRight: Align := alRight; + end; +end; + +function TTBDock.GetToolbarCount: Integer; +begin + Result := DockVisibleList.Count; +end; + +function TTBDock.GetToolbars(Index: Integer): TTBCustomDockableWindow; +begin + Result := TTBCustomDockableWindow(DockVisibleList[Index]); +end; + +(*function TTBDock.GetVersion: TToolbar97Version; +begin + Result := Toolbar97VersionPropText; +end; + +procedure TTBDock.SetVersion(const Value: TToolbar97Version); +begin + { write method required for the property to show up in Object Inspector } +end;*) + + +{ TTBFloatingWindowParent - Internal } + +procedure TTBFloatingWindowParent.CreateParams(var Params: TCreateParams); +const + ThickFrames: array[Boolean] of DWORD = (0, WS_THICKFRAME); +begin + inherited; + + { Disable complete redraws when size changes. CS_H/VREDRAW cause flicker + and are not necessary for this control at run time } + if not(csDesigning in ComponentState) then + with Params.WindowClass do + Style := Style and not(CS_HREDRAW or CS_VREDRAW); + + with Params do begin + { Note: WS_THICKFRAME and WS_BORDER styles are included to ensure that + sizing grips are displayed on child controls with scrollbars. The + thick frame or border is not drawn by Windows; TCustomToolWindow97 + handles all border drawing by itself. } + if not(csDesigning in ComponentState) then + Style := WS_POPUP or WS_BORDER or ThickFrames[FDockableWindow.FResizable] + else + Style := Style or WS_BORDER or ThickFrames[FDockableWindow.FResizable]; + { The WS_EX_TOOLWINDOW style is needed so there isn't a taskbar button + for the toolbar when FloatingMode = fmOnTopOfAllForms. } + ExStyle := WS_EX_TOOLWINDOW; + end; +end; + +procedure TTBFloatingWindowParent.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = FParentForm) then + FParentForm := nil; +end; + +procedure TTBFloatingWindowParent.AlignControls(AControl: TControl; var Rect: TRect); +begin + { ignore Align setting of the child toolbar } +end; + +procedure TTBFloatingWindowParent.WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo); +{$IFDEF CLR} +var + Temp: TMinMaxInfo; +{$ENDIF} +begin + inherited; + { Because the window uses the WS_THICKFRAME style (but not for the usual + purpose), it must process the WM_GETMINMAXINFO message to remove the + minimum and maximum size limits it imposes by default. } + {$IFNDEF CLR} + with Message.MinMaxInfo^ do begin + {$ELSE} + Temp := Message.MinMaxInfo; + with Temp do begin + {$ENDIF} + with ptMinTrackSize do begin + X := 1; + Y := 1; + { Note to self: Don't put GetMinimumSize code here, since + ClientWidth/Height values are sometimes invalid during a RecreateWnd } + end; + with ptMaxTrackSize do begin + { Because of the 16-bit (signed) size limitations of Windows 95, + Smallints must be used instead of Integers or Longints } + X := High(Smallint); + Y := High(Smallint); + end; + end; + {$IFDEF CLR} + Message.MinMaxInfo := Temp; + {$ENDIF} +end; + +procedure TTBFloatingWindowParent.CMShowingChanged(var Message: TMessage); +const + ShowFlags: array[Boolean] of UINT = ( + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_HIDEWINDOW, + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_SHOWWINDOW); +begin + { Must override TCustomForm/TForm's CM_SHOWINGCHANGED handler so that the + form doesn't get activated when Visible is set to True. } + SetWindowPos(WindowHandle, 0, 0, 0, 0, 0, ShowFlags[Showing and FShouldShow]); +end; + +procedure TTBFloatingWindowParent.CMDialogKey(var Message: TCMDialogKey); +begin + { If Escape if pressed on a floating toolbar, return focus to the form } + if (Message.CharCode = VK_ESCAPE) and + (KeyDataToShiftState(ClipToLongint(Message.KeyData)) = []) and + Assigned(ParentForm) then begin + ParentForm.SetFocus; + Message.Result := 1; + end + else + inherited; +end; + +procedure TTBFloatingWindowParent.CMTextChanged(var Message: TMessage); +begin + inherited; + RedrawNCArea([twrdCaption]); +end; + +function TTBFloatingWindowParent.GetCaptionRect(const AdjustForBorder, + MinusCloseButton: Boolean): TRect; +var + P: TPoint; +begin + Result := Rect(0, 0, ClientWidth, GetSmallCaptionHeight-1); + if MinusCloseButton then + Dec(Result.Right, Result.Bottom); + if AdjustForBorder then begin + P := FDockableWindow.GetFloatingBorderSize; + OffsetRect(Result, P.X, P.Y); + end; +end; + +function TTBFloatingWindowParent.GetCloseButtonRect(const AdjustForBorder: Boolean): TRect; +begin + Result := GetCaptionRect(AdjustForBorder, False); + Result.Left := Result.Right - (GetSmallCaptionHeight-1); +end; + +procedure TTBFloatingWindowParent.WMNCCalcSize(var Message: TWMNCCalcSize); + + procedure ApplyToRect(var R: TRect); + var + TL, BR: TPoint; + begin + FDockableWindow.GetFloatingNCArea(TL, BR); + Inc(R.Left, TL.X); + Inc(R.Top, TL.Y); + Dec(R.Right, BR.X); + Dec(R.Bottom, BR.Y); + end; + +{$IFDEF CLR} +var + Params: TNCCalcSizeParams; +{$ENDIF} +begin + { Doesn't call inherited since it overrides the normal NC sizes } + Message.Result := 0; + {$IFNDEF CLR} + ApplyToRect(Message.CalcSize_Params.rgrc[0]); + {$ELSE} + Params := Message.CalcSize_Params; + ApplyToRect(Params.rgrc0); + Message.CalcSize_Params := Params; + {$ENDIF} +end; + +procedure TTBFloatingWindowParent.WMNCPaint(var Message: TMessage); +begin + { Don't call inherited because it overrides the default NC painting } + DrawNCArea(False, 0, HRGN(Message.WParam), twrdAll); +end; + +procedure FloatingWindowParentNCPaintProc(Wnd: HWND; DC: HDC; AppData: TObject); +begin + with TTBFloatingWindowParent(AppData) do + DrawNCArea(True, DC, 0, twrdAll); +end; + +procedure TTBFloatingWindowParent.WMPrint(var Message: TMessage); +begin + HandleWMPrint(Handle, Message, FloatingWindowParentNCPaintProc, Self); +end; + +procedure TTBFloatingWindowParent.WMPrintClient(var Message: + {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); +begin + HandleWMPrintClient(PaintHandler, Message); +end; + +procedure TTBFloatingWindowParent.WMNCHitTest(var Message: TWMNCHitTest); +var + P: TPoint; + R: TRect; + BorderSize: TPoint; + C: Integer; +begin + inherited; + with Message do begin + P := SmallPointToPoint(Pos); + GetWindowRect(Handle, R); + Dec(P.X, R.Left); Dec(P.Y, R.Top); + if Result <> HTCLIENT then begin + Result := HTNOWHERE; + if FDockableWindow.ShowCaption and PtInRect(GetCaptionRect(True, False), P) then begin + if FDockableWindow.FCloseButton and PtInRect(GetCloseButtonRect(True), P) then + Result := HT_TB2k_Close + else + Result := HT_TB2k_Caption; + end + else + if FDockableWindow.Resizable then begin + BorderSize := FDockableWindow.GetFloatingBorderSize; + if not(tbdsResizeEightCorner in FDockableWindow.FDockableWindowStyles) then begin + if (P.Y >= 0) and (P.Y < BorderSize.Y) then Result := HTTOP else + if (P.Y < Height) and (P.Y >= Height-BorderSize.Y-1) then Result := HTBOTTOM else + if (P.X >= 0) and (P.X < BorderSize.X) then Result := HTLEFT else + if (P.X < Width) and (P.X >= Width-BorderSize.X-1) then Result := HTRIGHT; + end + else begin + C := BorderSize.X + (GetSmallCaptionHeight-1); + if (P.X >= 0) and (P.X < BorderSize.X) then begin + Result := HTLEFT; + if (P.Y < C) then Result := HTTOPLEFT else + if (P.Y >= Height-C) then Result := HTBOTTOMLEFT; + end + else + if (P.X < Width) and (P.X >= Width-BorderSize.X-1) then begin + Result := HTRIGHT; + if (P.Y < C) then Result := HTTOPRIGHT else + if (P.Y >= Height-C) then Result := HTBOTTOMRIGHT; + end + else + if (P.Y >= 0) and (P.Y < BorderSize.Y) then begin + Result := HTTOP; + if (P.X < C) then Result := HTTOPLEFT else + if (P.X >= Width-C) then Result := HTTOPRIGHT; + end + else + if (P.Y < Height) and (P.Y >= Height-BorderSize.Y-1) then begin + Result := HTBOTTOM; + if (P.X < C) then Result := HTBOTTOMLEFT else + if (P.X >= Width-C) then Result := HTBOTTOMRIGHT; + end; + end; + end; + end; + end; +end; + +procedure TTBFloatingWindowParent.SetCloseButtonState(Pushed: Boolean); +begin + if FCloseButtonDown <> Pushed then begin + FCloseButtonDown := Pushed; + RedrawNCArea([twrdCloseButton]); + end; +end; + +procedure TTBFloatingWindowParent.WMNCLButtonDown(var Message: TWMNCLButtonDown); +var + P: TPoint; + R, BR: TRect; +begin + case ClipToLongint(Message.HitTest) of + HT_TB2k_Caption: begin + P := FDockableWindow.ScreenToClient(Point(Message.XCursor, Message.YCursor)); + FDockableWindow.BeginMoving(P.X, P.Y); + end; + HTLEFT..HTBOTTOMRIGHT: + if FDockableWindow.Resizable then + FDockableWindow.BeginSizing(TTBSizeHandle(ClipToLongint(Message.HitTest) - HTLEFT)); + HT_TB2k_Close: begin + GetWindowRect(Handle, R); + BR := GetCloseButtonRect(True); + OffsetRect(BR, R.Left, R.Top); + if CloseButtonLoop(Handle, BR, SetCloseButtonState) then + FDockableWindow.Close; + end; + else + inherited; + end; +end; + +procedure TTBFloatingWindowParent.WMNCLButtonDblClk(var Message: TWMNCLButtonDblClk); +begin + if ClipToLongint(Message.HitTest) = HT_TB2k_Caption then + FDockableWindow.DoubleClick; +end; + +procedure TTBFloatingWindowParent.WMNCRButtonUp(var Message: TWMNCRButtonUp); +begin + FDockableWindow.ShowNCContextMenu(Message.XCursor, Message.YCursor); +end; + +procedure TTBFloatingWindowParent.WMClose(var Message: TWMClose); +var + MDIParentForm: TTBCustomForm; +begin + { A floating toolbar does not use WM_CLOSE messages when its close button + is clicked, but Windows still sends a WM_CLOSE message if the user + presses Alt+F4 while one of the toolbar's controls is focused. Inherited + is not called since we do not want Windows' default processing - which + destroys the window. Instead, relay the message to the parent form. } + MDIParentForm := GetMDIParent(TBGetToolWindowParentForm(FDockableWindow)); + if Assigned(MDIParentForm) and MDIParentForm.HandleAllocated then + SendMessage(MDIParentForm.Handle, WM_CLOSE, 0, 0); + { Note to self: MDIParentForm is used instead of OwnerForm since MDI + childs don't process Alt+F4 as Close } +end; + +procedure TTBFloatingWindowParent.WMActivate(var Message: TWMActivate); +var + ParentForm: TTBCustomForm; +begin + if csDesigning in ComponentState then begin + inherited; + Exit; + end; + + ParentForm := GetMDIParent(TBGetToolWindowParentForm(FDockableWindow)); + + if Assigned(ParentForm) and ParentForm.HandleAllocated then + SendMessage(ParentForm.Handle, WM_NCACTIVATE, Ord(Message.Active <> WA_INACTIVE), 0); + + if Message.Active <> WA_INACTIVE then begin + { This works around a "gotcha" in TCustomForm.CMShowingChanged. When a form + is hidden, it uses the internal VCL function FindTopMostWindow to + find a new active window. The problem is that handles of floating + toolbars on the form being hidden can be returned by + FindTopMostWindow, so the following code is used to prevent floating + toolbars on the hidden form from being left active. } + if not IsWindowVisible(Handle) then + { ^ Calling IsWindowVisible with a floating toolbar handle will + always return False if its parent form is hidden since the + WH_CALLWNDPROC hook automatically updates the toolbars' + visibility. } + { Find and activate a window besides this toolbar } + SetActiveWindow(FindTopLevelWindow(Handle)) + else + { If the toolbar is being activated and the previous active window wasn't + its parent form, the form is activated instead. This is done so that if + the application is deactivated while a floating toolbar was active and + the application is reactivated again, it returns focus to the form. } + if Assigned(ParentForm) and ParentForm.HandleAllocated and + (Message.ActiveWindow <> ParentForm.Handle) then + SetActiveWindow(ParentForm.Handle); + end; +end; + +procedure TTBFloatingWindowParent.WMMouseActivate(var Message: TWMMouseActivate); +var + ParentForm, MDIParentForm: TTBCustomForm; +begin + if csDesigning in ComponentState then begin + inherited; + Exit; + end; + + { When floating, prevent the toolbar from activating when clicked. + This is so it doesn't take the focus away from the window that had it } + Message.Result := MA_NOACTIVATE; + + { Similar to calling BringWindowToTop, but doesn't activate it } + SetWindowPos(Handle, HWND_TOP, 0, 0, 0, 0, + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); + + { Since it is returning MA_NOACTIVATE, activate the form instead. } + ParentForm := TBGetToolWindowParentForm(FDockableWindow); + MDIParentForm := GetMDIParent(ParentForm); + if (FDockableWindow.FFloatingMode = fmOnTopOfParentForm) and + FDockableWindow.FActivateParent and + Assigned(MDIParentForm) and (GetActiveWindow <> Handle) then begin + { ^ Note to self: The GetActiveWindow check must be in there so that + double-clicks work properly on controls like Edits } + if MDIParentForm.HandleAllocated then + SetActiveWindow(MDIParentForm.Handle); + if (MDIParentForm <> ParentForm) and { if it's an MDI child form } + ParentForm.HandleAllocated then + BringWindowToTop(ParentForm.Handle); + end; +end; + +procedure TTBFloatingWindowParent.WMMove(var Message: TWMMove); +begin + inherited; + FDockableWindow.Moved; +end; + +procedure TTBFloatingWindowParent.DrawNCArea(const DrawToDC: Boolean; + const ADC: HDC; const Clip: HRGN; RedrawWhat: TTBToolWindowNCRedrawWhat); +{ Redraws all the non-client area (the border, title bar, and close button) of + the toolbar when it is floating. } +const + BorderColors: array[Boolean] of Integer = + (COLOR_ACTIVEBORDER, COLOR_INACTIVEBORDER); + CaptionBkColors: array[Boolean, Boolean] of Integer = + ((COLOR_ACTIVECAPTION, COLOR_INACTIVECAPTION), + (COLOR_GRADIENTACTIVECAPTION, COLOR_GRADIENTINACTIVECAPTION)); + CloseButtonState: array[Boolean] of UINT = (0, DFCS_PUSHED); +var + DC: HDC; + R, R2: TRect; + Gradient: Boolean; + SavePen: HPEN; + SaveIndex: Integer; + S: TPoint; +begin + if not HandleAllocated then Exit; + + if not DrawToDC then + DC := GetWindowDC(Handle) + else + DC := ADC; + try + { Use update region } + if not DrawToDC then + SelectNCUpdateRgn(Handle, DC, Clip); + + { Work around an apparent NT 4.0 & 2000 bug. If the width of the DC is + greater than the width of the screen, then any call to ExcludeClipRect + inexplicably shrinks the clipping rectangle to the screen width. I've + found that calling IntersectClipRect as done below magically fixes the + problem (but I'm not sure why). } + GetWindowRect(Handle, R); OffsetRect(R, -R.Left, -R.Top); + IntersectClipRect(DC, R.Left, R.Top, R.Right, R.Bottom); + + Gradient := GetSystemParametersInfoBool(SPI_GETGRADIENTCAPTIONS, False); + + { Border } + if twrdBorder in RedrawWhat then begin + { This works around WM_NCPAINT problem described at top of source code } + {no! R := Rect(0, 0, Width, Height);} + GetWindowRect(Handle, R); OffsetRect(R, -R.Left, -R.Top); + R2 := R; + DrawEdge(DC, R, EDGE_RAISED, BF_RECT or BF_ADJUST); + S := FDockableWindow.GetFloatingBorderSize; + InflateRect(R2, -(S.X - 1), -(S.Y - 1)); + FrameRect(DC, R2, GetSysColorBrush(COLOR_BTNFACE)); + SaveIndex := SaveDC(DC); + ExcludeClipRect(DC, R2.Left, R2.Top, R2.Right, R2.Bottom); + FillRect(DC, R, GetSysColorBrush(BorderColors[FDockableWindow.FInactiveCaption])); + RestoreDC(DC, SaveIndex); + end; + + if FDockableWindow.ShowCaption then begin + if (twrdCaption in RedrawWhat) and FDockableWindow.FCloseButton and + (twrdCloseButton in RedrawWhat) then + SaveIndex := SaveDC(DC) + else + SaveIndex := 0; + try + if SaveIndex <> 0 then + with GetCloseButtonRect(True) do + { Reduces flicker } + ExcludeClipRect(DC, Left, Top, Right, Bottom); + + { Caption } + if twrdCaption in RedrawWhat then begin + R := GetCaptionRect(True, FDockableWindow.FCloseButton); + DrawSmallWindowCaption(Handle, DC, R, Caption, + not FDockableWindow.FInactiveCaption); + + { Line below caption } + R := GetCaptionRect(True, False); + SavePen := SelectObject(DC, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE))); + MoveToEx(DC, R.Left, R.Bottom, nil); + LineTo(DC, R.Right, R.Bottom); + DeleteObject(SelectObject(DC, SavePen)); + end; + finally + if SaveIndex <> 0 then + RestoreDC(DC, SaveIndex); + end; + + { Close button } + if FDockableWindow.FCloseButton then begin + R := GetCloseButtonRect(True); + R2 := R; + InflateRect(R2, 0, -2); + Dec(R2.Right, 2); + if twrdCaption in RedrawWhat then begin + SaveIndex := SaveDC(DC); + ExcludeClipRect(DC, R2.Left, R2.Top, R2.Right, R2.Bottom); + FillRect(DC, R, GetSysColorBrush(CaptionBkColors[Gradient, + FDockableWindow.FInactiveCaption])); + RestoreDC(DC, SaveIndex); + end; + if twrdCloseButton in RedrawWhat then + DrawFrameControl(DC, R2, DFC_CAPTION, DFCS_CAPTIONCLOSE or + CloseButtonState[FCloseButtonDown]); + end; + end; + finally + if not DrawToDC then + ReleaseDC(Handle, DC); + end; +end; + +procedure TTBFloatingWindowParent.RedrawNCArea(const RedrawWhat: TTBToolWindowNCRedrawWhat); +begin + { Note: IsWindowVisible is called as an optimization. There's no need to + draw on invisible windows. } + if HandleAllocated and IsWindowVisible(Handle) then + DrawNCArea(False, 0, 0, RedrawWhat); +end; + +procedure TTBFloatingWindowParent.CallRecreateWnd; +{ This method exists for Delphi.NET: If we try to call RecreateWnd directly + in TTBCustomDockableWindow.SetResizable, we get this compiler error: + "Only methods of descendant types may access protected member + [Borland.Vcl]TWinControl.RecreateWnd across assembly boundaries" } +begin + RecreateWnd; +end; + + +{ TTBCustomDockableWindow } + +constructor TTBCustomDockableWindow.Create(AOwner: TComponent); +begin + inherited; + + ControlStyle := ControlStyle + + [csAcceptsControls, csClickEvents, csDoubleClicks, csSetCaption] - + [csCaptureMouse{capturing is done manually}, csOpaque]; + FAutoResize := True; + FActivateParent := True; + FBorderStyle := bsSingle; + FCloseButton := True; + FDockableTo := [dpTop, dpBottom, dpLeft, dpRight]; + FDockableWindowStyles := [tbdsResizeEightCorner, tbdsResizeClipCursor]; + FDockPos := -1; + FDragHandleStyle := dhSingle; + FEffectiveDockRow := -1; + FHideWhenInactive := True; + FResizable := True; + FShowCaption := True; + FSmoothDrag := True; + FUseLastDock := True; + + Color := clBtnFace; + + if not(csDesigning in ComponentState) then + InstallHookProc(Self, ToolbarHookProc, [hpSendActivate, hpSendActivateApp, + hpSendWindowPosChanged, hpPreDestroy]); + InitTrackMouseEvent; +end; + +destructor TTBCustomDockableWindow.Destroy; +begin + inherited; + FreeAndNil(FDockForms); { must be done after 'inherited' because Notification accesses FDockForms } + FreeAndNil(FFloatParent); + UninstallHookProc(Self, ToolbarHookProc); +end; + +function TTBCustomDockableWindow.HasParent: Boolean; +begin + if Parent is TTBFloatingWindowParent then + Result := False + else + Result := inherited HasParent; +end; + +function TTBCustomDockableWindow.GetParentComponent: TComponent; +begin + if Parent is TTBFloatingWindowParent then + Result := nil + else + Result := inherited GetParentComponent; +end; + +procedure TTBCustomDockableWindow.Moved; +begin + if not(csLoading in ComponentState) and Assigned(FOnMove) and (FDisableOnMove <= 0) then + FOnMove(Self); +end; + +procedure TTBCustomDockableWindow.WMMove(var Message: TWMMove); + + procedure Redraw; + { Redraws the control using an off-screen bitmap to avoid flicker } + var + CR, R: TRect; + W: HWND; + DC, BmpDC: HDC; + Bmp: HBITMAP; + begin + if not HandleAllocated then Exit; + CR := ClientRect; + W := Handle; + if GetUpdateRect(W, R, False) and EqualRect(R, CR) then begin + { The client area is already completely invalid, so don't bother using + an off-screen bitmap } + InvalidateAll(Self); + Exit; + end; + ValidateRect(W, nil); + BmpDC := 0; + Bmp := 0; + DC := GetDC(W); + try + BmpDC := CreateCompatibleDC(DC); + Bmp := CreateCompatibleBitmap(DC, CR.Right, CR.Bottom); + SelectObject(BmpDC, Bmp); + SendMessage(W, WM_NCPAINT, 0, 0); + SendMessage(W, WM_ERASEBKGND, WPARAM(BmpDC), 0); + SendMessage(W, WM_PAINT, WPARAM(BmpDC), 0); + BitBlt(DC, 0, 0, CR.Right, CR.Bottom, BmpDC, 0, 0, SRCCOPY); + finally + if BmpDC <> 0 then DeleteDC(BmpDC); + if Bmp <> 0 then DeleteObject(Bmp); + ReleaseDC(W, DC); + end; + end; + +begin + inherited; + FMoved := True; + if Docked and CurrentDock.UsingBackground then begin + { Needs to redraw so that the background is lined up with the dock at the + new position. } + Redraw; + end; + Moved; +end; + +{$IFNDEF JR_D4} +procedure TTBCustomDockableWindow.WMSize(var Message: TWMSize); +begin + inherited; + if not(csLoading in ComponentState) and Assigned(FOnResize) then + FOnResize(Self); +end; +{$ENDIF} + +procedure TTBCustomDockableWindow.UpdateCaptionState; +{ Updates the caption active/inactive state of a floating tool window. + Called when the tool window is visible or is about to be shown. } + + function IsPopupWindowActive: Boolean; + const + IID_ITBPopupWindow: TGUID = '{E45CBE74-1ECF-44CB-B064-6D45B1924708}'; + var + Ctl: TWinControl; + {$IFDEF CLR} + Intfs: array of System.Type; + I: Integer; + {$ENDIF} + begin + Ctl := FindControl(GetActiveWindow); + { Instead of using "is TTBPopupWindow", which would require linking to the + TB2Item unit, check if the control implements the ITBPopupWindow + interface. This will tell us if it's a TTBPopupWindow or descendant. } + {$IFNDEF CLR} + Result := Assigned(Ctl) and Assigned(Ctl.GetInterfaceEntry(IID_ITBPopupWindow)); + {$ELSE} + Result := False; + if Assigned(Ctl) then begin + Intfs := TypeOf(Ctl).GetInterfaces; + for I := Low(Intfs) to High(Intfs) do begin + if Intfs[I].GUID = IID_ITBPopupWindow then begin + Result := True; + Break; + end; + end; + end; + {$ENDIF} + end; + + function GetActiveFormWindow: HWND; + var + Ctl: TWinControl; + begin + Result := GetActiveWindow; + { If the active window is a TTBFloatingWindowParent (i.e. a control on a + floating toolbar is focused), return the parent form handle instead } + Ctl := FindControl(Result); + if Assigned(Ctl) and (Ctl is TTBFloatingWindowParent) then begin + Ctl := TTBFloatingWindowParent(Ctl).ParentForm; + if Assigned(Ctl) and Ctl.HandleAllocated then + Result := Ctl.Handle; + end; + end; + +var + Inactive: Boolean; + ActiveWnd: HWND; +begin + { Update caption state if floating, but not if a control on a popup window + (e.g. a TTBEditItem) is currently focused; we don't want the captions on + all floating toolbars to turn gray in that case. (The caption state will + get updated when we're called the next time the active window changes, + i.e. when the user dismisses the popup window.) } + if (Parent is TTBFloatingWindowParent) and Parent.HandleAllocated and + not IsPopupWindowActive then begin + Inactive := False; + if not ApplicationIsActive then + Inactive := True + else if (FFloatingMode = fmOnTopOfParentForm) and + (HWND(GetWindowLong(Parent.Handle, GWL_HWNDPARENT)) <> Application.Handle) then begin + { Use inactive caption if the active window doesn't own the float parent + (directly or indirectly). Note: For compatibility with browser-embedded + TActiveForms, we use IsAncestorOfWindow instead of checking + TBGetToolWindowParentForm. } + ActiveWnd := GetActiveFormWindow; + if (ActiveWnd = 0) or not IsAncestorOfWindow(ActiveWnd, Parent.Handle) then + Inactive := True; + end; + if FInactiveCaption <> Inactive then begin + FInactiveCaption := Inactive; + TTBFloatingWindowParent(Parent).RedrawNCArea(twrdAll); + end; + end; +end; + +function TTBCustomDockableWindow.GetShowingState: Boolean; + + function IsWindowVisibleAndNotMinimized(Wnd: HWND): Boolean; + begin + Result := IsWindowVisible(Wnd); + if Result then begin + { Wnd may not be a top-level window (e.g. in the case of an MDI child + form, or an ActiveForm embedded in a web page), so go up the chain of + parent windows and see if any of them are minimized } + repeat + if IsIconic(Wnd) then begin + Result := False; + Break; + end; + { Stop if we're at a top-level window (no need to check owner windows) } + if GetWindowLong(Wnd, GWL_STYLE) and WS_CHILD = 0 then + Break; + Wnd := GetParent(Wnd); + until Wnd = 0; + end; + end; + +var + HideFloatingToolbars: Boolean; + ParentForm: TTBCustomForm; +begin + Result := Showing and (FHidden = 0); + if Floating and not(csDesigning in ComponentState) then begin + HideFloatingToolbars := FFloatingMode = fmOnTopOfParentForm; + if HideFloatingToolbars then begin + ParentForm := TBGetToolWindowParentForm(Self); + if Assigned(ParentForm) and ParentForm.HandleAllocated and + IsWindowVisibleAndNotMinimized(ParentForm.Handle) then + HideFloatingToolbars := False; + end; + Result := Result and not (HideFloatingToolbars or (FHideWhenInactive and not ApplicationIsActive)); + end; +end; + +procedure TTBCustomDockableWindow.UpdateVisibility; +{ Updates the visibility of the tool window, and additionally the caption + state if floating and showing } +var + IsVisible: Boolean; +begin + if HandleAllocated then begin + IsVisible := IsWindowVisible(Handle); + if IsVisible <> GetShowingState then begin + Perform(CM_SHOWINGCHANGED, 0, 0); + { Note: CMShowingChanged will call UpdateCaptionState automatically + when floating and showing } + end + else if IsVisible and Floating then begin + { If we're floating and we didn't send the CM_SHOWINGCHANGED message + then we have to call UpdateCaptionState manually } + UpdateCaptionState; + end; + end; +end; + +function IsTopmost(const Wnd: HWND): Boolean; +begin + Result := GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOPMOST <> 0; +end; + +procedure TTBCustomDockableWindow.UpdateTopmostFlag; +const + Wnds: array[Boolean] of HWND = (HWND_NOTOPMOST, HWND_TOPMOST); +var + ShouldBeTopmost: Boolean; +begin + if HandleAllocated then begin + if FFloatingMode = fmOnTopOfAllForms then + ShouldBeTopmost := True + else + ShouldBeTopmost := IsTopmost(HWND(GetWindowLong(Parent.Handle, GWL_HWNDPARENT))); + if ShouldBeTopmost <> IsTopmost(Parent.Handle) then + { ^ it must check if it already was topmost or non-topmost or else + it causes problems on Win95/98 for some reason } + SetWindowPos(Parent.Handle, Wnds[ShouldBeTopmost], 0, 0, 0, 0, + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); + end; +end; + +procedure TTBCustomDockableWindow.CMShowingChanged(var Message: TMessage); + + function GetPrevWnd(W: HWND): HWND; + var + WasTopmost, Done: Boolean; + ParentWnd: HWND; + begin + WasTopmost := IsTopmost(Parent.Handle); + Result := W; + repeat + Done := True; + Result := GetWindow(Result, GW_HWNDPREV); + ParentWnd := Result; + while ParentWnd <> 0 do begin + if WasTopmost and not IsTopmost(ParentWnd) then begin + Done := False; + Break; + end; + ParentWnd := HWND(GetWindowLong(ParentWnd, GWL_HWNDPARENT)); + if ParentWnd = W then begin + Done := False; + Break; + end; + end; + until Done; + end; + +const + ShowFlags: array[Boolean] of UINT = ( + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_HIDEWINDOW, + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_SHOWWINDOW); +var + Show: Boolean; + Form: TTBCustomForm; +begin + { inherited isn't called since TTBCustomDockableWindow handles CM_SHOWINGCHANGED + itself. For reference, the original TWinControl implementation is: + const + ShowFlags: array[Boolean] of Word = ( + SWP_NOSIZE + SWP_NOMOVE + SWP_NOZORDER + SWP_NOACTIVATE + SWP_HIDEWINDOW, + SWP_NOSIZE + SWP_NOMOVE + SWP_NOZORDER + SWP_NOACTIVATE + SWP_SHOWWINDOW); + begin + SetWindowPos(FHandle, 0, 0, 0, 0, 0, ShowFlags[FShowing]); + end; + } + if HandleAllocated then begin + Show := GetShowingState; + if Parent is TTBFloatingWindowParent then begin + if Show then begin + { If the toolbar is floating, set its "owner window" to the parent form + so that the toolbar window always stays on top of the form } + if FFloatingMode = fmOnTopOfParentForm then begin + Form := GetMDIParent(TBGetToolWindowParentForm(Self)); + if Assigned(Form) and Form.HandleAllocated and + (HWND(GetWindowLong(Parent.Handle, GWL_HWNDPARENT)) <> Form.Handle) then begin + SetWindowOwner(Parent.Handle, Form.Handle); + { Following is necessarily to make it immediately realize the + GWL_HWNDPARENT change } + SetWindowPos(Parent.Handle, GetPrevWnd(Form.Handle), 0, 0, 0, 0, SWP_NOACTIVATE or + SWP_NOMOVE or SWP_NOSIZE); + end; + end + else begin + SetWindowOwner(Parent.Handle, Application.Handle); + end; + { Initialize caption state after setting owner but before showing } + UpdateCaptionState; + end; + UpdateTopmostFlag; + { Show/hide the TTBFloatingWindowParent. The following lines had to be + added to fix a problem that was in 1.65d/e. In 1.65d/e, it always + kept TTBFloatingWindowParent visible (this change was made to improve + compatibility with D4's Actions), but this for some odd reason would + cause a Stack Overflow error if the program's main form was closed + while a floating toolwindow was focused. (This problem did not occur + on NT.) } + TTBFloatingWindowParent(Parent).FShouldShow := Show; + Parent.Perform(CM_SHOWINGCHANGED, 0, 0); + end; + SetWindowPos(Handle, 0, 0, 0, 0, 0, ShowFlags[Show]); + if not Show and (GetActiveWindow = Handle) then + { If the window is hidden but is still active, find and activate a + different window } + SetActiveWindow(FindTopLevelWindow(Handle)); + end; +end; + +procedure TTBCustomDockableWindow.CreateParams(var Params: TCreateParams); +begin + inherited; + + { Disable complete redraws when size changes. CS_H/VREDRAW cause flicker + and are not necessary for this control at run time } + if not(csDesigning in ComponentState) then + with Params.WindowClass do + Style := Style and not(CS_HREDRAW or CS_VREDRAW); +end; + +procedure TTBCustomDockableWindow.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if Operation = opRemove then begin + if AComponent = FDefaultDock then + FDefaultDock := nil + else + if AComponent = FLastDock then + FLastDock := nil + else + RemoveFromList(FDockForms, AComponent); + end; +end; + +procedure TTBCustomDockableWindow.MoveOnScreen(const OnlyIfFullyOffscreen: Boolean); +{ Moves the (floating) toolbar so that it is fully (or at least mostly) in + view on the screen } +var + R, S, Test: TRect; +begin + if Floating then begin + R := Parent.BoundsRect; + S := GetRectOfMonitorContainingRect(R, True); + + if OnlyIfFullyOffscreen and IntersectRect(Test, R, S) then + Exit; + + if R.Right > S.Right then + OffsetRect(R, S.Right - R.Right, 0); + if R.Bottom > S.Bottom then + OffsetRect(R, 0, S.Bottom - R.Bottom); + if R.Left < S.Left then + OffsetRect(R, S.Left - R.Left, 0); + if R.Top < S.Top then + OffsetRect(R, 0, S.Top - R.Top); + Parent.BoundsRect := R; + end; +end; + +procedure TTBCustomDockableWindow.ReadPositionData(const Data: TTBReadPositionData); +begin +end; + +procedure TTBCustomDockableWindow.DoneReadingPositionData(const Data: TTBReadPositionData); +begin +end; + +procedure TTBCustomDockableWindow.WritePositionData(const Data: TTBWritePositionData); +begin +end; + +procedure TTBCustomDockableWindow.InitializeOrdering; +begin +end; + +procedure TTBCustomDockableWindow.SizeChanging(const AWidth, AHeight: Integer); +begin +end; + +procedure TTBCustomDockableWindow.ReadSavedAtRunTime(Reader: TReader); +begin + FSavedAtRunTime := Reader.ReadBoolean; +end; + +procedure TTBCustomDockableWindow.WriteSavedAtRunTime(Writer: TWriter); +begin + { WriteSavedAtRunTime only called when not(csDesigning in ComponentState) } + Writer.WriteBoolean(True); +end; + +procedure TTBCustomDockableWindow.DefineProperties(Filer: TFiler); +begin + inherited; + Filer.DefineProperty('SavedAtRunTime', ReadSavedAtRunTime, + WriteSavedAtRunTime, not(csDesigning in ComponentState)); +end; + +procedure TTBCustomDockableWindow.Loaded; +var + R: TRect; +begin + inherited; + { Adjust coordinates if it was initially floating } + if not FSavedAtRunTime and not(csDesigning in ComponentState) and + (Parent is TTBFloatingWindowParent) then begin + R := BoundsRect; + MapWindowPoints(TBValidToolWindowParentForm(Self).Handle, 0, R, 2); + BoundsRect := R; + MoveOnScreen(False); + end; + InitializeOrdering; + { Arranging is disabled while component was loading, so arrange now } + Arrange; +end; + +procedure TTBCustomDockableWindow.BeginUpdate; +begin + Inc(FDisableArrange); +end; + +procedure TTBCustomDockableWindow.EndUpdate; +begin + Dec(FDisableArrange); + if FArrangeNeeded and (FDisableArrange = 0) then + Arrange; +end; + +procedure TTBCustomDockableWindow.AddDockForm(const Form: TTBCustomForm); +begin + if Form = nil then Exit; + if AddToList(FDockForms, Form) then + Form.FreeNotification(Self); +end; + +procedure TTBCustomDockableWindow.RemoveDockForm(const Form: TTBCustomForm); +begin + RemoveFromList(FDockForms, Form); +end; + +function TTBCustomDockableWindow.IsAutoResized: Boolean; +begin + Result := AutoResize or Assigned(CurrentDock) or Floating; +end; + +procedure TTBCustomDockableWindow.ChangeSize(AWidth, AHeight: Integer); +var + S: TPoint; +begin + if Docked then + CurrentDock.ArrangeToolbars + else begin + S := CalcNCSizes; + Inc(AWidth, S.X); + Inc(AHeight, S.Y); + { Leave the width and/or height alone if the control is Anchored + (or Aligned) } + if not Floating then begin + if (akLeft in Anchors) and (akRight in Anchors) then + AWidth := Width; + if (akTop in Anchors) and (akBottom in Anchors) then + AHeight := Height; + end; + Inc(FUpdatingBounds); + try + SetBounds(Left, Top, AWidth, AHeight); + finally + Dec(FUpdatingBounds); + end; + end; +end; + +procedure TTBCustomDockableWindow.Arrange; +var + Size: TPoint; +begin + if (FDisableArrange > 0) or + { Prevent flicker while loading } + (csLoading in ComponentState) or + { Don't call DoArrangeControls when Parent is nil. The VCL sets Parent to + 'nil' during destruction of a component; we can't have an OrderControls + call after a descendant control has freed its data. } + (Parent = nil) then begin + FArrangeNeeded := True; + Exit; + end; + + FArrangeNeeded := False; + + Size := DoArrange(True, TBGetDockTypeOf(CurrentDock, Floating), Floating, + CurrentDock); + if IsAutoResized then + ChangeSize(Size.X, Size.Y); +end; + +procedure TTBCustomDockableWindow.SetBounds(ALeft, ATop, AWidth, AHeight: Integer); +begin + if not(csDesigning in ComponentState) and Floating then begin + { Force Top & Left to 0 if floating } + ALeft := 0; + ATop := 0; + if Parent is TTBFloatingWindowParent then + with Parent do + SetBounds(Left, Top, (Width-ClientWidth) + AWidth, + (Height-ClientHeight) + AHeight); + end; + if (FUpdatingBounds = 0) and ((AWidth <> Width) or (AHeight <> Height)) then + SizeChanging(AWidth, AHeight); + { This allows you to drag the toolbar around the dock at design time } + if (csDesigning in ComponentState) and not(csLoading in ComponentState) and + Docked and (FUpdatingBounds = 0) and ((ALeft <> Left) or (ATop <> Top)) then begin + if not(CurrentDock.Position in PositionLeftOrRight) then begin + FDockRow := CurrentDock.GetDesignModeRowOf(ATop+(Height div 2)); + FDockPos := ALeft; + end + else begin + FDockRow := CurrentDock.GetDesignModeRowOf(ALeft+(Width div 2)); + FDockPos := ATop; + end; + inherited SetBounds(Left, Top, AWidth, AHeight); { only pass any size changes } + CurrentDock.ArrangeToolbars; { let ArrangeToolbars take care of position changes } + end + else begin + inherited; + {if not(csLoading in ComponentState) and Floating and (FUpdatingBounds = 0) then + FFloatingPosition := BoundsRect.TopLeft;} + end; +end; + +procedure TTBCustomDockableWindow.SetParent(AParent: TWinControl); + procedure UpdateFloatingToolWindows; + begin + if Parent is TTBFloatingWindowParent then begin + AddToList(FloatingToolWindows, Self); + Parent.SetBounds(FFloatingPosition.X, FFloatingPosition.Y, + Parent.Width, Parent.Height); + end + else + RemoveFromList(FloatingToolWindows, Self); + end; + function ParentToCurrentDock(const Ctl: TWinControl): TTBDock; + begin + if Ctl is TTBDock then + Result := TTBDock(Ctl) + else + Result := nil; + end; +var + OldCurrentDock, NewCurrentDock: TTBDock; + NewFloating: Boolean; + SaveHandle: HWND; +begin + OldCurrentDock := ParentToCurrentDock(Parent); + NewCurrentDock := ParentToCurrentDock(AParent); + NewFloating := AParent is TTBFloatingWindowParent; + + if AParent = Parent then begin + { Even though AParent is the same as the current Parent, this code is + necessary because when the VCL destroys the parent of the tool window, + it calls TWinControl.Remove to set FParent instead of using SetParent. + However TControl.Destroy does call SetParent(nil), so it is + eventually notified of the change before it is destroyed. } + FCurrentDock := NewCurrentDock; + FFloating := NewFloating; + FDocked := Assigned(FCurrentDock); + UpdateFloatingToolWindows; + end + else begin + if not(csDestroying in ComponentState) and Assigned(AParent) then begin + if Assigned(FOnDockChanging) then + FOnDockChanging(Self, NewFloating, NewCurrentDock); + if Assigned(FOnRecreating) then + FOnRecreating(Self); + end; + + { Before changing between docked and floating state (and vice-versa) + or between docks, increment FHidden and call UpdateVisibility to hide the + toolbar. This prevents any flashing while it's being moved } + Inc(FHidden); + Inc(FDisableOnMove); + try + UpdateVisibility; + if Assigned(OldCurrentDock) then + OldCurrentDock.BeginUpdate; + if Assigned(NewCurrentDock) then + NewCurrentDock.BeginUpdate; + Inc(FUpdatingBounds); + try + if Assigned(AParent) then + DoDockChangingHidden(NewFloating, NewCurrentDock); + BeginUpdate; + try + { FCurrentSize probably won't be valid after changing Parents, so + reset it to zero } + FCurrentSize := 0; + + if Parent is TTBDock then begin + if not FUseLastDock or (FLastDock <> Parent) then + TTBDock(Parent).ChangeDockList(False, Self); + TTBDock(Parent).ToolbarVisibilityChanged(Self, True); + end; + + { By default, the VCL destroys a control's window handle when it + changes parents. Prevent that from happening by capturing the + current handle, detaching the control from its current parent, + then restoring the handle back. } + SaveHandle := 0; + if Assigned(AParent) then begin + SaveHandle := WindowHandle; + WindowHandle := 0; + end; + inherited SetParent(nil); + FCurrentDock := NewCurrentDock; + FFloating := NewFloating; + FDocked := Assigned(FCurrentDock); + try + if SaveHandle <> 0 then begin + WindowHandle := SaveHandle; + Windows.SetParent(SaveHandle, AParent.Handle); + SetWindowPos(SaveHandle, 0, 0, 0, 0, 0, SWP_FRAMECHANGED or + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER); + end; + inherited; + except + { Failure is rare, but just in case, restore these back. } + FCurrentDock := ParentToCurrentDock(Parent); + FFloating := Parent is TTBFloatingWindowParent; + FDocked := Assigned(FCurrentDock); + raise; + end; + + { FEffectiveDockRow probably won't be valid on the new Parent, so + reset it to -1 so that GetMinRowSize will temporarily ignore this + toolbar } + FEffectiveDockRow := -1; + + { To conserve resources, free FFloatParent if it's no longer the + Parent. But don't do this while FSmoothDragging=True, because + destroying the window the user initially clicked down on causes + Windows to stop delivering mouse-move messages when the cursor is + moved over other applications' windows, even if we still have the + mouse capture. } + if not FSmoothDragging and + Assigned(FFloatParent) and (Parent <> FFloatParent) then + FreeAndNil(FFloatParent); + + if Parent is TTBDock then begin + if FUseLastDock and not FSmoothDragging then begin + LastDock := TTBDock(Parent); { calls ChangeDockList if LastDock changes } + TTBDock(Parent).ToolbarVisibilityChanged(Self, False); + end + else + TTBDock(Parent).ChangeDockList(True, Self); + end; + + UpdateFloatingToolWindows; + + { Schedule an arrange } + Arrange; + finally + EndUpdate; + end; + finally + Dec(FUpdatingBounds); + if Assigned(NewCurrentDock) then + NewCurrentDock.EndUpdate; + if Assigned(OldCurrentDock) then + OldCurrentDock.EndUpdate; + end; + finally + Dec(FDisableOnMove); + Dec(FHidden); + UpdateVisibility; + { ^ The above UpdateVisibility call not only updates the tool window's + visibility after decrementing FHidden, it also sets the + active/inactive state of the caption. } + end; + if Assigned(Parent) then + Moved; + + if not(csDestroying in ComponentState) and Assigned(AParent) then begin + if Assigned(FOnRecreated) then + FOnRecreated(Self); + if Assigned(FOnDockChanged) then + FOnDockChanged(Self); + end; + end; +end; + +procedure TTBCustomDockableWindow.AddDockedNCAreaToSize(var S: TPoint; + const LeftRight: Boolean); +var + TopLeft, BottomRight: TPoint; +begin + GetDockedNCArea(TopLeft, BottomRight, LeftRight); + Inc(S.X, TopLeft.X + BottomRight.X); + Inc(S.Y, TopLeft.Y + BottomRight.Y); +end; + +procedure TTBCustomDockableWindow.AddFloatingNCAreaToSize(var S: TPoint); +var + TopLeft, BottomRight: TPoint; +begin + GetFloatingNCArea(TopLeft, BottomRight); + Inc(S.X, TopLeft.X + BottomRight.X); + Inc(S.Y, TopLeft.Y + BottomRight.Y); +end; + +procedure TTBCustomDockableWindow.GetDockedNCArea(var TopLeft, BottomRight: TPoint; + const LeftRight: Boolean); +var + Z: Integer; +begin + Z := DockedBorderSize; { code optimization... } + TopLeft.X := Z; + TopLeft.Y := Z; + BottomRight.X := Z; + BottomRight.Y := Z; + if not LeftRight then begin + Inc(TopLeft.X, DragHandleSizes[CloseButtonWhenDocked, DragHandleStyle]); + //if FShowChevron then + // Inc(BottomRight.X, tbChevronSize); + end + else begin + Inc(TopLeft.Y, DragHandleSizes[CloseButtonWhenDocked, DragHandleStyle]); + //if FShowChevron then + // Inc(BottomRight.Y, tbChevronSize); + end; +end; + +function TTBCustomDockableWindow.GetFloatingBorderSize: TPoint; +{ Returns size of a thick border. Note that, depending on the Windows version, + this may not be the same as the actual window metrics since it draws its + own border } +const + XMetrics: array[Boolean] of Integer = (SM_CXDLGFRAME, SM_CXFRAME); + YMetrics: array[Boolean] of Integer = (SM_CYDLGFRAME, SM_CYFRAME); +begin + Result.X := GetSystemMetrics(XMetrics[Resizable]); + Result.Y := GetSystemMetrics(YMetrics[Resizable]); +end; + +procedure TTBCustomDockableWindow.GetFloatingNCArea(var TopLeft, BottomRight: TPoint); +begin + with GetFloatingBorderSize do begin + TopLeft.X := X; + TopLeft.Y := Y; + if ShowCaption then + Inc(TopLeft.Y, GetSmallCaptionHeight); + BottomRight.X := X; + BottomRight.Y := Y; + end; +end; + +function TTBCustomDockableWindow.GetDockedCloseButtonRect(LeftRight: Boolean): TRect; +var + X, Y, Z: Integer; +begin + Z := DragHandleSizes[CloseButtonWhenDocked, FDragHandleStyle] - 3; + if not LeftRight then begin + X := DockedBorderSize+1; + Y := DockedBorderSize; + end + else begin + X := (ClientWidth + DockedBorderSize) - Z; + Y := DockedBorderSize+1; + end; + Result := Bounds(X, Y, Z, Z); +end; + +function TTBCustomDockableWindow.CalcNCSizes: TPoint; +var + Z: Integer; +begin + if not Docked then begin + Result.X := 0; + Result.Y := 0; + end + else begin + Result.X := DockedBorderSize2; + Result.Y := DockedBorderSize2; + if CurrentDock.FAllowDrag then begin + Z := DragHandleSizes[FCloseButtonWhenDocked, FDragHandleStyle]; + if not(CurrentDock.Position in PositionLeftOrRight) then + Inc(Result.X, Z) + else + Inc(Result.Y, Z); + end; + end; +end; + +procedure TTBCustomDockableWindow.WMNCCalcSize(var Message: TWMNCCalcSize); + + procedure ApplyToRect(var R: TRect); + var + Z: Integer; + begin + InflateRect(R, -DockedBorderSize, -DockedBorderSize); + if CurrentDock.FAllowDrag then begin + Z := DragHandleSizes[FCloseButtonWhenDocked, FDragHandleStyle]; + if not(CurrentDock.Position in PositionLeftOrRight) then + Inc(R.Left, Z) + else + Inc(R.Top, Z); + end; + end; + +{$IFDEF CLR} +var + Params: TNCCalcSizeParams; +{$ENDIF} +begin + { Doesn't call inherited since it overrides the normal NC sizes } + Message.Result := 0; + if Docked then begin + {$IFNDEF CLR} + ApplyToRect(Message.CalcSize_Params.rgrc[0]); + {$ELSE} + Params := Message.CalcSize_Params; + ApplyToRect(Params.rgrc0); + Message.CalcSize_Params := Params; + {$ENDIF} + end; +end; + +procedure TTBCustomDockableWindow.WMSetCursor(var Message: TWMSetCursor); +var + P: TPoint; + R: TRect; + I: Integer; +begin + if Docked and CurrentDock.FAllowDrag and + (Message.CursorWnd = WindowHandle) and + (Smallint(Message.HitTest) = HT_TB2k_Border) and + (DragHandleStyle <> dhNone) then begin + GetCursorPos(P); + GetWindowRect(Handle, R); + if not(CurrentDock.Position in PositionLeftOrRight) then + I := P.X - R.Left + else + I := P.Y - R.Top; + if I < DockedBorderSize + DragHandleSizes[CloseButtonWhenDocked, DragHandleStyle] then begin + SetCursor(LoadCursor(0, IDC_SIZEALL)); + Message.Result := 1; + Exit; + end; + end; + inherited; +end; + +procedure TTBCustomDockableWindow.DrawNCArea(const DrawToDC: Boolean; + const ADC: HDC; const Clip: HRGN); +{ Redraws all the non-client area of the toolbar when it is docked. } +var + DC: HDC; + R: TRect; + VerticalDock: Boolean; + X, Y, Y2, Y3, YO, S, SaveIndex: Integer; + R2, R3, R4: TRect; + P1, P2: TPoint; + Brush: HBRUSH; + Clr: TColorRef; + UsingBackground, B: Boolean; + + procedure DrawRaisedEdge(R: TRect; const FillInterior: Boolean); + const + FillMiddle: array[Boolean] of UINT = (0, BF_MIDDLE); + begin + DrawEdge(DC, R, BDR_RAISEDINNER, BF_RECT or FillMiddle[FillInterior]); + end; + + function CreateCloseButtonBitmap: HBITMAP; + const + Pattern: array[0..15] of Byte = + (0, 0, $CC, 0, $78, 0, $30, 0, $78, 0, $CC, 0, 0, 0, 0, 0); + begin + Result := CreateMonoBitmap(8, 8, Pattern); + end; + + procedure DrawButtonBitmap(const Bmp: HBITMAP); + var + TempBmp: TBitmap; + begin + TempBmp := TBitmap.Create; + try + TempBmp.Handle := Bmp; + SetTextColor(DC, clBlack); + SetBkColor(DC, clWhite); + SelectObject(DC, GetSysColorBrush(COLOR_BTNTEXT)); + BitBlt(DC, R2.Left, R2.Top, R2.Right - R2.Left, R2.Bottom - R2.Top, + TempBmp.Canvas.Handle, 0, 0, $00E20746 {ROP_DSPDxax}); + finally + TempBmp.Free; + end; + end; + +const + CloseButtonState: array[Boolean] of UINT = (0, DFCS_PUSHED); +begin + if not Docked or not HandleAllocated then Exit; + + if not DrawToDC then + DC := GetWindowDC(Handle) + else + DC := ADC; + try + { Use update region } + if not DrawToDC then + SelectNCUpdateRgn(Handle, DC, Clip); + + { This works around WM_NCPAINT problem described at top of source code } + {no! R := Rect(0, 0, Width, Height);} + GetWindowRect(Handle, R); OffsetRect(R, -R.Left, -R.Top); + + VerticalDock := CurrentDock.Position in PositionLeftOrRight; + + Brush := CreateSolidBrush(ColorToRGB(Color)); + + UsingBackground := CurrentDock.UsingBackground and CurrentDock.FBkgOnToolbars; + + { Border } + if BorderStyle = bsSingle then + DrawRaisedEdge(R, False) + else + FrameRect(DC, R, Brush); + R2 := R; + InflateRect(R2, -1, -1); + if not UsingBackground then + FrameRect(DC, R2, Brush); + + { Draw the Background } + if UsingBackground then begin + R2 := R; + P1 := CurrentDock.ClientToScreen(Point(0, 0)); + P2 := CurrentDock.Parent.ClientToScreen(CurrentDock.BoundsRect.TopLeft); + Dec(R2.Left, Left + CurrentDock.Left + (P1.X-P2.X)); + Dec(R2.Top, Top + CurrentDock.Top + (P1.Y-P2.Y)); + InflateRect(R, -1, -1); + GetWindowRect(Handle, R4); + R3 := ClientRect; + with ClientToScreen(Point(0, 0)) do + OffsetRect(R3, X-R4.Left, Y-R4.Top); + SaveIndex := SaveDC(DC); + IntersectClipRect(DC, R.Left, R.Top, R.Right, R.Bottom); + ExcludeClipRect(DC, R3.Left, R3.Top, R3.Right, R3.Bottom); + CurrentDock.DrawBackground(DC, R2); + RestoreDC(DC, SaveIndex); + end; + + { The drag handle at the left, or top } + if CurrentDock.FAllowDrag then begin + SaveIndex := SaveDC(DC); + if not VerticalDock then + Y2 := ClientHeight + else + Y2 := ClientWidth; + Inc(Y2, DockedBorderSize); + S := DragHandleSizes[FCloseButtonWhenDocked, FDragHandleStyle]; + if FDragHandleStyle <> dhNone then begin + Y3 := Y2; + X := DockedBorderSize + DragHandleXOffsets[FCloseButtonWhenDocked, FDragHandleStyle]; + Y := DockedBorderSize; + YO := Ord(FDragHandleStyle = dhSingle); + if FCloseButtonWhenDocked then begin + if not VerticalDock then + Inc(Y, S - 2) + else + Dec(Y3, S - 2); + end; + Clr := GetSysColor(COLOR_BTNHIGHLIGHT); + for B := False to (FDragHandleStyle = dhDouble) do begin + if not VerticalDock then + R2 := Rect(X, Y+YO, X+3, Y2-YO) + else + R2 := Rect(Y+YO, X, Y3-YO, X+3); + DrawRaisedEdge(R2, True); + if not VerticalDock then + SetPixelV(DC, X, Y2-1-YO, Clr) + else + SetPixelV(DC, Y3-1-YO, X, Clr); + ExcludeClipRect(DC, R2.Left, R2.Top, R2.Right, R2.Bottom); + Inc(X, 3); + end; + end; + if not UsingBackground then begin + if not VerticalDock then + R2 := Rect(DockedBorderSize, DockedBorderSize, + DockedBorderSize+S, Y2) + else + R2 := Rect(DockedBorderSize, DockedBorderSize, + Y2, DockedBorderSize+S); + FillRect(DC, R2, Brush); + end; + RestoreDC(DC, SaveIndex); + { Close button } + if FCloseButtonWhenDocked then begin + R2 := GetDockedCloseButtonRect(VerticalDock); + if FCloseButtonDown then + DrawEdge(DC, R2, BDR_SUNKENOUTER, BF_RECT) + else if FCloseButtonHover then + DrawRaisedEdge(R2, False); + InflateRect(R2, -2, -2); + if FCloseButtonDown then + OffsetRect(R2, 1, 1); + DrawButtonBitmap(CreateCloseButtonBitmap); + end; + end; + + DeleteObject(Brush); + finally + if not DrawToDC then + ReleaseDC(Handle, DC); + end; +end; + +procedure TTBCustomDockableWindow.RedrawNCArea; +begin + { Note: IsWindowVisible is called as an optimization. There's no need to + draw on invisible windows. } + if HandleAllocated and IsWindowVisible(Handle) then + DrawNCArea(False, 0, 0); +end; + +procedure TTBCustomDockableWindow.WMNCPaint(var Message: TMessage); +begin + { Don't call inherited because it overrides the default NC painting } + DrawNCArea(False, 0, HRGN(Message.WParam)); +end; + +procedure DockableWindowNCPaintProc(Wnd: HWND; DC: HDC; AppData: TObject); +begin + with TTBCustomDockableWindow(AppData) do + DrawNCArea(True, DC, 0) +end; + +procedure TTBCustomDockableWindow.WMPrint(var Message: TMessage); +begin + HandleWMPrint(Handle, Message, DockableWindowNCPaintProc, Self); +end; + +procedure TTBCustomDockableWindow.WMPrintClient(var Message: + {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); +begin + HandleWMPrintClient(PaintHandler, Message); +end; + +procedure TTBCustomDockableWindow.WMEraseBkgnd(var Message: TWMEraseBkgnd); +var + R, R2, R3: TRect; + P1, P2: TPoint; + SaveIndex: Integer; +begin + if Docked and CurrentDock.UsingBackground and CurrentDock.FBkgOnToolbars then begin + R := ClientRect; + R2 := R; + P1 := CurrentDock.ClientToScreen(Point(0, 0)); + P2 := CurrentDock.Parent.ClientToScreen(CurrentDock.BoundsRect.TopLeft); + Dec(R2.Left, Left + CurrentDock.Left + (P1.X-P2.X)); + Dec(R2.Top, Top + CurrentDock.Top + (P1.Y-P2.Y)); + GetWindowRect(Handle, R3); + with ClientToScreen(Point(0, 0)) do begin + Inc(R2.Left, R3.Left-X); + Inc(R2.Top, R3.Top-Y); + end; + SaveIndex := SaveDC(Message.DC); + IntersectClipRect(Message.DC, R.Left, R.Top, R.Right, R.Bottom); + CurrentDock.DrawBackground(Message.DC, R2); + RestoreDC(Message.DC, SaveIndex); + Message.Result := 1; + end + else + inherited; +end; + +function TTBCustomDockableWindow.GetPalette: HPALETTE; +begin + if Docked then + Result := CurrentDock.GetPalette + else + Result := 0; +end; + +function TTBCustomDockableWindow.PaletteChanged(Foreground: Boolean): Boolean; +begin + Result := inherited PaletteChanged(Foreground); + if Result and not Foreground then begin + { There seems to be a bug in Delphi's palette handling. When the form is + inactive and another window realizes a palette, docked TToolbar97s + weren't getting redrawn. So this workaround code was added. } + InvalidateAll(Self); + end; +end; + +procedure TTBCustomDockableWindow.DrawDraggingOutline(const DC: HDC; + const NewRect, OldRect: TRect; const NewDocking, OldDocking: Boolean); +var + NewSize, OldSize: TSize; +begin + with GetFloatingBorderSize do begin + if NewDocking then NewSize.cx := 1 else NewSize.cx := X; + NewSize.cy := NewSize.cx; + if OldDocking then OldSize.cx := 1 else OldSize.cx := X; + OldSize.cy := OldSize.cx; + end; + DrawHalftoneInvertRect(DC, NewRect, OldRect, NewSize, OldSize); +end; + +procedure TTBCustomDockableWindow.CMColorChanged(var Message: TMessage); +begin + { Make sure non-client area is redrawn } + InvalidateAll(Self); + inherited; { the inherited handler calls Invalidate } +end; + +procedure TTBCustomDockableWindow.CMTextChanged(var Message: TMessage); +begin + inherited; + if Parent is TTBFloatingWindowParent then + TTBFloatingWindowParent(Parent).Caption := Caption; +end; + +procedure TTBCustomDockableWindow.CMVisibleChanged(var Message: TMessage); +begin + if not(csDesigning in ComponentState) and Docked then + CurrentDock.ToolbarVisibilityChanged(Self, False); + inherited; + if Assigned(FOnVisibleChanged) then + FOnVisibleChanged(Self); +end; + +type + TRowSize = record + Size: Integer; + FullSizeRow: Boolean; + end; + TDockedSize = class + Dock: TTBDock; + BoundsRect: TRect; + Size: TPoint; + RowSizes: array of TRowSize; + end; + +procedure TTBCustomDockableWindow.BeginMoving(const InitX, InitY: Integer); +const + SplitCursors: array[Boolean] of {$IFNDEF CLR} PChar {$ELSE} Integer {$ENDIF} = + (IDC_SIZEWE, IDC_SIZENS); +var + UseSmoothDrag: Boolean; + DockList: TList; + NewDockedSizes: TList; + OriginalDock, MouseOverDock: TTBDock; + MoveRect: TRect; + StartDocking, PreventDocking, PreventFloating, WatchForSplit, SplitVertical: Boolean; + ScreenDC: HDC; + OldCursor: HCURSOR; + NPoint, DPoint: TPoint; + OriginalDockRow, OriginalDockPos: Integer; + FirstPos, LastPos, CurPos: TPoint; + + function FindDockedSize(const ADock: TTBDock): TDockedSize; + var + I: Integer; + begin + for I := 0 to NewDockedSizes.Count-1 do begin + Result := TDockedSize(NewDockedSizes[I]); + if Result.Dock = ADock then + Exit; + end; + Result := nil; + end; + + function GetRowOf(const RowSizes: array of TRowSize; const XY: Integer; + var Before: Boolean): Integer; + { Returns row number of the specified coordinate. Before is set to True if it + was in the top (or left) quarter of the row. } + var + HighestRow, R, CurY, NextY, CurRowSize, EdgeSize: Integer; + FullSizeRow: Boolean; + begin + Before := False; + HighestRow := High(RowSizes); + CurY := 0; + for R := 0 to HighestRow do begin + CurRowSize := RowSizes[R].Size; + FullSizeRow := FullSize or RowSizes[R].FullSizeRow; + if CurRowSize = 0 then + Continue; + NextY := CurY + CurRowSize; + if not FullSizeRow then + EdgeSize := CurRowSize div 4 + else + EdgeSize := CurRowSize div 2; + if XY < CurY + EdgeSize then begin + Result := R; + Before := True; + Exit; + end; + if not FullSizeRow and (XY < NextY - EdgeSize) then begin + Result := R; + Exit; + end; + CurY := NextY; + end; + Result := HighestRow+1; + end; + + procedure Dropped; + var + NewDockRow: Integer; + Before: Boolean; + MoveRectClient: TRect; + C: Integer; + DockedSize: TDockedSize; + begin + if MouseOverDock <> nil then begin + DockedSize := FindDockedSize(MouseOverDock); + MoveRectClient := MoveRect; + OffsetRect(MoveRectClient, -DockedSize.BoundsRect.Left, + -DockedSize.BoundsRect.Top); + if not FDragSplitting then begin + if not(MouseOverDock.Position in PositionLeftOrRight) then + C := (MoveRectClient.Top+MoveRectClient.Bottom) div 2 + else + C := (MoveRectClient.Left+MoveRectClient.Right) div 2; + NewDockRow := GetRowOf(DockedSize.RowSizes, C, Before); + if Before then + WatchForSplit := False; + end + else begin + NewDockRow := FDockRow; + Before := False; + end; + if WatchForSplit then begin + if (MouseOverDock <> OriginalDock) or (NewDockRow <> OriginalDockRow) then + WatchForSplit := False + else begin + if not SplitVertical then + C := FirstPos.X - LastPos.X + else + C := FirstPos.Y - LastPos.Y; + if Abs(C) >= 10 then begin + WatchForSplit := False; + FDragSplitting := True; + SetCursor(LoadCursor(0, SplitCursors[SplitVertical])); + end; + end; + end; + FDockRow := NewDockRow; + if not(MouseOverDock.Position in PositionLeftOrRight) then + FDockPos := MoveRectClient.Left + else + FDockPos := MoveRectClient.Top; + Parent := MouseOverDock; + if not FSmoothDragging then + CurrentDock.CommitNewPositions := True; + FInsertRowBefore := Before; + try + CurrentDock.ArrangeToolbars; + finally + FInsertRowBefore := False; + end; + end + else begin + WatchForSplit := False; + FloatingPosition := MoveRect.TopLeft; + Floating := True; + { Make sure it doesn't go completely off the screen } + MoveOnScreen(True); + end; + + { Make sure it's repainted immediately (looks better on really slow + computers when smooth dragging is enabled) } + Update; + end; + + procedure MouseMoved; + var + OldMouseOverDock: TTBDock; + OldMoveRect: TRect; + Pos: TPoint; + + function GetDockRect(Control: TTBDock): TRect; + var + I: Integer; + begin + for I := 0 to NewDockedSizes.Count-1 do + with TDockedSize(NewDockedSizes[I]) do begin + if Dock <> Control then Continue; + Result := Bounds(Pos.X-MulDiv(Size.X-1, NPoint.X, DPoint.X), + Pos.Y-MulDiv(Size.Y-1, NPoint.Y, DPoint.Y), + Size.X, Size.Y); + Exit; + end; + SetRectEmpty(Result); + end; + + function CheckIfCanDockTo(Control: TTBDock; R: TRect): Boolean; + const + DockSensX = 25; + DockSensY = 25; + var + S, Temp: TRect; + Sens: Integer; + begin + with Control do begin + Result := False; + + InflateRect(R, 3, 3); + S := GetDockRect(Control); + + { Like Office, distribute ~25 pixels of extra dock detection area + to the left side if the toolbar was grabbed at the left, both sides + if the toolbar was grabbed at the middle, or the right side if + toolbar was grabbed at the right. If outside, don't try to dock. } + Sens := MulDiv(DockSensX, NPoint.X, DPoint.X); + if (Pos.X < R.Left-(DockSensX-Sens)) or (Pos.X >= R.Right+Sens) then + Exit; + + { Don't try to dock to the left or right if pointer is above or below + the boundaries of the dock } + if (Control.Position in PositionLeftOrRight) and + ((Pos.Y < R.Top) or (Pos.Y >= R.Bottom)) then + Exit; + + { And also distribute ~25 pixels of extra dock detection area to + the top or bottom side } + Sens := MulDiv(DockSensY, NPoint.Y, DPoint.Y); + if (Pos.Y < R.Top-(DockSensY-Sens)) or (Pos.Y >= R.Bottom+Sens) then + Exit; + + Result := IntersectRect(Temp, R, S); + end; + end; + + var + R, R2: TRect; + I: Integer; + Dock: TTBDock; + Accept: Boolean; + TL, BR: TPoint; + begin + OldMouseOverDock := MouseOverDock; + OldMoveRect := MoveRect; + + GetCursorPos(Pos); + + if FDragSplitting then + MouseOverDock := CurrentDock + else begin + { Check if it can dock } + MouseOverDock := nil; + if StartDocking and not PreventDocking then + for I := 0 to DockList.Count-1 do begin + Dock := TTBDock(DockList[I]); + if CheckIfCanDockTo(Dock, FindDockedSize(Dock).BoundsRect) then begin + MouseOverDock := Dock; + Accept := True; + if Assigned(MouseOverDock.FOnRequestDock) then + MouseOverDock.FOnRequestDock(MouseOverDock, Self, Accept); + if Accept then + Break + else + MouseOverDock := nil; + end; + end; + end; + + { If not docking, clip the point so it doesn't get dragged under the + taskbar } + if MouseOverDock = nil then begin + R := GetRectOfMonitorContainingPoint(Pos, True); + if Pos.X < R.Left then Pos.X := R.Left; + if Pos.X > R.Right then Pos.X := R.Right; + if Pos.Y < R.Top then Pos.Y := R.Top; + if Pos.Y > R.Bottom then Pos.Y := R.Bottom; + end; + + MoveRect := GetDockRect(MouseOverDock); + + { Make sure title bar (or at least part of the toolbar) is still accessible + if it's dragged almost completely off the screen. This prevents the + problem seen in Office 97 where you drag it offscreen so that only the + border is visible, sometimes leaving you no way to move it back short of + resetting the toolbar. } + if MouseOverDock = nil then begin + R2 := GetRectOfMonitorContainingPoint(Pos, True); + R := R2; + with GetFloatingBorderSize do + InflateRect(R, -(X+4), -(Y+4)); + if MoveRect.Bottom < R.Top then + OffsetRect(MoveRect, 0, R.Top-MoveRect.Bottom); + if MoveRect.Top > R.Bottom then + OffsetRect(MoveRect, 0, R.Bottom-MoveRect.Top); + if MoveRect.Right < R.Left then + OffsetRect(MoveRect, R.Left-MoveRect.Right, 0); + if MoveRect.Left > R.Right then + OffsetRect(MoveRect, R.Right-MoveRect.Left, 0); + + GetFloatingNCArea(TL, BR); + I := R2.Top + 4 - TL.Y; + if MoveRect.Top < I then + OffsetRect(MoveRect, 0, I-MoveRect.Top); + end; + + { Empty MoveRect if it's wanting to float but it's not allowed to, and + set the mouse cursor accordingly. } + if PreventFloating and not Assigned(MouseOverDock) then begin + SetRectEmpty(MoveRect); + SetCursor(LoadCursor(0, IDC_NO)); + end + else begin + if FDragSplitting then + SetCursor(LoadCursor(0, SplitCursors[SplitVertical])) + else + SetCursor(OldCursor); + end; + + { Update the dragging outline } + if not UseSmoothDrag then + DrawDraggingOutline(ScreenDC, MoveRect, OldMoveRect, MouseOverDock <> nil, + OldMouseOverDock <> nil) + else + if not IsRectEmpty(MoveRect) then + Dropped; + end; + + procedure BuildDockList; + + function AcceptableDock(const D: TTBDock): Boolean; + begin + Result := D.FAllowDrag and (D.Position in DockableTo); + end; + + procedure Recurse(const ParentCtl: TWinControl); + var + D: TTBDockPosition; + I: Integer; + begin + if ContainsControl(ParentCtl) or not ParentCtl.HandleAllocated or + not IsWindowVisible(ParentCtl.Handle) then + Exit; + with ParentCtl do begin + for D := Low(D) to High(D) do + for I := 0 to ParentCtl.ControlCount-1 do + if (Controls[I] is TTBDock) and (TTBDock(Controls[I]).Position = D) then + Recurse(TWinControl(Controls[I])); + for I := 0 to ParentCtl.ControlCount-1 do + if (Controls[I] is TWinControl) and not(Controls[I] is TTBDock) then + Recurse(TWinControl(Controls[I])); + end; + if (ParentCtl is TTBDock) and AcceptableDock(TTBDock(ParentCtl)) and + (DockList.IndexOf(ParentCtl) = -1) then + DockList.Add(ParentCtl); + end; + + var + ParentForm: TTBCustomForm; + DockFormsList: TList; + I, J: Integer; + begin + { Manually add CurrentDock to the DockList first so that it gets priority + over other docks } + if Assigned(CurrentDock) and AcceptableDock(CurrentDock) then + DockList.Add(CurrentDock); + ParentForm := TBGetToolWindowParentForm(Self); + DockFormsList := TList.Create; + try + if Assigned(FDockForms) then begin + for I := 0 to Screen.{$IFDEF JR_D3}CustomFormCount{$ELSE}FormCount{$ENDIF}-1 do begin + J := FDockForms.IndexOf(Screen.{$IFDEF JR_D3}CustomForms{$ELSE}Forms{$ENDIF}[I]); + if (J <> -1) and (FDockForms[J] <> ParentForm) then + DockFormsList.Add(FDockForms[J]); + end; + end; + if Assigned(ParentForm) then + DockFormsList.Insert(0, ParentForm); + for I := 0 to DockFormsList.Count-1 do + Recurse(TWinControl(DockFormsList[I])); + finally + DockFormsList.Free; + end; + end; + +var + Accept: Boolean; + R: TRect; + Msg: TMsg; + NewDockedSize: TDockedSize; + I, J: Integer; +begin + Accept := False; + SplitVertical := False; + WatchForSplit := False; + OriginalDock := CurrentDock; + OriginalDockRow := FDockRow; + OriginalDockPos := FDockPos; + try + FDragMode := True; + FDragSplitting := False; + if Docked then begin + FDragCanSplit := False; + CurrentDock.CommitNewPositions := True; + CurrentDock.ArrangeToolbars; { needed for WatchForSplit assignment below } + SplitVertical := CurrentDock.Position in PositionLeftOrRight; + WatchForSplit := FDragCanSplit; + end; + DockList := nil; + NewDockedSizes := nil; + try + UseSmoothDrag := FSmoothDrag; + FSmoothDragging := UseSmoothDrag; + + NPoint := Point(InitX, InitY); + { Adjust for non-client area } + if not(Parent is TTBFloatingWindowParent) then begin + GetWindowRect(Handle, R); + R.BottomRight := ClientToScreen(Point(0, 0)); + DPoint := Point(Width-1, Height-1); + end + else begin + GetWindowRect(Parent.Handle, R); + R.BottomRight := Parent.ClientToScreen(Point(0, 0)); + DPoint := Point(Parent.Width-1, Parent.Height-1); + end; + Dec(NPoint.X, R.Left-R.Right); + Dec(NPoint.Y, R.Top-R.Bottom); + + PreventDocking := GetKeyState(VK_CONTROL) < 0; + PreventFloating := DockMode <> dmCanFloat; + + { Build list of all TTBDock's on the form } + DockList := TList.Create; + if DockMode <> dmCannotFloatOrChangeDocks then + BuildDockList + else + if Docked then + DockList.Add(CurrentDock); + + { Ensure positions of each possible dock are committed } + for I := 0 to DockList.Count-1 do + TTBDock(DockList[I]).CommitPositions; + + { Set up potential sizes for each dock type } + NewDockedSizes := TList.Create; + for I := -1 to DockList.Count-1 do begin + NewDockedSizes.Expand; + NewDockedSize := TDockedSize.Create; + try + with NewDockedSize do begin + if I = -1 then begin + { -1 adds the floating size } + Dock := nil; + SetRectEmpty(BoundsRect); + Size := DoArrange(False, TBGetDockTypeOf(CurrentDock, Floating), True, nil); + AddFloatingNCAreaToSize(Size); + end + else begin + Dock := TTBDock(DockList[I]); + BoundsRect := Dock.ClientRect; + MapWindowPoints(Dock.Handle, 0, BoundsRect, 2); + if Dock <> CurrentDock then begin + Size := DoArrange(False, TBGetDockTypeOf(CurrentDock, Floating), False, Dock); + AddDockedNCAreaToSize(Size, Dock.Position in PositionLeftOrRight); + end + else + Size := Point(Width, Height); + end; + end; + if Assigned(NewDockedSize.Dock) then begin + SetLength(NewDockedSize.RowSizes, NewDockedSize.Dock.GetHighestRow(True) + 1); + for J := 0 to High(NewDockedSize.RowSizes) do begin + NewDockedSize.RowSizes[J].Size := NewDockedSize.Dock.GetCurrentRowSize(J, + NewDockedSize.RowSizes[J].FullSizeRow); + end; + end; + except + NewDockedSize.Free; + raise; + end; + NewDockedSizes.Add(NewDockedSize); + end; + + { Before locking, make sure all pending paint messages are processed } + ProcessPaintMessages; + + { Save the original mouse cursor } + OldCursor := GetCursor; + + SetRectEmpty(MoveRect); + if not UseSmoothDrag then begin + { This uses LockWindowUpdate to suppress all window updating so the + dragging outlines doesn't sometimes get garbled. (This is safe, and in + fact, is the main purpose of the LockWindowUpdate function) + IMPORTANT! While debugging you might want to enable the 'TB2Dock_DisableLock' + conditional define (see top of the source code). } + {$IFNDEF TB2Dock_DisableLock} + LockWindowUpdate(GetDesktopWindow); + {$ENDIF} + { Get a DC of the entire screen. Works around the window update lock + by specifying DCX_LOCKWINDOWUPDATE. } + ScreenDC := GetDCEx(GetDesktopWindow, 0, + DCX_LOCKWINDOWUPDATE or DCX_CACHE or DCX_WINDOW); + end + else + ScreenDC := 0; + try + SetCapture(Handle); + + { Initialize } + StartDocking := Docked; + MouseOverDock := nil; + GetCursorPos(FirstPos); + LastPos := FirstPos; + MouseMoved; + StartDocking := True; + + { Stay in message loop until capture is lost. Capture is removed either + by this procedure manually doing it, or by an outside influence (like + a message box or menu popping up) } + while GetCapture = Handle do begin + case Integer(GetMessage(Msg, 0, 0, 0)) of + -1: Break; { if GetMessage failed } + 0: begin + { Repost WM_QUIT messages } + PostQuitMessage(ClipToLongint(Msg.wParam)); + Break; + end; + end; + + case Msg.Message of + WM_KEYDOWN, WM_KEYUP: + { Ignore all keystrokes while dragging. But process Ctrl and Escape } + case Word(Msg.wParam) of + VK_CONTROL: + if PreventDocking <> (Msg.Message = WM_KEYDOWN) then begin + PreventDocking := Msg.Message = WM_KEYDOWN; + MouseMoved; + end; + VK_ESCAPE: + Break; + end; + WM_MOUSEMOVE: begin + { Note to self: WM_MOUSEMOVE messages should never be dispatched + here to ensure no hints get shown during the drag process } + CurPos := GetMessagePosAsPoint; + if (LastPos.X <> CurPos.X) or (LastPos.Y <> CurPos.Y) then begin + MouseMoved; + LastPos := CurPos; + end; + end; + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK: + { Make sure it doesn't begin another loop } + Break; + WM_LBUTTONUP: begin + Accept := True; + Break; + end; + WM_RBUTTONDOWN..WM_MBUTTONDBLCLK: + { Ignore all other mouse up/down messages } + ; + else + TranslateMessage(Msg); + DispatchMessage(Msg); + end; + end; + finally + { Since it sometimes breaks out of the loop without capture being + released } + if GetCapture = Handle then + ReleaseCapture; + + if not UseSmoothDrag then begin + { Hide dragging outline. Since NT will release a window update lock if + another thread comes to the foreground, it has to release the DC + and get a new one for erasing the dragging outline. Otherwise, + the DrawDraggingOutline appears to have no effect when this happens. } + ReleaseDC(GetDesktopWindow, ScreenDC); + ScreenDC := GetDCEx(GetDesktopWindow, 0, + DCX_LOCKWINDOWUPDATE or DCX_CACHE or DCX_WINDOW); + SetRectEmpty(R); + DrawDraggingOutline(ScreenDC, R, MoveRect, True, MouseOverDock <> nil); + ReleaseDC(GetDesktopWindow, ScreenDC); + + { Release window update lock } + {$IFNDEF TB2Dock_DisableLock} + LockWindowUpdate(0); + {$ENDIF} + end; + end; + + { Move to new position only if MoveRect isn't empty } + FSmoothDragging := False; + if Accept and not IsRectEmpty(MoveRect) then + { Note: Dropped must be called again after FSmoothDragging is reset to + False so that TTBDock.ArrangeToolbars makes the DockPos changes + permanent } + Dropped; + + { LastDock isn't automatically updated while FSmoothDragging=True, so + update it now that it's back to False } + if FUseLastDock and Assigned(CurrentDock) then + LastDock := CurrentDock; + + { To conserve resources, free FFloatParent if it's no longer the Parent. + (SetParent doesn't do this automatically when FSmoothDragging=True.) } + if Assigned(FFloatParent) and (Parent <> FFloatParent) then + FreeAndNil(FFloatParent); + finally + FSmoothDragging := False; + if not Docked then begin + { If we didn't end up docking, restore the original DockRow & DockPos + values } + FDockRow := OriginalDockRow; + FDockPos := OriginalDockPos; + end; + if Assigned(NewDockedSizes) then begin + for I := NewDockedSizes.Count-1 downto 0 do + TDockedSize(NewDockedSizes[I]).Free; + NewDockedSizes.Free; + end; + DockList.Free; + end; + finally + FDragMode := False; + FDragSplitting := False; + end; +end; + +function TTBCustomDockableWindow.ChildControlTransparent(Ctl: TControl): Boolean; +begin + Result := False; +end; + +procedure TTBCustomDockableWindow.ControlExistsAtPos(const P: TPoint; + var ControlExists: Boolean); +var + I: Integer; +begin + for I := 0 to ControlCount-1 do + if not ChildControlTransparent(Controls[I]) and Controls[I].Visible and + PtInRect(Controls[I].BoundsRect, P) then begin + ControlExists := True; + Break; + end; +end; + +procedure TTBCustomDockableWindow.DoubleClick; +begin + if Docked then begin + if DockMode = dmCanFloat then begin + Floating := True; + MoveOnScreen(True); + end; + end + else + if Assigned(LastDock) then + Parent := LastDock + else + if Assigned(DefaultDock) then begin + FDockRow := ForceDockAtTopRow; + FDockPos := ForceDockAtLeftPos; + Parent := DefaultDock; + end; +end; + +function TTBCustomDockableWindow.IsMovable: Boolean; +begin + Result := (Docked and CurrentDock.FAllowDrag) or Floating; +end; + +procedure TTBCustomDockableWindow.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + P: TPoint; + CtlExists: Boolean; +begin + inherited; + if (Button <> mbLeft) or not IsMovable then + Exit; + { Ignore message if user clicked on a child control } + P := Point(X, Y); + if PtInRect(ClientRect, P) then begin + CtlExists := False; + ControlExistsAtPos(P, CtlExists); + if CtlExists then + Exit; + end; + + if not(ssDouble in Shift) then begin + BeginMoving(X, Y); + MouseUp(mbLeft, [], -1, -1); + end + else + { Handle double click } + DoubleClick; +end; + +procedure TTBCustomDockableWindow.WMNCHitTest(var Message: TWMNCHitTest); +var + P: TPoint; + R: TRect; +begin + inherited; + if Docked then + with Message do begin + P := SmallPointToPoint(Pos); + GetWindowRect(Handle, R); + Dec(P.X, R.Left); Dec(P.Y, R.Top); + if Result <> HTCLIENT then begin + Result := HTNOWHERE; + if FCloseButtonWhenDocked and CurrentDock.FAllowDrag and + PtInRect(GetDockedCloseButtonRect( + TBGetDockTypeOf(CurrentDock, Floating) = dtLeftRight), P) then + Result := HT_TB2k_Close + else + Result := HT_TB2k_Border; + end; + end; +end; + +procedure TTBCustomDockableWindow.WMNCMouseMove(var Message: TWMNCMouseMove); +var + InArea: Boolean; +begin + inherited; + { Note: TME_NONCLIENT was introduced in Windows 98 and 2000 } + if (Win32MajorVersion >= 5) or + (Win32MajorVersion = 4) and (Win32MinorVersion >= 10) then + CallTrackMouseEvent(Handle, TME_LEAVE or $10 {TME_NONCLIENT}); + InArea := (ClipToLongint(Message.HitTest) = HT_TB2k_Close); + if FCloseButtonHover <> InArea then begin + FCloseButtonHover := InArea; + RedrawNCArea; + end; +end; + +procedure TTBCustomDockableWindow.WMNCMouseLeave(var Message: TMessage); +begin + if not MouseCapture then + CancelNCHover; + inherited; +end; + +procedure TTBCustomDockableWindow.CMMouseLeave(var Message: TMessage); +begin + inherited; + { On Windows versions that can't send a WM_NCMOUSELEAVE message, trap + CM_MOUSELEAVE to detect when the mouse moves from the non-client area to + another control. } + CancelNCHover; +end; + +procedure TTBCustomDockableWindow.WMMouseMove(var Message: TWMMouseMove); +begin + { On Windows versions that can't send a WM_NCMOUSELEAVE message, trap + WM_MOUSEMOVE to detect when the mouse moves from the non-client area to + the client area. + Note: We are overriding WM_MOUSEMOVE instead of MouseMove so that our + processing always gets done first. } + CancelNCHover; + inherited; +end; + +procedure TTBCustomDockableWindow.CancelNCHover; +begin + if FCloseButtonHover then begin + FCloseButtonHover := False; + RedrawNCArea; + end; +end; + +procedure TTBCustomDockableWindow.Close; +var + Accept: Boolean; +begin + Accept := True; + if Assigned(FOnCloseQuery) then + FOnCloseQuery(Self, Accept); + { Did the CloseQuery event return True? } + if Accept then begin + Hide; + if Assigned(FOnClose) then + FOnClose(Self); + end; +end; + +procedure TTBCustomDockableWindow.SetCloseButtonState(Pushed: Boolean); +begin + if FCloseButtonDown <> Pushed then begin + FCloseButtonDown := Pushed; + RedrawNCArea; + end; +end; + +procedure TTBCustomDockableWindow.WMNCLButtonDown(var Message: TWMNCLButtonDown); +var + R, BR: TRect; + P: TPoint; +begin + case ClipToLongint(Message.HitTest) of + HT_TB2k_Close: begin + GetWindowRect(Handle, R); + BR := GetDockedCloseButtonRect( + TBGetDockTypeOf(CurrentDock, Floating) = dtLeftRight); + OffsetRect(BR, R.Left, R.Top); + if CloseButtonLoop(Handle, BR, SetCloseButtonState) then + Close; + end; + HT_TB2k_Border: begin + P := ScreenToClient(GetMessagePosAsPoint); + if IsMovable then + BeginMoving(P.X, P.Y); + end; + else + inherited; + end; +end; + +procedure TTBCustomDockableWindow.WMNCLButtonDblClk(var Message: TWMNCLButtonDblClk); +begin + if ClipToLongint(Message.HitTest) = HT_TB2k_Border then begin + if IsMovable then + DoubleClick; + end + else + inherited; +end; + +procedure TTBCustomDockableWindow.ShowNCContextMenu(const PosX, PosY: Smallint); + + {$IFNDEF JR_D5} + { Note: this is identical to TControl.CheckMenuPopup (from Delphi 4), + except where noted. + TControl.CheckMenuPopup is unfortunately 'private', so it can't be called + outside of the Controls unit. } + procedure CheckMenuPopup; + var + Control: TControl; + PopupMenu: TPopupMenu; + begin + if csDesigning in ComponentState then Exit; + Control := Self; + while Control <> nil do + begin + { Added TControlAccess cast because GetPopupMenu is 'protected' } + PopupMenu := TControlAccess(Control).GetPopupMenu; + if (PopupMenu <> nil) then + begin + if not PopupMenu.AutoPopup then Exit; + SendCancelMode(nil); + PopupMenu.PopupComponent := Control; + { Changed the following. LPARAM of WM_NCRBUTTONUP is in screen + coordinates, not client coordinates } + {with ClientToScreen(SmallPointToPoint(Pos)) do + PopupMenu.Popup(X, Y);} + PopupMenu.Popup(PosX, PosY); + Exit; + end; + Control := Control.Parent; + end; + end; + {$ENDIF} + +begin + {$IFDEF JR_D5} + { Delphi 5 and later use the WM_CONTEXTMENU message for popup menus } + SendMessage(Handle, WM_CONTEXTMENU, WPARAM(Handle), MAKELPARAM(Word(PosX), Word(PosY))); + {$ELSE} + CheckMenuPopup; + {$ENDIF} +end; + +procedure TTBCustomDockableWindow.WMNCRButtonUp(var Message: TWMNCRButtonUp); +begin + ShowNCContextMenu(Message.XCursor, Message.YCursor); +end; + +{$IFDEF JR_D5} +procedure TTBCustomDockableWindow.WMContextMenu(var Message: TWMContextMenu); +{ Unfortunately TControl.WMContextMenu ignores clicks in the non-client area. + On docked toolbars, we need right clicks on the border, part of the + non-client area, to display the popup menu. The only way I see to have it do + that is to create a new version of WMContextMenu specifically for the + non-client area, and that is what this method is. + Note: This is identical to Delphi 2006's TControl.WMContextMenu, except where + noted. } +var + Pt, Temp: TPoint; + Handled: Boolean; + PopupMenu: TPopupMenu; +begin + { Added 'inherited;' here } + inherited; + if Message.Result <> 0 then Exit; + if csDesigning in ComponentState then + begin + inherited; + Exit; + end; + + Pt := SmallPointToPoint(Message.Pos); + if InvalidPoint(Pt) then + Temp := Pt + else + begin + Temp := ScreenToClient(Pt); + { Changed the following. We're only interested in the non-client area } + {if not PtInRect(ClientRect, Temp) then} + if PtInRect(ClientRect, Temp) then + begin + {inherited;} + Exit; + end; + end; + + Handled := False; + DoContextPopup(Temp, Handled); + Message.Result := Ord(Handled); + if Handled then Exit; + + PopupMenu := GetPopupMenu; + if (PopupMenu <> nil) and PopupMenu.AutoPopup then + begin + SendCancelMode(Self); + PopupMenu.PopupComponent := Self; + if InvalidPoint(Pt) then + Pt := ClientToScreen(Point(0, 0)); + PopupMenu.Popup(Pt.X, Pt.Y); + Message.Result := 1; + end; + + if Message.Result = 0 then + inherited; +end; +{$ENDIF} + +procedure TTBCustomDockableWindow.GetMinShrinkSize(var AMinimumSize: Integer); +begin +end; + +function TTBCustomDockableWindow.GetFloatingWindowParentClass: TTBFloatingWindowParentClass; +begin + Result := TTBFloatingWindowParent; +end; + +procedure TTBCustomDockableWindow.GetMinMaxSize(var AMinClientWidth, + AMinClientHeight, AMaxClientWidth, AMaxClientHeight: Integer); +begin +end; + +function TTBCustomDockableWindow.GetShrinkMode: TTBShrinkMode; +begin + Result := tbsmNone; +end; + +procedure TTBCustomDockableWindow.ResizeBegin; +begin +end; + +procedure TTBCustomDockableWindow.ResizeTrack(var Rect: TRect; const OrigRect: TRect); +begin +end; + +procedure TTBCustomDockableWindow.ResizeTrackAccept; +begin +end; + +procedure TTBCustomDockableWindow.ResizeEnd; +begin +end; + +procedure TTBCustomDockableWindow.BeginSizing(const ASizeHandle: TTBSizeHandle); +var + UseSmoothDrag, DragX, DragY, ReverseX, ReverseY: Boolean; + MinWidth, MinHeight, MaxWidth, MaxHeight: Integer; + DragRect, OrigDragRect: TRect; + ScreenDC: HDC; + OrigPos, OldPos: TPoint; + + procedure DoResize; + begin + BeginUpdate; + try + ResizeTrackAccept; + Parent.BoundsRect := DragRect; + SetBounds(Left, Top, Parent.ClientWidth, Parent.ClientHeight); + finally + EndUpdate; + end; + + { Make sure it doesn't go completely off the screen } + MoveOnScreen(True); + end; + + procedure MouseMoved; + var + Pos: TPoint; + OldDragRect: TRect; + begin + GetCursorPos(Pos); + { It needs to check if the cursor actually moved since last time. This is + because a call to LockWindowUpdate (apparently) generates a mouse move + message even when mouse hasn't moved. } + if (Pos.X = OldPos.X) and (Pos.Y = OldPos.Y) then Exit; + OldPos := Pos; + + OldDragRect := DragRect; + DragRect := OrigDragRect; + if DragX then begin + if not ReverseX then Inc(DragRect.Right, Pos.X-OrigPos.X) + else Inc(DragRect.Left, Pos.X-OrigPos.X); + end; + if DragY then begin + if not ReverseY then Inc(DragRect.Bottom, Pos.Y-OrigPos.Y) + else Inc(DragRect.Top, Pos.Y-OrigPos.Y); + end; + if DragRect.Right-DragRect.Left < MinWidth then begin + if not ReverseX then DragRect.Right := DragRect.Left + MinWidth + else DragRect.Left := DragRect.Right - MinWidth; + end; + if (MaxWidth > 0) and (DragRect.Right-DragRect.Left > MaxWidth) then begin + if not ReverseX then DragRect.Right := DragRect.Left + MaxWidth + else DragRect.Left := DragRect.Right - MaxWidth; + end; + if DragRect.Bottom-DragRect.Top < MinHeight then begin + if not ReverseY then DragRect.Bottom := DragRect.Top + MinHeight + else DragRect.Top := DragRect.Bottom - MinHeight; + end; + if (MaxHeight > 0) and (DragRect.Bottom-DragRect.Top > MaxHeight) then begin + if not ReverseY then DragRect.Bottom := DragRect.Top + MaxHeight + else DragRect.Top := DragRect.Bottom - MaxHeight; + end; + + ResizeTrack(DragRect, OrigDragRect); + if not UseSmoothDrag then + DrawDraggingOutline(ScreenDC, DragRect, OldDragRect, False, False) + else + DoResize; + end; +var + Accept: Boolean; + Msg: TMsg; + R: TRect; +begin + if not Floating then Exit; + + Accept := False; + + UseSmoothDrag := FSmoothDrag; + + MinWidth := 0; + MinHeight := 0; + MaxWidth := 0; + MaxHeight := 0; + GetMinMaxSize(MinWidth, MinHeight, MaxWidth, MaxHeight); + Inc(MinWidth, Parent.Width-Width); + Inc(MinHeight, Parent.Height-Height); + if MaxWidth > 0 then + Inc(MaxWidth, Parent.Width-Width); + if MaxHeight > 0 then + Inc(MaxHeight, Parent.Height-Height); + + DragX := ASizeHandle in [twshLeft, twshRight, twshTopLeft, twshTopRight, + twshBottomLeft, twshBottomRight]; + ReverseX := ASizeHandle in [twshLeft, twshTopLeft, twshBottomLeft]; + DragY := ASizeHandle in [twshTop, twshTopLeft, twshTopRight, twshBottom, + twshBottomLeft, twshBottomRight]; + ReverseY := ASizeHandle in [twshTop, twshTopLeft, twshTopRight]; + + ResizeBegin(ASizeHandle); + try + { Before locking, make sure all pending paint messages are processed } + ProcessPaintMessages; + + if not UseSmoothDrag then begin + { This uses LockWindowUpdate to suppress all window updating so the + dragging outlines doesn't sometimes get garbled. (This is safe, and in + fact, is the main purpose of the LockWindowUpdate function) + IMPORTANT! While debugging you might want to enable the 'TB2Dock_DisableLock' + conditional define (see top of the source code). } + {$IFNDEF TB2Dock_DisableLock} + LockWindowUpdate(GetDesktopWindow); + {$ENDIF} + { Get a DC of the entire screen. Works around the window update lock + by specifying DCX_LOCKWINDOWUPDATE. } + ScreenDC := GetDCEx(GetDesktopWindow, 0, + DCX_LOCKWINDOWUPDATE or DCX_CACHE or DCX_WINDOW); + end + else + ScreenDC := 0; + try + SetCapture(Handle); + if (tbdsResizeClipCursor in FDockableWindowStyles) and + not UsingMultipleMonitors then begin + R := GetRectOfPrimaryMonitor(False); + ClipCursor({$IFNDEF CLR}@{$ENDIF} R); + end; + + { Initialize } + OrigDragRect := Parent.BoundsRect; + DragRect := OrigDragRect; + if not UseSmoothDrag then begin + SetRectEmpty(R); + DrawDraggingOutline(ScreenDC, DragRect, R, False, False); + end; + GetCursorPos(OrigPos); + OldPos := OrigPos; + + { Stay in message loop until capture is lost. Capture is removed either + by this procedure manually doing it, or by an outside influence (like + a message box or menu popping up) } + while GetCapture = Handle do begin + case Integer(GetMessage(Msg, 0, 0, 0)) of + -1: Break; { if GetMessage failed } + 0: begin + { Repost WM_QUIT messages } + PostQuitMessage(ClipToLongint(Msg.wParam)); + Break; + end; + end; + + case Msg.Message of + WM_KEYDOWN, WM_KEYUP: + { Ignore all keystrokes while sizing except for Escape } + if Word(Msg.wParam) = VK_ESCAPE then + Break; + WM_MOUSEMOVE: + { Note to self: WM_MOUSEMOVE messages should never be dispatched + here to ensure no hints get shown during the drag process } + MouseMoved; + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK: + { Make sure it doesn't begin another loop } + Break; + WM_LBUTTONUP: begin + Accept := True; + Break; + end; + WM_RBUTTONDOWN..WM_MBUTTONDBLCLK: + { Ignore all other mouse up/down messages } + ; + else + TranslateMessage(Msg); + DispatchMessage(Msg); + end; + end; + finally + { Since it sometimes breaks out of the loop without capture being + released } + if GetCapture = Handle then + ReleaseCapture; + ClipCursor(nil); + + if not UseSmoothDrag then begin + { Hide dragging outline. Since NT will release a window update lock if + another thread comes to the foreground, it has to release the DC + and get a new one for erasing the dragging outline. Otherwise, + the DrawDraggingOutline appears to have no effect when this happens. } + ReleaseDC(GetDesktopWindow, ScreenDC); + ScreenDC := GetDCEx(GetDesktopWindow, 0, + DCX_LOCKWINDOWUPDATE or DCX_CACHE or DCX_WINDOW); + SetRectEmpty(R); + DrawDraggingOutline(ScreenDC, R, DragRect, False, False); + ReleaseDC(GetDesktopWindow, ScreenDC); + + { Release window update lock } + {$IFNDEF TB2Dock_DisableLock} + LockWindowUpdate(0); + {$ENDIF} + end; + end; + + if not UseSmoothDrag and Accept then + DoResize; + finally + ResizeEnd; + end; +end; + +procedure TTBCustomDockableWindow.DoDockChangingHidden(NewFloating: Boolean; + DockingTo: TTBDock); +begin + if not(csDestroying in ComponentState) and Assigned(FOnDockChangingHidden) then + FOnDockChangingHidden(Self, NewFloating, DockingTo); +end; + +{ TTBCustomDockableWindow - property access methods } + +function TTBCustomDockableWindow.GetNonClientWidth: Integer; +begin + Result := CalcNCSizes.X; +end; + +function TTBCustomDockableWindow.GetNonClientHeight: Integer; +begin + Result := CalcNCSizes.Y; +end; + +function TTBCustomDockableWindow.IsLastDockStored: Boolean; +begin + Result := FCurrentDock = nil; {}{should this be changed to 'Floating'?} +end; + +function TTBCustomDockableWindow.IsWidthAndHeightStored: Boolean; +begin + Result := (CurrentDock = nil) and not Floating; +end; + +procedure TTBCustomDockableWindow.SetCloseButton(Value: Boolean); +begin + if FCloseButton <> Value then begin + FCloseButton := Value; + + { Update the close button's visibility } + if Parent is TTBFloatingWindowParent then + TTBFloatingWindowParent(Parent).RedrawNCArea([twrdCaption, twrdCloseButton]); + end; +end; + +procedure TTBCustomDockableWindow.SetCloseButtonWhenDocked(Value: Boolean); +begin + if FCloseButtonWhenDocked <> Value then begin + FCloseButtonWhenDocked := Value; + if Docked then + RecalcNCArea(Self); + end; +end; + +procedure TTBCustomDockableWindow.SetDefaultDock(Value: TTBDock); +begin + if FDefaultDock <> Value then begin + FDefaultDock := Value; + if Assigned(Value) then + Value.FreeNotification(Self); + end; +end; + +procedure TTBCustomDockableWindow.SetCurrentDock(Value: TTBDock); +begin + if not(csLoading in ComponentState) then begin + if Assigned(Value) then + Parent := Value + else + Parent := TBValidToolWindowParentForm(Self); + end; +end; + +procedure TTBCustomDockableWindow.SetDockPos(Value: Integer); +begin + FDockPos := Value; + if Docked then + CurrentDock.ArrangeToolbars; +end; + +procedure TTBCustomDockableWindow.SetDockRow(Value: Integer); +begin + FDockRow := Value; + if Docked then + CurrentDock.ArrangeToolbars; +end; + +procedure TTBCustomDockableWindow.SetAutoResize(Value: Boolean); +begin + if FAutoResize <> Value then begin + FAutoResize := Value; + if Value then + Arrange; + end; +end; + +procedure TTBCustomDockableWindow.SetBorderStyle(Value: TBorderStyle); +begin + if FBorderStyle <> Value then begin + FBorderStyle := Value; + if Docked then + RecalcNCArea(Self); + end; +end; + +procedure TTBCustomDockableWindow.SetDragHandleStyle(Value: TTBDragHandleStyle); +begin + if FDragHandleStyle <> Value then begin + FDragHandleStyle := Value; + if Docked then + RecalcNCArea(Self); + end; +end; + +procedure TTBCustomDockableWindow.SetFloating(Value: Boolean); +var + ParentFrm: TTBCustomForm; + NewFloatParent: TTBFloatingWindowParent; +begin + if FFloating <> Value then begin + if Value and not(csDesigning in ComponentState) then begin + ParentFrm := TBValidToolWindowParentForm(Self); + if FFloatParent = nil then begin + NewFloatParent := GetFloatingWindowParentClass.CreateNew(nil); + try + with NewFloatParent do begin + FDockableWindow := Self; + BorderStyle := bsToolWindow; + ShowHint := True; + Visible := True; + { Note: The above line doesn't actually make it visible at this + point since FShouldShow is still False. } + end; + except + NewFloatParent.Free; + raise; + end; + FFloatParent := NewFloatParent; + end; + ParentFrm.FreeNotification(FFloatParent); + FFloatParent.FParentForm := ParentFrm; + FFloatParent.Caption := Caption; + Parent := FFloatParent; + SetBounds(0, 0, Width, Height); + end + else + Parent := TBValidToolWindowParentForm(Self); + end; +end; + +procedure TTBCustomDockableWindow.SetFloatingMode(Value: TTBFloatingMode); +begin + if FFloatingMode <> Value then begin + FFloatingMode := Value; + if HandleAllocated then + Perform(CM_SHOWINGCHANGED, 0, 0); + end; +end; + +procedure TTBCustomDockableWindow.SetFloatingPosition(Value: TPoint); +begin + FFloatingPosition := Value; + if Floating and Assigned(Parent) then + Parent.SetBounds(Value.X, Value.Y, Parent.Width, Parent.Height); +end; + +procedure TTBCustomDockableWindow.SetFullSize(Value: Boolean); +begin + if FFullSize <> Value then begin + FFullSize := Value; + if Docked then + CurrentDock.ArrangeToolbars; + end; +end; + +procedure TTBCustomDockableWindow.SetLastDock(Value: TTBDock); +begin + if FUseLastDock and Assigned(FCurrentDock) then + { When docked, LastDock must be equal to DockedTo } + Value := FCurrentDock; + if FLastDock <> Value then begin + if Assigned(FLastDock) and (FLastDock <> Parent) then + FLastDock.ChangeDockList(False, Self); + FLastDock := Value; + if Assigned(Value) then begin + FUseLastDock := True; + Value.FreeNotification(Self); + Value.ChangeDockList(True, Self); + end; + end; +end; + +procedure TTBCustomDockableWindow.SetResizable(Value: Boolean); +begin + if FResizable <> Value then begin + FResizable := Value; + if Floating and (Parent is TTBFloatingWindowParent) then begin + { Recreate the window handle because Resizable affects whether the + tool window is created with a WS_THICKFRAME style } + TTBFloatingWindowParent(Parent).CallRecreateWnd; + end; + end; +end; + +procedure TTBCustomDockableWindow.SetShowCaption(Value: Boolean); +begin + if FShowCaption <> Value then begin + FShowCaption := Value; + if Floating then begin + { Recalculate FloatingWindowParent's NC area, and resize the toolbar + accordingly } + RecalcNCArea(Parent); + Arrange; + end; + end; +end; + +procedure TTBCustomDockableWindow.SetStretch(Value: Boolean); +begin + if FStretch <> Value then begin + FStretch := Value; + if Docked then + CurrentDock.ArrangeToolbars; + end; +end; + +procedure TTBCustomDockableWindow.SetUseLastDock(Value: Boolean); +begin + if FUseLastDock <> Value then begin + FUseLastDock := Value; + if not Value then + LastDock := nil + else + LastDock := FCurrentDock; + end; +end; + +(*function TTBCustomDockableWindow.GetVersion: TToolbar97Version; +begin + Result := Toolbar97VersionPropText; +end; + +procedure TTBCustomDockableWindow.SetVersion(const Value: TToolbar97Version); +begin + { write method required for the property to show up in Object Inspector } +end;*) + + +{ TTBBackground } + +{$IFNDEF CLR} +type + PNotifyEvent = ^TNotifyEvent; +{$ENDIF} + +constructor TTBBackground.Create(AOwner: TComponent); +begin + inherited; + FBkColor := clBtnFace; + FBitmap := TBitmap.Create; + FBitmap.OnChange := BitmapChanged; +end; + +destructor TTBBackground.Destroy; +{$IFNDEF CLR} +var + I: Integer; +{$ENDIF} +begin + inherited; + FBitmapCache.Free; + FBitmap.Free; + if Assigned(FNotifyList) then begin + {$IFNDEF CLR} + for I := FNotifyList.Count-1 downto 0 do + Dispose(PNotifyEvent(FNotifyList[I])); + {$ENDIF} + FNotifyList.Free; + end; +end; + +procedure TTBBackground.BitmapChanged(Sender: TObject); +var + I: Integer; +begin + { Erase the cache and notify } + FreeAndNil(FBitmapCache); + if Assigned(FNotifyList) then + for I := 0 to FNotifyList.Count-1 do + {$IFNDEF CLR} + PNotifyEvent(FNotifyList[I])^(Self); + {$ELSE} + TNotifyEvent(FNotifyList[I])(Self); + {$ENDIF} +end; + +procedure TTBBackground.Draw(DC: HDC; const DrawRect: TRect); +var + UseBmp: TBitmap; + R2: TRect; + SaveIndex: Integer; + DC2: HDC; + Brush: HBRUSH; + P: TPoint; +begin + if FBitmapCache = nil then begin + FBitmapCache := TBitmap.Create; + FBitmapCache.Palette := CopyPalette(FBitmap.Palette); + FBitmapCache.Width := FBitmap.Width; + FBitmapCache.Height := FBitmap.Height; + if not FTransparent then begin + { Copy from a possible DIB to our DDB } + BitBlt(FBitmapCache.Canvas.Handle, 0, 0, FBitmapCache.Width, + FBitmapCache.Height, FBitmap.Canvas.Handle, 0, 0, SRCCOPY); + end + else begin + with FBitmapCache do begin + Canvas.Brush.Color := FBkColor; + R2 := Rect(0, 0, Width, Height); + Canvas.BrushCopy(R2, FBitmap, R2, + FBitmap.Canvas.Pixels[0, Height-1] or $02000000); + end; + end; + FBitmap.Dormant; + end; + UseBmp := FBitmapCache; + + DC2 := 0; + SaveIndex := SaveDC(DC); + try + if UseBmp.Palette <> 0 then begin + SelectPalette(DC, UseBmp.Palette, True); + RealizePalette(DC); + end; + { Note: versions of Toolbar97 prior to 1.68 used 'UseBmp.Canvas.Handle' + instead of DC2 in the BitBlt call. This was changed because there + seems to be a bug in D2/BCB1's Graphics.pas: if you called + .Background.LoadFromFile() twice the background + would not be shown. } + if (UseBmp.Width = 8) and (UseBmp.Height = 8) then begin + { Use pattern brushes to draw 8x8 bitmaps. + Note: Win9x can't use bitmaps <8x8 in size for pattern brushes } + Brush := CreatePatternBrush(UseBmp.Handle); + GetWindowOrgEx(DC, P); + SetBrushOrgEx(DC, DrawRect.Left - P.X, DrawRect.Top - P.Y, nil); + FillRect(DC, DrawRect, Brush); + DeleteObject(Brush); + end + else begin + { BitBlt is faster than pattern brushes on large bitmaps } + DC2 := CreateCompatibleDC(DC); + SelectObject(DC2, UseBmp.Handle); + R2 := DrawRect; + while R2.Left < R2.Right do begin + while R2.Top < R2.Bottom do begin + BitBlt(DC, R2.Left, R2.Top, UseBmp.Width, UseBmp.Height, + DC2, 0, 0, SRCCOPY); + Inc(R2.Top, UseBmp.Height); + end; + R2.Top := DrawRect.Top; + Inc(R2.Left, UseBmp.Width); + end; + end; + finally + if DC2 <> 0 then + DeleteDC(DC2); + { Restore the palette and brush origin back } + RestoreDC(DC, SaveIndex); + end; +end; + +function TTBBackground.GetPalette: HPALETTE; +begin + Result := FBitmap.Palette; +end; + +procedure TTBBackground.SysColorChanged; +begin + if FTransparent and (FBkColor < 0) then + BitmapChanged(nil); +end; + +function TTBBackground.UsingBackground: Boolean; +begin + Result := (FBitmap.Width <> 0) and (FBitmap.Height <> 0); +end; + +procedure TTBBackground.RegisterChanges(Proc: TNotifyEvent); +var + I: Integer; + {$IFNDEF CLR} + P: PNotifyEvent; + {$ENDIF} +begin + if FNotifyList = nil then + FNotifyList := TList.Create; + for I := 0 to FNotifyList.Count-1 do begin + {$IFNDEF CLR} + P := FNotifyList[I]; + if MethodsEqual(TMethod(P^), TMethod(Proc)) then + {$ELSE} + if @TNotifyEvent(FNotifyList[I]) = @Proc then + {$ENDIF} + Exit; + end; + {$IFNDEF CLR} + FNotifyList.Expand; + New(P); + P^ := Proc; + FNotifyList.Add(P); + {$ELSE} + FNotifyList.Add(@Proc); + {$ENDIF} +end; + +procedure TTBBackground.UnregisterChanges(Proc: TNotifyEvent); +var + I: Integer; + {$IFNDEF CLR} + P: PNotifyEvent; + {$ENDIF} +begin + if FNotifyList = nil then + Exit; + for I := 0 to FNotifyList.Count-1 do begin + {$IFNDEF CLR} + P := FNotifyList[I]; + if MethodsEqual(TMethod(P^), TMethod(Proc)) then begin + {$ELSE} + if @TNotifyEvent(FNotifyList[I]) = @Proc then begin + {$ENDIF} + FNotifyList.Delete(I); + {$IFNDEF CLR} + Dispose(P); + {$ENDIF} + Break; + end; + end; +end; + +procedure TTBBackground.SetBkColor(Value: TColor); +begin + if FBkColor <> Value then begin + FBkColor := Value; + if FTransparent then + BitmapChanged(nil); + end; +end; + +procedure TTBBackground.SetBitmap(Value: TBitmap); +begin + FBitmap.Assign(Value); +end; + +procedure TTBBackground.SetTransparent(Value: Boolean); +begin + if FTransparent <> Value then begin + FTransparent := Value; + BitmapChanged(nil); + end; +end; + + +{ Global procedures } + +procedure TBCustomLoadPositions(const OwnerComponent: TComponent; + const ReadIntProc: TTBPositionReadIntProc; + const ReadStringProc: TTBPositionReadStringProc; + const ExtraData: TTBPositionExtraData); +var + Rev: Integer; + + function FindDock(AName: String): TTBDock; + var + I: Integer; + begin + Result := nil; + for I := 0 to OwnerComponent.ComponentCount-1 do + if (OwnerComponent.Components[I] is TTBDock) and + {$IFNDEF CLR} + (CompareText(OwnerComponent.Components[I].Name, AName) = 0) then begin + {$ELSE} + SameText(OwnerComponent.Components[I].Name, AName, loInvariantLocale) then begin + {$ENDIF} + Result := TTBDock(OwnerComponent.Components[I]); + Break; + end; + end; + + procedure ReadValues(const Toolbar: TTBCustomDockableWindow; const NewDock: TTBDock); + var + Pos: TPoint; + Data: TTBReadPositionData; + LastDockName: String; + ADock: TTBDock; + begin + with Toolbar do begin + DockRow := ReadIntProc(Name, rvDockRow, DockRow, ExtraData); + DockPos := ReadIntProc(Name, rvDockPos, DockPos, ExtraData); + Pos.X := ReadIntProc(Name, rvFloatLeft, 0, ExtraData); + Pos.Y := ReadIntProc(Name, rvFloatTop, 0, ExtraData); + Data.ReadIntProc := ReadIntProc; + Data.ReadStringProc := ReadStringProc; + Data.ExtraData := ExtraData; + ReadPositionData(Data); + FloatingPosition := Pos; + if Assigned(NewDock) then + Parent := NewDock + else begin + //Parent := Form; + Floating := True; + MoveOnScreen(True); + if (Rev >= 3) and FUseLastDock then begin + LastDockName := ReadStringProc(Name, rvLastDock, '', ExtraData); + if LastDockName <> '' then begin + ADock := FindDock(LastDockName); + if Assigned(ADock) then + LastDock := ADock; + end; + end; + end; + Arrange; + DoneReadingPositionData(Data); + end; + end; + +var + DocksDisabled: TList; + I: Integer; + ToolWindow: TComponent; + ADock: TTBDock; + DockedToName: String; +begin + DocksDisabled := TList.Create; + try + with OwnerComponent do + for I := 0 to ComponentCount-1 do + if Components[I] is TTBDock then begin + TTBDock(Components[I]).BeginUpdate; + DocksDisabled.Add(Components[I]); + end; + + for I := 0 to OwnerComponent.ComponentCount-1 do begin + ToolWindow := OwnerComponent.Components[I]; + if ToolWindow is TTBCustomDockableWindow then + with TTBCustomDockableWindow(ToolWindow) do begin + {}{should skip over toolbars that are neither Docked nor Floating } + if Name = '' then + Continue; + Rev := ReadIntProc(Name, rvRev, 0, ExtraData); + if Rev = 2000 then begin + Visible := ReadIntProc(Name, rvVisible, Ord(Visible), ExtraData) <> 0; + DockedToName := ReadStringProc(Name, rvDockedTo, '', ExtraData); + if DockedToName <> '' then begin + if DockedToName <> rdDockedToFloating then begin + ADock := FindDock(DockedToName); + if (ADock <> nil) and (ADock.FAllowDrag) then + ReadValues(TTBCustomDockableWindow(ToolWindow), ADock); + end + else + ReadValues(TTBCustomDockableWindow(ToolWindow), nil); + end; + end; + end; + end; + finally + for I := DocksDisabled.Count-1 downto 0 do + TTBDock(DocksDisabled[I]).EndUpdate; + DocksDisabled.Free; + end; +end; + +procedure TBCustomSavePositions(const OwnerComponent: TComponent; + const WriteIntProc: TTBPositionWriteIntProc; + const WriteStringProc: TTBPositionWriteStringProc; + const ExtraData: TTBPositionExtraData); +var + I: Integer; + N, L: String; + Data: TTBWritePositionData; +begin + for I := 0 to OwnerComponent.ComponentCount-1 do + if OwnerComponent.Components[I] is TTBCustomDockableWindow then + with TTBCustomDockableWindow(OwnerComponent.Components[I]) do begin + if Name = '' then + Continue; + if Floating then + N := rdDockedToFloating + else if Docked then begin + if CurrentDock.FAllowDrag then begin + N := CurrentDock.Name; + if N = '' then + raise Exception.Create(STBToolwinDockedToNameNotSet); + end + else + N := ''; + end + else + Continue; { skip if it's neither floating nor docked } + L := ''; + if Assigned(FLastDock) then + L := FLastDock.Name; + WriteIntProc(Name, rvRev, rdCurrentRev, ExtraData); + WriteIntProc(Name, rvVisible, Ord(Visible), ExtraData); + WriteStringProc(Name, rvDockedTo, N, ExtraData); + WriteStringProc(Name, rvLastDock, L, ExtraData); + WriteIntProc(Name, rvDockRow, FDockRow, ExtraData); + WriteIntProc(Name, rvDockPos, FDockPos, ExtraData); + WriteIntProc(Name, rvFloatLeft, FFloatingPosition.X, ExtraData); + WriteIntProc(Name, rvFloatTop, FFloatingPosition.Y, ExtraData); + Data.WriteIntProc := WriteIntProc; + Data.WriteStringProc := WriteStringProc; + Data.ExtraData := ExtraData; + WritePositionData(Data); + end; +end; + +type + TIniReadWriteData = class + private + IniFile: TCustomIniFile; + SectionNamePrefix: String; + end; + +function IniReadInt(const ToolbarName, Value: String; const Default: Longint; + const ExtraData: TTBPositionExtraData): Longint; +begin + Result := TIniReadWriteData(ExtraData).IniFile.ReadInteger( + TIniReadWriteData(ExtraData).SectionNamePrefix + ToolbarName, Value, Default); +end; +function IniReadString(const ToolbarName, Value, Default: String; + const ExtraData: TTBPositionExtraData): String; +begin + Result := TIniReadWriteData(ExtraData).IniFile.ReadString( + TIniReadWriteData(ExtraData).SectionNamePrefix + ToolbarName, Value, Default); +end; +procedure IniWriteInt(const ToolbarName, Value: String; const Data: Longint; + const ExtraData: TTBPositionExtraData); +begin + TIniReadWriteData(ExtraData).IniFile.WriteInteger( + TIniReadWriteData(ExtraData).SectionNamePrefix + ToolbarName, Value, Data); +end; +procedure IniWriteString(const ToolbarName, Value, Data: String; + const ExtraData: TTBPositionExtraData); +begin + TIniReadWriteData(ExtraData).IniFile.WriteString( + TIniReadWriteData(ExtraData).SectionNamePrefix + ToolbarName, Value, Data); +end; + +procedure TBIniLoadPositions(const OwnerComponent: TComponent; + const IniFile: TCustomIniFile; const SectionNamePrefix: String); +var + Data: TIniReadWriteData; +begin + Data := TIniReadWriteData.Create; + try + Data.IniFile := IniFile; + Data.SectionNamePrefix := SectionNamePrefix; + TBCustomLoadPositions(OwnerComponent, IniReadInt, IniReadString, Data); + finally + Data.Free; + end; +end; + +procedure TBIniLoadPositions(const OwnerComponent: TComponent; + const Filename, SectionNamePrefix: String); +var + IniFile: TIniFile; +begin + IniFile := TIniFile.Create(Filename); + try + TBIniLoadPositions(OwnerComponent, IniFile, SectionNamePrefix); + finally + IniFile.Free; + end; +end; + +procedure TBIniSavePositions(const OwnerComponent: TComponent; + const IniFile: TCustomIniFile; const SectionNamePrefix: String); +var + Data: TIniReadWriteData; +begin + Data := TIniReadWriteData.Create; + try + Data.IniFile := IniFile; + Data.SectionNamePrefix := SectionNamePrefix; + TBCustomSavePositions(OwnerComponent, IniWriteInt, IniWriteString, Data); + finally + Data.Free; + end; +end; + +procedure TBIniSavePositions(const OwnerComponent: TComponent; + const Filename, SectionNamePrefix: String); +var + IniFile: TIniFile; +begin + IniFile := TIniFile.Create(Filename); + try + TBIniSavePositions(OwnerComponent, IniFile, SectionNamePrefix); + finally + IniFile.Free; + end; +end; + +function RegReadInt(const ToolbarName, Value: String; const Default: Longint; + const ExtraData: TTBPositionExtraData): Longint; +begin + Result := TRegIniFile(ExtraData).ReadInteger(ToolbarName, Value, Default); +end; +function RegReadString(const ToolbarName, Value, Default: String; + const ExtraData: TTBPositionExtraData): String; +begin + Result := TRegIniFile(ExtraData).ReadString(ToolbarName, Value, Default); +end; +procedure RegWriteInt(const ToolbarName, Value: String; const Data: Longint; + const ExtraData: TTBPositionExtraData); +begin + TRegIniFile(ExtraData).WriteInteger(ToolbarName, Value, Data); +end; +procedure RegWriteString(const ToolbarName, Value, Data: String; + const ExtraData: TTBPositionExtraData); +begin + TRegIniFile(ExtraData).WriteString(ToolbarName, Value, Data); +end; + +procedure TBRegLoadPositions(const OwnerComponent: TComponent; + const RootKey: DWORD; const BaseRegistryKey: String); +var + Reg: TRegIniFile; +begin + Reg := TRegIniFile.Create(''); + try + {$IFDEF JR_D5} + Reg.Access := KEY_QUERY_VALUE; + {$ENDIF} + Reg.RootKey := RootKey; + if Reg.OpenKey(BaseRegistryKey, False) then + TBCustomLoadPositions(OwnerComponent, RegReadInt, RegReadString, Reg); + finally + Reg.Free; + end; +end; + +procedure TBRegSavePositions(const OwnerComponent: TComponent; + const RootKey: DWORD; const BaseRegistryKey: String); +var + Reg: TRegIniFile; +begin + Reg := TRegIniFile.Create(''); + try + Reg.RootKey := RootKey; + Reg.CreateKey(BaseRegistryKey); + if Reg.OpenKey(BaseRegistryKey, True) then + TBCustomSavePositions(OwnerComponent, RegWriteInt, RegWriteString, Reg); + finally + Reg.Free; + end; +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.dfm b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.dfm new file mode 100644 index 0000000..9d5ad45 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.dfm differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.dfm.txt b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.dfm.txt new file mode 100644 index 0000000..a1b062f --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.dfm.txt @@ -0,0 +1,65 @@ +object TBConvertOptionsForm: TTBConvertOptionsForm + Left = 225 + Top = 133 + BorderIcons = [biSystemMenu, biMinimize] + BorderStyle = bsDialog + Caption = 'Convert Menu' + ClientHeight = 90 + ClientWidth = 249 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 8 + Top = 8 + Width = 81 + Height = 13 + Caption = '&Menu to convert:' + FocusControl = MenuCombo + end + object MenuCombo: TComboBox + Left = 8 + Top = 24 + Width = 233 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 0 + end + object ConvertButton: TButton + Left = 8 + Top = 57 + Width = 73 + Height = 23 + Caption = '&Convert' + Default = True + ModalResult = 1 + TabOrder = 1 + end + object HelpButton: TButton + Left = 168 + Top = 57 + Width = 73 + Height = 23 + Caption = '&Help' + TabOrder = 2 + OnClick = HelpButtonClick + end + object Button1: TButton + Left = 88 + Top = 57 + Width = 73 + Height = 23 + Cancel = True + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 3 + end +end diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.hpp b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.hpp new file mode 100644 index 0000000..7e6e41a --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.hpp @@ -0,0 +1,64 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Tb2dsgnconvertoptions.pas' rev: 20.00 + +#ifndef Tb2dsgnconvertoptionsHPP +#define Tb2dsgnconvertoptionsHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Tb2dsgnconvertoptions +{ +//-- type declarations ------------------------------------------------------- +class DELPHICLASS TTBConvertOptionsForm; +class PASCALIMPLEMENTATION TTBConvertOptionsForm : public Forms::TForm +{ + typedef Forms::TForm inherited; + +__published: + Stdctrls::TComboBox* MenuCombo; + Stdctrls::TLabel* Label1; + Stdctrls::TButton* ConvertButton; + Stdctrls::TButton* HelpButton; + Stdctrls::TButton* Button1; + void __fastcall HelpButtonClick(System::TObject* Sender); +public: + /* TCustomForm.Create */ inline __fastcall virtual TTBConvertOptionsForm(Classes::TComponent* AOwner) : Forms::TForm(AOwner) { } + /* TCustomForm.CreateNew */ inline __fastcall virtual TTBConvertOptionsForm(Classes::TComponent* AOwner, int Dummy) : Forms::TForm(AOwner, Dummy) { } + /* TCustomForm.Destroy */ inline __fastcall virtual ~TTBConvertOptionsForm(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TTBConvertOptionsForm(HWND ParentWindow) : Forms::TForm(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- + +} /* namespace Tb2dsgnconvertoptions */ +using namespace Tb2dsgnconvertoptions; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // Tb2dsgnconvertoptionsHPP diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.pas new file mode 100644 index 0000000..5c47a46 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConvertOptions.pas @@ -0,0 +1,67 @@ +unit TB2DsgnConvertOptions; + +{ + Toolbar2000 + Copyright (C) 1998-2005 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2DsgnConvertOptions.pas,v 1.6 2005/01/06 03:56:50 jr Exp $ +} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls; + +type + TTBConvertOptionsForm = class(TForm) + MenuCombo: TComboBox; + Label1: TLabel; + ConvertButton: TButton; + HelpButton: TButton; + Button1: TButton; + procedure HelpButtonClick(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +implementation + +{$R *.DFM} + +procedure TTBConvertOptionsForm.HelpButtonClick(Sender: TObject); +const + SMsg1 = 'This will import the contents of a TMainMenu or TPopupMenu ' + + 'component on the form.'#13#10#13#10 + + 'The new items will take the names of the old menu ' + + 'items. The old menu items will have "_OLD" appended to the end of ' + + 'their names.'#13#10#13#10 + + 'After the conversion process completes, you should verify that ' + + 'everything was copied correctly. Afterward, you may delete the ' + + 'old menu component.'; +begin + Application.MessageBox(SMsg1, 'Convert Help', MB_OK or MB_ICONINFORMATION); +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.dfm b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.dfm new file mode 100644 index 0000000..f684c17 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.dfm differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.dfm.txt b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.dfm.txt new file mode 100644 index 0000000..7d2cbaf --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.dfm.txt @@ -0,0 +1,51 @@ +object TBConverterForm: TTBConverterForm + Left = 200 + Top = 104 + AutoScroll = False + Caption = 'Conversion Status' + ClientHeight = 218 + ClientWidth = 425 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + OnClose = FormClose + PixelsPerInch = 96 + TextHeight = 13 + object MessageList: TListBox + Left = 8 + Top = 8 + Width = 409 + Height = 169 + Anchors = [akLeft, akTop, akRight, akBottom] + ItemHeight = 13 + TabOrder = 0 + end + object CloseButton: TButton + Left = 176 + Top = 185 + Width = 73 + Height = 23 + Anchors = [akRight, akBottom] + Cancel = True + Caption = '&Close' + Enabled = False + TabOrder = 1 + OnClick = CloseButtonClick + end + object CopyButton: TButton + Left = 256 + Top = 185 + Width = 161 + Height = 23 + Anchors = [akRight, akBottom] + Caption = 'C&opy Messages to Clipboard' + Enabled = False + TabOrder = 2 + OnClick = CopyButtonClick + end +end diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.hpp b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.hpp new file mode 100644 index 0000000..e172540 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.hpp @@ -0,0 +1,64 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Tb2dsgnconverter.pas' rev: 20.00 + +#ifndef Tb2dsgnconverterHPP +#define Tb2dsgnconverterHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Tb2dsgnconverter +{ +//-- type declarations ------------------------------------------------------- +class DELPHICLASS TTBConverterForm; +class PASCALIMPLEMENTATION TTBConverterForm : public Forms::TForm +{ + typedef Forms::TForm inherited; + +__published: + Stdctrls::TListBox* MessageList; + Stdctrls::TButton* CloseButton; + Stdctrls::TButton* CopyButton; + void __fastcall CloseButtonClick(System::TObject* Sender); + void __fastcall CopyButtonClick(System::TObject* Sender); + void __fastcall FormClose(System::TObject* Sender, Forms::TCloseAction &Action); +public: + /* TCustomForm.Create */ inline __fastcall virtual TTBConverterForm(Classes::TComponent* AOwner) : Forms::TForm(AOwner) { } + /* TCustomForm.CreateNew */ inline __fastcall virtual TTBConverterForm(Classes::TComponent* AOwner, int Dummy) : Forms::TForm(AOwner, Dummy) { } + /* TCustomForm.Destroy */ inline __fastcall virtual ~TTBConverterForm(void) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TTBConverterForm(HWND ParentWindow) : Forms::TForm(ParentWindow) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +extern PACKAGE void __fastcall DoConvert(const Tb2item::TTBCustomItem* ParentItem, const Classes::TComponent* Owner); + +} /* namespace Tb2dsgnconverter */ +using namespace Tb2dsgnconverter; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // Tb2dsgnconverterHPP diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.pas new file mode 100644 index 0000000..e1a2456 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnConverter.pas @@ -0,0 +1,217 @@ +unit TB2DsgnConverter; + +{ + Toolbar2000 + Copyright (C) 1998-2005 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2DsgnConverter.pas,v 1.16 2005/01/06 03:56:50 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, SysUtils, Classes, Controls, Forms, Menus, StdCtrls, + TB2Item; + +type + TTBConverterForm = class(TForm) + MessageList: TListBox; + CloseButton: TButton; + CopyButton: TButton; + procedure CloseButtonClick(Sender: TObject); + procedure CopyButtonClick(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); + end; + +procedure DoConvert(const ParentItem: TTBCustomItem; const Owner: TComponent); + +implementation + +{$R *.DFM} + +uses + Clipbrd, TB2DsgnConvertOptions; + +procedure DoConvert(const ParentItem: TTBCustomItem; const Owner: TComponent); +const + SPropNotTransferred = 'Warning: %s property not transferred on ''%s''.'; +var + ConverterForm: TTBConverterForm; + + procedure Log(const S: String); + begin + ConverterForm.MessageList.Items.Add(S); + ConverterForm.MessageList.TopIndex := ConverterForm.MessageList.Items.Count-1; + ConverterForm.Update; + end; + + procedure Recurse(MenuItem: TMenuItem; TBItem: TTBCustomItem); + var + I: Integer; + Src: TMenuItem; + IsSep, IsSubmenu: Boolean; + Dst: TTBCustomItem; + N: String; + begin + for I := 0 to MenuItem.Count-1 do begin + Src := MenuItem[I]; + IsSep := (Src.Caption = '-'); + IsSubmenu := False; + if not IsSep then begin + if Src.Count > 0 then + IsSubmenu := True; + if not IsSubmenu then + Dst := TTBItem.Create(Owner) + else + Dst := TTBSubmenuItem.Create(Owner); + Dst.Action := Src.Action; + {$IFDEF JR_D6} + Dst.AutoCheck := Src.AutoCheck; + {$ENDIF} + Dst.Caption := Src.Caption; + Dst.Checked := Src.Checked; + if Src.Default then + Dst.Options := Dst.Options + [tboDefault]; + Dst.Enabled := Src.Enabled; + Dst.GroupIndex := Src.GroupIndex; + Dst.HelpContext := Src.HelpContext; + Dst.ImageIndex := Src.ImageIndex; + Dst.RadioItem := Src.RadioItem; + Dst.ShortCut := Src.ShortCut; + {$IFDEF JR_D5} + Dst.SubMenuImages := Src.SubMenuImages; + {$ENDIF} + Dst.OnClick := Src.OnClick; + end + else begin + Dst := TTBSeparatorItem.Create(Owner); + end; + Dst.Hint := Src.Hint; + Dst.Tag := Src.Tag; + Dst.Visible := Src.Visible; + if not IsSep then + { Temporarily clear the menu item's OnClick property, so that renaming + the menu item doesn't cause the function name to change } + Src.OnClick := nil; + try + N := Src.Name; + Src.Name := N + '_OLD'; + Dst.Name := N; + finally + if not IsSep then + Src.OnClick := Dst.OnClick; + end; + TBItem.Add(Dst); + {$IFDEF JR_D5} + if @Src.OnAdvancedDrawItem <> nil then + Log(Format(SPropNotTransferred, ['OnAdvancedDrawItem', Dst.Name])); + {$ENDIF} + if @Src.OnDrawItem <> nil then + Log(Format(SPropNotTransferred, ['OnDrawItem', Dst.Name])); + if @Src.OnMeasureItem <> nil then + Log(Format(SPropNotTransferred, ['OnMeasureItem', Dst.Name])); + if IsSubmenu then + Recurse(Src, Dst); + end; + end; + +var + OptionsForm: TTBConvertOptionsForm; + I: Integer; + C: TComponent; + Menu: TMenu; +begin + Menu := nil; + OptionsForm := TTBConvertOptionsForm.Create(Application); + try + for I := 0 to Owner.ComponentCount-1 do begin + C := Owner.Components[I]; + if (C is TMenu) and not(C is TTBPopupMenu) then + OptionsForm.MenuCombo.Items.AddObject(C.Name, C); + end; + if OptionsForm.MenuCombo.Items.Count = 0 then + raise Exception.Create('Could not find any menus on the form to convert'); + OptionsForm.MenuCombo.ItemIndex := 0; + if (OptionsForm.ShowModal <> mrOK) or (OptionsForm.MenuCombo.ItemIndex < 0) then + Exit; + Menu := TMenu(OptionsForm.MenuCombo.Items.Objects[OptionsForm.MenuCombo.ItemIndex]); + finally + OptionsForm.Free; + end; + ParentItem.SubMenuImages := Menu.Images; + ConverterForm := TTBConverterForm.Create(Application); + ConverterForm.Show; + ConverterForm.Update; + Log(Format('Converting ''%s'', please wait...', [Menu.Name])); + ParentItem.ViewBeginUpdate; + try + Recurse(Menu.Items, ParentItem); + finally + ParentItem.ViewEndUpdate; + end; + Log('Done!'); + ConverterForm.CloseButton.Enabled := True; + ConverterForm.CopyButton.Enabled := True; +end; + + +{ TTBConverterForm } + +procedure TTBConverterForm.FormClose(Sender: TObject; + var Action: TCloseAction); +begin + Action := caFree; +end; + +procedure TTBConverterForm.CloseButtonClick(Sender: TObject); +begin + Close; +end; + +procedure TTBConverterForm.CopyButtonClick(Sender: TObject); +begin + Clipboard.AsText := MessageList.Items.Text; +end; + + +procedure FreeConverterForms; +var + I: Integer; + Form: TCustomForm; +label Restart; +begin + Restart: + for I := 0 to Screen.CustomFormCount-1 do begin + Form := Screen.CustomForms[I]; + if Form is TTBConverterForm then begin + Form.Free; + goto Restart; + end; + end; +end; + +initialization +finalization + FreeConverterForms; +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.dfm b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.dfm new file mode 100644 index 0000000..748a7cd Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.dfm differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.dfm.txt b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.dfm.txt new file mode 100644 index 0000000..a2a3205 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.dfm.txt @@ -0,0 +1,184 @@ +object TBItemEditForm: TTBItemEditForm + Left = 200 + Top = 104 + AutoScroll = False + BorderIcons = [biSystemMenu, biMinimize] + ClientHeight = 247 + ClientWidth = 440 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + OnActivate = FormActivate + OnClose = FormClose + PixelsPerInch = 96 + TextHeight = 13 + object Splitter1: TSplitter + Left = 129 + Top = 19 + Width = 3 + Height = 228 + Cursor = crHSplit + ResizeStyle = rsUpdate + end + object TreeView: TTreeView + Left = 0 + Top = 19 + Width = 129 + Height = 228 + Align = alLeft + HideSelection = False + Indent = 19 + ReadOnly = True + ShowRoot = False + TabOrder = 2 + OnChange = TreeViewChange + OnDragDrop = TreeViewDragDrop + OnDragOver = TreeViewDragOver + OnEnter = TreeViewEnter + OnKeyDown = TreeViewKeyDown + OnKeyPress = TreeViewKeyPress + end + object ListView: TListView + Left = 132 + Top = 19 + Width = 308 + Height = 228 + Align = alClient + Columns = < + item + Caption = 'Caption' + Width = 160 + end + item + Caption = 'Type' + Width = 120 + end> + ColumnClick = False + DragMode = dmAutomatic + HideSelection = False + MultiSelect = True + ReadOnly = True + RowSelect = True + PopupMenu = TBPopupMenu1 + TabOrder = 1 + ViewStyle = vsReport + OnChange = ListViewChange + OnDblClick = ListViewDblClick + OnEnter = ListViewEnter + OnDragDrop = ListViewDragDrop + OnDragOver = ListViewDragOver + OnKeyDown = ListViewKeyDown + OnKeyPress = ListViewKeyPress + end + object Toolbar: TTBToolbar + Left = 0 + Top = 0 + Width = 440 + Height = 19 + Align = alTop + Caption = 'Toolbar' + DockPos = 0 + FullSize = True + LinkSubitems = ToolbarItems + ParentShowHint = False + ShowHint = True + TabOrder = 0 + end + object TBPopupMenu1: TTBPopupMenu + LinkSubitems = ToolbarItems + Left = 256 + Top = 120 + end + object TBItemContainer1: TTBItemContainer + Left = 224 + Top = 120 + object ToolbarItems: TTBSubmenuItem + object NewItemButton: TTBItem + Caption = 'New &Item' + Hint = 'New Item' + ImageIndex = 0 + ShortCut = 45 + OnClick = NewItemButtonClick + end + object NewSubmenuButton: TTBItem + Caption = 'New &Submenu' + Hint = 'New Submenu' + ImageIndex = 1 + ShortCut = 16429 + OnClick = NewSubmenuButtonClick + end + object NewSepButton: TTBItem + Caption = 'New Se¶tor' + Hint = 'New Separator' + ImageIndex = 2 + ShortCut = 189 + OnClick = NewSepButtonClick + end + object MoreMenu: TTBSubmenuItem + Caption = '&More' + Options = [tboDropdownArrow] + end + object TBSeparatorItem1: TTBSeparatorItem + end + object CutButton: TTBItem + Caption = 'Cu&t' + Enabled = False + Hint = 'Cut' + ImageIndex = 5 + OnClick = CutButtonClick + end + object CopyButton: TTBItem + Caption = '&Copy' + Enabled = False + Hint = 'Copy' + ImageIndex = 4 + OnClick = CopyButtonClick + end + object PasteButton: TTBItem + Caption = '&Paste' + Hint = 'Paste' + ImageIndex = 6 + OnClick = PasteButtonClick + end + object DeleteButton: TTBItem + Caption = '&Delete Item' + Enabled = False + Hint = 'Delete Item' + ImageIndex = 3 + ShortCut = 46 + OnClick = DeleteButtonClick + end + object TBSeparatorItem2: TTBSeparatorItem + end + object MoveUpButton: TTBItem + Caption = 'Move &Up' + Hint = 'Move Up' + ImageIndex = 7 + ShortCut = 32806 + OnClick = MoveUpButtonClick + end + object MoveDownButton: TTBItem + Caption = 'Move D&own' + Hint = 'Move Down' + ImageIndex = 8 + ShortCut = 32808 + OnClick = MoveDownButtonClick + end + object TBSeparatorItem3: TTBSeparatorItem + end + object TBSubmenuItem1: TTBSubmenuItem + Caption = '&Tools' + Options = [tboDropdownArrow] + object TConvertMenu: TTBItem + Caption = '&Convert TMainMenu/TPopupMenu...' + OnClick = TConvertMenuClick + end + end + end + end +end diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.hpp b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.hpp new file mode 100644 index 0000000..bcf2cfd --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.hpp @@ -0,0 +1,189 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Tb2dsgnitemeditor.pas' rev: 20.00 + +#ifndef Tb2dsgnitemeditorHPP +#define Tb2dsgnitemeditorHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Tb2dsgnitemeditor +{ +//-- type declarations ------------------------------------------------------- +class DELPHICLASS TTBItemEditForm; +class PASCALIMPLEMENTATION TTBItemEditForm : public Designwindows::TDesignWindow +{ + typedef Designwindows::TDesignWindow inherited; + +__published: + Comctrls::TTreeView* TreeView; + Comctrls::TListView* ListView; + Extctrls::TSplitter* Splitter1; + Tb2toolbar::TTBToolbar* Toolbar; + Tb2item::TTBItem* NewSubmenuButton; + Tb2item::TTBItem* NewItemButton; + Tb2item::TTBItem* NewSepButton; + Tb2item::TTBItem* DeleteButton; + Tb2item::TTBSeparatorItem* TBSeparatorItem1; + Tb2item::TTBPopupMenu* TBPopupMenu1; + Tb2item::TTBItemContainer* TBItemContainer1; + Tb2item::TTBSubmenuItem* ToolbarItems; + Tb2item::TTBItem* CopyButton; + Tb2item::TTBItem* CutButton; + Tb2item::TTBItem* PasteButton; + Tb2item::TTBSubmenuItem* MoreMenu; + Tb2item::TTBSeparatorItem* TBSeparatorItem2; + Tb2item::TTBSubmenuItem* TBSubmenuItem1; + Tb2item::TTBItem* TConvertMenu; + Tb2item::TTBSeparatorItem* TBSeparatorItem3; + Tb2item::TTBItem* MoveUpButton; + Tb2item::TTBItem* MoveDownButton; + void __fastcall FormClose(System::TObject* Sender, Forms::TCloseAction &Action); + void __fastcall TreeViewChange(System::TObject* Sender, Comctrls::TTreeNode* Node); + void __fastcall NewSubmenuButtonClick(System::TObject* Sender); + void __fastcall NewItemButtonClick(System::TObject* Sender); + void __fastcall ListViewChange(System::TObject* Sender, Comctrls::TListItem* Item, Comctrls::TItemChange Change); + void __fastcall DeleteButtonClick(System::TObject* Sender); + void __fastcall NewSepButtonClick(System::TObject* Sender); + void __fastcall ListViewDragOver(System::TObject* Sender, System::TObject* Source, int X, int Y, Controls::TDragState State, bool &Accept); + void __fastcall ListViewDragDrop(System::TObject* Sender, System::TObject* Source, int X, int Y); + void __fastcall TreeViewEnter(System::TObject* Sender); + void __fastcall TreeViewDragDrop(System::TObject* Sender, System::TObject* Source, int X, int Y); + void __fastcall TreeViewDragOver(System::TObject* Sender, System::TObject* Source, int X, int Y, Controls::TDragState State, bool &Accept); + void __fastcall CopyButtonClick(System::TObject* Sender); + void __fastcall ListViewKeyDown(System::TObject* Sender, System::Word &Key, Classes::TShiftState Shift); + void __fastcall CutButtonClick(System::TObject* Sender); + void __fastcall PasteButtonClick(System::TObject* Sender); + void __fastcall FormActivate(System::TObject* Sender); + void __fastcall ListViewKeyPress(System::TObject* Sender, System::WideChar &Key); + void __fastcall ListViewDblClick(System::TObject* Sender); + void __fastcall ListViewEnter(System::TObject* Sender); + void __fastcall TreeViewKeyDown(System::TObject* Sender, System::Word &Key, Classes::TShiftState Shift); + void __fastcall TConvertMenuClick(System::TObject* Sender); + void __fastcall TreeViewKeyPress(System::TObject* Sender, System::WideChar &Key); + void __fastcall MoveUpButtonClick(System::TObject* Sender); + void __fastcall MoveDownButtonClick(System::TObject* Sender); + +private: + Classes::TComponent* FParentComponent; + Tb2item::TTBCustomItem* FRootItem; + Tb2item::TTBCustomItem* FSelParentItem; + Classes::TList* FNotifyItemList; + int FSettingSel; + int FRebuildingTree; + int FRebuildingList; + Comctrls::TListItem* __fastcall AddListViewItem(const int Index, const Tb2item::TTBCustomItem* Item); + MESSAGE void __fastcall CMDeferUpdate(Messages::TMessage &Message); + void __fastcall Copy(void); + void __fastcall CreateNewItem(const Tb2item::TTBCustomItemClass AClass); + void __fastcall Cut(void); + void __fastcall Delete(void); + void __fastcall DeleteItem(const Tb2item::TTBCustomItem* Item); + System::UnicodeString __fastcall GetItemTreeCaption(Tb2item::TTBCustomItem* AItem); + void __fastcall GetSelItemList(const Classes::TList* AList); + void __fastcall ItemNotification(Tb2item::TTBCustomItem* Ancestor, bool Relayed, Tb2item::TTBItemChangedAction Action, int Index, Tb2item::TTBCustomItem* Item); + void __fastcall MoreItemClick(System::TObject* Sender); + void __fastcall MoveItem(int CurIndex, int NewIndex); + void __fastcall Paste(void); + void __fastcall RebuildList(void); + void __fastcall RebuildTree(void); + void __fastcall SelectInObjectInspector(Classes::TList* AList); + void __fastcall SetSelParentItem(Tb2item::TTBCustomItem* ASelParentItem); + bool __fastcall TreeViewDragHandler(System::TObject* Sender, System::TObject* Source, int X, int Y, bool Drop); + void __fastcall UnregisterAllNotifications(void); + +protected: + virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); + virtual System::UnicodeString __fastcall UniqueName(Classes::TComponent* Component); + +public: + __fastcall virtual TTBItemEditForm(Classes::TComponent* AOwner); + __fastcall virtual ~TTBItemEditForm(void); + virtual bool __fastcall EditAction(Designintf::TEditAction Action); + virtual Designintf::TEditState __fastcall GetEditState(void); +public: + /* TCustomForm.CreateNew */ inline __fastcall virtual TTBItemEditForm(Classes::TComponent* AOwner, int Dummy) : Designwindows::TDesignWindow(AOwner, Dummy) { } + +public: + /* TWinControl.CreateParented */ inline __fastcall TTBItemEditForm(HWND ParentWindow) : Designwindows::TDesignWindow(ParentWindow) { } + +}; + + +class DELPHICLASS TTBItemsEditor; +class PASCALIMPLEMENTATION TTBItemsEditor : public Designeditors::TDefaultEditor +{ + typedef Designeditors::TDefaultEditor inherited; + +public: + virtual void __fastcall Edit(void); + virtual void __fastcall ExecuteVerb(int Index); + virtual System::UnicodeString __fastcall GetVerb(int Index); + virtual int __fastcall GetVerbCount(void); +public: + /* TComponentEditor.Create */ inline __fastcall virtual TTBItemsEditor(Classes::TComponent* AComponent, Designintf::_di_IDesigner ADesigner) : Designeditors::TDefaultEditor(AComponent, ADesigner) { } + +public: + /* TObject.Destroy */ inline __fastcall virtual ~TTBItemsEditor(void) { } + +}; + + +class DELPHICLASS TTBItemsPropertyEditor; +class PASCALIMPLEMENTATION TTBItemsPropertyEditor : public Designeditors::TStringProperty +{ + typedef Designeditors::TStringProperty inherited; + +public: + virtual void __fastcall Edit(void); + virtual Designintf::TPropertyAttributes __fastcall GetAttributes(void); + virtual System::UnicodeString __fastcall GetValue(); +public: + /* TPropertyEditor.Create */ inline __fastcall virtual TTBItemsPropertyEditor(const Designintf::_di_IDesigner ADesigner, int APropCount) : Designeditors::TStringProperty(ADesigner, APropCount) { } + /* TPropertyEditor.Destroy */ inline __fastcall virtual ~TTBItemsPropertyEditor(void) { } + +}; + + +//-- var, const, procedure --------------------------------------------------- +static const Word CM_DEFERUPDATE = 0x464; +extern PACKAGE void __fastcall TBRegisterItemClass(Tb2item::TTBCustomItemClass AClass, const System::UnicodeString ACaption, unsigned ResInstance); + +} /* namespace Tb2dsgnitemeditor */ +using namespace Tb2dsgnitemeditor; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // Tb2dsgnitemeditorHPP diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.pas new file mode 100644 index 0000000..a8b35fc --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.pas @@ -0,0 +1,1439 @@ +unit TB2DsgnItemEditor; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2DsgnItemEditor.pas,v 1.63 2008/09/25 18:49:31 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + {$IFDEF CLR} System.ComponentModel, {$ENDIF} + StdCtrls, ExtCtrls, Buttons, ComCtrls, ImgList, Menus, + TB2Item, TB2Toolbar, TB2Dock, + {$IFDEF JR_D6} + DesignIntf, DesignWindows, DesignEditors; + {$ELSE} + DsgnIntf, DsgnWnds, LibIntf; + {$ENDIF} + +const + CM_DEFERUPDATE = WM_USER + 100; + +type + TTBItemEditForm = class(TDesignWindow) + TreeView: TTreeView; + ListView: TListView; + Splitter1: TSplitter; + Toolbar: TTBToolbar; + NewSubmenuButton: TTBItem; + NewItemButton: TTBItem; + NewSepButton: TTBItem; + DeleteButton: TTBItem; + TBSeparatorItem1: TTBSeparatorItem; + TBPopupMenu1: TTBPopupMenu; + TBItemContainer1: TTBItemContainer; + ToolbarItems: TTBSubmenuItem; + CopyButton: TTBItem; + CutButton: TTBItem; + PasteButton: TTBItem; + MoreMenu: TTBSubmenuItem; + TBSeparatorItem2: TTBSeparatorItem; + TBSubmenuItem1: TTBSubmenuItem; + TConvertMenu: TTBItem; + TBSeparatorItem3: TTBSeparatorItem; + MoveUpButton: TTBItem; + MoveDownButton: TTBItem; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure TreeViewChange(Sender: TObject; Node: TTreeNode); + procedure NewSubmenuButtonClick(Sender: TObject); + procedure NewItemButtonClick(Sender: TObject); + procedure ListViewChange(Sender: TObject; Item: TListItem; + Change: TItemChange); + procedure DeleteButtonClick(Sender: TObject); + procedure NewSepButtonClick(Sender: TObject); + procedure ListViewDragOver(Sender, Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); + procedure ListViewDragDrop(Sender, Source: TObject; X, Y: Integer); + procedure TreeViewEnter(Sender: TObject); + procedure TreeViewDragDrop(Sender, Source: TObject; X, Y: Integer); + procedure TreeViewDragOver(Sender, Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); + procedure CopyButtonClick(Sender: TObject); + procedure ListViewKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure CutButtonClick(Sender: TObject); + procedure PasteButtonClick(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure ListViewKeyPress(Sender: TObject; var Key: Char); + procedure ListViewDblClick(Sender: TObject); + procedure ListViewEnter(Sender: TObject); + procedure TreeViewKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure TConvertMenuClick(Sender: TObject); + procedure TreeViewKeyPress(Sender: TObject; var Key: Char); + procedure MoveUpButtonClick(Sender: TObject); + procedure MoveDownButtonClick(Sender: TObject); + private + FParentComponent: TComponent; + FRootItem, FSelParentItem: TTBCustomItem; + FNotifyItemList: TList; + FSettingSel, FRebuildingTree, FRebuildingList: Integer; + function AddListViewItem(const Index: Integer; + const Item: TTBCustomItem): TListItem; + procedure CMDeferUpdate(var Message: TMessage); message CM_DEFERUPDATE; + procedure Copy; + procedure CreateNewItem(const AClass: TTBCustomItemClass); + procedure Cut; + procedure Delete; + procedure DeleteItem(const Item: TTBCustomItem); + function GetItemTreeCaption(AItem: TTBCustomItem): String; + procedure GetSelItemList(const AList: TList); + procedure ItemNotification(Ancestor: TTBCustomItem; Relayed: Boolean; + Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); + procedure MoreItemClick(Sender: TObject); + procedure MoveItem(CurIndex, NewIndex: Integer); + procedure Paste; + procedure RebuildList; + procedure RebuildTree; + procedure SelectInObjectInspector(AList: TList); + procedure SetSelParentItem(ASelParentItem: TTBCustomItem); + function TreeViewDragHandler(Sender, Source: TObject; X, Y: Integer; + Drop: Boolean): Boolean; + procedure UnregisterAllNotifications; + protected + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + function UniqueName(Component: TComponent): String; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + {$IFDEF JR_D6} + function EditAction(Action: TEditAction): Boolean; override; + {$ELSE} + procedure EditAction(Action: TEditAction); override; + {$ENDIF} + function GetEditState: TEditState; override; + end; + + TTBItemsEditor = class(TDefaultEditor) + public + procedure Edit; override; + procedure ExecuteVerb(Index: Integer); override; + function GetVerb(Index: Integer): String; override; + function GetVerbCount: Integer; override; + end; + + TTBItemsPropertyEditor = class(TStringProperty) + public + procedure Edit; override; + function GetAttributes: TPropertyAttributes; override; + function GetValue: String; override; + end; + +procedure TBRegisterItemClass(AClass: TTBCustomItemClass; + const ACaption: String; ResInstance: HINST); + +implementation + +{$R *.DFM} + +uses + {$IFDEF CLR} System.Drawing, System.IO, System.Reflection, {$ENDIF} + TypInfo, CommCtrl, TB2Version, TB2Common, TB2DsgnConverter; + +type +{$IFNDEF JR_D5} + TDesignerSelectionList = TComponentList; +{$ENDIF} +{$IFDEF JR_D6} + TDesignerSelectionList = IDesignerSelections; +{$ENDIF} + + TItemClassInfo = class + ItemClass: TTBCustomItemClass; + Caption: String; + ImageIndex: Integer; + end; + +var + ItemClasses: TList; + ItemImageList: TImageList; + +{$IFNDEF JR_D6} +function CreateSelectionList: TDesignerSelectionList; +begin + Result := TDesignerSelectionList.Create; +end; +{$ENDIF} + +procedure FreeItemClasses; +var + I: Integer; + IC: TList; +begin + if ItemClasses = nil then Exit; + IC := ItemClasses; + ItemClasses := nil; + for I := IC.Count-1 downto 0 do + TItemClassInfo(IC[I]).Free; + IC.Free; +end; + +{ Note: AFAIK, there is no need for a similar function on .NET since assemblies + can't be unloaded. When a design-time package is uninstalled, it remains + loaded until the IDE is restarted. } +{$IFNDEF CLR} +procedure UnregisterModuleItemClasses(AModule: {$IFDEF JR_D5} LongWord {$ELSE} Integer {$ENDIF}); +var + I: Integer; + Info: TItemClassInfo; +begin + I := 0; + while I < ItemClasses.Count do begin + Info := TItemClassInfo(ItemClasses[I]); + if FindClassHInstance(Info.ItemClass) = AModule then begin + ItemClasses.Delete(I); + Info.Free; + end + else + Inc(I); + end; + { Note: TTBItemEditForm also holds references to item classes, but since + Delphi automatically closes all editor forms before compiling/removing + a package, we don't need to remove them. } +end; +{$ENDIF} + +{$IFNDEF CLR} +function LoadItemImage(Instance: HINST; const ResName: String): Integer; +var + Bmp: TBitmap; +begin + Bmp := TBitmap.Create; + try + Bmp.Handle := LoadBitmap(Instance, {$IFNDEF CLR}PChar{$ENDIF}(ResName)); + if Bmp.Handle = 0 then + Result := -1 + else + Result := ItemImageList.AddMasked(Bmp, Bmp.Canvas.Pixels[0, Bmp.Height-1]); + finally + Bmp.Free; + end; +end; +{$ELSE} +function LoadItemImage(const AAssembly: System.Reflection.Assembly; + const ResName: String): Integer; +var + Bmp: TBitmap; + ResStream: System.IO.Stream; + ResBmp: System.Drawing.Bitmap; +begin + Bmp := TBitmap.Create; + try + ResStream := AAssembly.GetManifestResourceStream(ResName); + if ResStream = nil then begin + Result := -1; + Exit; + end; + try + ResBmp := System.Drawing.Bitmap.Create(ResStream); + try + Bmp.LoadFromBitmap(ResBmp); + finally + ResBmp.Dispose; + end; + finally + ResStream.Close; + end; + Result := ItemImageList.AddMasked(Bmp, Bmp.Canvas.Pixels[0, Bmp.Height-1]); + finally + Bmp.Free; + end; +end; +{$ENDIF} + +procedure TBRegisterItemClass(AClass: TTBCustomItemClass; + const ACaption: String; ResInstance: HINST); +var + I: Integer; + Info: TItemClassInfo; +begin + { Hack for Delphi.NET 2006 bug: + If you start Delphi, open & rebuild the tb2k_dn10 package only, then open + the Demo project, the IDE calls the Register procedure on tb2kdsgn_d10 a + second time, without reloading either of the two packages. As a result, + the TBRegisterItemClass calls are repeated. To avoid doubled items on the + editor form's More menu, check if the class was already registered. } + for I := 0 to ItemClasses.Count-1 do + if TItemClassInfo(ItemClasses[I]).ItemClass = AClass then + Exit; + Info := TItemClassInfo.Create; + Info.ItemClass := AClass; + Info.Caption := ACaption; + {$IFNDEF CLR} + Info.ImageIndex := LoadItemImage(ResInstance, + Uppercase(AClass.ClassName {$IFDEF JR_D9} , loInvariantLocale {$ENDIF})); + {$ELSE} + Info.ImageIndex := LoadItemImage(Assembly.GetCallingAssembly, + AClass.ClassName + '.bmp'); + {$ENDIF} + ItemClasses.Add(Info); +end; + +function GetItemClassImage(AClass: TTBCustomItemClass): Integer; +var + I: Integer; + Info: TItemClassInfo; +begin + for I := ItemClasses.Count-1 downto 0 do begin + Info := TItemClassInfo(ItemClasses[I]); + if AClass.InheritsFrom(Info.ItemClass) then begin + Result := Info.ImageIndex; + if Result >= 0 then + Exit; + end; + end; + if AClass.InheritsFrom(TTBSubmenuItem) then + Result := 1 + else if AClass.InheritsFrom(TTBSeparatorItem) then + Result := 2 + else + Result := 0; +end; + +procedure ShowEditForm(AParentComponent: TComponent; ARootItem: TTBCustomItem; + const ADesigner: {$IFDEF JR_D6} IDesigner {$ELSE} IFormDesigner {$ENDIF}); +var + I: Integer; + Form: TCustomForm; + EditForm: TTBItemEditForm; +begin + if Assigned(ARootItem.LinkSubitems) then begin + case MessageDlg(Format('The LinkSubitems property is set to ''%s''. ' + + 'Would you like to edit that item instead?', + [ARootItem.LinkSubitems.Name]), mtConfirmation, [mbYes, mbNo, mbCancel], 0) of + mrYes: begin + AParentComponent := ARootItem.LinkSubitems; + ARootItem := ARootItem.LinkSubitems; + end; + mrCancel: Exit; + end; + end; + for I := 0 to Screen.FormCount-1 do begin + Form := Screen.Forms[I]; + if Form is TTBItemEditForm then + if TTBItemEditForm(Form).FRootItem = ARootItem then begin + Form.Show; + if Form.WindowState = wsMinimized then + Form.WindowState := wsNormal; + Exit; + end; + end; + EditForm := TTBItemEditForm.Create(Application); + try + EditForm.Designer := ADesigner; + EditForm.FParentComponent := AParentComponent; + AParentComponent.FreeNotification(EditForm); + EditForm.FRootItem := ARootItem; + ARootItem.FreeNotification(EditForm); + EditForm.FSelParentItem := ARootItem; + EditForm.Caption := 'Editing ' + AParentComponent.Name; + EditForm.RebuildTree; + EditForm.RebuildList; + {$IFDEF JR_D9} + EditForm.PopupMode := pmExplicit; + {$ENDIF} + EditForm.Show; + except + EditForm.Free; + raise; + end; +end; + +function IsSubmenuItem(Item: TTBCustomItem): Boolean; +begin + Result := tbisSubitemsEditable in Item.GetItemStyle; +end; + +procedure ShowVersion; +const + AboutText = + '%s'#13#10 + + 'Copyright (C) 1998-2008 by Jordan Russell'#13#10 + + 'For conditions of distribution and use, see LICENSE.TXT.'#13#10 + + #13#10 + + 'Visit my web site for the latest versions of Toolbar2000:'#13#10 + + 'http://www.jrsoftware.org/'; +begin + MessageDlg(Format(AboutText, [Toolbar2000VersionPropText]), mtInformation, + [mbOK], 0); +end; + + +{ TTBItemEditForm } + +constructor TTBItemEditForm.Create(AOwner: TComponent); +var + I: Integer; + Info: TItemClassInfo; + Item: TTBItem; +begin + inherited; + FNotifyItemList := TList.Create; + ToolbarItems.SubMenuImages := ItemImageList; + ListView.SmallImages := ItemImageList; + { Populate the 'More' menu } + for I := 0 to ItemClasses.Count-1 do begin + Info := TItemClassInfo(ItemClasses[I]); + Item := TTBItem.Create(Self); + Item.Caption := Info.Caption; + Item.ImageIndex := GetItemClassImage(Info.ItemClass); + Item.Tag := {$IFNDEF CLR}Integer{$ELSE}TTag{$ENDIF}(Info.ItemClass); + Item.OnClick := MoreItemClick; + MoreMenu.Add(Item); + end; +end; + +destructor TTBItemEditForm.Destroy; +begin + inherited; + if Assigned(FNotifyItemList) then begin + UnregisterAllNotifications; + FNotifyItemList.Free; + FNotifyItemList := nil; + end; +end; + +procedure TTBItemEditForm.FormClose(Sender: TObject; + var Action: TCloseAction); +begin + Action := caFree; +end; + +procedure TTBItemEditForm.FormActivate(Sender: TObject); +begin + SetSelParentItem(FSelParentItem); +end; + +procedure TTBItemEditForm.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and + ((AComponent = FParentComponent) or (AComponent = FRootItem)) then + { Must use Free instead of Close, since Close causes the freeing of the + form to be delayed until the next message. We have to destroy the form + immediately, otherwise Delphi will crash when Compile is clicked on the + TB2k package. } + Free; + {}{temp:} + (*if (Operation = opRemove) and (FNotifyItemList.IndexOf(AComponent) <> -1) then begin + outputdebugstring(pchar('Still in list: ' + AComponent.name)); + //beep; + end;*) +end; + +function TTBItemEditForm.UniqueName(Component: TComponent): String; +begin + Result := Designer.UniqueName(Component.ClassName); +end; + +function TTBItemEditForm.GetEditState: TEditState; +begin + Result := []; + if ActiveControl = ListView then begin + if Assigned(ListView.Selected) then + Result := [esCanDelete, esCanCut, esCanCopy]; + if ClipboardComponents then + Include(Result, esCanPaste); + end; +end; + +{$IFDEF JR_D6} +function TTBItemEditForm.EditAction(Action: TEditAction): Boolean; +{$ELSE} +procedure TTBItemEditForm.EditAction(Action: TEditAction); +{$ENDIF} +begin + {$IFDEF JR_D6} + Result := True; + {$ENDIF} + case Action of + eaCut: Cut; + eaCopy: Copy; + eaPaste: Paste; + eaDelete: Delete; + {$IFDEF JR_D6} + else + Result := False; + {$ENDIF} + end; +end; + +procedure TTBItemEditForm.UnregisterAllNotifications; +var + I: Integer; +begin + for I := FNotifyItemList.Count-1 downto 0 do begin + //outputdebugstring(pchar('Unregall: ' + TTBCustomItem(FNotifyItemList[I]).name)); + TTBCustomItem(FNotifyItemList[I]).UnregisterNotification(ItemNotification); + FNotifyItemList.Delete(I); + end; +end; + +procedure TTBItemEditForm.ItemNotification(Ancestor: TTBCustomItem; + Relayed: Boolean; Action: TTBItemChangedAction; Index: Integer; + Item: TTBCustomItem); +var + ListItem: TListItem; + TreeNode: TTreeNode; + I: Integer; + C: String; +begin + { Manipulate the list view when items are inserted, deleted, or their Caption + changes } + case Action of + tbicInserted: + begin + if (Ancestor = FSelParentItem) and not Relayed then + AddListViewItem(Index, Item); + if IsSubmenuItem(Item) then + RebuildTree; + end; + tbicDeleting: + if (Ancestor = FSelParentItem) and not Relayed then begin + ListItem := ListView.FindData(0, Item, True, False); + if Assigned(ListItem) then + ListItem.Delete; + end; + tbicInvalidateAndResize: + if (Ancestor = FSelParentItem) and not Relayed then begin + ListItem := ListView.FindData(0, Item, True, False); + if Assigned(ListItem) and (ListItem.Caption <> TTBCustomItem(Item).Caption) then + ListItem.Caption := TTBCustomItem(Item).Caption; + end; + end; + { Update tree view when an item is deleted, or a Caption changes } + if Action = tbicDeleting then begin + I := FNotifyItemList.IndexOf(Item); + if I <> -1 then begin + //outputdebugstring(pchar('Deleting, so unreging: ' + item.name)); + TTBCustomItem(Item).UnregisterNotification(ItemNotification); + FNotifyItemList.Delete(I); + end; + end; + if Action in [tbicDeleting, tbicInvalidateAndResize, tbicNameChanged] then begin + TreeNode := TreeView.Items.GetFirstNode; + while Assigned(TreeNode) do begin + if TreeNode.Data = Item then begin + if Action = tbicDeleting then begin + TreeNode.Delete; + if FSelParentItem = Item then + SetSelParentItem(TTBCustomItem(Item).Parent); + end + else begin + { tbicInvalidateAndResize, tbicNameChanged: } + C := GetItemTreeCaption(Item); + if TreeNode.Text <> C then + TreeNode.Text := C; + end; + Break; + end; + TreeNode := TreeNode.GetNext; + end; + end; +end; + +function TTBItemEditForm.GetItemTreeCaption(AItem: TTBCustomItem): String; +begin + if AItem <> FRootItem then begin + Result := AItem.Caption; + if Result = '' then + Result := '[' + AItem.Name + ']'; + end + else + Result := '(Root)'; +end; + +procedure TTBItemEditForm.RebuildTree; + + procedure Recurse(const AParentItem: TTBCustomItem; const ATreeNode: TTreeNode; + var FoundSelParentItem: TTreeNode); + var + I: Integer; + NewNode: TTreeNode; + ChildItem: TTBCustomItem; + begin + {}AParentItem.FreeNotification(Self); + AParentItem.RegisterNotification(ItemNotification); + FNotifyItemList.Add(AParentItem); + NewNode := TreeView.Items.AddChild(ATreeNode, GetItemTreeCaption(AParentItem)); + NewNode.Data := AParentItem; + if AParentItem = FSelParentItem then + FoundSelParentItem := NewNode; + for I := 0 to AParentItem.Count-1 do begin + ChildItem := AParentItem[I]; + if IsSubmenuItem(ChildItem) then + Recurse(ChildItem, NewNode, FoundSelParentItem); + end; + end; + +var + FoundSelParentItem: TTreeNode; +begin + Inc(FRebuildingTree); + try + TreeView.Items.BeginUpdate; + try + TreeView.Items.Clear; + UnregisterAllNotifications; + FoundSelParentItem := nil; + Recurse(FRootItem, nil, FoundSelParentItem); + if FoundSelParentItem = nil then + SetSelParentItem(FRootItem) + else + TreeView.Selected := FoundSelParentItem; + TreeView.Items[0].Expand(True); + finally + TreeView.Items.EndUpdate; + end; + finally + Dec(FRebuildingTree); + end; +end; + +function TTBItemEditForm.AddListViewItem(const Index: Integer; + const Item: TTBCustomItem): TListItem; +begin + Result := ListView.Items.Insert(Index); + Result.Data := Item; + if not(Item is TTBControlItem) then begin + Result.Caption := Item.Caption; + Result.Subitems.Add(Item.ClassName); + Result.ImageIndex := GetItemClassImage(TTBCustomItemClass(Item.ClassType)); + end + else begin + Result.Caption := '(Control)'; + Result.Subitems.Add(Item.ClassName); + Result.ImageIndex := -1; + end; +end; + +procedure TTBItemEditForm.RebuildList; +var + ChildItem: TTBCustomItem; + I: Integer; +begin + Inc(FRebuildingList); + try + ListView.Items.BeginUpdate; + try + ListView.Items.Clear; + if Assigned(FSelParentItem) then begin + for I := 0 to FSelParentItem.Count-1 do begin + ChildItem := FSelParentItem[I]; + { Check for csDestroying because deleting an item in the tree view + causes the parent item to be selected, and the parent item won't + get a notification that the item is deleting since notifications + were already sent } + if not(csDestroying in ChildItem.ComponentState) then + AddListViewItem(I, ChildItem); + end; + { Add an empty item to the end } + ListView.Items.Add.ImageIndex := -1; + end; + finally + ListView.Items.EndUpdate; + end; + { Work around a strange TListView bug(?). Without this, the column header + isn't painted properly. } + if HandleAllocated then + SetWindowPos(ListView.Handle, 0, 0, 0, 0, 0, SWP_FRAMECHANGED or + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER); + finally + Dec(FRebuildingList); + end; +end; + +procedure TTBItemEditForm.SelectInObjectInspector(AList: TList); +var + CompList1, CompList2: TDesignerSelectionList; + I: Integer; + C: TComponent; +begin + { Designer.SetSelections will make components appear selected on the form. + It will also select the component in Object Inspector, but only if the + form has the focus. TDesignWindow.SetSelection will select the component + in Object Inspector regardless of whether the form has the focus. } + CompList1 := CreateSelectionList; + CompList2 := CreateSelectionList; + for I := 0 to AList.Count-1 do begin + C := TComponent(AList[I]); + { Must check for csDestroying. If SetSelection is passed a component that's + destroying, Delphi will crash. } + if not(csDestroying in C.ComponentState) then begin + CompList1.Add(C); + CompList2.Add(C); + end; + end; + if CompList1.Count = 0 then begin + {$IFNDEF JR_D6} + CompList1.Free; + CompList2.Free; + {$ENDIF} + end + else begin + Designer.SetSelections(CompList1); + { Note: Never pass an empty list to SetSelection or Delphi will crash } + { History here: + - 1.34: SetSelection call remarked out because it fixed Delphi 6 issue + with random AV's after the editor was closed. + - 1.38: SetSelection call restored because without it, Ctrl+X/C/V didn't + work. + - 1.40: SetSelection call disabled on Delphi 6 only because AV problem + still seems to exist despite another change which I thought fixed it. + On D6 it isn't necessary to call SetSelection for Ctrl+X/C/V to work. + Note: Using "ComponentDesigner.SetSelection(Designer, nil, CompList2);" + instead seems to fix the AV problem, but for consistency with Delphi's + TMainMenu editor (which only selects items when its parent form is + focused), I decided not to call SetSelection at all on D6. + } + {$IFNDEF JR_D6} + SetSelection(CompList2); + {$ENDIF} + end; +end; + +procedure TTBItemEditForm.GetSelItemList(const AList: TList); +var + ListItem: TListItem; +begin + ListItem := nil; + while True do begin + ListItem := ListView.GetNextItem(ListItem, sdAll, [isSelected]); + if ListItem = nil then + Break; + if Assigned(ListItem.Data) then + AList.Add(ListItem.Data); + end; +end; + +procedure TTBItemEditForm.SetSelParentItem(ASelParentItem: TTBCustomItem); +{ - Rebuilds the list view to match a new selection (ASelParentItem) in the + tree view + - Updates toolbar + - Selects selected item(s) into Object Inspector } +var + I: Integer; + TreeNode: TTreeNode; + ItemIsSelected: Boolean; + List: TList; +begin + if FSettingSel > 0 then + Exit; + List := TList.Create; + Inc(FSettingSel); + try + if FSelParentItem <> ASelParentItem then begin + FSelParentItem := ASelParentItem; + NewSubmenuButton.Enabled := Assigned(ASelParentItem); + NewItemButton.Enabled := Assigned(ASelParentItem); + NewSepButton.Enabled := Assigned(ASelParentItem); + for I := 0 to MoreMenu.Count-1 do + MoreMenu[I].Enabled := Assigned(ASelParentItem); + if not Assigned(TreeView.Selected) or (TreeView.Selected.Data <> FSelParentItem) then begin + if FSelParentItem = nil then + TreeView.Selected := nil + else begin + TreeNode := TreeView.Items.GetFirstNode; + while Assigned(TreeNode) do begin + if TreeNode.Data = FSelParentItem then begin + TreeView.Selected := TreeNode; + Break; + end; + TreeNode := TreeNode.GetNext; + end; + end; + end; + RebuildList; + end; + + ItemIsSelected := (ActiveControl = ListView) and Assigned(ListView.Selected) and + Assigned(ListView.Selected.Data); + if ItemIsSelected then + GetSelItemList(List); + + CutButton.Enabled := ItemIsSelected; + CopyButton.Enabled := ItemIsSelected; + PasteButton.Enabled := (ActiveControl = ListView); + DeleteButton.Enabled := ItemIsSelected or + ((ActiveControl = TreeView) and (FSelParentItem <> FRootItem)); + MoveUpButton.Enabled := ItemIsSelected and + (FSelParentItem.IndexOf(TTBCustomItem(List.First)) > 0); + MoveDownButton.Enabled := ItemIsSelected and + (FSelParentItem.IndexOf(TTBCustomItem(List.Last)) < FSelParentItem.Count-1); + + if ActiveControl = ListView then begin + if List.Count = 0 then + { No item was selected, or the blank item was selected. + Select the root item so it looks like no item was selected in + Object Inspector } + List.Add(FRootItem); + end + else if not Assigned(ASelParentItem) or (ASelParentItem = FRootItem) then + List.Add(FParentComponent) + else + List.Add(ASelParentItem); + SelectInObjectInspector(List); + finally + Dec(FSettingSel); + List.Free; + end; +end; + +procedure TTBItemEditForm.Cut; +begin + Copy; + Delete; +end; + +procedure TTBItemEditForm.Copy; +var + SelList: TList; + CompList: TDesignerSelectionList; + I: Integer; + Item: TTBCustomItem; +begin + if ListView.Selected = nil then Exit; + CompList := nil; + SelList := TList.Create; + try + GetSelItemList(SelList); + CompList := CreateSelectionList; + for I := 0 to SelList.Count-1 do begin + Item := TTBCustomItem(SelList[I]); + if Item is TTBControlItem then + raise EInvalidOperation.Create('Cannot cut or copy TTBControlItems'); + CompList.Add(Item); + end; + CopyComponents(FParentComponent.Owner, CompList); + finally + {$IFNDEF JR_D6} + CompList.Free; + {$ENDIF} + SelList.Free; + end; +end; + +procedure TTBItemEditForm.Paste; +var + CompList: TDesignerSelectionList; +begin + if FSelParentItem = nil then Exit; + CompList := CreateSelectionList; + try + PasteComponents(FParentComponent.Owner, FSelParentItem, CompList); + if CompList.Count <> 0 then + Designer.Modified; + finally + {$IFNDEF JR_D6} + CompList.Free; + {$ENDIF} + end; +end; + +procedure TTBItemEditForm.DeleteItem(const Item: TTBCustomItem); +begin + if csAncestor in Item.ComponentState then + raise EInvalidOperation.Create('Items introduced in an ancestor form cannot be deleted'); + //Designer.ValidateRename(Item, Item.Name, ''); + Item.Free; + Designer.Modified; +end; + +procedure TTBItemEditForm.Delete; +var + List: TList; + Item: TTBCustomItem; + ListItem: TListItem; +begin + List := TList.Create; + try + List.Add(FSelParentItem); + SelectInObjectInspector(List); + finally + List.Free; + end; + FSelParentItem.ViewBeginUpdate; + try + while Assigned(ListView.Selected) do begin + Item := TTBCustomItem(ListView.Selected.Data); + if Item = nil then + Break; + DeleteItem(Item); + end; + finally + FSelParentItem.ViewEndUpdate; + end; + { After deleting the items, select the item with the focus } + ListItem := ListView.GetNextItem(nil, sdAll, [isFocused]); + if Assigned(ListItem) then + ListItem.Selected := True; +end; + +procedure TTBItemEditForm.MoveItem(CurIndex, NewIndex: Integer); +var + WasFocused: Boolean; +begin + WasFocused := ListView.Items[CurIndex].Focused; + + FSelParentItem.Move(CurIndex, NewIndex); + Designer.Modified; + + if WasFocused then + ListView.Items[NewIndex].Focused := True; + ListView.Items[NewIndex].Selected := True; +end; + +procedure TTBItemEditForm.TreeViewChange(Sender: TObject; Node: TTreeNode); +var + NewSelectedParentItem: TTBCustomItem; +begin + if (FRebuildingTree > 0) or (FSettingSel > 0) then Exit; + if Node = nil then + NewSelectedParentItem := nil + else + NewSelectedParentItem := TTBCustomItem(Node.Data); + SetSelParentItem(NewSelectedParentItem); +end; + +procedure TTBItemEditForm.TreeViewEnter(Sender: TObject); +{ When the tree view gets the focus, act as if the currently selected item + was clicked. } +begin + ListView.Selected := nil; + SetSelParentItem(FSelParentItem); +end; + +procedure TTBItemEditForm.CMDeferUpdate(var Message: TMessage); +begin + SetSelParentItem(FSelParentItem); +end; + +procedure TTBItemEditForm.ListViewChange(Sender: TObject; Item: TListItem; + Change: TItemChange); +var + Msg: TMsg; +begin + if (FRebuildingList > 0) or (FSettingSel > 0) or (Change <> ctState) or + (csDestroying in ListView.ComponentState) then + Exit; + if not PeekMessage(Msg, Handle, CM_DEFERUPDATE, CM_DEFERUPDATE, + PM_NOREMOVE or PM_NOYIELD) then + PostMessage(Handle, CM_DEFERUPDATE, 0, 0); +end; + +procedure TTBItemEditForm.ListViewEnter(Sender: TObject); +begin + { When list view gets the focus, update the toolbar } + SetSelParentItem(FSelParentItem); +end; + +procedure TTBItemEditForm.ListViewDblClick(Sender: TObject); +var + SelItem: TTBCustomItem; + PropCount, I: Integer; + Props: {$IFNDEF CLR} PPropList {$ELSE} TPropList {$ENDIF}; + PropInfo: {$IFNDEF CLR} PPropInfo {$ELSE} TPropInfo {$ENDIF}; + MethodName: String; + Method: TMethod; +begin + SelItem := nil; + if Assigned(ListView.Selected) then + SelItem := TTBCustomItem(ListView.Selected.Data); + if SelItem = nil then Exit; + if IsSubmenuItem(SelItem) then begin + SetSelParentItem(SelItem); + Exit; + end; + {$IFNDEF CLR} + PropCount := GetPropList(SelItem.ClassInfo, [tkMethod], nil); + GetMem(Props, PropCount * SizeOf(PPropInfo)); + try + GetPropList(SelItem.ClassInfo, [tkMethod], Props); + {$ELSE} + Props := GetPropList(SelItem.ClassInfo, [tkMethod]); + PropCount := Length(Props); + {$ENDIF} + for I := PropCount-1 downto 0 do begin + PropInfo := Props[I]; + {$IFNDEF CLR} + if CompareText(String(PropInfo.Name), 'OnClick') = 0 then begin + {$ELSE} + if SameText(PropInfo.Name, 'OnClick', loInvariantLocale) then begin + {$ENDIF} + Method := GetMethodProp(SelItem, PropInfo); + MethodName := Designer.GetMethodName(Method); + if MethodName = '' then begin + MethodName := SelItem.Name + 'Click'; + Method := Designer.CreateMethod(MethodName, GetTypeData( + {$IFNDEF CLR} PropInfo.PropType^ {$ELSE} PropInfo.TypeInfo {$ENDIF})); + SetMethodProp(SelItem, PropInfo, Method); + Designer.Modified; + end; + if Designer.MethodExists(MethodName) then + Designer.ShowMethod(MethodName); + Break; + end; + end; + {$IFNDEF CLR} + finally + FreeMem(Props); + end; + {$ENDIF} +end; + +procedure TTBItemEditForm.ListViewKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + case Key of + VK_RETURN: begin + Key := 0; + ActivateInspector(#0); + end; + VK_INSERT: begin + Key := 0; + if ssCtrl in Shift then + NewSubmenuButtonClick(Sender) + else + NewItemButtonClick(Sender); + end; + VK_DELETE: begin + Key := 0; + Delete; + end; + end; +end; + +procedure TTBItemEditForm.TreeViewKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + case Key of + VK_RETURN: begin + Key := 0; + ActivateInspector(#0); + end; + VK_DELETE: begin + Key := 0; + DeleteButtonClick(Sender); + end; + end; +end; + +procedure TTBItemEditForm.TreeViewKeyPress(Sender: TObject; var Key: Char); +begin + if (Key >= #33) and (Key <= #126) then begin + ActivateInspector(Key); + Key := #0; + end + else if Key = #13 then + Key := #0; { suppress beep } +end; + +procedure TTBItemEditForm.ListViewKeyPress(Sender: TObject; var Key: Char); +begin + if Key = '-' then begin + NewSepButtonClick(Sender); + Key := #0; + end + else if (Key >= #33) and (Key <= #126) then begin + ActivateInspector(Key); + Key := #0; + end; +end; + +procedure TTBItemEditForm.ListViewDragOver(Sender, Source: TObject; X, + Y: Integer; State: TDragState; var Accept: Boolean); +{ List item dragged over the list view } +var + Item: TListItem; +begin + Accept := False; + if (Sender = ListView) and (Source = ListView) and (ListView.SelCount = 1) then begin + Item := ListView.GetItemAt(X, Y); + if Assigned(Item) and (Item <> ListView.Selected) then + Accept := True; + end; +end; + +procedure TTBItemEditForm.ListViewDragDrop(Sender, Source: TObject; X, + Y: Integer); +{ List item dropped onto another list item } +var + ListItem: TListItem; + Item: TTBCustomItem; + NewIndex: Integer; +begin + if (Sender = ListView) and (Source = ListView) and (ListView.SelCount = 1) then begin + ListItem := ListView.GetItemAt(X, Y); + if Assigned(ListItem) and (ListItem <> ListView.Selected) and Assigned(FSelParentItem) then begin + NewIndex := FSelParentItem.IndexOf(TTBCustomItem(ListItem.Data)); + if NewIndex <> -1 then begin + ListView.Items.BeginUpdate; + { For good performance and to prevent Object Inspector flicker, increment + FSettingSel to prevent calls to SetSelParentItem while moving items } + Inc(FSettingSel); + try + Item := TTBCustomItem(ListView.Selected.Data); + MoveItem(FSelParentItem.IndexOf(Item), NewIndex); + finally + Dec(FSettingSel); + ListView.Items.EndUpdate; + end; + { After decrementing FSettingSel, now call SetSelParentItem, to update + the toolbar buttons } + SetSelParentItem(FSelParentItem); + end; + end; + end; +end; + +function TTBItemEditForm.TreeViewDragHandler(Sender, Source: TObject; + X, Y: Integer; Drop: Boolean): Boolean; +var + Node: TTreeNode; + ListItem: TListItem; + Item, NewParentItem: TTBCustomItem; + ItemList: TList; + I: Integer; + NeedRebuildTree: Boolean; +begin + Result := False; + if (Sender = TreeView) and (Source = ListView) then begin + Node := TreeView.GetNodeAt(X, Y); + if Assigned(Node) and (Node <> TreeView.Selected) then begin + NewParentItem := TTBCustomItem(Node.Data); + ItemList := TList.Create; + try + ListItem := nil; + while True do begin + ListItem := ListView.GetNextItem(ListItem, sdAll, [isSelected]); + if ListItem = nil then + Break; + Item := TTBCustomItem(ListItem.Data); + if Assigned(Item) and (Item <> NewParentItem) and + not Item.ContainsItem(NewParentItem) and + not(Item is TTBControlItem) then begin + Result := True; + ItemList.Add(Item); + end; + end; + if Drop then begin + NeedRebuildTree := False; + for I := 0 to ItemList.Count-1 do begin + Item := TTBCustomItem(ItemList[I]); + Item.Parent.Remove(Item); + NewParentItem.Add(Item); + Designer.Modified; + if IsSubmenuItem(Item) then + NeedRebuildTree := True; + end; + if NeedRebuildTree then + RebuildTree; + end; + finally + ItemList.Free; + end; + end; + end; +end; + +procedure TTBItemEditForm.TreeViewDragOver(Sender, Source: TObject; X, + Y: Integer; State: TDragState; var Accept: Boolean); +{ List item dragged over the tree view } +begin + Accept := TreeViewDragHandler(Sender, Source, X, Y, False); +end; + +procedure TTBItemEditForm.TreeViewDragDrop(Sender, Source: TObject; X, + Y: Integer); +{ List item dropped onto the tree view } +begin + TreeViewDragHandler(Sender, Source, X, Y, True); +end; + +procedure TTBItemEditForm.CreateNewItem(const AClass: TTBCustomItemClass); +var + NewIndex: Integer; + NewItem: TTBCustomItem; + ListItem: TListItem; +begin + if FSelParentItem = nil then Exit; + NewIndex := -1; + if (GetKeyState(VK_SHIFT) >= 0) and Assigned(ListView.Selected) then + NewIndex := FSelParentItem.IndexOf(TTBCustomItem(ListView.Selected.Data)); + if NewIndex = -1 then + NewIndex := FSelParentItem.Count; + NewItem := AClass.Create(FParentComponent.Owner{Designer.Form}); + try + NewItem.Name := Designer.UniqueName(NewItem.ClassName); + FSelParentItem.Insert(NewIndex, NewItem); + except + NewItem.Free; + raise; + end; + Designer.Modified; + ListView.Selected := nil; + ListItem := ListView.FindData(0, NewItem, True, False); + if Assigned(ListItem) then begin + ListItem.Selected := True; + ListItem.Focused := True; + ListItem.MakeVisible(False); + ListView.SetFocus; + end; +end; + +procedure TTBItemEditForm.NewSubmenuButtonClick(Sender: TObject); +begin + CreateNewItem(TTBSubmenuItem); +end; + +procedure TTBItemEditForm.NewItemButtonClick(Sender: TObject); +begin + CreateNewItem(TTBItem); +end; + +procedure TTBItemEditForm.NewSepButtonClick(Sender: TObject); +begin + CreateNewItem(TTBSeparatorItem); +end; + +procedure TTBItemEditForm.MoreItemClick(Sender: TObject); +begin + CreateNewItem(TTBCustomItemClass((Sender as TTBItem).Tag)); +end; + +procedure TTBItemEditForm.CutButtonClick(Sender: TObject); +begin + Cut; +end; + +procedure TTBItemEditForm.CopyButtonClick(Sender: TObject); +begin + Copy; +end; + +procedure TTBItemEditForm.PasteButtonClick(Sender: TObject); +begin + Paste; +end; + +procedure TTBItemEditForm.DeleteButtonClick(Sender: TObject); +begin + if ActiveControl = ListView then + Delete + else if (ActiveControl = TreeView) and (FSelParentItem <> FRootItem) then + DeleteItem(FSelParentItem); +end; + +procedure TTBItemEditForm.MoveUpButtonClick(Sender: TObject); +var + SelList: TList; + I, J: Integer; + Item: TTBCustomItem; + ListItem: TListItem; +begin + if FSelParentItem = nil then Exit; + SelList := TList.Create; + try + GetSelItemList(SelList); + if SelList.Count = 0 then Exit; + + ListView.Items.BeginUpdate; + FSelParentItem.ViewBeginUpdate; + { For good performance and to prevent Object Inspector flicker, increment + FSettingSel to prevent calls to SetSelParentItem while moving items } + Inc(FSettingSel); + try + for I := 0 to SelList.Count-1 do begin + Item := TTBCustomItem(SelList[I]); + J := FSelParentItem.IndexOf(Item); + if J <> -1 then + MoveItem(J, J-1); + end; + ListItem := ListView.FindData(0, SelList[0], True, False); + if Assigned(ListItem) then + ListItem.MakeVisible(False); + finally + Dec(FSettingSel); + FSelParentItem.ViewEndUpdate; + ListView.Items.EndUpdate; + end; + { After decrementing FSettingSel, now call SetSelParentItem, to update + the toolbar buttons } + SetSelParentItem(FSelParentItem); + finally + SelList.Free; + end; +end; + +procedure TTBItemEditForm.MoveDownButtonClick(Sender: TObject); +var + SelList: TList; + I, J: Integer; + Item: TTBCustomItem; + ListItem: TListItem; +begin + if FSelParentItem = nil then Exit; + SelList := TList.Create; + try + GetSelItemList(SelList); + if SelList.Count = 0 then Exit; + + ListView.Items.BeginUpdate; + FSelParentItem.ViewBeginUpdate; + { For good performance and to prevent Object Inspector flicker, increment + FSettingSel to prevent calls to SetSelParentItem while moving items } + Inc(FSettingSel); + try + for I := SelList.Count-1 downto 0 do begin + Item := TTBCustomItem(SelList[I]); + J := FSelParentItem.IndexOf(Item); + if J <> -1 then + MoveItem(J, J+1); + end; + ListItem := ListView.FindData(0, SelList[SelList.Count-1], True, False); + if Assigned(ListItem) then + ListItem.MakeVisible(False); + finally + Dec(FSettingSel); + FSelParentItem.ViewEndUpdate; + ListView.Items.EndUpdate; + end; + { After decrementing FSettingSel, now call SetSelParentItem, to update + the toolbar buttons } + SetSelParentItem(FSelParentItem); + finally + SelList.Free; + end; +end; + +procedure TTBItemEditForm.TConvertMenuClick(Sender: TObject); +begin + if FSelParentItem = nil then Exit; + DoConvert(FSelParentItem, FParentComponent.Owner); +end; + + +{ TTBItemsEditor } + +procedure TTBItemsEditor.Edit; +var + Item: TTBCustomItem; +begin + if Assigned(Component) then begin + Item := TBGetItems(Component); + if Assigned(Item) then + ShowEditForm(Component, Item, Designer); + end; +end; + +procedure TTBItemsEditor.ExecuteVerb(Index: Integer); +begin + case Index of + 0: Edit; + 1: ShowVersion; + end; +end; + +function TTBItemsEditor.GetVerbCount: Integer; +begin + Result := 2; +end; + +function TTBItemsEditor.GetVerb(Index: Integer): String; +begin + case Index of + 0: Result := 'Edit...'; + 1: Result := 'Version...'; + else + Result := ''; + end; +end; + + +{ TTBItemsPropertyEditor } + +procedure TTBItemsPropertyEditor.Edit; +var + Editor: {$IFDEF JR_D6} IComponentEditor {$ELSE} TComponentEditor {$ENDIF}; +begin + if PropCount <> 1 then Exit; + Editor := GetComponentEditor(GetComponent(0) as TComponent, Designer); + try + Editor.Edit; + finally + {$IFNDEF JR_D6} + Editor.Free; + {$ENDIF} + end; +end; + +function TTBItemsPropertyEditor.GetAttributes: TPropertyAttributes; +begin + Result := inherited GetAttributes + [paDialog, paReadOnly]; +end; + +function TTBItemsPropertyEditor.GetValue: String; +begin + Result := '(TB2000 Items)'; +end; + +initialization + ItemImageList := TImageList.Create(nil); + {$IFNDEF CLR} + ItemImageList.Handle := ImageList_LoadImage(HInstance, 'TB2_DSGNEDITORIMAGES', + 16, 0, clFuchsia, IMAGE_BITMAP, 0); + {$ELSE} + { Initialize the image list as plain ILC_COLOR (4-bit), because on Windows + 2000, at color depths > 16 (what TImageList's ILC_COLORDDB would give us + when running on a true-color display), selected images are drawn with an + ugly dithering effect } + ItemImageList.Handle := ImageList_Create(16, 16, ILC_COLOR or ILC_MASK, 4, 4); + LoadItemImage(Assembly.GetExecutingAssembly, 'TB2DsgnEditorImages.bmp'); + {$ENDIF} + ItemClasses := TList.Create; + {$IFNDEF CLR} + AddModuleUnloadProc(UnregisterModuleItemClasses); + {$ENDIF} +finalization + {$IFNDEF CLR} + RemoveModuleUnloadProc(UnregisterModuleItemClasses); + {$ENDIF} + FreeItemClasses; + FreeAndNil(ItemImageList); +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.res b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.res new file mode 100644 index 0000000..938763e Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/TB2DsgnItemEditor.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2ExtItems.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2ExtItems.pas new file mode 100644 index 0000000..1442793 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2ExtItems.pas @@ -0,0 +1,990 @@ +unit TB2ExtItems; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2ExtItems.pas,v 1.68 2008/04/10 21:51:12 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, CommCtrl, Menus, ActnList, + TB2Item; + +type + TTBEditItemOption = (tboUseEditWhenVertical); + TTBEditItemOptions = set of TTBEditItemOption; + +const + EditItemDefaultEditOptions = []; + EditItemDefaultEditWidth = 64; + +type + TTBEditItem = class; + TTBEditItemViewer = class; + + TTBAcceptTextEvent = procedure(Sender: TObject; var NewText: String; + var Accept: Boolean) of object; + TTBBeginEditEvent = procedure(Sender: TTBEditItem; Viewer: TTBEditItemViewer; + EditControl: TEdit) of object; + + TTBEditAction = class(TAction) + private + FEditOptions: TTBEditItemOptions; + FEditCaption: String; + FEditWidth: Integer; + FOnAcceptText: TTBAcceptTextEvent; + FText: String; + procedure SetEditCaption(Value: String); + procedure SetEditOptions(Value: TTBEditItemOptions); + procedure SetEditWidth(Value: Integer); + procedure SetOnAcceptText(Value: TTBAcceptTextEvent); + procedure SetText(Value: String); + public + constructor Create(AOwner: TComponent); override; + published + property EditCaption: String read FEditCaption write SetEditCaption; + property EditOptions: TTBEditItemOptions read FEditOptions write SetEditOptions default EditItemDefaultEditOptions; + property EditWidth: Integer read FEditWidth write SetEditWidth default EditItemDefaultEditWidth; + property Text: String read FText write SetText; + + property OnAcceptText: TTBAcceptTextEvent read FOnAcceptText write SetOnAcceptText; + end; + + TTBEditItemActionLink = class(TTBCustomItemActionLink) + protected + procedure AssignClient(AClient: TObject); override; + function IsEditCaptionLinked: Boolean; virtual; + function IsEditOptionsLinked: Boolean; virtual; + function IsEditWidthLinked: Boolean; virtual; + function IsOnAcceptTextLinked: Boolean; virtual; + function IsTextLinked: Boolean; virtual; + procedure SetEditCaption(const Value: String); virtual; + procedure SetEditOptions(Value: TTBEditItemOptions); virtual; + procedure SetEditWidth(const Value: Integer); virtual; + procedure SetOnAcceptText(Value: TTBAcceptTextEvent); virtual; + procedure SetText(const Value: String); virtual; + end; + + TTBEditItem = class(TTBCustomItem) + private + FCharCase: TEditCharCase; + FEditCaption: String; + FEditOptions: TTBEditItemOptions; + FEditWidth: Integer; + FMaxLength: Integer; + FOnAcceptText: TTBAcceptTextEvent; + FOnBeginEdit: TTBBeginEditEvent; + FText: String; + function IsEditCaptionStored: Boolean; + function IsEditOptionsStored: Boolean; + function IsEditWidthStored: Boolean; + function IsTextStored: Boolean; + procedure SetCharCase(Value: TEditCharCase); + procedure SetEditCaption(Value: String); + procedure SetEditOptions(Value: TTBEditItemOptions); + procedure SetEditWidth(Value: Integer); + procedure SetMaxLength(Value: Integer); + procedure SetText(Value: String); + protected + procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; + procedure DoBeginEdit(Viewer: TTBEditItemViewer); virtual; + function GetActionLinkClass: TTBCustomItemActionLinkClass; override; + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + function NeedToRecreateViewer(AViewer: TTBItemViewer): Boolean; override; + public + constructor Create(AOwner: TComponent); override; + procedure Clear; + procedure Click; override; + published + property Action; + property AutoCheck; + property Caption; + property CharCase: TEditCharCase read FCharCase write SetCharCase default ecNormal; + property Checked; + property DisplayMode; + property EditCaption: String read FEditCaption write SetEditCaption stored IsEditCaptionStored; + property EditOptions: TTBEditItemOptions read FEditOptions write SetEditOptions stored IsEditOptionsStored; + property EditWidth: Integer read FEditWidth write SetEditWidth stored IsEditWidthStored; + property MaxLength: Integer read FMaxLength write SetMaxLength default 0; + property Enabled; + property GroupIndex; + property HelpContext; + property Hint; + property ImageIndex; + property InheritOptions; + property MaskOptions; + property Options; + property RadioItem; + property ShortCut; + property Text: String read FText write SetText stored IsTextStored; + property Visible; + + property OnAcceptText: TTBAcceptTextEvent read FOnAcceptText write FOnAcceptText; + property OnBeginEdit: TTBBeginEditEvent read FOnBeginEdit write FOnBeginEdit; + property OnClick; + property OnSelect; + end; + + TTBEditItemViewer = class(TTBItemViewer) + private + FEditControl: TEdit; + FEditControlStatus: set of (ecsContinueLoop, ecsAccept, ecsClose); + function EditLoop(const CapHandle: HWND): Boolean; + procedure EditWndProc(var Message: TMessage); + procedure MouseBeginEdit; + protected + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); + override; + function CaptionShown: Boolean; override; + function DoExecute: Boolean; override; + function GetAccRole: Integer; override; + function GetAccValue(var Value: WideString): Boolean; override; + function GetCaptionText: String; override; + procedure GetCursor(const Pt: TPoint; var ACursor: HCURSOR); override; + procedure GetEditRect(var R: TRect); virtual; + procedure MouseDown(Shift: TShiftState; X, Y: Integer; + var MouseDownOnMenu: Boolean); override; + procedure MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); override; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + function UsesSameWidth: Boolean; override; + public + property EditControl: TEdit read FEditControl; + end; + + { TTBVisibilityToggleItem } + + TTBVisibilityToggleItem = class(TTBCustomItem) + private + FControl: TControl; + procedure SetControl(Value: TControl); + procedure UpdateProps; + protected + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + procedure Click; override; + procedure InitiateAction; override; + published + property Caption; + property Control: TControl read FControl write SetControl; + property DisplayMode; + property Enabled; + property HelpContext; + property Hint; + property ImageIndex; + property Images; + property InheritOptions; + property MaskOptions; + property Options; + property ShortCut; + property Visible; + + property OnClick; + property OnSelect; + end; + + +implementation + +uses + TB2Common, TB2Consts; + +const + EditMenuTextMargin = 3; + EditMenuMidWidth = 4; + +type + TControlAccess = class(TControl); + TEditAccess = {$IFNDEF CLR} class(TEdit) {$ELSE} IControl {$ENDIF}; + + +{ TTBEditAction } + +constructor TTBEditAction.Create(AOwner: TComponent); +begin + inherited; + FEditOptions := EditItemDefaultEditOptions; + FEditWidth := EditItemDefaultEditWidth; + DisableIfNoHandler := False; +end; + +procedure TTBEditAction.SetEditCaption(Value: String); +var + I: Integer; +begin + if FEditCaption <> Value then begin + for I := 0 to FClients.Count - 1 do + if TBasicActionLink(FClients[I]) is TTBEditItemActionLink then + TTBEditItemActionLink(FClients[I]).SetEditCaption(Value); + FEditCaption := Value; + Change; + end; +end; + +procedure TTBEditAction.SetEditOptions(Value: TTBEditItemOptions); +var + I: Integer; +begin + if FEditOptions <> Value then begin + for I := 0 to FClients.Count - 1 do + if TBasicActionLink(FClients[I]) is TTBEditItemActionLink then + TTBEditItemActionLink(FClients[I]).SetEditOptions(Value); + FEditOptions := Value; + Change; + end; +end; + +procedure TTBEditAction.SetEditWidth(Value: Integer); +var + I: Integer; +begin + if FEditWidth <> Value then begin + for I := 0 to FClients.Count - 1 do + if TBasicActionLink(FClients[I]) is TTBEditItemActionLink then + TTBEditItemActionLink(FClients[I]).SetEditWidth(Value); + FEditWidth := Value; + Change; + end; +end; + +procedure TTBEditAction.SetOnAcceptText(Value: TTBAcceptTextEvent); +var + I: Integer; +begin + {$IFNDEF CLR} + if not MethodsEqual(TMethod(FOnAcceptText), TMethod(Value)) then begin + {$ELSE} + if @FOnAcceptText <> @Value then begin + {$ENDIF} + for I := 0 to FClients.Count - 1 do + if TBasicActionLink(FClients[I]) is TTBEditItemActionLink then + TTBEditItemActionLink(FClients[I]).SetOnAcceptText(Value); + FOnAcceptText := Value; + Change; + end; +end; + +procedure TTBEditAction.SetText(Value: String); +var + I: Integer; +begin + if FText <> Value then begin + for I := 0 to FClients.Count - 1 do + if TBasicActionLink(FClients[I]) is TTBEditItemActionLink then + TTBEditItemActionLink(FClients[I]).SetText(Value); + FText := Value; + Change; + end; +end; + + +{ TTBEditItemActionLink } + +procedure TTBEditItemActionLink.AssignClient(AClient: TObject); +begin + FClient := AClient as TTBEditItem; +end; + +function TTBEditItemActionLink.IsEditCaptionLinked: Boolean; +begin + if Action is TTBEditAction then + Result := TTBEditItem(FClient).EditCaption = TTBEditAction(Action).EditCaption + else + Result := False; +end; + +function TTBEditItemActionLink.IsEditOptionsLinked: Boolean; +begin + if Action is TTBEditAction then + Result := TTBEditItem(FClient).EditOptions = TTBEditAction(Action).EditOptions + else + Result := False; +end; + +function TTBEditItemActionLink.IsEditWidthLinked: Boolean; +begin + if Action is TTBEditAction then + Result := TTBEditItem(FClient).EditWidth = TTBEditAction(Action).EditWidth + else + Result := False; +end; + +function TTBEditItemActionLink.IsOnAcceptTextLinked: Boolean; +begin + if Action is TTBEditAction then + {$IFNDEF CLR} + Result := MethodsEqual(TMethod(TTBEditItem(FClient).OnAcceptText), + TMethod(TTBEditAction(Action).OnAcceptText)) + {$ELSE} + Result := @TTBEditItem(FClient).OnAcceptText = @TTBEditAction(Action).OnAcceptText + {$ENDIF} + else + Result := False; +end; + +function TTBEditItemActionLink.IsTextLinked: Boolean; +begin + if Action is TTBEditAction then + Result := TTBEditItem(FClient).Text = TTBEditAction(Action).Text + else + Result := False; +end; + +procedure TTBEditItemActionLink.SetEditCaption(const Value: String); +begin + if IsEditCaptionLinked then TTBEditItem(FClient).EditCaption := Value; +end; + +procedure TTBEditItemActionLink.SetEditOptions(Value: TTBEditItemOptions); +begin + if IsEditOptionsLinked then TTBEditItem(FClient).EditOptions := Value; +end; + +procedure TTBEditItemActionLink.SetEditWidth(const Value: Integer); +begin + if IsEditWidthLinked then TTBEditItem(FClient).EditWidth := Value; +end; + +procedure TTBEditItemActionLink.SetOnAcceptText(Value: TTBAcceptTextEvent); +begin + if IsOnAcceptTextLinked then TTBEditItem(FClient).OnAcceptText := Value; +end; + +procedure TTBEditItemActionLink.SetText(const Value: String); +begin + if IsTextLinked then TTBEditItem(FClient).Text := Value; +end; + + +{ TTBEditItem } + +constructor TTBEditItem.Create(AOwner: TComponent); +begin + inherited; + FEditOptions := EditItemDefaultEditOptions; + FEditWidth := EditItemDefaultEditWidth; +end; + +procedure TTBEditItem.ActionChange(Sender: TObject; CheckDefaults: Boolean); +begin + inherited; + if Action is TTBEditAction then + with TTBEditAction(Sender) do + begin + if not CheckDefaults or (Self.EditCaption = '') then + Self.EditCaption := EditCaption; + if not CheckDefaults or (Self.EditOptions = []) then + Self.EditOptions := EditOptions; + if not CheckDefaults or (Self.Text = '') then + Self.Text := Text; + if not CheckDefaults or not Assigned(Self.OnAcceptText) then + Self.OnAcceptText := OnAcceptText; + end; +end; + +function TTBEditItem.GetActionLinkClass: TTBCustomItemActionLinkClass; +begin + Result := TTBEditItemActionLink; +end; + +function TTBEditItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + if not(tboUseEditWhenVertical in EditOptions) and + (AView.Orientation = tbvoVertical) then + Result := inherited GetItemViewerClass(AView) + else + Result := TTBEditItemViewer; +end; + +function TTBEditItem.NeedToRecreateViewer(AViewer: TTBItemViewer): Boolean; +begin + Result := GetItemViewerClass(AViewer.View) <> AViewer.ClassType; +end; + +procedure TTBEditItem.Clear; +begin + Text := ''; +end; + +procedure TTBEditItem.Click; +begin + inherited; +end; + +procedure TTBEditItem.DoBeginEdit(Viewer: TTBEditItemViewer); +begin + if Assigned(FOnBeginEdit) then + FOnBeginEdit(Self, Viewer, Viewer.EditControl); +end; + +function TTBEditItem.IsEditOptionsStored: Boolean; +begin + Result := (EditOptions <> EditItemDefaultEditOptions) and + ((ActionLink = nil) or not(ActionLink is TTBEditItemActionLink) or + not TTBEditItemActionLink(ActionLink).IsEditOptionsLinked); +end; + +function TTBEditItem.IsEditCaptionStored: Boolean; +begin + Result := (ActionLink = nil) or not(ActionLink is TTBEditItemActionLink) or + not TTBEditItemActionLink(ActionLink).IsEditCaptionLinked; +end; + +function TTBEditItem.IsEditWidthStored: Boolean; +begin + Result := (EditWidth <> EditItemDefaultEditWidth) and + ((ActionLink = nil) or not(ActionLink is TTBEditItemActionLink) or + not TTBEditItemActionLink(ActionLink).IsEditWidthLinked); +end; + +function TTBEditItem.IsTextStored: Boolean; +begin + Result := (ActionLink = nil) or not(ActionLink is TTBEditItemActionLink) or + not TTBEditItemActionLink(ActionLink).IsTextLinked; +end; + +procedure TTBEditItem.SetCharCase(Value: TEditCharCase); +begin + if FCharCase <> Value then begin + FCharCase := Value; + Text := Text; { update case } + end; +end; + +procedure TTBEditItem.SetEditOptions(Value: TTBEditItemOptions); +begin + if FEditOptions <> Value then begin + FEditOptions := Value; + Change(True); + end; +end; + +procedure TTBEditItem.SetEditCaption(Value: String); +begin + if FEditCaption <> Value then begin + FEditCaption := Value; + Change(True); + end; +end; + +procedure TTBEditItem.SetEditWidth(Value: Integer); +begin + if FEditWidth <> Value then begin + FEditWidth := Value; + Change(True); + end; +end; + +procedure TTBEditItem.SetMaxLength(Value: Integer); +begin + if FMaxLength <> Value then begin + FMaxLength := Value; + Change(False); + end; +end; + +procedure TTBEditItem.SetText(Value: String); +begin + case FCharCase of + ecUpperCase: Value := {$IFNDEF CLR} AnsiUpperCase {$ELSE} UpperCase {$ENDIF} (Value); + ecLowerCase: Value := {$IFNDEF CLR} AnsiLowerCase {$ELSE} LowerCase {$ENDIF} (Value); + end; + if FText <> Value then begin + FText := Value; + Change(False); + end; +end; + + +{ TTBEditItemViewer } + +procedure TTBEditItemViewer.EditWndProc(var Message: TMessage); +var + Item: TTBEditItem; + + procedure AcceptText; + var + S: String; + Accept: Boolean; + begin + S := FEditControl.Text; + Accept := True; + if Assigned(Item.FOnAcceptText) then + Item.FOnAcceptText(Self, S, Accept); + if Accept then + Item.Text := S; + end; + +begin + Item := TTBEditItem(Self.Item); + if Message.Msg = WM_CHAR then + case Word(Message.WParam) of + VK_TAB: begin + FEditControlStatus := [ecsAccept]; + AcceptText; + Exit; + end; + VK_RETURN: begin + FEditControlStatus := [ecsAccept, ecsClose]; + AcceptText; + Exit; + end; + VK_ESCAPE: begin + FEditControlStatus := []; + Exit; + end; + end; + TEditAccess(FEditControl).WndProc(Message); + if Message.Msg = WM_KILLFOCUS then begin + { Someone has stolen the focus from us, so 'cancel mode'. (We have to + handle WM_KILLFOCUS in addition to the upstream WM_CANCELMODE handling + since we don't always hold the mouse capture.) } + View.CancelMode; + FEditControlStatus := [ecsClose]; + end; +end; + +procedure TTBEditItemViewer.GetEditRect(var R: TRect); +var + Item: TTBEditItem; + DC: HDC; +begin + Item := TTBEditItem(Self.Item); + DC := GetDC(0); + try + SelectObject(DC, View.GetFont.Handle); + R := BoundsRect; + if not View.IsToolbar and (Item.EditCaption <> '') then begin + Inc(R.Left, GetTextWidth(DC, Item.EditCaption, True) + + EditMenuMidWidth + EditMenuTextMargin * 2); + end; + finally + ReleaseDC(0, DC); + end; +end; + +procedure TTBEditItemViewer.CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); +var + Item: TTBEditItem; + DC: HDC; +begin + Item := TTBEditItem(Self.Item); + DC := Canvas.Handle; + AWidth := Item.FEditWidth; + AHeight := GetTextHeight(DC) + (EditMenuTextMargin * 2) + 1; + if not IsToolbarStyle and (Item.EditCaption <> '') then begin + Inc(AWidth, GetTextWidth(DC, Item.EditCaption, True) + EditMenuMidWidth + + EditMenuTextMargin * 2); + end; + { Review: Should the height include external leading on fonts that use it, + such as the default menu font on Windows Me Trad. Chinese? Office 2000 + seems to insist on using Tahoma on Chinese Windows, so I'm not sure how it + handles external leading on edit items. } +end; + +function TTBEditItemViewer.CaptionShown: Boolean; +begin + Result := not IsToolbarStyle and inherited CaptionShown; +end; + +function TTBEditItemViewer.GetCaptionText: String; +begin + Result := TTBEditItem(Item).EditCaption; +end; + +procedure TTBEditItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); +const + FillColors: array[Boolean] of TColor = (clBtnFace, clWindow); + TextColors: array[Boolean] of TColor = (clGrayText, clWindowText); +var + Item: TTBEditItem; + S: String; + R: TRect; + W: Integer; +begin + Item := TTBEditItem(Self.Item); + R := ClientAreaRect; + + { Caption } + if not IsToolbarStyle and (Item.EditCaption <> '') then begin + S := Item.EditCaption; + W := GetTextWidth(Canvas.Handle, S, True) + EditMenuTextMargin * 2; + R.Right := R.Left + W; + if IsSelected then + Canvas.FillRect(R); + Inc(R.Left, EditMenuTextMargin); + DrawItemCaption(Canvas, R, S, UseDisabledShadow, DT_SINGLELINE or + DT_LEFT or DT_VCENTER); + R := ClientAreaRect; + Inc(R.Left, W + EditMenuMidWidth); + end; + + { Border } + if IsSelected and Item.Enabled then + DrawEdge(Canvas.Handle, R, BDR_SUNKENOUTER, BF_RECT); + InflateRect(R, -1, -1); + Canvas.Brush.Color := FillColors[not Item.Enabled]; + Canvas.FrameRect(R); + InflateRect(R, -1, -1); + + { Fill } + Canvas.Brush.Color := FillColors[Item.Enabled]; + Canvas.FillRect(R); + InflateRect(R, -1, -1); + + { Text } + if Item.Text <> '' then begin + S := Item.Text; + Canvas.Brush.Style := bsClear; { speed optimization } + Canvas.Font.Color := TextColors[Item.Enabled]; + DrawTextStr(Canvas.Handle, S, R, DT_SINGLELINE or DT_NOPREFIX); + end; +end; + +procedure TTBEditItemViewer.GetCursor(const Pt: TPoint; var ACursor: HCURSOR); +var + R: TRect; +begin + if not Item.Enabled then + Exit; + GetEditRect(R); + OffsetRect(R, -BoundsRect.Left, -BoundsRect.Top); + InflateRect(R, -2, -2); + if PtInRect(R, Pt) then + ACursor := LoadCursor(0, IDC_IBEAM); +end; + +function TTBEditItemViewer.EditLoop(const CapHandle: HWND): Boolean; + + procedure ControlMessageLoop; + + function PointInWindow(const Wnd: HWND; const P: TPoint): Boolean; + var + W: HWND; + begin + Result := False; + W := WindowFromPoint(P); + if W = 0 then Exit; + if W = Wnd then + Result := True + else + if IsChild(Wnd, W) then + Result := True; + end; + + function ContinueLoop: Boolean; + begin + Result := (ecsContinueLoop in FEditControlStatus) and + not View.IsModalEnding and FEditControl.Focused and Item.Enabled; + { Note: View.IsModalEnding is checked since TTBView.CancelMode doesn't + destroy popup windows; it merely hides them and calls EndModal. So if + IsModalEnding returns True we can infer that CancelMode was likely + called. } + end; + + var + Msg: TMsg; + IsKeypadDigit: Boolean; + ScanCode: Byte; + V: Integer; + begin + try + while ContinueLoop do begin + { Examine the next message before popping it out of the queue } + if not PeekMessage(Msg, 0, 0, 0, PM_NOREMOVE) then begin + WaitMessage; + Continue; + end; + case Msg.message of + WM_SYSKEYDOWN: begin + { Exit immediately if Alt+[key] or F10 are pressed, but not + Alt+Shift, Alt+`, or Alt+[keypad digit] } + if not(Word(Msg.wParam) in [VK_MENU, VK_SHIFT, VK_HANJA]) then begin + IsKeypadDigit := False; + { This detect digits regardless of whether Num Lock is on: } + ScanCode := Byte(Msg.lParam shr 16); + if ScanCode <> 0 then + for V := VK_NUMPAD0 to VK_NUMPAD9 do + if MapVirtualKey(V, 0) = ScanCode then begin + IsKeypadDigit := True; + Break; + end; + if not IsKeypadDigit then begin + FEditControlStatus := [ecsClose]; + Exit; + end; + end; + end; + WM_SYSKEYUP: begin + { Exit when Alt is released by itself } + if Word(Msg.wParam) = VK_MENU then begin + FEditControlStatus := [ecsClose]; + Exit; + end; + end; + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, + WM_RBUTTONDOWN, WM_RBUTTONDBLCLK, + WM_MBUTTONDOWN, WM_MBUTTONDBLCLK, + WM_NCLBUTTONDOWN, WM_NCLBUTTONDBLCLK, + WM_NCRBUTTONDOWN, WM_NCRBUTTONDBLCLK, + WM_NCMBUTTONDOWN, WM_NCMBUTTONDBLCLK: begin + { If a mouse click outside the edit control is in the queue, + exit and let the upstream message loop deal with it } + if Msg.hwnd <> FEditControl.Handle then + Exit; + end; + WM_MOUSEMOVE, WM_NCMOUSEMOVE: begin + if GetCapture = CapHandle then begin + if PointInWindow(FEditControl.Handle, Msg.pt) then + ReleaseCapture; + end + else if GetCapture = 0 then begin + if not PointInWindow(FEditControl.Handle, Msg.pt) then + SetCapture(CapHandle); + end; + if GetCapture = CapHandle then + SetCursor(LoadCursor(0, IDC_ARROW)); + end; + end; + { Now pop the message out of the queue } + if not PeekMessage(Msg, 0, Msg.message, Msg.message, PM_REMOVE or PM_NOYIELD) then + Continue; + if ((Msg.message >= WM_MOUSEFIRST) and (Msg.message <= WM_MOUSELAST)) and + (Msg.hwnd = CapHandle) then + { discard, so that the selection doesn't get changed } + else begin + TranslateMessage(Msg); + DispatchMessage(Msg); + end; + end; + finally + { Make sure there are no outstanding WM_*CHAR messages } + RemoveMessages(WM_CHAR, WM_DEADCHAR); + RemoveMessages(WM_SYSCHAR, WM_SYSDEADCHAR); + end; + end; + + procedure RestoreEditControlWndProc; + {$IFNDEF CLR} + var + OrigWndProc: TWndMethod; + begin + { NOTE: We can't assign WndProc to WindowProc directly because on Delphi 4 + and 5, the compiler generates incorrect code, causing an AV at run-time } + OrigWndProc := TEditAccess(FEditControl).WndProc; + FEditControl.WindowProc := OrigWndProc; + end; + {$ELSE} + begin + IControl(FEditControl).RestoreWndProc; + end; + {$ENDIF} + +var + Item: TTBEditItem; + R: TRect; + ActiveWnd, FocusWnd: HWND; +begin + Item := TTBEditItem(Self.Item); + GetEditRect(R); + if IsRectEmpty(R) then begin + Result := False; + Exit; + end; + + ActiveWnd := GetActiveWindow; + FocusWnd := GetFocus; + + { Create the edit control } + InflateRect(R, -3, -3); + //View.FreeNotification(Self); + FEditControl := TEdit.Create(nil); + try + FEditControl.Visible := False; + FEditControl.BorderStyle := bsNone; + FEditControl.AutoSize := False; + FEditControl.Font.Assign(View.GetFont); + FEditControl.Text := Item.Text; + FEditControl.CharCase := Item.FCharCase; + FEditControl.MaxLength := Item.FMaxLength; + FEditControl.BoundsRect := R; + FEditControl.WindowProc := EditWndProc; + FEditControl.ParentWindow := View.Window.Handle; + FEditControl.SelectAll; + Item.DoBeginEdit(Self); + FEditControl.Visible := True; + FEditControl.SetFocus; + if GetActiveWindow <> ActiveWnd then + { don't gray out title bar of old active window } + SendMessage(ActiveWnd, WM_NCACTIVATE, 1, 0) + else + ActiveWnd := 0; + + FEditControlStatus := [ecsContinueLoop]; + ControlMessageLoop; + finally + { Restore the original window procedure before destroying the control so + it doesn't see a WM_KILLFOCUS message } + RestoreEditControlWndProc; + FreeAndNil(FEditControl); + end; + + { ensure the area underneath the edit control is repainted immediately } + View.Window.Update; + { If app is still active, set focus to previous control and restore capture + to CapHandle if another control hasn't taken it } + if GetActiveWindow <> 0 then begin + SetFocus(FocusWnd); + if GetCapture = 0 then + SetCapture(CapHandle); + end; + if ActiveWnd <> 0 then + SendMessage(ActiveWnd, WM_NCACTIVATE, Ord(GetActiveWindow = ActiveWnd), 0); + { The SetFocus call above can change the Z order of windows. If the parent + window is a popup window, reassert its topmostness. } + if View.Window is TTBPopupWindow then + SetWindowPos(View.Window.Handle, HWND_TOPMOST, 0, 0, 0, 0, + SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); + { Send an MSAA "focus" event now that we're returning to the regular modal loop } + View.NotifyFocusEvent; + + Result := ecsClose in FEditControlStatus; + if not Result and (GetCapture = CapHandle) then begin + if ecsAccept in FEditControlStatus then + { if we are accepting but not closing, Tab must have been pressed } + View.Selected := View.NextSelectable(View.Selected, + GetKeyState(VK_SHIFT) >= 0); + end; +end; + +function TTBEditItemViewer.DoExecute: Boolean; +begin + { Close any delay-close popup menus before entering the edit loop } + View.CancelChildPopups; + Result := False; + if EditLoop(View.GetCaptureWnd) then begin + View.EndModal; + if ecsAccept in FEditControlStatus then + Result := True; + end; +end; + +procedure TTBEditItemViewer.MouseBeginEdit; +begin + if Item.Enabled then + Execute(True) + else begin + if (View.ParentView = nil) and not View.IsPopup then + View.EndModal; + end; +end; + +procedure TTBEditItemViewer.MouseDown(Shift: TShiftState; X, Y: Integer; + var MouseDownOnMenu: Boolean); +begin + if IsPtInButtonPart(X, Y) then { for TBX... } + MouseBeginEdit + else + inherited; +end; + +procedure TTBEditItemViewer.MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); +begin + if IsPtInButtonPart(X, Y) then { for TBX... } + MouseBeginEdit + else + inherited; +end; + +function TTBEditItemViewer.UsesSameWidth: Boolean; +begin + Result := False; +end; + +function TTBEditItemViewer.GetAccRole: Integer; +const + ROLE_SYSTEM_TEXT = $2a; { from OleAcc.h } +begin + Result := ROLE_SYSTEM_TEXT; +end; + +function TTBEditItemViewer.GetAccValue(var Value: WideString): Boolean; +begin + Value := TTBEditItem(Item).Text; + Result := True; +end; + + +{ TTBToolbarVisibilityItem } + +procedure TTBVisibilityToggleItem.Click; +begin + if Assigned(FControl) then + FControl.Visible := not FControl.Visible; + inherited; +end; + +procedure TTBVisibilityToggleItem.InitiateAction; +begin + UpdateProps; +end; + +procedure TTBVisibilityToggleItem.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = FControl) then + Control := nil; +end; + +procedure TTBVisibilityToggleItem.SetControl(Value: TControl); +begin + if FControl <> Value then begin + FControl := Value; + if Assigned(Value) then begin + Value.FreeNotification(Self); + if (Caption = '') and not(csLoading in ComponentState) then + {$IFNDEF CLR} + Caption := TControlAccess(Value).Caption; + {$ELSE} + Caption := Value.GetText; + {$ENDIF} + end; + UpdateProps; + end; +end; + +procedure TTBVisibilityToggleItem.UpdateProps; +begin + if (ComponentState * [csDesigning, csLoading, csDestroying] = []) then + Checked := Assigned(FControl) and FControl.Visible; +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Hook.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Hook.pas new file mode 100644 index 0000000..fbc6f62 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Hook.pas @@ -0,0 +1,344 @@ +unit TB2Hook; + +{ + Toolbar2000 + Copyright (C) 1998-2006 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Hook.pas,v 1.17 2006/03/12 23:11:59 jr Exp $ +} + +interface + +uses + Windows; + +type + THookProcCode = (hpSendActivate, hpSendActivateApp, hpSendWindowPosChanged, + hpPreDestroy, hpGetMessage); + THookProcCodes = set of THookProcCode; + + THookProc = procedure(Code: THookProcCode; Wnd: HWND; WParam: WPARAM; LParam: LPARAM); + +procedure InstallHookProc(AUser: TObject; AProc: THookProc; ACodes: THookProcCodes); +procedure UninstallHookProc(AUser: TObject; AProc: THookProc); + +implementation + +uses + {$IFDEF CLR} System.Runtime.InteropServices, {$ENDIF} + SysUtils, Classes, Messages, TB2Common; + +type + THookType = (htCallWndProc, htCBT, htGetMessage); + THookTypes = set of THookType; + + THookUserData = class + Prev: THookUserData; + User: TObject; + InstalledHookTypes: THookTypes; + end; + + THookProcData = class + Proc: THookProc; + Codes: THookProcCodes; + LastUserData: THookUserData; + end; + + THookInfo = class + Handles: array[THookType] of HHOOK; + Counts: array[THookType] of Longint; + end; + +threadvar + HookInfo: THookInfo; + HookProcList: TList; + + +function CallWndProcHook(Code: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; +{$IFNDEF CLR} stdcall; {$ENDIF} +type + THookProcCodeMsgs = hpSendActivate..hpSendWindowPosChanged; +const + MsgMap: array[THookProcCodeMsgs] of UINT = + (WM_ACTIVATE, WM_ACTIVATEAPP, WM_WINDOWPOSCHANGED); +var + J: THookProcCodeMsgs; + I: Integer; + CWPStruct: {$IFNDEF CLR} PCWPStruct {$ELSE} TCWPStruct {$ENDIF}; +begin + if Assigned(HookProcList) and (Code = HC_ACTION) then begin + {$IFNDEF CLR} + CWPStruct := PCWPStruct(LParam); + {$ELSE} + CWPStruct := TCWPStruct(Marshal.PtrToStructure(IntPtr(LParam), TypeOf(TCWPStruct))); + {$ENDIF} + for J := Low(J) to High(J) do + if CWPStruct.Message = MsgMap[J] then begin + for I := 0 to HookProcList.Count-1 do + try + with THookProcData(HookProcList.List[I]) do + if J in Codes then + Proc(J, CWPStruct.hwnd, CWPStruct.WParam, CWPStruct.LParam); + except + end; + Break; + end; + end; + Result := CallNextHookEx(HookInfo.Handles[htCallWndProc], Code, WParam, LParam); +end; + +function CBTHook(Code: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; +{$IFNDEF CLR} stdcall; {$ENDIF} +var + I: Integer; +begin + if Assigned(HookProcList) and (Code = HCBT_DESTROYWND) then + for I := 0 to HookProcList.Count-1 do + try + with THookProcData(HookProcList.List[I]) do + if hpPreDestroy in Codes then + Proc(hpPreDestroy, HWND(WParam), 0, 0); + except + end; + Result := CallNextHookEx(HookInfo.Handles[htCBT], Code, WParam, LParam); +end; + +function GetMessageHook(Code: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; +{$IFNDEF CLR} stdcall; {$ENDIF} +var + I: Integer; +begin + if Assigned(HookProcList) and (Code = HC_ACTION) then + for I := 0 to HookProcList.Count-1 do + try + with THookProcData(HookProcList.List[I]) do + if hpGetMessage in Codes then + Proc(hpGetMessage, 0, WParam, LParam); + except + end; + Result := CallNextHookEx(HookInfo.Handles[htGetMessage], Code, WParam, LParam); +end; + +function HookCodesToTypes(Codes: THookProcCodes): THookTypes; +const + HookCodeToType: array[THookProcCode] of THookType = + (htCallWndProc, htCallWndProc, htCallWndProc, htCBT, htGetMessage); +var + J: THookProcCode; +begin + Result := []; + for J := Low(J) to High(J) do + if J in Codes then + Include(Result, HookCodeToType[J]); +end; + +var + HookProcs: array[THookType] of TFNHookProc; +const + HookIDs: array[THookType] of Integer = + (WH_CALLWNDPROC, WH_CBT, WH_GETMESSAGE); + +procedure InstallHooks(ATypes: THookTypes; var InstalledTypes: THookTypes); +var + T: THookType; +begin + if HookInfo = nil then + HookInfo := THookInfo.Create; + + { Don't increment reference counts for hook types that were already + installed previously } + ATypes := ATypes - InstalledTypes; + + { Increment reference counts first. This should never raise an exception. } + for T := Low(T) to High(T) do + if T in ATypes then begin + Inc(HookInfo.Counts[T]); + Include(InstalledTypes, T); + end; + + { Then install the hooks } + for T := Low(T) to High(T) do + if T in InstalledTypes then begin + if HookInfo.Handles[T] = 0 then begin + { On Windows NT platforms, SetWindowsHookExW is used to work around an + apparent bug in Windows NT/2000/XP: if an 'ANSI' WH_GETMESSAGE hook + is called *before* a 'wide' WH_GETMESSAGE hook, then WM_*CHAR + messages passed to the 'wide' hook use ANSI character codes. + This is needed for compatibility with the combination of Tnt Unicode + Controls and Keyman. See "Widechar's and tb2k" thread on the + newsgroup from 2003-09-23 for more information. } + if Win32Platform = VER_PLATFORM_WIN32_NT then + HookInfo.Handles[T] := SetWindowsHookExW(HookIDs[T], HookProcs[T], + 0, GetCurrentThreadId) + else + HookInfo.Handles[T] := SetWindowsHookEx(HookIDs[T], HookProcs[T], + 0, GetCurrentThreadId); + { .NET note: A reference to the delegate passed to SetWindowsHookEx + must exist for as long as the hook is installed, otherwise the GC + will collect it and the app will crash. Hence we always pass a + global variable (HookProcs[]) to SetWindowsHookEx. } + end; + end; +end; + +procedure UninstallHooks(const ATypes: THookTypes; const Force: Boolean); +var + T: THookType; +begin + { HookInfo can be nil if InstallHooks was never called previously (e.g. when + we're being called with Force=True), or if it was called but failed with + an exception } + if HookInfo = nil then + Exit; + + { Decrement reference counts first. This should never raise an exception. } + if not Force then + for T := Low(T) to High(T) do + if T in ATypes then + Dec(HookInfo.Counts[T]); + + { Then uninstall the hooks } + for T := Low(T) to High(T) do + if T in ATypes then begin + if (Force or (HookInfo.Counts[T] = 0)) and (HookInfo.Handles[T] <> 0) then begin + UnhookWindowsHookEx(HookInfo.Handles[T]); + HookInfo.Handles[T] := 0; + end; + end; + + { If all hooks are uninstalled, free HookInfo } + for T := Low(T) to High(T) do + if (HookInfo.Counts[T] <> 0) or (HookInfo.Handles[T] <> 0) then + Exit; + FreeAndNil(HookInfo); +end; + +procedure InstallHookProc(AUser: TObject; AProc: THookProc; ACodes: THookProcCodes); +var + Found: Boolean; + I: Integer; + UserData: THookUserData; + ProcData: THookProcData; +label 1; +begin + if HookProcList = nil then + HookProcList := TList.Create; + Found := False; + UserData := nil; { avoid warning } + for I := 0 to HookProcList.Count-1 do begin + ProcData := THookProcData(HookProcList[I]); + if @ProcData.Proc = @AProc then begin + UserData := ProcData.LastUserData; + while Assigned(UserData) do begin + if UserData.User = AUser then begin + { InstallHookProc was already called for AUser/AProc. Go ahead and + call InstallHooks again just in case the hooks weren't successfully + installed last time. } + goto 1; + end; + UserData := UserData.Prev; + end; + UserData := THookUserData.Create; + UserData.Prev := ProcData.LastUserData; + UserData.User := AUser; + UserData.InstalledHookTypes := []; + ProcData.LastUserData := UserData; + Found := True; + Break; + end; + end; + if not Found then begin + UserData := THookUserData.Create; + try + UserData.Prev := nil; + UserData.User := AUser; + UserData.InstalledHookTypes := []; + HookProcList.Expand; + ProcData := THookProcData.Create; + except + UserData.Free; + raise; + end; + ProcData.Proc := AProc; + ProcData.Codes := ACodes; + ProcData.LastUserData := UserData; + HookProcList.Add(ProcData); + end; +1:InstallHooks(HookCodesToTypes(ACodes), UserData.InstalledHookTypes); +end; + +procedure UninstallHookProc(AUser: TObject; AProc: THookProc); +var + I: Integer; + ProcData: THookProcData; + NextUserData, UserData: THookUserData; + T: THookTypes; +begin + if HookProcList = nil then Exit; + for I := 0 to HookProcList.Count-1 do begin + ProcData := THookProcData(HookProcList[I]); + if @ProcData.Proc = @AProc then begin + { Locate the UserData record } + NextUserData := nil; + UserData := ProcData.LastUserData; + while Assigned(UserData) and (UserData.User <> AUser) do begin + NextUserData := UserData; + UserData := UserData.Prev; + end; + if UserData = nil then + Exit; + + { Remove record from linked list } + if NextUserData = nil then begin + { It's the last item in the list } + if UserData.Prev = nil then begin + { It's the only item in the list, so destroy the ProcData record } + HookProcList.Delete(I); + ProcData.Free; + end + else + ProcData.LastUserData := UserData.Prev; + end + else + NextUserData.Prev := UserData.Prev; + + T := UserData.InstalledHookTypes; + UserData.Free; + UninstallHooks(T, False); + Break; + end; + end; + if HookProcList.Count = 0 then + FreeAndNil(HookProcList); +end; + + +initialization + { Work around Delphi.NET 2005 bug: declaring a constant array of procedural + types crashes the compiler (see QC #10381; 2006 fixes it). So we instead + declare HookProcs as a variable, and initialize the elements here. } + HookProcs[htCallWndProc] := CallWndProcHook; + HookProcs[htCBT] := CBTHook; + HookProcs[htGetMessage] := GetMessageHook; +finalization + UninstallHooks([Low(THookType)..High(THookType)], True); +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Item.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Item.pas new file mode 100644 index 0000000..6891cdd --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Item.pas @@ -0,0 +1,6982 @@ +unit TB2Item; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Item.pas,v 1.313 2008/09/19 16:35:48 jr Exp $ +} + +interface + +{$I TB2Ver.inc} +{x$DEFINE TB2K_NO_ANIMATION} + { Enabling the above define disables all menu animation. For debugging + purpose only. } +{x$DEFINE TB2K_USE_STRICT_O2K_MENU_STYLE} + { Enabling the above define forces it to use clBtnFace for the menu color + instead of clMenu, and disables the use of flat menu borders on Windows + XP with themes enabled. } + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + {$IFDEF CLR} TB2OleMarshal, {$ENDIF} + StdCtrls, CommCtrl, Menus, ActnList, ImgList, TB2Anim; + +type + TTBCustomItem = class; + TTBCustomItemClass = class of TTBCustomItem; + TTBCustomItemActionLink = class; + TTBCustomItemActionLinkClass = class of TTBCustomItemActionLink; + TTBItemViewer = class; + TTBItemViewerClass = class of TTBItemViewer; + TTBPopupWindow = class; + TTBPopupWindowClass = class of TTBPopupWindow; + TTBView = class; + + TTBDoneAction = (tbdaNone, tbdaCancel, tbdaClickItem, tbdaOpenSystemMenu, + tbdaHelpContext); + TTBDoneActionData = record + DoneAction: TTBDoneAction; + { tbdaClickItem-specific fields: } + ClickItem: TTBCustomItem; + Sound: Boolean; + { tbdaOpenSystemMenu-specific fields: } + Wnd: HWND; + Key: Word; + { tbdaHelpContext-specific fields: } + ContextID: Integer; + end; + TTBInsertItemProc = procedure(AParent: TComponent; AItem: TTBCustomItem) of object; + TTBItemChangedAction = (tbicInserted, tbicDeleting, tbicSubitemsChanged, + tbicSubitemsBeginUpdate, tbicSubitemsEndUpdate, tbicInvalidate, + tbicInvalidateAndResize, tbicRecreateItemViewers, tbicNameChanged, + tbicSubMenuImagesChanged); + TTBItemChangedProc = procedure(Sender: TTBCustomItem; Relayed: Boolean; + Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem) of object; + TTBItemDisplayMode = (nbdmDefault, nbdmTextOnly, nbdmTextOnlyInMenus, nbdmImageAndText); + TTBItemOption = (tboDefault, tboDropdownArrow, tboImageAboveCaption, + tboLongHintInMenuOnly, tboNoAutoHint, tboNoRotation, tboSameWidth, + tboShowHint, tboToolbarStyle, tboToolbarSize); + TTBItemOptions = set of TTBItemOption; + TTBItemStyle = set of (tbisSubmenu, tbisSelectable, tbisSeparator, + tbisEmbeddedGroup, tbisClicksTransparent, tbisCombo, tbisNoAutoOpen, + tbisSubitemsEditable, tbisNoLineBreak, tbisRightAlign, tbisDontSelectFirst, + tbisRedrawOnSelChange, tbisRedrawOnMouseOverChange); + TTBPopupAlignment = (tbpaLeft, tbpaRight, tbpaCenter); + TTBPopupEvent = procedure(Sender: TTBCustomItem; FromLink: Boolean) of object; + TTBSelectEvent = procedure(Sender: TTBCustomItem; Viewer: TTBItemViewer; + Selecting: Boolean) of object; + + ETBItemError = class(Exception); + + TTBImageChangeLink = class(TChangeLink) + private + FLastWidth, FLastHeight: Integer; + end; + {$IFNDEF JR_D5} + TImageIndex = type Integer; + {$ENDIF} + + TTBCustomItem = class(TComponent) + private + FActionLink: TTBCustomItemActionLink; + FAutoCheck: Boolean; + FCaption: String; + FChecked: Boolean; + FDisplayMode: TTBItemDisplayMode; + FEnabled: Boolean; + FEffectiveOptions: TTBItemOptions; + FGroupIndex: Integer; + FHelpContext: THelpContext; + FHint: String; + FImageIndex: TImageIndex; + FImages: TCustomImageList; + FImagesChangeLink: TTBImageChangeLink; + FItems: TList; + FItemStyle: TTBItemStyle; + FLinkParents: TList; + FMaskOptions: TTBItemOptions; + FOptions: TTBItemOptions; + FInheritOptions: Boolean; + FNotifyList: TList; + FOnClick: TNotifyEvent; + FOnPopup: TTBPopupEvent; + FOnSelect: TTBSelectEvent; + FParent: TTBCustomItem; + FParentComponent: TComponent; + FRadioItem: Boolean; + FShortCut: TShortCut; + FSubMenuImages: TCustomImageList; + FSubMenuImagesChangeLink: TTBImageChangeLink; + FLinkSubitems: TTBCustomItem; + FVisible: Boolean; + + procedure DoActionChange(Sender: TObject); + function ChangeImages(var AImages: TCustomImageList; + const Value: TCustomImageList; var AChangeLink: TTBImageChangeLink): Boolean; + class procedure ClickWndProc(var Message: TMessage); {$IFDEF CLR} static; {$ENDIF} + function FindItemWithShortCut(AShortCut: TShortCut; + var ATopmostParent: TTBCustomItem): TTBCustomItem; + function FixOptions(const AOptions: TTBItemOptions): TTBItemOptions; + function GetAction: TBasicAction; + function GetCount: Integer; + function GetItem(Index: Integer): TTBCustomItem; + procedure ImageListChangeHandler(Sender: TObject); + procedure InternalNotify(Ancestor: TTBCustomItem; NestingLevel: Integer; + Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); + {$IFDEF JR_D6} + function IsAutoCheckStored: Boolean; + {$ENDIF} + function IsCaptionStored: Boolean; + function IsCheckedStored: Boolean; + function IsEnabledStored: Boolean; + function IsHelpContextStored: Boolean; + function IsHintStored: Boolean; + function IsImageIndexStored: Boolean; + function IsOnClickStored: Boolean; + function IsShortCutStored: Boolean; + function IsVisibleStored: Boolean; + procedure Notify(Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); + procedure RefreshOptions; + procedure SetAction(Value: TBasicAction); + procedure SetCaption(Value: String); + procedure SetChecked(Value: Boolean); + procedure SetDisplayMode(Value: TTBItemDisplayMode); + procedure SetEnabled(Value: Boolean); + procedure SetGroupIndex(Value: Integer); + procedure SetImageIndex(Value: TImageIndex); + procedure SetImages(Value: TCustomImageList); + procedure SetInheritOptions(Value: Boolean); + procedure SetLinkSubitems(Value: TTBCustomItem); + procedure SetMaskOptions(Value: TTBItemOptions); + procedure SetOptions(Value: TTBItemOptions); + procedure SetRadioItem(Value: Boolean); + procedure SetSubMenuImages(Value: TCustomImageList); + procedure SetVisible(Value: Boolean); + procedure SubMenuImagesChanged; + procedure TurnSiblingsOff; + protected + procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); dynamic; + procedure Change(NeedResize: Boolean); virtual; + function CreatePopup(const ParentView: TTBView; const ParentViewer: TTBItemViewer; + const PositionAsSubmenu, SelectFirstItem, Customizing: Boolean; + const APopupPoint: TPoint; const Alignment: TTBPopupAlignment): TTBPopupWindow; virtual; + procedure DoPopup(Sender: TTBCustomItem; FromLink: Boolean); virtual; + procedure EnabledChanged; virtual; + function GetActionLinkClass: TTBCustomItemActionLinkClass; dynamic; + function GetChevronParentView: TTBView; virtual; + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; virtual; + function GetPopupWindowClass: TTBPopupWindowClass; virtual; + class procedure IndexError; + procedure Loaded; override; + function NeedToRecreateViewer(AViewer: TTBItemViewer): Boolean; virtual; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + function OpenPopup(const SelectFirstItem, TrackRightButton: Boolean; + const PopupPoint: TPoint; const Alignment: TTBPopupAlignment; + const ReturnClickedItemOnly: Boolean): TTBCustomItem; + procedure RecreateItemViewers; + procedure SetChildOrder(Child: TComponent; Order: Integer); override; + procedure SetName(const NewName: TComponentName); override; + {$IFNDEF CLR} + procedure SetParentComponent(Value: TComponent); override; + {$ENDIF} + + property ActionLink: TTBCustomItemActionLink read FActionLink write FActionLink; + property ItemStyle: TTBItemStyle read FItemStyle write FItemStyle; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function HasParent: Boolean; override; + function GetParentComponent: TComponent; override; + + procedure Add(AItem: TTBCustomItem); + procedure Clear; + procedure Click; virtual; + function ContainsItem(AItem: TTBCustomItem): Boolean; + procedure Delete(Index: Integer); + function GetItemStyle: TTBItemStyle; + function GetShortCutText: String; + function IndexOf(AItem: TTBCustomItem): Integer; + procedure InitiateAction; virtual; + procedure Insert(NewIndex: Integer; AItem: TTBCustomItem); + function IsShortCut(var Message: TWMKey): Boolean; + procedure Move(CurIndex, NewIndex: Integer); + function Popup(X, Y: Integer; TrackRightButton: Boolean; + Alignment: TTBPopupAlignment = tbpaLeft; + ReturnClickedItemOnly: Boolean = False): TTBCustomItem; + procedure PostClick; + procedure RegisterNotification(ANotify: TTBItemChangedProc); + procedure Remove(Item: TTBCustomItem); + {$IFDEF CLR} + procedure SetParentComponent(Value: TComponent); override; + {$ENDIF} + procedure UnregisterNotification(ANotify: TTBItemChangedProc); + procedure ViewBeginUpdate; + procedure ViewEndUpdate; + + property Action: TBasicAction read GetAction write SetAction; + property AutoCheck: Boolean read FAutoCheck write FAutoCheck {$IFDEF JR_D6} stored IsAutoCheckStored {$ENDIF} default False; + property Caption: String read FCaption write SetCaption stored IsCaptionStored; + property Count: Integer read GetCount; + property Checked: Boolean read FChecked write SetChecked stored IsCheckedStored default False; + property DisplayMode: TTBItemDisplayMode read FDisplayMode write SetDisplayMode default nbdmDefault; + property EffectiveOptions: TTBItemOptions read FEffectiveOptions; + property Enabled: Boolean read FEnabled write SetEnabled stored IsEnabledStored default True; + property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0; + property HelpContext: THelpContext read FHelpContext write FHelpContext stored IsHelpContextStored default 0; + property Hint: String read FHint write FHint stored IsHintStored; + property ImageIndex: TImageIndex read FImageIndex write SetImageIndex stored IsImageIndexStored default -1; + property Images: TCustomImageList read FImages write SetImages; + property InheritOptions: Boolean read FInheritOptions write SetInheritOptions default True; + property Items[Index: Integer]: TTBCustomItem read GetItem; default; + property LinkSubitems: TTBCustomItem read FLinkSubitems write SetLinkSubitems; + property MaskOptions: TTBItemOptions read FMaskOptions write SetMaskOptions default []; + property Options: TTBItemOptions read FOptions write SetOptions default []; + property Parent: TTBCustomItem read FParent; + property ParentComponent: TComponent read FParentComponent write FParentComponent; + property RadioItem: Boolean read FRadioItem write SetRadioItem default False; + property ShortCut: TShortCut read FShortCut write FShortCut stored IsShortCutStored default 0; + property SubMenuImages: TCustomImageList read FSubMenuImages write SetSubMenuImages; + property Visible: Boolean read FVisible write SetVisible stored IsVisibleStored default True; + property OnClick: TNotifyEvent read FOnClick write FOnClick stored IsOnClickStored; + property OnPopup: TTBPopupEvent read FOnPopup write FOnPopup; + property OnSelect: TTBSelectEvent read FOnSelect write FOnSelect; + end; + + TTBCustomItemActionLink = class(TActionLink) + protected + FClient: TTBCustomItem; + procedure AssignClient(AClient: TObject); override; + {$IFDEF JR_D6} + function IsAutoCheckLinked: Boolean; virtual; + {$ENDIF} + function IsCaptionLinked: Boolean; override; + function IsCheckedLinked: Boolean; override; + function IsEnabledLinked: Boolean; override; + function IsHelpContextLinked: Boolean; override; + function IsHintLinked: Boolean; override; + function IsImageIndexLinked: Boolean; override; + function IsShortCutLinked: Boolean; override; + function IsVisibleLinked: Boolean; override; + function IsOnExecuteLinked: Boolean; override; + {$IFDEF JR_D6} + procedure SetAutoCheck(Value: Boolean); override; + {$ENDIF} + procedure SetCaption(const Value: String); override; + procedure SetChecked(Value: Boolean); override; + procedure SetEnabled(Value: Boolean); override; + procedure SetHelpContext(Value: THelpContext); override; + procedure SetHint(const Value: String); override; + procedure SetImageIndex(Value: Integer); override; + procedure SetShortCut(Value: TShortCut); override; + procedure SetVisible(Value: Boolean); override; + procedure SetOnExecute(Value: TNotifyEvent); override; + end; + + {$IFNDEF CLR} + TTBBaseAccObject = class(TInterfacedObject, IDispatch) + {$ELSE} + TTBBaseAccObject = class(TTBStandardOleMarshalObject) + {$ENDIF} + public + procedure ClientIsDestroying; virtual; abstract; + {$IFNDEF CLR} + { IDispatch } + function GetTypeInfoCount(out Count: Integer): HResult; stdcall; + function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall; + function GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall; + function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer; + Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall; + {$ENDIF} + end; + + TTBItemViewer = class + private + FBoundsRect: TRect; + FClipped: Boolean; + FGroupLevel: Integer; + FItem: TTBCustomItem; + FOffEdge: Boolean; + FShow: Boolean; + FView: TTBView; + procedure AccSelect(const AExecute: Boolean); + function GetIndex: Integer; + protected + FAccObjectInstance: TTBBaseAccObject; + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); + virtual; + function CaptionShown: Boolean; dynamic; + function DoExecute: Boolean; virtual; + procedure DrawItemCaption(const Canvas: TCanvas; ARect: TRect; + const ACaption: String; ADrawDisabledShadow: Boolean; AFormat: UINT); virtual; + procedure Entering; virtual; + function GetAccRole: Integer; virtual; + function GetAccValue(var Value: WideString): Boolean; virtual; + function GetCaptionText: String; virtual; + procedure GetCursor(const Pt: TPoint; var ACursor: HCURSOR); virtual; + function GetImageList: TCustomImageList; + function ImageShown: Boolean; + function IsRotated: Boolean; + function IsToolbarSize: Boolean; + function IsPtInButtonPart(X, Y: Integer): Boolean; virtual; + procedure KeyDown(var Key: Word; Shift: TShiftState); virtual; + procedure Leaving; virtual; + procedure LosingCapture; virtual; + procedure MouseDown(Shift: TShiftState; X, Y: Integer; + var MouseDownOnMenu: Boolean); virtual; + procedure MouseMove(X, Y: Integer); virtual; + procedure MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); virtual; + procedure MouseWheel(WheelDelta: Integer; X, Y: Integer); virtual; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); virtual; + procedure PostAccSelect(const AExecute: Boolean); + function UsesSameWidth: Boolean; virtual; + public + State: set of (tbisInvalidated, tbisLineSep); + property BoundsRect: TRect read FBoundsRect; + property Clipped: Boolean read FClipped; + property Index: Integer read GetIndex; + property Item: TTBCustomItem read FItem; + property OffEdge: Boolean read FOffEdge; + property Show: Boolean read FShow; + property View: TTBView read FView; + constructor Create(AView: TTBView; AItem: TTBCustomItem; AGroupLevel: Integer); virtual; + destructor Destroy; override; + procedure Execute(AGivePriority: Boolean); + function GetAccObject: TTBBaseAccObject; + function GetHintText: String; + function IsAccessible: Boolean; + function IsToolbarStyle: Boolean; + function ScreenToClient(const P: TPoint): TPoint; + end; + TTBViewOrientation = (tbvoHorizontal, tbvoVertical, tbvoFloating); + TTBEnterToolbarLoopOptions = set of (tbetMouseDown, tbetExecuteSelected, + tbetFromMSAA); + TTBViewState = set of (vsModal, vsMouseInWindow, vsDrawInOrder, vsOppositePopup, + vsIgnoreFirstMouseUp, vsShowAccels, vsDropDownMenus, vsNoAnimation); + TTBViewStyle = set of (vsMenuBar, vsUseHiddenAccels, vsAlwaysShowHints); + TTBViewTimerID = (tiOpen, tiClose, tiScrollUp, tiScrollDown); + + TTBViewClass = class of TTBView; + TTBView = class(TComponent) + private + FViewers: TList; { at front to minimize code size } + FActiveTimers: set of TTBViewTimerID; + FBackgroundColor: TColor; + FBaseSize: TPoint; + FCapture: Boolean; + FCaptureWnd: HWND; + FChevronOffset: Integer; + FChevronParentView: TTBView; + FChevronSize: Integer; + FCurParentItem: TTBCustomItem; + FCustomizing: Boolean; + FDoneActionData: TTBDoneActionData; + FInternalViewersAtEnd: Integer; + FInternalViewersAtFront: Integer; + FIsPopup: Boolean; + FIsToolbar: Boolean; + FMaxHeight: Integer; + FMonitorRect: TRect; + FMouseOverSelected: Boolean; + FNewViewersGetHighestPriority: Boolean; + FOpenViewer: TTBItemViewer; + FOpenViewerView: TTBView; + FOpenViewerWindow: TTBPopupWindow; + FParentView: TTBView; + FParentItem: TTBCustomItem; + FPriorityList: TList; + FOrientation: TTBViewOrientation; + FScrollOffset: Integer; + FSelected: TTBItemViewer; + FSelectedViaMouse: Boolean; + FShowDownArrow: Boolean; + FShowUpArrow: Boolean; + FState: TTBViewState; + FStyle: TTBViewStyle; + FUpdating: Integer; + FUsePriorityList: Boolean; + FValidated: Boolean; + FWindow: TWinControl; + FWrapOffset: Integer; + + procedure DeletingViewer(Viewer: TTBItemViewer); + procedure DrawItem(Viewer: TTBItemViewer; DrawTo: TCanvas; Offscreen: Boolean); + procedure FreeViewers; + function GetViewer(Index: Integer): TTBItemViewer; + function GetViewerCount: Integer; {$IFDEF JR_D9} inline; {$ENDIF} + procedure ImagesChanged; + function InsertItemViewers(const NewIndex: Integer; + const AItem: TTBCustomItem; const AGroupLevel: Integer; + const AddToPriorityList, TopOfPriorityList: Boolean): Integer; + procedure ItemNotification(Ancestor: TTBCustomItem; Relayed: Boolean; + Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); + procedure LinkNotification(Ancestor: TTBCustomItem; Relayed: Boolean; + Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); + procedure RecreateItemViewer(const I: Integer); + procedure Scroll(ADown: Boolean); + procedure SetCustomizing(Value: Boolean); + procedure SetSelected(Value: TTBItemViewer); + procedure SetUsePriorityList(Value: Boolean); + procedure StartTimer(const ATimer: TTBViewTimerID; const Interval: Integer); + procedure StopAllTimers; + procedure StopTimer(const ATimer: TTBViewTimerID); + procedure UpdateCurParentItem; + protected + FAccObjectInstance: TTBBaseAccObject; + procedure AutoSize(AWidth, AHeight: Integer); virtual; + function CalculatePositions(const CanMoveControls: Boolean; + const AOrientation: TTBViewOrientation; + AWrapOffset, AChevronOffset, AChevronSize: Integer; + var ABaseSize, TotalSize: TPoint; + var AWrappedLines: Integer): Boolean; + procedure DoUpdatePositions(var ASize: TPoint); virtual; + function GetChevronItem: TTBCustomItem; virtual; + procedure GetMargins(AOrientation: TTBViewOrientation; var Margins: TRect); + virtual; + function GetMDIButtonsItem: TTBCustomItem; virtual; + function GetMDISystemMenuItem: TTBCustomItem; virtual; + function GetParentToolbarView: TTBView; + function GetRootView: TTBView; + function HandleWMGetObject(var Message: TMessage): Boolean; + procedure InitiateActions; + procedure KeyDown(var Key: Word; Shift: TShiftState); virtual; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure SetAccelsVisibility(AShowAccels: Boolean); + public + constructor Create(AOwner: TComponent; AParentView: TTBView; + AParentItem: TTBCustomItem; AWindow: TWinControl; + AIsToolbar, ACustomizing, AUsePriorityList: Boolean); reintroduce; virtual; + destructor Destroy; override; + procedure BeginUpdate; + procedure CancelCapture; + procedure CancelChildPopups; + procedure CancelMode; + procedure CloseChildPopups; + function ContainsView(AView: TTBView): Boolean; + procedure DrawSubitems(ACanvas: TCanvas); + procedure EndModal; + procedure EndModalWithClick(AViewer: TTBItemViewer); + procedure EndModalWithHelp(AContextID: Integer); + procedure EndModalWithSystemMenu(AWnd: HWND; AKey: Word); + procedure EndUpdate; + procedure EnterToolbarLoop(Options: TTBEnterToolbarLoopOptions); + procedure ExecuteSelected(AGivePriority: Boolean); + function Find(Item: TTBCustomItem): TTBItemViewer; + function FirstSelectable: TTBItemViewer; + function GetAccObject: TTBBaseAccObject; + function GetCaptureWnd: HWND; + function GetFont: TFont; virtual; + procedure GetOffEdgeControlList(const List: TList); + procedure GivePriority(AViewer: TTBItemViewer); + procedure HandleHintShowMessage(var Message: TCMHintShow); + function HighestPriorityViewer: TTBItemViewer; + procedure Invalidate(AViewer: TTBItemViewer); + procedure InvalidatePositions; virtual; + function IndexOf(AViewer: TTBItemViewer): Integer; + function IsModalEnding: Boolean; + function NextSelectable(CurViewer: TTBItemViewer; GoForward: Boolean): TTBItemViewer; + function NextSelectableWithAccel(CurViewer: TTBItemViewer; Key: Char; + RequirePrimaryAccel: Boolean; var IsOnlyItemWithAccel: Boolean): TTBItemViewer; + procedure NotifyFocusEvent; + function OpenChildPopup(const SelectFirstItem: Boolean): Boolean; + procedure RecreateAllViewers; + procedure ScrollSelectedIntoView; + procedure Select(Value: TTBItemViewer; ViaMouse: Boolean); + procedure SetCapture; + procedure TryValidatePositions; + procedure UpdateSelection(const P: TPoint; const AllowNewSelection: Boolean); + function UpdatePositions: TPoint; + procedure ValidatePositions; + function ViewerFromPoint(const P: TPoint): TTBItemViewer; + + property BackgroundColor: TColor read FBackgroundColor write FBackgroundColor; + property BaseSize: TPoint read FBaseSize; + property Capture: Boolean read FCapture; + property ChevronOffset: Integer read FChevronOffset write FChevronOffset; + property ChevronSize: Integer read FChevronSize write FChevronSize; + property Customizing: Boolean read FCustomizing write SetCustomizing; + property IsPopup: Boolean read FIsPopup; + property IsToolbar: Boolean read FIsToolbar; + property MouseOverSelected: Boolean read FMouseOverSelected; + property NewViewersGetHighestPriority: Boolean read FNewViewersGetHighestPriority + write FNewViewersGetHighestPriority; + property ParentView: TTBView read FParentView; + property ParentItem: TTBCustomItem read FParentItem; + property OpenViewer: TTBItemViewer read FOpenViewer; + property OpenViewerView: TTBView read FOpenViewerView; + property Orientation: TTBViewOrientation read FOrientation write FOrientation; + property Selected: TTBItemViewer read FSelected write SetSelected; + property SelectedViaMouse: Boolean read FSelectedViaMouse; + property State: TTBViewState read FState; + property Style: TTBViewStyle read FStyle write FStyle; + property UsePriorityList: Boolean read FUsePriorityList write SetUsePriorityList; + property Viewers[Index: Integer]: TTBItemViewer read GetViewer; + property ViewerCount: Integer read GetViewerCount; + property Window: TWinControl read FWindow; + property WrapOffset: Integer read FWrapOffset write FWrapOffset; + end; + + TTBRootItemClass = class of TTBRootItem; + TTBRootItem = class(TTBCustomItem); + { same as TTBCustomItem, except there's a property editor for it } + + TTBItem = class(TTBCustomItem) + published + property Action; + property AutoCheck; + property Caption; + property Checked; + property DisplayMode; + property Enabled; + property GroupIndex; + property HelpContext; + property Hint; + property ImageIndex; + property Images; + property InheritOptions; + property MaskOptions; + property Options; + property RadioItem; + property ShortCut; + property Visible; + + property OnClick; + property OnSelect; + end; + + TTBGroupItem = class(TTBCustomItem) + public + constructor Create(AOwner: TComponent); override; + published + property InheritOptions; + property LinkSubitems; + property MaskOptions; + property Options; + end; + + TTBSubmenuItem = class(TTBCustomItem) + private + function GetDropdownCombo: Boolean; + procedure SetDropdownCombo(Value: Boolean); + public + constructor Create(AOwner: TComponent); override; + published + property Action; + property AutoCheck; + property Caption; + property Checked; + //property DisplayAsToolbar; + property DisplayMode; + property DropdownCombo: Boolean read GetDropdownCombo write SetDropdownCombo default False; + property Enabled; + property GroupIndex; + property HelpContext; + property Hint; + property ImageIndex; + property Images; + property InheritOptions; + property LinkSubitems; + property MaskOptions; + property Options; + property RadioItem; + property ShortCut; + property SubMenuImages; + property Visible; + + property OnClick; + property OnPopup; + property OnSelect; + end; + + TTBSeparatorItem = class(TTBCustomItem) + private + FBlank: Boolean; + procedure SetBlank(Value: Boolean); + protected + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + public + constructor Create(AOwner: TComponent); override; + published + property Blank: Boolean read FBlank write SetBlank default False; + property Hint; + property Visible; + end; + + TTBSeparatorItemViewer = class(TTBItemViewer) + protected + procedure CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); override; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + function UsesSameWidth: Boolean; override; + end; + + TTBControlItem = class(TTBCustomItem) + private + FControl: TControl; + FDontFreeControl: Boolean; + procedure SetControl(Value: TControl); + protected + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property DontFreeControl: Boolean read FDontFreeControl write FDontFreeControl; + published + property Control: TControl read FControl write SetControl; + end; + + TTBPopupView = class(TTBView) + protected + procedure AutoSize(AWidth, AHeight: Integer); override; + public + function GetFont: TFont; override; + end; + + ITBPopupWindow = interface + ['{E45CBE74-1ECF-44CB-B064-6D45B1924708}'] + end; + + TTBPopupWindow = class(TCustomControl, ITBPopupWindow) + private + FAccelsVisibilitySet: Boolean; + FAnimationDirection: TTBAnimationDirection; + FView: TTBView; + procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW; + procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED; + procedure WMClose(var Message: TWMClose); message WM_CLOSE; + procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMGetObject(var Message: TMessage); message WM_GETOBJECT; + procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE; + procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT; + procedure WMPaint(var Message: TWMPaint); message WM_PAINT; + procedure WMPrint(var Message: TMessage); message WM_PRINT; + procedure WMPrintClient(var Message: {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); message WM_PRINTCLIENT; + protected + procedure CreateParams(var Params: TCreateParams); override; + procedure CreateWnd; override; + procedure DestroyWindowHandle; override; + function GetViewClass: TTBViewClass; dynamic; + procedure Paint; override; + procedure PaintScrollArrows; virtual; + public + constructor CreatePopupWindow(AOwner: TComponent; const AParentView: TTBView; + const AItem: TTBCustomItem; const ACustomizing: Boolean); virtual; + destructor Destroy; override; + + property View: TTBView read FView; + end; + + ITBItems = interface + ['{A5C0D7CC-3EC4-4090-A0F8-3D03271877EA}'] + function GetItems: TTBCustomItem; + end; + + TTBItemContainer = class(TComponent, ITBItems) + private + FItem: TTBRootItem; + function GetImages: TCustomImageList; + function GetItems: TTBCustomItem; + procedure SetImages(Value: TCustomImageList); + protected + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + property Items: TTBRootItem read FItem; + published + property Images: TCustomImageList read GetImages write SetImages; + end; + + TTBPopupMenu = class(TPopupMenu, ITBItems) + private + FItem: TTBRootItem; + //procedure SetItems(Value: TTBCustomItem); + function GetImages: TCustomImageList; + function GetItems: TTBCustomItem; + function GetLinkSubitems: TTBCustomItem; + function GetOptions: TTBItemOptions; + procedure RootItemClick(Sender: TObject); + procedure SetImages(Value: TCustomImageList); + procedure SetLinkSubitems(Value: TTBCustomItem); + procedure SetOptions(Value: TTBItemOptions); + protected + {$IFNDEF JR_D5} + procedure DoPopup(Sender: TObject); + {$ENDIF} + function GetRootItemClass: TTBRootItemClass; dynamic; + procedure SetChildOrder(Child: TComponent; Order: Integer); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; + function IsShortCut(var Message: TWMKey): Boolean; override; + procedure Popup(X, Y: Integer); override; + function PopupEx(X, Y: Integer; ReturnClickedItemOnly: Boolean = False): TTBCustomItem; + published + property Images: TCustomImageList read GetImages write SetImages; + property Items: TTBRootItem read FItem; + property LinkSubitems: TTBCustomItem read GetLinkSubitems write SetLinkSubitems; + property Options: TTBItemOptions read GetOptions write SetOptions default []; + end; + + TTBCustomImageList = class(TImageList) + private + FCheckedImages: TCustomImageList; + FCheckedImagesChangeLink: TChangeLink; + FDisabledImages: TCustomImageList; + FDisabledImagesChangeLink: TChangeLink; + FHotImages: TCustomImageList; + FHotImagesChangeLink: TChangeLink; + FImagesBitmap: TBitmap; + FImagesBitmapMaskColor: TColor; + procedure ChangeImages(var AImageList: TCustomImageList; + Value: TCustomImageList; AChangeLink: TChangeLink); + procedure ImageListChanged(Sender: TObject); + procedure ImagesBitmapChanged(Sender: TObject); + procedure SetCheckedImages(Value: TCustomImageList); + procedure SetDisabledImages(Value: TCustomImageList); + procedure SetHotImages(Value: TCustomImageList); + procedure SetImagesBitmap(Value: TBitmap); + procedure SetImagesBitmapMaskColor(Value: TColor); + {$IFDEF CLR} + procedure WriteLeft(Writer: TWriter); + procedure WriteTop(Writer: TWriter); + {$ENDIF} + protected + procedure DefineProperties(Filer: TFiler); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + property CheckedImages: TCustomImageList read FCheckedImages write SetCheckedImages; + property DisabledImages: TCustomImageList read FDisabledImages write SetDisabledImages; + property HotImages: TCustomImageList read FHotImages write SetHotImages; + property ImagesBitmap: TBitmap read FImagesBitmap write SetImagesBitmap; + property ImagesBitmapMaskColor: TColor read FImagesBitmapMaskColor + write SetImagesBitmapMaskColor default clFuchsia; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure DrawState(Canvas: TCanvas; X, Y, Index: Integer; + Enabled, Selected, Checked: Boolean); virtual; + end; + + TTBImageList = class(TTBCustomImageList) + published + property CheckedImages; + property DisabledImages; + property HotImages; + property ImagesBitmap; + property ImagesBitmapMaskColor; + end; + +const + {$IFNDEF TB2K_USE_STRICT_O2K_MENU_STYLE} + tbMenuBkColor = clMenu; + tbMenuTextColor = clMenuText; + {$ELSE} + tbMenuBkColor = clBtnFace; + tbMenuTextColor = clBtnText; + {$ENDIF} + + tbMenuVerticalMargin = 4; + tbMenuImageTextSpace = 1; + tbMenuLeftTextMargin = 2; + tbMenuRightTextMargin = 3; + + tbMenuSeparatorOffset = 12; + + tbMenuScrollArrowHeight = 19; + + tbDropdownArrowWidth = 8; + tbDropdownArrowMargin = 3; + tbDropdownComboArrowWidth = 11; + tbDropdownComboMargin = 2; + + tbLineSpacing = 6; + tbLineSepOffset = 1; + tbDockedLineSepOffset = 4; + + WM_TB2K_CLICKITEM = WM_USER + $100; + +function TBGetItems(const AObject: TObject): TTBCustomItem; +procedure TBInitToolbarSystemFont; + +var + ToolbarFont: TFont; + + +implementation + +uses + {$IFDEF CLR} System.Runtime.InteropServices, System.Text, System.Threading, + Types, WinUtils, {$ENDIF} + TB2Consts, TB2Common, IMM, TB2Acc; + +{$UNDEF ALLOCHWND_CLASSES} +{$IFNDEF CLR} + {$IFDEF JR_D6} + {$DEFINE ALLOCHWND_CLASSES} + {$ENDIF} +{$ENDIF} + +var + LastPos: TPoint; + +threadvar + ClickWndRefCount: Integer; + ClickWnd: HWND; + ClickList: TList; + +type + TTBModalHandler = class + private + FCreatedWnd: Boolean; + FInited: Boolean; + FWnd: HWND; + FRootPopup: TTBPopupWindow; + FSaveFocusWnd: HWND; + procedure WndProc(var Msg: TMessage); + public + constructor Create(AExistingWnd: HWND); + destructor Destroy; override; + procedure Loop(const RootView: TTBView; const AMouseDown, AExecuteSelected, + AFromMSAA, TrackRightButton: Boolean); + property RootPopup: TTBPopupWindow read FRootPopup write FRootPopup; + property Wnd: HWND read FWnd; + end; + + TItemChangedNotificationData = class + private + Proc: TTBItemChangedProc; + RefCount: Integer; + end; + + {$IFNDEF CLR} + TComponentAccess = class(TComponent); + TControlAccess = class(TControl); + {$ENDIF} + +const + ViewTimerBaseID = 9000; + MaxGroupLevel = 10; + + +{ Misc. } + +function TBGetItems(const AObject: TObject): TTBCustomItem; +{ If AObject is an item, returns AObject, otherwise finds the root item + associated with AObject. If AObject is not a TTBCustomItem and does not + implement the ITBItems interface, nil is returned. } +var + Intf: ITBItems; +begin + if AObject is TTBCustomItem then + Result := TTBCustomItem(AObject) + else begin + {$IFNDEF CLR} + if AObject.GetInterface(ITBItems, Intf) then + {$ELSE} + Intf := ITBItems(AObject); + if Assigned(Intf) then + {$ENDIF} + Result := Intf.GetItems + else + Result := nil; + end; +end; + +procedure DestroyClickWnd; +begin + if ClickWnd <> 0 then begin + {$IFDEF ALLOCHWND_CLASSES}Classes.{$ENDIF} DeallocateHWnd(ClickWnd); + ClickWnd := 0; + end; + FreeAndNil(ClickList); +end; + +procedure ReferenceClickWnd; +begin + Inc(ClickWndRefCount); +end; + +procedure ReleaseClickWnd; +begin + Dec(ClickWndRefCount); + if ClickWndRefCount = 0 then + DestroyClickWnd; +end; + +procedure QueueClick(const AItem: TObject; const AArg: Integer); +{ Adds an item to ClickList and posts a message to handle it. AItem must be + either a TTBCustomItem or TTBItemViewer. } +var + I: Integer; +begin + if ClickWnd = 0 then + ClickWnd := {$IFDEF ALLOCHWND_CLASSES}Classes.{$ENDIF} AllocateHWnd(TTBCustomItem.ClickWndProc); + if ClickList = nil then + ClickList := TList.Create; + + { Add a new item to ClickList or replace an empty one } + I := ClickList.IndexOf(nil); + if I = -1 then + I := ClickList.Add(AItem) + else + ClickList[I] := AItem; + + PostMessage(ClickWnd, WM_TB2K_CLICKITEM, AArg, I); +end; + +procedure RemoveFromClickList(const AItem: TObject); +{ Any class that potentially calls QueueClick needs to call RemoveFromClickList + before an instance is destroyed to ensure that any references to the + instance still in ClickList are removed. } +var + I: Integer; +begin + if Assigned(ClickList) and Assigned(AItem) then + for I := 0 to ClickList.Count-1 do + if ClickList[I] = AItem then + ClickList[I] := ClickList; + { ^ The special value of ClickList is assigned to the item instead of + of nil because we want the index to stay reserved until the + WM_TB2K_CLICKITEM message for the index is processed. We don't want + the WM_TB2K_CLICKITEM message that's still in the queue to later + refer to a different item; this would result in queued clicks being + processed in the wrong order in a case like this: + A.PostClick; B.PostClick; A.Free; C.PostClick; + C's click would end up being processed before A's, because C would + get A's index. } +end; + +function ProcessDoneAction(const DoneActionData: TTBDoneActionData; + const ReturnClickedItemOnly: Boolean): TTBCustomItem; +begin + Result := nil; + case DoneActionData.DoneAction of + tbdaNone: ; + tbdaClickItem: begin + if DoneActionData.Sound and NeedToPlaySound('MenuCommand') then + PlaySystemSound('MenuCommand'); + Result := DoneActionData.ClickItem; + if not ReturnClickedItemOnly then + Result.PostClick; + end; + tbdaOpenSystemMenu: begin + SendMessage(DoneActionData.Wnd, WM_SYSCOMMAND, SC_KEYMENU, DoneActionData.Key); + end; + tbdaHelpContext: begin + { Based on code in TPopupList.WndProc: } + if Assigned(Screen.ActiveForm) and + (biHelp in Screen.ActiveForm.BorderIcons) then + Application.HelpCommand(HELP_CONTEXTPOPUP, DoneActionData.ContextID) + else + Application.HelpContext(DoneActionData.ContextID); + end; + end; +end; + + +{ TTBCustomItemActionLink } + +procedure TTBCustomItemActionLink.AssignClient(AClient: TObject); +begin + FClient := AClient as TTBCustomItem; +end; + +{$IFDEF JR_D6} +function TTBCustomItemActionLink.IsAutoCheckLinked: Boolean; +begin + Result := (FClient.AutoCheck = (Action as TCustomAction).AutoCheck); +end; +{$ENDIF} + +function TTBCustomItemActionLink.IsCaptionLinked: Boolean; +begin + Result := inherited IsCaptionLinked and + (FClient.Caption = (Action as TCustomAction).Caption); +end; + +function TTBCustomItemActionLink.IsCheckedLinked: Boolean; +begin + Result := inherited IsCheckedLinked and + (FClient.Checked = (Action as TCustomAction).Checked); +end; + +function TTBCustomItemActionLink.IsEnabledLinked: Boolean; +begin + Result := inherited IsEnabledLinked and + (FClient.Enabled = (Action as TCustomAction).Enabled); +end; + +function TTBCustomItemActionLink.IsHelpContextLinked: Boolean; +begin + Result := inherited IsHelpContextLinked and + (FClient.HelpContext = (Action as TCustomAction).HelpContext); +end; + +function TTBCustomItemActionLink.IsHintLinked: Boolean; +begin + Result := inherited IsHintLinked and + (FClient.Hint = (Action as TCustomAction).Hint); +end; + +function TTBCustomItemActionLink.IsImageIndexLinked: Boolean; +begin + Result := inherited IsImageIndexLinked and + (FClient.ImageIndex = (Action as TCustomAction).ImageIndex); +end; + +function TTBCustomItemActionLink.IsShortCutLinked: Boolean; +begin + Result := inherited IsShortCutLinked and + (FClient.ShortCut = (Action as TCustomAction).ShortCut); +end; + +function TTBCustomItemActionLink.IsVisibleLinked: Boolean; +begin + Result := inherited IsVisibleLinked and + (FClient.Visible = (Action as TCustomAction).Visible); +end; + +function TTBCustomItemActionLink.IsOnExecuteLinked: Boolean; +begin + Result := inherited IsOnExecuteLinked and + {$IFNDEF CLR} + MethodsEqual(TMethod(FClient.OnClick), TMethod(Action.OnExecute)); + {$ELSE} + (@FClient.OnClick = @Action.OnExecute); + {$ENDIF} +end; + +{$IFDEF JR_D6} +procedure TTBCustomItemActionLink.SetAutoCheck(Value: Boolean); +begin + if IsAutoCheckLinked then FClient.AutoCheck := Value; +end; +{$ENDIF} + +procedure TTBCustomItemActionLink.SetCaption(const Value: string); +begin + if IsCaptionLinked then FClient.Caption := Value; +end; + +procedure TTBCustomItemActionLink.SetChecked(Value: Boolean); +begin + if IsCheckedLinked then FClient.Checked := Value; +end; + +procedure TTBCustomItemActionLink.SetEnabled(Value: Boolean); +begin + if IsEnabledLinked then FClient.Enabled := Value; +end; + +procedure TTBCustomItemActionLink.SetHelpContext(Value: THelpContext); +begin + if IsHelpContextLinked then FClient.HelpContext := Value; +end; + +procedure TTBCustomItemActionLink.SetHint(const Value: string); +begin + if IsHintLinked then FClient.Hint := Value; +end; + +procedure TTBCustomItemActionLink.SetImageIndex(Value: Integer); +begin + if IsImageIndexLinked then FClient.ImageIndex := Value; +end; + +procedure TTBCustomItemActionLink.SetShortCut(Value: TShortCut); +begin + if IsShortCutLinked then FClient.ShortCut := Value; +end; + +procedure TTBCustomItemActionLink.SetVisible(Value: Boolean); +begin + if IsVisibleLinked then FClient.Visible := Value; +end; + +procedure TTBCustomItemActionLink.SetOnExecute(Value: TNotifyEvent); +begin + if IsOnExecuteLinked then FClient.OnClick := Value; +end; + + +{ TTBCustomItem } + +{}function ItemContainingItems(const AItem: TTBCustomItem): TTBCustomItem; +begin + if Assigned(AItem) and Assigned(AItem.FLinkSubitems) then + Result := AItem.FLinkSubitems + else + Result := AItem; +end; + +constructor TTBCustomItem.Create(AOwner: TComponent); +begin + inherited; + FEnabled := True; + FImageIndex := -1; + FInheritOptions := True; + FItemStyle := [tbisSelectable, tbisRedrawOnSelChange, tbisRedrawOnMouseOverChange]; + FVisible := True; + ReferenceClickWnd; +end; + +destructor TTBCustomItem.Destroy; +var + I: Integer; +begin + Destroying; + RemoveFromClickList(Self); + { Changed in 0.33. Moved FParent.Remove call *after* the child items are + deleted. } + for I := Count-1 downto 0 do + Items[I].Free; + if Assigned(FParent) then + FParent.Remove(Self); + FreeAndNil(FItems); + FActionLink.Free; + FActionLink := nil; + FreeAndNil(FSubMenuImagesChangeLink); + FreeAndNil(FImagesChangeLink); + inherited; + if Assigned(FNotifyList) then begin + for I := FNotifyList.Count-1 downto 0 do + TItemChangedNotificationData(FNotifyList[I]).Free; + FNotifyList.Free; + end; + FLinkParents.Free; + ReleaseClickWnd; +end; + +{$IFDEF JR_D6} +function TTBCustomItem.IsAutoCheckStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsAutoCheckLinked; +end; +{$ENDIF} + +function TTBCustomItem.IsCaptionStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsCaptionLinked; +end; + +function TTBCustomItem.IsCheckedStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsCheckedLinked; +end; + +function TTBCustomItem.IsEnabledStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsEnabledLinked; +end; + +function TTBCustomItem.IsHintStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsHintLinked; +end; + +function TTBCustomItem.IsHelpContextStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsHelpContextLinked; +end; + +function TTBCustomItem.IsImageIndexStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsImageIndexLinked; +end; + +function TTBCustomItem.IsShortCutStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsShortCutLinked; +end; + +function TTBCustomItem.IsVisibleStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsVisibleLinked; +end; + +function TTBCustomItem.IsOnClickStored: Boolean; +begin + Result := (ActionLink = nil) or not FActionLink.IsOnExecuteLinked; +end; + +function TTBCustomItem.GetAction: TBasicAction; +begin + if FActionLink <> nil then + Result := FActionLink.Action + else + Result := nil; +end; + +function TTBCustomItem.GetActionLinkClass: TTBCustomItemActionLinkClass; +begin + Result := TTBCustomItemActionLink; +end; + +procedure TTBCustomItem.DoActionChange(Sender: TObject); +begin + if Sender = Action then ActionChange(Sender, False); +end; + +procedure TTBCustomItem.ActionChange(Sender: TObject; CheckDefaults: Boolean); +begin + if Action is TCustomAction then + with TCustomAction(Sender) do + begin + {$IFDEF JR_D6} + if not CheckDefaults or (Self.AutoCheck = False) then + Self.AutoCheck := AutoCheck; + {$ENDIF} + if not CheckDefaults or (Self.Caption = '') then + Self.Caption := Caption; + if not CheckDefaults or (Self.Checked = False) then + Self.Checked := Checked; + if not CheckDefaults or (Self.Enabled = True) then + Self.Enabled := Enabled; + if not CheckDefaults or (Self.HelpContext = 0) then + Self.HelpContext := HelpContext; + if not CheckDefaults or (Self.Hint = '') then + Self.Hint := Hint; + if not CheckDefaults or (Self.ImageIndex = -1) then + Self.ImageIndex := ImageIndex; + if not CheckDefaults or (Self.ShortCut = scNone) then + Self.ShortCut := ShortCut; + if not CheckDefaults or (Self.Visible = True) then + Self.Visible := Visible; + if not CheckDefaults or not Assigned(Self.OnClick) then + Self.OnClick := OnExecute; + end; +end; + +procedure TTBCustomItem.SetAction(Value: TBasicAction); +begin + if Value = nil then begin + FActionLink.Free; + FActionLink := nil; + end + else begin + if FActionLink = nil then + FActionLink := GetActionLinkClass.Create(Self); + FActionLink.Action := Value; + FActionLink.OnChange := DoActionChange; + { Note: Delphi's Controls.pas and Menus.pas merely check for + "csLoading in Value.ComponentState" here. But that doesn't help when + the Action property references an action on another form / data module + that has already finished loading. So we check two things: + 1. csLoading in Value.ComponentState + 2. csLoading in ComponentState + In the typical case where the item and action list reside on the same + form, #1 and #2 are both true. + Only #1 is true when Action references an action on another form / data + module that is created *after* the item (e.g. if Form1.TBItem1.Action = + Form2.Action1, and Form1 is created before Form2). + Only #2 is true when Action references an action on another form / data + module that is created *before* the item (e.g. if Form2.TBItem1.Action = + Form1.Action1, and Form1 is created before Form2). } + ActionChange(Value, (csLoading in Value.ComponentState) or + (csLoading in ComponentState)); + Value.FreeNotification(Self); + end; +end; + +procedure TTBCustomItem.InitiateAction; +begin + if FActionLink <> nil then FActionLink.Update; +end; + +procedure TTBCustomItem.Loaded; +begin + inherited; + if Action <> nil then ActionChange(Action, True); +end; + +procedure TTBCustomItem.GetChildren(Proc: TGetChildProc; Root: TComponent); +var + I: Integer; +begin + for I := 0 to Count-1 do + Proc(Items[I]); +end; + +procedure TTBCustomItem.SetChildOrder(Child: TComponent; Order: Integer); +var + I: Integer; +begin + I := IndexOf(Child as TTBCustomItem); + if I <> -1 then + Move(I, Order); +end; + +function TTBCustomItem.HasParent: Boolean; +begin + Result := True; +end; + +function TTBCustomItem.GetParentComponent: TComponent; +begin + if (FParent <> nil) and (FParent.FParentComponent <> nil) then + Result := FParent.FParentComponent + else + Result := FParent; +end; + +procedure TTBCustomItem.SetName(const NewName: TComponentName); +begin + if Name <> NewName then begin + inherited; + if Assigned(FParent) then + FParent.Notify(tbicNameChanged, -1, Self); + end; +end; + +procedure TTBCustomItem.SetParentComponent(Value: TComponent); +var + RootItem: TTBCustomItem; +begin + if FParent <> nil then FParent.Remove(Self); + if Value <> nil then begin + RootItem := TBGetItems(Value); + if Assigned(RootItem) then + RootItem.Add(Self) + else + raise ETBItemError.CreateFmt(STBToolbarItemParentInvalid, [Value.ClassName]); + end; +end; + +procedure TTBCustomItem.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if Operation = opRemove then begin + RemoveFromList(FLinkParents, AComponent); + if AComponent = Action then Action := nil; + if AComponent = Images then Images := nil; + if AComponent = SubMenuImages then SubMenuImages := nil; + if AComponent = LinkSubitems then LinkSubitems := nil; + end; +end; + +class procedure TTBCustomItem.IndexError; +begin + raise ETBItemError.Create(STBToolbarIndexOutOfBounds); +end; + +class procedure TTBCustomItem.ClickWndProc(var Message: TMessage); +var + List: TList; + I: Integer; + Item: TObject; +begin + if Message.Msg = WM_TB2K_CLICKITEM then begin + List := ClickList; { optimization... } + if Assigned(List) then begin + I := ClipToLongint(Message.LParam); + if (I >= 0) and (I < List.Count) then begin + Item := List[I]; + List[I] := nil; + { If the item value is set to ClickList, then it was 'removed' from + the list by RemoveFromClickList } + if Item = List then + Item := nil; + end + else + Item := nil; + + { Remove trailing nil items from ClickList. This is not *necessary*, but + it will make RemoveFromClickList faster if we clean out items that + aren't used, and may never be used again. } + for I := List.Count-1 downto 0 do begin + if List[I] = nil then + List.Delete(I) + else + Break; + end; + + if Assigned(Item) then begin + try + if Item is TTBCustomItem then + TTBCustomItem(Item).Click + else if Item is TTBItemViewer then + TTBItemViewer(Item).AccSelect(Message.WParam <> 0); + except + Application.HandleException(Item); + end; + end; + end; + end + else + with Message do + Result := DefWindowProc(ClickWnd, Msg, wParam, lParam); +end; + +procedure TTBCustomItem.PostClick; +{ Posts a message to the message queue that causes the item's Click handler to + be executed when control is returned to the message loop. + This should be called instead of Click when a WM_SYSCOMMAND message is + (possibly) currently being handled, because TApplication.WndProc's + CM_APPSYSCOMMAND handler disables the VCL's processing of focus messages + until the Perform(WM_SYSCOMMAND, ...) call returns. (An OnClick handler which + calls TForm.ShowModal needs focus messages to be enabled or else the form + will be shown with no initial focus.) } +begin + QueueClick(Self, 0); +end; + +procedure TTBCustomItem.Click; +begin + if Enabled then begin + { Following code based on D6's TMenuItem.Click } + {$IFDEF JR_D6} + if (not Assigned(ActionLink) and AutoCheck) or + (Assigned(ActionLink) and not ActionLink.IsAutoCheckLinked and AutoCheck) then + {$ELSE} + if AutoCheck then + {$ENDIF} + Checked := not Checked; + { Following code based on D4's TControl.Click } + { Call OnClick if assigned and not equal to associated action's OnExecute. + If associated action's OnExecute assigned then call it, otherwise, call + OnClick. } + if Assigned(FOnClick) and (Action <> nil) and + {$IFNDEF CLR} + not MethodsEqual(TMethod(FOnClick), TMethod(Action.OnExecute)) then + {$ELSE} + (@FOnClick <> @Action.OnExecute) then + {$ENDIF} + FOnClick(Self) + else + if not(csDesigning in ComponentState) and (ActionLink <> nil) then + ActionLink.Execute {$IFDEF JR_D6}(Self){$ENDIF} + else + if Assigned(FOnClick) then + FOnClick(Self); + end; +end; + +function TTBCustomItem.GetCount: Integer; +begin + if FItems = nil then + Result := 0 + else + Result := FItems.Count; +end; + +function TTBCustomItem.GetItem(Index: Integer): TTBCustomItem; +begin + if (FItems = nil) or (Index < 0) or (Index >= FItems.Count) then begin + IndexError; + Result := nil; + Exit; + end; + Result := TTBCustomItem(FItems.List[Index]); +end; + +procedure TTBCustomItem.Add(AItem: TTBCustomItem); +begin + Insert(Count, AItem); +end; + +procedure TTBCustomItem.InternalNotify(Ancestor: TTBCustomItem; + NestingLevel: Integer; Action: TTBItemChangedAction; Index: Integer; + Item: TTBCustomItem); +{ Note: Ancestor is Item's parent, or in the case of a group item relayed + notification, it can also be a group item which *links* to Item's parent + (i.e. ItemContainingItems(Ancestor) = Item.Parent). } + + procedure RelayToParentOf(const AItem: TTBCustomItem); + begin + if NestingLevel > MaxGroupLevel then + Exit; + if (tbisEmbeddedGroup in AItem.ItemStyle) and Assigned(AItem.Parent) then begin + if Ancestor = Self then + AItem.Parent.InternalNotify(AItem, NestingLevel + 1, Action, Index, Item) + else + { Don't alter Ancestor on subsequent relays; only on the first. } + AItem.Parent.InternalNotify(Ancestor, NestingLevel + 1, Action, Index, Item); + end; + end; + +var + I: Integer; + P: TTBCustomItem; + SaveProc: TTBItemChangedProc; +begin + { If Self is a group item, relay the notification to the parent } + RelayToParentOf(Self); + { If any group items are linked to Self, relay the notification to + those items' parents } + if Assigned(FLinkParents) then + for I := 0 to FLinkParents.Count-1 do begin + P := TTBCustomItem(FLinkParents[I]); + if P <> Parent then + RelayToParentOf(P); + end; + if Assigned(FNotifyList) then begin + I := 0; + while I < FNotifyList.Count do begin + with TItemChangedNotificationData(FNotifyList[I]) do begin + SaveProc := Proc; + Proc(Ancestor, Ancestor <> Self, Action, Index, Item); + end; + { Is I now out of bounds? } + if I >= FNotifyList.Count then + Break; + { Only proceed to the next index if the list didn't change } + {$IFNDEF CLR} + if MethodsEqual(TMethod(TItemChangedNotificationData(FNotifyList[I]).Proc), + TMethod(SaveProc)) then + {$ELSE} + if @TItemChangedNotificationData(FNotifyList[I]).Proc = @SaveProc then + {$ENDIF} + Inc(I); + end; + end; +end; + +procedure TTBCustomItem.Notify(Action: TTBItemChangedAction; Index: Integer; + Item: TTBCustomItem); +begin + InternalNotify(Self, 0, Action, Index, Item); +end; + +procedure TTBCustomItem.ViewBeginUpdate; +begin + Notify(tbicSubitemsBeginUpdate, -1, nil); +end; + +procedure TTBCustomItem.ViewEndUpdate; +begin + Notify(tbicSubitemsEndUpdate, -1, nil); +end; + +procedure TTBCustomItem.Insert(NewIndex: Integer; AItem: TTBCustomItem); +begin + if Assigned(AItem.FParent) then + raise ETBItemError.Create(STBToolbarItemReinserted); + if (NewIndex < 0) or (NewIndex > Count) then IndexError; + if FItems = nil then + FItems := TList.Create; + FItems.Insert(NewIndex, AItem); + AItem.FParent := Self; + ViewBeginUpdate; + try + Notify(tbicInserted, NewIndex, AItem); + AItem.RefreshOptions; + finally + ViewEndUpdate; + end; +end; + +procedure TTBCustomItem.Delete(Index: Integer); +var + Item: TTBCustomItem; +begin + Item := Items[Index]; { will raise exception if out of range } + Notify(tbicDeleting, Index, Item); + Item.FParent := nil; + FItems.Delete(Index); +end; + +function TTBCustomItem.IndexOf(AItem: TTBCustomItem): Integer; +var + I: Integer; +begin + for I := 0 to Count-1 do + if FItems.List[I] = AItem then begin + Result := I; + Exit; + end; + Result := -1; +end; + +procedure TTBCustomItem.Remove(Item: TTBCustomItem); +var + I: Integer; +begin + I := IndexOf(Item); + //if I = -1 then raise ETBItemError.Create(STBToolbarItemNotFound); + if I <> -1 then + Delete(I); +end; + +procedure TTBCustomItem.Clear; +var + I: Integer; +begin + for I := Count-1 downto 0 do + Items[I].Free; +end; + +procedure TTBCustomItem.Move(CurIndex, NewIndex: Integer); +var + Item: TTBCustomItem; +begin + if CurIndex <> NewIndex then begin + if (NewIndex < 0) or (NewIndex >= Count) then IndexError; + Item := Items[CurIndex]; + ViewBeginUpdate; + try + Delete(CurIndex); + Insert(NewIndex, Item); + finally + ViewEndUpdate; + end; + end; +end; + +function TTBCustomItem.ContainsItem(AItem: TTBCustomItem): Boolean; +begin + while Assigned(AItem) and (AItem <> Self) do + AItem := AItem.Parent; + Result := Assigned(AItem); +end; + +procedure TTBCustomItem.RegisterNotification(ANotify: TTBItemChangedProc); +var + I: Integer; + Data: TItemChangedNotificationData; +begin + if FNotifyList = nil then FNotifyList := TList.Create; + for I := 0 to FNotifyList.Count-1 do + with TItemChangedNotificationData(FNotifyList[I]) do + {$IFNDEF CLR} + if MethodsEqual(TMethod(ANotify), TMethod(Proc)) then begin + {$ELSE} + if @ANotify = @Proc then begin + {$ENDIF} + Inc(RefCount); + Exit; + end; + FNotifyList.Expand; + Data := TItemChangedNotificationData.Create; + Data.Proc := ANotify; + Data.RefCount := 1; + FNotifyList.Add(Data); +end; + +procedure TTBCustomItem.UnregisterNotification(ANotify: TTBItemChangedProc); +var + I: Integer; + Data: TItemChangedNotificationData; +begin + if Assigned(FNotifyList) then + for I := 0 to FNotifyList.Count-1 do begin + Data := TItemChangedNotificationData(FNotifyList[I]); + {$IFNDEF CLR} + if MethodsEqual(TMethod(Data.Proc), TMethod(ANotify)) then begin + {$ELSE} + if @Data.Proc = @ANotify then begin + {$ENDIF} + Dec(Data.RefCount); + if Data.RefCount = 0 then begin + FNotifyList.Delete(I); + Data.Free; + if FNotifyList.Count = 0 then + FreeAndNil(FNotifyList); + end; + Break; + end; + end; +end; + +function TTBCustomItem.GetPopupWindowClass: TTBPopupWindowClass; +begin + Result := TTBPopupWindow; +end; + +procedure TTBCustomItem.DoPopup(Sender: TTBCustomItem; FromLink: Boolean); +begin + if Assigned(FOnPopup) then + FOnPopup(Sender, FromLink); + if not(tbisCombo in ItemStyle) then + Click; +end; + +var + PlayedSound: Boolean = False; + +function TTBCustomItem.CreatePopup(const ParentView: TTBView; + const ParentViewer: TTBItemViewer; const PositionAsSubmenu, SelectFirstItem, + Customizing: Boolean; const APopupPoint: TPoint; + const Alignment: TTBPopupAlignment): TTBPopupWindow; + + function CountObscured(X, Y, W, H: Integer): Integer; + var + I: Integer; + P: TPoint; + V: TTBItemViewer; + begin + Result := 0; + if ParentView = nil then + Exit; + P := ParentView.FWindow.ClientToScreen(Point(0, 0)); + Dec(X, P.X); + Dec(Y, P.Y); + Inc(W, X); + Inc(H, Y); + for I := 0 to ParentView.FViewers.Count-1 do begin + V := ParentView.Viewers[I]; + if V.Show and (V.BoundsRect.Left >= X) and (V.BoundsRect.Right <= W) and + (V.BoundsRect.Top >= Y) and (V.BoundsRect.Bottom <= H) then + Inc(Result); + end; + end; + +var + EventItem, ParentItem: TTBCustomItem; + Opposite: Boolean; + ChevronParentView: TTBView; + X, X2, Y, Y2, W, H: Integer; + P: TPoint; + RepeatCalcX: Boolean; + ParentItemRect: TRect; + MonitorRect: TRect; + AnimDir: TTBAnimationDirection; +begin + EventItem := ItemContainingItems(Self); + if EventItem <> Self then + EventItem.DoPopup(Self, True); + DoPopup(Self, False); + + ChevronParentView := GetChevronParentView; + if ChevronParentView = nil then + ParentItem := Self + else + ParentItem := ChevronParentView.FParentItem; + + Opposite := Assigned(ParentView) and (vsOppositePopup in ParentView.FState); + Result := GetPopupWindowClass.CreatePopupWindow(nil, ParentView, ParentItem, + Customizing); + try + if Assigned(ChevronParentView) then begin + ChevronParentView.FreeNotification(Result.View); + Result.View.FChevronParentView := ChevronParentView; + Result.View.FIsToolbar := True; + Result.View.Style := Result.View.Style + + (ChevronParentView.Style * [vsAlwaysShowHints]); + Result.Color := clBtnFace; + end; + + { Calculate ParentItemRect, and MonitorRect (the rectangle of the monitor + that the popup window will be confined to) } + if Assigned(ParentView) then begin + ParentView.ValidatePositions; + ParentItemRect := ParentViewer.BoundsRect; + P := ParentView.FWindow.ClientToScreen(Point(0, 0)); + OffsetRect(ParentItemRect, P.X, P.Y); + if not IsRectEmpty(ParentView.FMonitorRect) then + MonitorRect := ParentView.FMonitorRect + else + MonitorRect := GetRectOfMonitorContainingRect(ParentItemRect, False); + end + else begin + ParentItemRect.TopLeft := APopupPoint; + ParentItemRect.BottomRight := APopupPoint; + MonitorRect := GetRectOfMonitorContainingPoint(APopupPoint, False); + end; + Result.View.FMonitorRect := MonitorRect; + + { Initialize item positions and size of the popup window } + if ChevronParentView = nil then + Result.View.FMaxHeight := (MonitorRect.Bottom - MonitorRect.Top) - + (PopupMenuWindowNCSize * 2) + else + Result.View.WrapOffset := (MonitorRect.Right - MonitorRect.Left) - + (PopupMenuWindowNCSize * 2); + if SelectFirstItem then + Result.View.Selected := Result.View.FirstSelectable; + Result.View.UpdatePositions; + W := Result.Width; + H := Result.Height; + + { Calculate initial X,Y position of the popup window } + if Assigned(ParentView) then begin + if not PositionAsSubmenu then begin + if ChevronParentView = nil then begin + if (ParentView = nil) or (ParentView.FOrientation <> tbvoVertical) then begin + if GetSystemMetrics(SM_MENUDROPALIGNMENT) = 0 then + X := ParentItemRect.Left + else + X := ParentItemRect.Right - W; + Y := ParentItemRect.Bottom; + end + else begin + X := ParentItemRect.Left - W; + Y := ParentItemRect.Top; + end; + end + else begin + if ChevronParentView.FOrientation <> tbvoVertical then begin + X := ParentItemRect.Right - W; + Y := ParentItemRect.Bottom; + end + else begin + X := ParentItemRect.Left - W; + Y := ParentItemRect.Top; + end; + end; + end + else begin + X := ParentItemRect.Right - PopupMenuWindowNCSize; + Y := ParentItemRect.Top - PopupMenuWindowNCSize; + end; + end + else begin + X := APopupPoint.X; + Y := APopupPoint.Y; + case Alignment of + tbpaRight: Dec(X, W); + tbpaCenter: Dec(X, W div 2); + end; + end; + + { Adjust the Y position of the popup window } + { If the window is going off the bottom of the monitor, try placing it + above the parent item } + if (Y + H > MonitorRect.Bottom) and + ((ParentView = nil) or (ParentView.FOrientation <> tbvoVertical)) then begin + if not PositionAsSubmenu then + Y2 := ParentItemRect.Top + else + Y2 := ParentItemRect.Bottom + PopupMenuWindowNCSize; + Dec(Y2, H); + { Only place it above the parent item if it isn't going to go off the + top of the monitor } + if Y2 >= MonitorRect.Top then + Y := Y2; + end; + { If it's still going off the bottom (which can be possible if a menu bar + was off the screen to begin with), clip it to the bottom of the monitor } + if Y + H > MonitorRect.Bottom then + Y := MonitorRect.Bottom - H; + if Y < MonitorRect.Top then + Y := MonitorRect.Top; + + { Other adjustments to the position of the popup window } + if not PositionAsSubmenu then begin + if (ParentView = nil) and (Alignment = tbpaRight) and (X < MonitorRect.Left) then + Inc(X, W); + if X + W > MonitorRect.Right then begin + if Assigned(ParentView) or (Alignment <> tbpaLeft) then + X := MonitorRect.Right; + Dec(X, W); + end; + if X < MonitorRect.Left then + X := MonitorRect.Left; + if (ParentView = nil) or (ParentView.FOrientation <> tbvoVertical) then begin + Y2 := ParentItemRect.Top - H; + if Y2 >= MonitorRect.Top then begin + { Would the popup window obscure less items if it popped out to the + top instead? } + if (CountObscured(X, Y2, W, H) < CountObscured(X, Y, W, H)) or + ((Y < ParentItemRect.Bottom) and (Y + H > ParentItemRect.Top) and + (X < ParentItemRect.Right) and (X + W > ParentItemRect.Left)) then + Y := Y2; + end; + { Make sure a tall popup window doesn't overlap the parent item } + if (Y < ParentItemRect.Bottom) and (Y + H > ParentItemRect.Top) and + (X < ParentItemRect.Right) and (X + W > ParentItemRect.Left) then begin + if ParentItemRect.Right + W <= MonitorRect.Right then + X := ParentItemRect.Right + else + X := ParentItemRect.Left - W; + if X < MonitorRect.Top then + X := MonitorRect.Top; + end; + end + else begin + X2 := ParentItemRect.Right; + if X2 + W <= MonitorRect.Right then begin + { Would the popup window obscure less items if it popped out to the + right instead? } + if (CountObscured(X2, Y, W, H) < CountObscured(X, Y, W, H)) or + ((Y < ParentItemRect.Bottom) and (Y + H > ParentItemRect.Top) and + (X < ParentItemRect.Right) and (X + W > ParentItemRect.Left)) then + X := X2; + end; + { Make sure a wide popup window doesn't overlap the parent item } + if (Y < ParentItemRect.Bottom) and (Y + H > ParentItemRect.Top) and + (X < ParentItemRect.Right) and (X + W > ParentItemRect.Left) then begin + if ParentItemRect.Bottom + H <= MonitorRect.Bottom then + Y := ParentItemRect.Bottom + else + Y := ParentItemRect.Top - H; + if Y < MonitorRect.Top then + Y := MonitorRect.Top; + end; + end; + end + else begin + { Make nested submenus go from left to right on the screen. Each it + runs out of space on the screen, switch directions } + repeat + RepeatCalcX := False; + X2 := X; + if Opposite or (X2 + W > MonitorRect.Right) then begin + if Assigned(ParentView) then + X2 := ParentItemRect.Left + PopupMenuWindowNCSize; + Dec(X2, W); + if not Opposite then + Include(Result.View.FState, vsOppositePopup) + else begin + if X2 < MonitorRect.Left then begin + Opposite := False; + RepeatCalcX := True; + end + else + Include(Result.View.FState, vsOppositePopup); + end; + end; + until not RepeatCalcX; + X := X2; + if X < MonitorRect.Left then + X := MonitorRect.Left; + end; + + { Determine animation direction } + AnimDir := []; + if not PositionAsSubmenu then begin + if Y >= ParentItemRect.Bottom then + Include(AnimDir, tbadDown) + else if Y + H <= ParentItemRect.Top then + Include(AnimDir, tbadUp); + if X >= ParentItemRect.Right then + Include(AnimDir, tbadRight) + else if X + W <= ParentItemRect.Left then + Include(AnimDir, tbadLeft); + end + else begin + if X + W div 2 >= ParentItemRect.Left + (ParentItemRect.Right - ParentItemRect.Left) div 2 then + Include(AnimDir, tbadRight) + else + Include(AnimDir, tbadLeft); + end; + Result.FAnimationDirection := AnimDir; + + Result.SetBounds(X, Y, W, H); + if Assigned(ParentView) then begin + Result.FreeNotification(ParentView); + ParentView.FOpenViewerWindow := Result; + ParentView.FOpenViewerView := Result.View; + ParentView.FOpenViewer := ParentViewer; + if ParentView.FIsToolbar then begin + Include(ParentView.FState, vsDropDownMenus); + ParentView.Invalidate(ParentViewer); + ParentView.FWindow.Update; + end; + end; + Include(Result.View.FState, vsDrawInOrder); + if not NeedToPlaySound('MenuPopup') then begin + { Don't call PlaySound if we don't have to } + Result.Visible := True; + end + else begin + if not PlayedSound then begin + { Work around Windows 2000 "bug" where there's a 1/3 second delay upon the + first call to PlaySound (or sndPlaySound) by painting the window + completely first. This way the delay isn't very noticable. } + PlayedSound := True; + Result.Visible := True; + Result.Update; + PlaySystemSound('MenuPopup'); + end + else begin + PlaySystemSound('MenuPopup'); + Result.Visible := True; + end; + end; + CallNotifyWinEvent(EVENT_SYSTEM_MENUPOPUPSTART, Result.View.FWindow.Handle, + OBJID_CLIENT, CHILDID_SELF); + { Call NotifyFocusEvent now that the window is visible } + if Assigned(Result.View.Selected) then + Result.View.NotifyFocusEvent; + except + Result.Free; + raise; + end; +end; + +function TTBCustomItem.OpenPopup(const SelectFirstItem, TrackRightButton: Boolean; + const PopupPoint: TPoint; const Alignment: TTBPopupAlignment; + const ReturnClickedItemOnly: Boolean): TTBCustomItem; +var + ModalHandler: TTBModalHandler; + Popup: TTBPopupWindow; + DoneActionData: TTBDoneActionData; +begin + ModalHandler := TTBModalHandler.Create(0); + try + Popup := CreatePopup(nil, nil, False, SelectFirstItem, False, PopupPoint, + Alignment); + try + Include(Popup.View.FState, vsIgnoreFirstMouseUp); + ModalHandler.RootPopup := Popup; + ModalHandler.Loop(Popup.View, False, False, False, TrackRightButton); + DoneActionData := Popup.View.FDoneActionData; + finally + ModalHandler.RootPopup := nil; + { Remove vsModal state from the root view before any TTBView.Destroy + methods get called, so that NotifyFocusEvent becomes a no-op } + Exclude(Popup.View.FState, vsModal); + Popup.Free; + end; + finally + ModalHandler.Free; + end; + Result := ProcessDoneAction(DoneActionData, ReturnClickedItemOnly); +end; + +function TTBCustomItem.Popup(X, Y: Integer; TrackRightButton: Boolean; + Alignment: TTBPopupAlignment = tbpaLeft; + ReturnClickedItemOnly: Boolean = False): TTBCustomItem; +var + P: TPoint; +begin + P.X := X; + P.Y := Y; + Result := OpenPopup(False, TrackRightButton, P, Alignment, + ReturnClickedItemOnly); +end; + +function TTBCustomItem.FindItemWithShortCut(AShortCut: TShortCut; + var ATopmostParent: TTBCustomItem): TTBCustomItem; + + function DoItem(AParentItem: TTBCustomItem; LinkDepth: Integer): TTBCustomItem; + var + I: Integer; + NewParentItem, Item: TTBCustomItem; + begin + Result := nil; + NewParentItem := AParentItem; + if Assigned(NewParentItem.LinkSubitems) then begin + NewParentItem := NewParentItem.LinkSubitems; + Inc(LinkDepth); + if LinkDepth > 25 then + Exit; { prevent infinite link recursion } + end; + for I := 0 to NewParentItem.Count-1 do begin + Item := NewParentItem.Items[I]; + if Item.ShortCut = AShortCut then begin + Result := Item; + Exit; + end; + Result := DoItem(Item, LinkDepth); + if Assigned(Result) then begin + ATopmostParent := Item; + Exit; + end; + end; + end; + +begin + ATopmostParent := nil; + Result := DoItem(Self, 0); +end; + +function TTBCustomItem.IsShortCut(var Message: TWMKey): Boolean; +var + ShortCut: TShortCut; + ShiftState: TShiftState; + ShortCutItem, TopmostItem, Item, EventItem: TTBCustomItem; + I: Integer; +label StartOver; +begin + Result := False; + ShiftState := KeyDataToShiftState(ClipToLongint(Message.KeyData)); + ShortCut := Menus.ShortCut(Message.CharCode, ShiftState); +StartOver: + ShortCutItem := FindItemWithShortCut(ShortCut, TopmostItem); + if Assigned(ShortCutItem) then begin + { Send OnPopup/OnClick events to ShortCutItem's parents so that they can + update the Enabled state of ShortCutItem if needed } + Item := Self; + repeat + if not Item.Enabled then + Exit; + EventItem := ItemContainingItems(Item); + if not(csDesigning in ComponentState) then begin + for I := 0 to EventItem.Count-1 do + EventItem.Items[I].InitiateAction; + end; + if not(tbisEmbeddedGroup in Item.ItemStyle) then begin + if EventItem <> Item then begin + try + EventItem.DoPopup(Item, True); + except + Application.HandleException(Self); + end; + end; + try + Item.DoPopup(Item, False); + except + Application.HandleException(Self); + end; + end; + ShortCutItem := Item.FindItemWithShortCut(ShortCut, TopmostItem); + if ShortCutItem = nil then + { Can no longer find the shortcut inside TopmostItem. Start over + because the shortcut might have moved. } + goto StartOver; + Item := TopmostItem; + until Item = nil; + if ShortCutItem.Enabled then begin + try + ShortCutItem.Click; + except + Application.HandleException(Self); + end; + Result := True; + end; + end; +end; + +function TTBCustomItem.GetChevronParentView: TTBView; +begin + Result := nil; +end; + +function TTBCustomItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TTBItemViewer; +end; + +function TTBCustomItem.NeedToRecreateViewer(AViewer: TTBItemViewer): Boolean; +begin + Result := False; +end; + +function TTBCustomItem.GetItemStyle: TTBItemStyle; +begin + { This public method exists for TB2DsgnItemEditor. It needs access to + ItemStyle but can't access a protected member across assembly boundaries. } + Result := FItemStyle; +end; + +function TTBCustomItem.GetShortCutText: String; +var + P: Integer; +begin + P := Pos(#9, Caption); + if P = 0 then begin + if ShortCut <> 0 then + Result := ShortCutToText(ShortCut) + else + Result := ''; + end + else + Result := Copy(Caption, P+1, Maxint); +end; + +procedure TTBCustomItem.Change(NeedResize: Boolean); +const + ItemChangedActions: array[Boolean] of TTBItemChangedAction = + (tbicInvalidate, tbicInvalidateAndResize); +begin + if Assigned(FParent) then + FParent.Notify(ItemChangedActions[NeedResize], -1, Self); +end; + +procedure TTBCustomItem.RecreateItemViewers; +begin + if Assigned(FParent) then + FParent.Notify(tbicRecreateItemViewers, -1, Self); +end; + +procedure TTBCustomItem.ImageListChangeHandler(Sender: TObject); +var + Resize: Boolean; +begin + if Sender = FSubMenuImages then begin + FSubMenuImagesChangeLink.FLastWidth := FSubMenuImages.Width; + FSubMenuImagesChangeLink.FLastHeight := FSubMenuImages.Height; + SubMenuImagesChanged; + end + else begin + { Sender is FImages } + Resize := False; + if (FImagesChangeLink.FLastWidth <> FImages.Width) or + (FImagesChangeLink.FLastHeight <> FImages.Height) then begin + FImagesChangeLink.FLastWidth := FImages.Width; + FImagesChangeLink.FLastHeight := FImages.Height; + Resize := True; + end; + Change(Resize); + end; +end; + +procedure TTBCustomItem.SubMenuImagesChanged; +begin + Notify(tbicSubMenuImagesChanged, -1, nil); +end; + +procedure TTBCustomItem.TurnSiblingsOff; +var + I: Integer; + Item: TTBCustomItem; +begin + if (GroupIndex <> 0) and Assigned(FParent) then begin + for I := 0 to FParent.Count-1 do begin + Item := FParent[I]; + if (Item <> Self) and (Item.GroupIndex = GroupIndex) then + Item.Checked := False; + end; + end; +end; + +procedure TTBCustomItem.SetCaption(Value: String); +begin + if FCaption <> Value then begin + FCaption := Value; + Change(True); + end; +end; + +procedure TTBCustomItem.SetChecked(Value: Boolean); +begin + if FChecked <> Value then begin + FChecked := Value; + Change(False); + if Value then + TurnSiblingsOff; + end; +end; + +procedure TTBCustomItem.SetDisplayMode(Value: TTBItemDisplayMode); +begin + if FDisplayMode <> Value then begin + FDisplayMode := Value; + Change(True); + end; +end; + +procedure TTBCustomItem.EnabledChanged; +begin + Change(False); +end; + +procedure TTBCustomItem.SetEnabled(Value: Boolean); +begin + if FEnabled <> Value then begin + FEnabled := Value; + EnabledChanged; + end; +end; + +procedure TTBCustomItem.SetGroupIndex(Value: Integer); +begin + if FGroupIndex <> Value then begin + FGroupIndex := Value; + if Checked then + TurnSiblingsOff; + end; +end; + +procedure TTBCustomItem.SetImageIndex(Value: TImageIndex); +var + HadNoImage: Boolean; +begin + if FImageIndex <> Value then begin + HadNoImage := FImageIndex = -1; + FImageIndex := Value; + Change(HadNoImage xor (Value = -1)); + end; +end; + +function TTBCustomItem.ChangeImages(var AImages: TCustomImageList; + const Value: TCustomImageList; var AChangeLink: TTBImageChangeLink): Boolean; +{ Returns True if image list was resized } +var + LastWidth, LastHeight: Integer; +begin + Result := False; + LastWidth := -1; + LastHeight := -1; + if Assigned(AImages) then begin + LastWidth := AImages.Width; + LastHeight := AImages.Height; + AImages.UnregisterChanges(AChangeLink); + if Value = nil then begin + AChangeLink.Free; + AChangeLink := nil; + Result := True; + end; + end; + AImages := Value; + if Assigned(Value) then begin + Result := (Value.Width <> LastWidth) or (Value.Height <> LastHeight); + if AChangeLink = nil then begin + AChangeLink := TTBImageChangeLink.Create; + AChangeLink.FLastWidth := Value.Width; + AChangeLink.FLastHeight := Value.Height; + AChangeLink.OnChange := ImageListChangeHandler; + end; + Value.RegisterChanges(AChangeLink); + Value.FreeNotification(Self); + end; +end; + +procedure TTBCustomItem.SetImages(Value: TCustomImageList); +begin + if FImages <> Value then + Change(ChangeImages(FImages, Value, FImagesChangeLink)); +end; + +procedure TTBCustomItem.SetSubMenuImages(Value: TCustomImageList); +begin + if FSubMenuImages <> Value then begin + ChangeImages(FSubMenuImages, Value, FSubMenuImagesChangeLink); + SubMenuImagesChanged; + end; +end; + +procedure TTBCustomItem.SetInheritOptions(Value: Boolean); +begin + if FInheritOptions <> Value then begin + FInheritOptions := Value; + RefreshOptions; + end; +end; + +procedure TTBCustomItem.SetLinkSubitems(Value: TTBCustomItem); +begin + if Value = Self then + Value := nil; + if FLinkSubitems <> Value then begin + if Assigned(FLinkSubitems) then + RemoveFromList(FLinkSubitems.FLinkParents, Self); + FLinkSubitems := Value; + if Assigned(Value) then begin + Value.FreeNotification(Self); + AddToList(Value.FLinkParents, Self); + end; + Notify(tbicSubitemsChanged, -1, nil); + end; +end; + +function TTBCustomItem.FixOptions(const AOptions: TTBItemOptions): TTBItemOptions; +begin + Result := AOptions; + if not(tboToolbarStyle in Result) then + Exclude(Result, tboToolbarSize); +end; + +procedure TTBCustomItem.RefreshOptions; +const + NonInheritedOptions = [tboDefault]; + ChangeOptions = [tboDefault, tboDropdownArrow, tboImageAboveCaption, + tboNoRotation, tboSameWidth, tboToolbarStyle, tboToolbarSize]; +var + OldOptions, NewOptions: TTBItemOptions; + I: Integer; + Item: TTBCustomItem; +begin + OldOptions := FEffectiveOptions; + if FInheritOptions and Assigned(FParent) then + NewOptions := FParent.FEffectiveOptions - NonInheritedOptions + else + NewOptions := []; + NewOptions := FixOptions(NewOptions - FMaskOptions + FOptions); + if FEffectiveOptions <> NewOptions then begin + FEffectiveOptions := NewOptions; + if (OldOptions * ChangeOptions) <> (NewOptions * ChangeOptions) then + Change(True); + for I := 0 to Count-1 do begin + Item := Items[I]; + if Item.FInheritOptions then + Item.RefreshOptions; + end; + end; +end; + +procedure TTBCustomItem.SetMaskOptions(Value: TTBItemOptions); +begin + if FMaskOptions <> Value then begin + FMaskOptions := Value; + RefreshOptions; + end; +end; + +procedure TTBCustomItem.SetOptions(Value: TTBItemOptions); +begin + Value := FixOptions(Value); + if FOptions <> Value then begin + FOptions := Value; + RefreshOptions; + end; +end; + +procedure TTBCustomItem.SetRadioItem(Value: Boolean); +begin + if FRadioItem <> Value then begin + FRadioItem := Value; + Change(False); + end; +end; + +procedure TTBCustomItem.SetVisible(Value: Boolean); +begin + if FVisible <> Value then begin + FVisible := Value; + Change(True); + end; +end; + + +{ TTBGroupItem } + +constructor TTBGroupItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle + [tbisEmbeddedGroup, tbisSubitemsEditable]; +end; + + +{ TTBSubmenuItem } + +constructor TTBSubmenuItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle + [tbisSubMenu, tbisSubitemsEditable]; +end; + +function TTBSubmenuItem.GetDropdownCombo: Boolean; +begin + Result := tbisCombo in ItemStyle; +end; + +procedure TTBSubmenuItem.SetDropdownCombo(Value: Boolean); +begin + if (tbisCombo in ItemStyle) <> Value then begin + if Value then + ItemStyle := ItemStyle + [tbisCombo] + else + ItemStyle := ItemStyle - [tbisCombo]; + Change(True); + end; +end; + + +{ TTBSeparatorItem } + +constructor TTBSeparatorItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle - [tbisSelectable, tbisRedrawOnSelChange, + tbisRedrawOnMouseOverChange] + [tbisSeparator, tbisClicksTransparent]; +end; + +function TTBSeparatorItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TTBSeparatorItemViewer; +end; + +procedure TTBSeparatorItem.SetBlank(Value: Boolean); +begin + if FBlank <> Value then begin + FBlank := Value; + Change(False); + end; +end; + + +{ TTBSeparatorItemViewer } + +procedure TTBSeparatorItemViewer.CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); +begin + if not IsToolbarStyle then + { Office 2000's menu separators have a hard-coded height of 10 } + AHeight := 10 + else begin + AWidth := 6; + AHeight := 6; + end; +end; + +procedure TTBSeparatorItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); +var + DC: HDC; + R: TRect; + ToolbarStyle, Horiz, LineSep: Boolean; +begin + DC := Canvas.Handle; + if TTBSeparatorItem(Item).FBlank then + Exit; + + R := ClientAreaRect; + ToolbarStyle := IsToolbarStyle; + Horiz := not ToolbarStyle or (View.FOrientation = tbvoVertical); + LineSep := tbisLineSep in State; + if LineSep then + Horiz := not Horiz; + if Horiz then begin + R.Top := R.Bottom div 2 - 1; + if not ToolbarStyle then + InflateRect(R, -tbMenuSeparatorOffset, 0) + else if LineSep then begin + if View.FOrientation = tbvoFloating then + InflateRect(R, -tbLineSepOffset, 0) + else + InflateRect(R, -tbDockedLineSepOffset, 0); + end; + DrawEdge(DC, R, EDGE_ETCHED, BF_TOP); + end + else begin + R.Left := R.Right div 2 - 1; + if LineSep then + InflateRect(R, 0, -tbDockedLineSepOffset); + DrawEdge(DC, R, EDGE_ETCHED, BF_LEFT); + end; +end; + +function TTBSeparatorItemViewer.UsesSameWidth: Boolean; +begin + Result := False; +end; + + +{ TTBControlItem } + +constructor TTBControlItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle - [tbisSelectable] + [tbisClicksTransparent]; +end; + +destructor TTBControlItem.Destroy; +begin + inherited; + { Free the associated control *after* the item is completely destroyed } + if not FDontFreeControl and Assigned(FControl) and + not(csAncestor in FControl.ComponentState) then + FControl.Free; +end; + +procedure TTBControlItem.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = FControl) then + Control := nil; +end; + +procedure TTBControlItem.SetControl(Value: TControl); +begin + if FControl <> Value then begin + FControl := Value; + if Assigned(Value) then + Value.FreeNotification(Self); + Change(True); + end; +end; + + +{ TTBItemViewer } + +constructor TTBItemViewer.Create(AView: TTBView; AItem: TTBCustomItem; + AGroupLevel: Integer); +begin + inherited Create; + FItem := AItem; + FView := AView; + FGroupLevel := AGroupLevel; + ReferenceClickWnd; +end; + +destructor TTBItemViewer.Destroy; +begin + RemoveFromClickList(Self); + if Assigned(FAccObjectInstance) then begin + FAccObjectInstance.ClientIsDestroying; + FAccObjectInstance := nil; + end; + inherited; + ReleaseClickWnd; +end; + +function TTBItemViewer.GetAccObject: TTBBaseAccObject; +begin + if FAccObjectInstance = nil then begin + if not InitializeOleAcc then begin + Result := nil; + Exit; + end; + FAccObjectInstance := TTBItemViewerAccObject.Create(Self); + end; + Result := FAccObjectInstance; +end; + +procedure TTBItemViewer.AccSelect(const AExecute: Boolean); +{ Called by ClickWndProc when an item of type TTBItemViewer is in ClickList } +var + Obj: {$IFNDEF CLR} IDispatch {$ELSE} TTBBaseAccObject {$ENDIF}; +begin + { Ensure FAccObjectInstance is created by calling GetAccObject. Store the + reference as an interface so that the object will be destroyed when we + exit if it's no longer used. } + Obj := GetAccObject; + if Assigned(Obj) then + (FAccObjectInstance as TTBItemViewerAccObject).HandleAccSelect(AExecute); +end; + +procedure TTBItemViewer.PostAccSelect(const AExecute: Boolean); +{ Internally called by TTBItemViewerAccObject. Don't call directly. } +begin + QueueClick(Self, Ord(AExecute)); +end; + +function TTBItemViewer.IsAccessible: Boolean; +{ Returns True if MSAA clients should know about the viewer, specifically + if it's either shown, off-edge, or clipped (in other words, not completely + invisible/inaccessible). } +begin + { Note: Can't simply check Item.Visible because the chevron item's Visible + property is always True } + Result := Show or OffEdge or Clipped; +end; + +function TTBItemViewer.GetCaptionText: String; +var + P: Integer; +begin + Result := Item.Caption; + P := Pos(#9, Result); + if P <> 0 then + SetLength(Result, P-1); +end; + +function TTBItemViewer.GetHintText: String; +begin + Result := GetShortHint(Item.Hint); + { If there is no short hint, use the caption for the hint. Like Office, + strip any trailing colon or ellipsis. } + if (Result = '') and not(tboNoAutoHint in Item.EffectiveOptions) and + (not(tbisSubmenu in Item.ItemStyle) or (tbisCombo in Item.ItemStyle) or + not CaptionShown) then + Result := StripAccelChars(StripTrailingPunctuation(GetCaptionText)); + { Call associated action's OnHint event handler to post-process the hint } + if Assigned(Item.ActionLink) and + (Item.ActionLink.Action is TCustomAction) then begin + if not TCustomAction(Item.ActionLink.Action).DoHint(Result) then + Result := ''; + { Note: TControlActionLink.DoShowHint actually misinterprets the result + of DoHint, but we get it right... } + end; + { Add shortcut text } + if (Result <> '') and Application.HintShortCuts and + (Item.ShortCut <> scNone) then + Result := Format('%s (%s)', [Result, ShortCutToText(Item.ShortCut)]); +end; + +function TTBItemViewer.CaptionShown: Boolean; +begin + Result := (GetCaptionText <> '') and (not IsToolbarSize or + (Item.ImageIndex < 0) or (Item.DisplayMode in [nbdmTextOnly, nbdmImageAndText])) or + (tboImageAboveCaption in Item.EffectiveOptions); +end; + +function TTBItemViewer.ImageShown: Boolean; +begin + {}{should also return false if Images=nil (use UsedImageList?)} + ImageShown := (Item.ImageIndex >= 0) and + ((Item.DisplayMode in [nbdmDefault, nbdmImageAndText]) or + (IsToolbarStyle and (Item.DisplayMode = nbdmTextOnlyInMenus))); +end; + +function TTBItemViewer.GetImageList: TCustomImageList; +var + V: TTBView; +begin + Result := Item.Images; + if Assigned(Result) then + Exit; + V := View; + repeat + if Assigned(V.FCurParentItem) then begin + Result := V.FCurParentItem.SubMenuImages; + if Assigned(Result) then + Break; + end; + if Assigned(V.FParentItem) then begin + Result := V.FParentItem.SubMenuImages; + if Assigned(Result) then + Break; + end; + V := V.FParentView; + until V = nil; +end; + +function TTBItemViewer.IsRotated: Boolean; +{ Returns True if the caption should be drawn with rotated (vertical) text, + underneath the image } +begin + Result := (View.Orientation = tbvoVertical) and + not (tboNoRotation in Item.EffectiveOptions) and + not (tboImageAboveCaption in Item.EffectiveOptions); +end; + +procedure TTBItemViewer.CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); +var + ToolbarStyle: Boolean; + DC: HDC; + TextMetrics: TTextMetric; + H, LeftMargin: Integer; + ImgList: TCustomImageList; + S: String; + RotatedFont, SaveFont: HFONT; +begin + ToolbarStyle := IsToolbarStyle; + DC := Canvas.Handle; + ImgList := GetImageList; + if ToolbarStyle then begin + AWidth := 6; + AHeight := 6; + end + else begin + AWidth := 0; + AHeight := 0; + end; + if not ToolbarStyle or CaptionShown then begin + if not IsRotated then begin + GetTextMetrics(DC, TextMetrics); + Inc(AHeight, TextMetrics.tmHeight); + Inc(AWidth, GetTextWidth(DC, GetCaptionText, True)); + if ToolbarStyle then + Inc(AWidth, 6); + end + else begin + { Vertical text isn't always the same size as horizontal text, so we have + to select the rotated font into the DC to get an accurate size } + RotatedFont := CreateRotatedFont(DC); + SaveFont := SelectObject(DC, RotatedFont); + GetTextMetrics(DC, TextMetrics); + Inc(AWidth, TextMetrics.tmHeight); + Inc(AHeight, GetTextWidth(DC, GetCaptionText, True)); + if ToolbarStyle then + Inc(AHeight, 6); + SelectObject(DC, SaveFont); + DeleteObject(RotatedFont); + end; + end; + if ToolbarStyle and ImageShown and Assigned(ImgList) then begin + if not IsRotated and not(tboImageAboveCaption in Item.EffectiveOptions) then begin + Inc(AWidth, ImgList.Width + 1); + if AHeight < ImgList.Height + 6 then + AHeight := ImgList.Height + 6; + end + else begin + Inc(AHeight, ImgList.Height); + if AWidth < ImgList.Width + 7 then + AWidth := ImgList.Width + 7; + end; + end; + if ToolbarStyle and (tbisSubmenu in Item.ItemStyle) then begin + if tbisCombo in Item.ItemStyle then + Inc(AWidth, tbDropdownComboArrowWidth) + else + if tboDropdownArrow in Item.EffectiveOptions then begin + if View.Orientation <> tbvoVertical then + Inc(AWidth, tbDropdownArrowWidth) + else + Inc(AHeight, tbDropdownArrowWidth); + end; + end; + if not ToolbarStyle then begin + Inc(AHeight, TextMetrics.tmExternalLeading + tbMenuVerticalMargin); + if Assigned(ImgList) then begin + H := ImgList.Height + 3; + if H > AHeight then + AHeight := H; + LeftMargin := MulDiv(ImgList.Width + 3, AHeight, H); + end + else + LeftMargin := AHeight; + Inc(AWidth, LeftMargin + tbMenuImageTextSpace + tbMenuLeftTextMargin + + tbMenuRightTextMargin); + S := Item.GetShortCutText; + if S <> '' then + Inc(AWidth, (AHeight - 6) + GetTextWidth(DC, S, True)); + Inc(AWidth, AHeight); + end; +end; + +procedure TTBItemViewer.DrawItemCaption(const Canvas: TCanvas; ARect: TRect; + const ACaption: String; ADrawDisabledShadow: Boolean; AFormat: UINT); +var + DC: HDC; + + procedure Draw; + begin + if not IsRotated then + DrawTextStr(DC, ACaption, ARect, AFormat) + else + DrawRotatedText(DC, ACaption, ARect, AFormat); + end; + +var + ShadowColor, HighlightColor, SaveTextColor: DWORD; +begin + DC := Canvas.Handle; + if not ADrawDisabledShadow then + Draw + else begin + ShadowColor := GetSysColor(COLOR_BTNSHADOW); + HighlightColor := GetSysColor(COLOR_BTNHIGHLIGHT); + OffsetRect(ARect, 1, 1); + SaveTextColor := SetTextColor(DC, HighlightColor); + Draw; + OffsetRect(ARect, -1, -1); + SetTextColor(DC, ShadowColor); + Draw; + SetTextColor(DC, SaveTextColor); + end; +end; + +procedure TTBItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); +var + ShowEnabled, HasArrow: Boolean; + MenuCheckWidth, MenuCheckHeight: Integer; + + function GetDrawTextFlags: UINT; + begin + Result := 0; + if not AreKeyboardCuesEnabled and (vsUseHiddenAccels in View.FStyle) and + not(vsShowAccels in View.FState) then + Result := DT_HIDEPREFIX; + end; + + procedure DrawSubmenuArrow; + var + BR: TRect; + Bmp: TBitmap; + + procedure DrawWithColor(AColor: TColor); + const + ROP_DSPDxax = $00E20746; + var + DC: HDC; + SaveTextColor, SaveBkColor: TColorRef; + begin + Canvas.Brush.Color := AColor; + DC := Canvas.Handle; + SaveTextColor := SetTextColor(DC, clWhite); + SaveBkColor := SetBkColor(DC, clBlack); + BitBlt(DC, BR.Left, BR.Top, MenuCheckWidth, MenuCheckHeight, + Bmp.Canvas.Handle, 0, 0, ROP_DSPDxax); + SetBkColor(DC, SaveBkColor); + SetTextColor(DC, SaveTextColor); + Canvas.Brush.Style := bsClear; + end; + + begin + Bmp := TBitmap.Create; + try + Bmp.Monochrome := True; + Bmp.Width := MenuCheckWidth; + Bmp.Height := MenuCheckHeight; + BR := Rect(0, 0, MenuCheckWidth, MenuCheckHeight); + DrawFrameControl(Bmp.Canvas.Handle, BR, DFC_MENU, DFCS_MENUARROW); + OffsetRect(BR, ClientAreaRect.Right - MenuCheckWidth, + ClientAreaRect.Top + ((ClientAreaRect.Bottom - ClientAreaRect.Top) - MenuCheckHeight) div 2); + if not UseDisabledShadow then begin + if ShowEnabled and (tbisCombo in Item.ItemStyle) and IsSelected then begin + OffsetRect(BR, 1, 1); + DrawWithColor(clBtnText); + end + else + DrawWithColor(Canvas.Font.Color); + end + else begin + OffsetRect(BR, 1, 1); + DrawWithColor(clBtnHighlight); + OffsetRect(BR, -1, -1); + DrawWithColor(clBtnShadow); + end; + finally + Bmp.Free; + end; + end; + + procedure DrawDropdownArrow(R: TRect; Rotated: Boolean); + + procedure DrawWithColor(AColor: TColor); + var + X, Y: Integer; + P: array[0..2] of TPoint; + begin + X := (R.Left + R.Right) div 2; + Y := (R.Top + R.Bottom) div 2; + if not Rotated then begin + Dec(Y); + P[0].X := X-2; + P[0].Y := Y; + P[1].X := X+2; + P[1].Y := Y; + P[2].X := X; + P[2].Y := Y+2; + end + else begin + Dec(X); + P[0].X := X; + P[0].Y := Y+2; + P[1].X := X; + P[1].Y := Y-2; + P[2].X := X-2; + P[2].Y := Y; + end; + Canvas.Pen.Color := AColor; + Canvas.Brush.Color := AColor; + Canvas.Polygon(P); + end; + + begin + if not UseDisabledShadow then + DrawWithColor(Canvas.Font.Color) + else begin + OffsetRect(R, 1, 1); + DrawWithColor(clBtnHighlight); + OffsetRect(R, -1, -1); + DrawWithColor(clBtnShadow); + end; + end; + + function GetDitherBitmap: TBitmap; + begin + Result := AllocPatternBitmap(clBtnFace, clBtnHighlight); + Result.HandleType := bmDDB; { needed for Win95, or else brush is solid white } + end; + +const + EdgeStyles: array[Boolean] of UINT = (BDR_RAISEDINNER, BDR_SUNKENOUTER); + BlackCheckMarkPoints: array[0..6] of TPoint = ( + (X: -2; Y: -2), (X: 0; Y: 0), (X: 4; Y: -4), + (X: 4; Y: -3), (X: 0; Y: 1), (X: -2; Y: -1), + (X: -2; Y: -2)); + WhiteCheckMarkPoints: array[0..4] of TPoint = ( + (X: -3; Y: -2), (X: -3; Y: -1), (X: 0; Y: 2), + (X: 5; Y: -3), (X: 5; Y: -5)); +var + ToolbarStyle, ImageIsShown: Boolean; + R, RC, RD: TRect; + S: String; + ImgList: TCustomImageList; + I, X, Y: Integer; + BlackPoints: array[0..6] of TPoint; + WhitePoints: array[0..4] of TPoint; + DrawTextFlags: UINT; + LeftMargin: Integer; + TextMetrics: TTextMetric; +begin + ToolbarStyle := IsToolbarStyle; + ShowEnabled := Item.Enabled or View.Customizing; + HasArrow := (tbisSubmenu in Item.ItemStyle) and + ((tbisCombo in Item.ItemStyle) or (tboDropdownArrow in Item.EffectiveOptions)); + MenuCheckWidth := GetSystemMetrics(SM_CXMENUCHECK); + MenuCheckHeight := GetSystemMetrics(SM_CYMENUCHECK); + ImgList := GetImageList; + ImageIsShown := ImageShown and Assigned(ImgList); + LeftMargin := 0; + if not ToolbarStyle then begin + if Assigned(ImgList) then + LeftMargin := MulDiv(ImgList.Width + 3, ClientAreaRect.Bottom, ImgList.Height + 3) + else + LeftMargin := ClientAreaRect.Bottom; + end; + + { Border } + RC := ClientAreaRect; + if ToolbarStyle then begin + if HasArrow then begin + if tbisCombo in Item.ItemStyle then begin + Dec(RC.Right, tbDropdownComboMargin); + RD := RC; + Dec(RC.Right, tbDropdownComboArrowWidth - tbDropdownComboMargin); + RD.Left := RC.Right; + end + else begin + if View.Orientation <> tbvoVertical then + RD := Rect(RC.Right - tbDropdownArrowWidth - tbDropdownArrowMargin, 0, + RC.Right - tbDropdownArrowMargin, RC.Bottom) + else + RD := Rect(0, RC.Bottom - tbDropdownArrowWidth - tbDropdownArrowMargin, + RC.Right, RC.Bottom - tbDropdownArrowMargin); + end; + end + else + SetRectEmpty(RD); + if (IsSelected and ShowEnabled) or Item.Checked or + (csDesigning in Item.ComponentState) then begin + if not(tbisCombo in Item.ItemStyle) then + DrawEdge(Canvas.Handle, RC, EdgeStyles[IsPushed or Item.Checked], BF_RECT) + else begin + DrawEdge(Canvas.Handle, RC, EdgeStyles[(IsPushed and View.FCapture) or Item.Checked], BF_RECT); + if (IsSelected and ShowEnabled) or + (csDesigning in Item.ComponentState) then + DrawEdge(Canvas.Handle, RD, EdgeStyles[IsPushed and not View.FCapture], BF_RECT); + end; + end; + if HasArrow then begin + if not(tbisCombo in Item.ItemStyle) and IsPushed then + OffsetRect(RD, 1, 1); + DrawDropdownArrow(RD, not(tbisCombo in Item.ItemStyle) and + (View.Orientation = tbvoVertical)); + end; + InflateRect(RC, -1, -1); + if Item.Checked and not (IsSelected and ShowEnabled) then begin + Canvas.Brush.Bitmap := GetDitherBitmap; + Canvas.FillRect(RC); + Canvas.Brush.Style := bsClear; + end; + InflateRect(RC, -1, -1); + if Item.Checked or + ((IsSelected and IsPushed) and + (not(tbisCombo in Item.ItemStyle) or View.FCapture)) then + OffsetRect(RC, 1, 1); + if HasArrow and not(tbisCombo in Item.ItemStyle) then begin + if View.Orientation <> tbvoVertical then + Dec(RC.Right, tbDropdownArrowWidth) + else + Dec(RC.Bottom, tbDropdownArrowWidth); + end; + end + else begin + { On selected menu items, fill the background with the selected color. + Note: This assumes the brush color was not changed from the initial + value. } + if IsSelected then begin + R := RC; + if ImageIsShown or Item.Checked then + Inc(R.Left, LeftMargin + tbMenuImageTextSpace); + if (tbisCombo in Item.ItemStyle) and IsSelected and ShowEnabled then + Dec(R.Right, MenuCheckWidth); + Canvas.FillRect(R); + end; + end; + + { Adjust brush & font } + Canvas.Brush.Style := bsClear; + if tboDefault in Item.EffectiveOptions then + with Canvas.Font do Style := Style + [fsBold]; + GetTextMetrics(Canvas.Handle, TextMetrics); + + { Caption } + if CaptionShown then begin + S := GetCaptionText; + R := RC; + DrawTextFlags := GetDrawTextFlags; + if ToolbarStyle then begin + if ImageIsShown then begin + if not IsRotated and not(tboImageAboveCaption in Item.EffectiveOptions) then + Inc(R.Left, ImgList.Width + 1) + else + Inc(R.Top, ImgList.Height + 1); + end; + DrawItemCaption(Canvas, R, S, UseDisabledShadow, + DT_SINGLELINE or DT_CENTER or DT_VCENTER or DrawTextFlags) + end + else begin + Inc(R.Left, LeftMargin + tbMenuImageTextSpace + tbMenuLeftTextMargin); + { Like standard menus, shift the text up one pixel if the text height + is 4 pixels less than the total item height. This is done so underlined + characters aren't displayed too low. } + if (R.Bottom - R.Top) - (TextMetrics.tmHeight + TextMetrics.tmExternalLeading) = tbMenuVerticalMargin then + Dec(R.Bottom); + Inc(R.Top, TextMetrics.tmExternalLeading); + DrawItemCaption(Canvas, R, S, UseDisabledShadow, + DT_SINGLELINE or DT_LEFT or DT_VCENTER or DrawTextFlags); + end; + end; + + { Shortcut and/or submenu arrow (menus only) } + if not ToolbarStyle then begin + S := Item.GetShortCutText; + if S <> '' then begin + R := RC; + R.Left := R.Right - (R.Bottom - R.Top) - GetTextWidth(Canvas.Handle, S, True); + { Like standard menus, shift the text up one pixel if the text height + is 4 pixels less than the total item height. This is done so underlined + characters aren't displayed too low. } + if (R.Bottom - R.Top) - (TextMetrics.tmHeight + TextMetrics.tmExternalLeading) = tbMenuVerticalMargin then + Dec(R.Bottom); + Inc(R.Top, TextMetrics.tmExternalLeading); + DrawItemCaption(Canvas, R, S, UseDisabledShadow, + DT_SINGLELINE or DT_LEFT or DT_VCENTER or DT_NOPREFIX); + end; + if tbisSubmenu in Item.ItemStyle then begin + if tbisCombo in Item.ItemStyle then begin + R := RC; + R.Left := R.Right - MenuCheckWidth; + if IsSelected and ShowEnabled then + DrawEdge(Canvas.Handle, R, BDR_SUNKENOUTER, BF_RECT or BF_MIDDLE) + else begin + Dec(R.Left); + if not IsSelected then + DrawEdge(Canvas.Handle, R, EDGE_ETCHED, BF_LEFT) + else + DrawEdge(Canvas.Handle, R, BDR_SUNKENOUTER, BF_LEFT); + end; + end; + DrawSubmenuArrow; + end; + end; + + { Image, or check box } + if ImageIsShown or (not ToolbarStyle and Item.Checked) then begin + R := RC; + if ToolbarStyle then begin + if not IsRotated and not(tboImageAboveCaption in Item.EffectiveOptions) then + R.Right := R.Left + ImgList.Width + 2 + else + R.Bottom := R.Top + ImgList.Height + 2; + end + else begin + R.Right := R.Left + LeftMargin; + if (IsSelected and ShowEnabled) or Item.Checked then + DrawEdge(Canvas.Handle, R, EdgeStyles[Item.Checked], BF_RECT or BF_MIDDLE); + if Item.Checked and not IsSelected then begin + InflateRect(R, -1, -1); + Canvas.Brush.Bitmap := GetDitherBitmap; + Canvas.FillRect(R); + Canvas.Brush.Style := bsClear; + InflateRect(R, 1, 1); + end; + if Item.Checked then + OffsetRect(R, 1, 1); + end; + if ImageIsShown then begin + X := R.Left + ((R.Right - R.Left) - ImgList.Width) div 2; + Y := R.Top + ((R.Bottom - R.Top) - ImgList.Height) div 2; + if ImgList is TTBCustomImageList then + TTBCustomImageList(ImgList).DrawState(Canvas, X, Y, Item.ImageIndex, + ShowEnabled, IsSelected, Item.Checked) + else + ImgList.Draw(Canvas, X, Y, Item.ImageIndex, ShowEnabled); + end + else + if not ToolbarStyle and Item.Checked then begin + { Draw default check mark or radio button image when user hasn't + specified their own } + X := (R.Left + R.Right) div 2; + Y := (R.Top + R.Bottom) div 2; + if Item.RadioItem then begin + Canvas.Pen.Color := clBtnText; + Canvas.Brush.Color := clBtnText; + Canvas.RoundRect(X-3, Y-3, X+2, Y+2, 2, 2); + Canvas.Pen.Color := clBtnHighlight; + Canvas.Brush.Style := bsClear; + Canvas.RoundRect(X-4, Y-4, X+3, Y+3, 6, 6); + end + else begin + Dec(X, 2); + Inc(Y); + for I := Low(BlackPoints) to High(BlackPoints) do begin + BlackPoints[I].X := X + BlackCheckMarkPoints[I].X; + BlackPoints[I].Y := Y + BlackCheckMarkPoints[I].Y; + end; + for I := Low(WhitePoints) to High(WhitePoints) do begin + WhitePoints[I].X := X + WhiteCheckMarkPoints[I].X; + WhitePoints[I].Y := Y + WhiteCheckMarkPoints[I].Y; + end; + Canvas.Pen.Color := clBtnText; + Polyline(Canvas.Handle, BlackPoints, Length(BlackPoints)); + Canvas.Pen.Color := clBtnHighlight; + Polyline(Canvas.Handle, WhitePoints, Length(WhitePoints)); + end; + end; + end; +end; + +procedure TTBItemViewer.GetCursor(const Pt: TPoint; var ACursor: HCURSOR); +begin +end; + +function TTBItemViewer.GetIndex: Integer; +begin + Result := View.IndexOf(Self); +end; + +function TTBItemViewer.IsToolbarSize: Boolean; +begin + Result := View.FIsToolbar or (tboToolbarSize in Item.FEffectiveOptions); +end; + +function TTBItemViewer.IsToolbarStyle: Boolean; +begin + Result := View.FIsToolbar or (tboToolbarStyle in Item.FEffectiveOptions); +end; + +function TTBItemViewer.IsPtInButtonPart(X, Y: Integer): Boolean; +var + W: Integer; +begin + Result := not(tbisSubmenu in Item.ItemStyle); + if tbisCombo in Item.ItemStyle then begin + if IsToolbarStyle then + W := tbDropdownComboArrowWidth + else + W := GetSystemMetrics(SM_CXMENUCHECK); + Result := X < (BoundsRect.Right - BoundsRect.Left) - W; + end; +end; + +procedure TTBItemViewer.MouseDown(Shift: TShiftState; X, Y: Integer; + var MouseDownOnMenu: Boolean); + + procedure HandleDefaultDoubleClick(const View: TTBView); + { Looks for a tboDefault item in View and ends the modal loop if it finds + one. } + var + I: Integer; + Viewer: TTBItemViewer; + Item: TTBCustomItem; + begin + for I := 0 to View.FViewers.Count-1 do begin + Viewer := View.Viewers[I]; + Item := Viewer.Item; + if (Viewer.Show or Viewer.Clipped) and (tboDefault in Item.EffectiveOptions) and + (tbisSelectable in Item.ItemStyle) and Item.Enabled and Item.Visible then begin + Viewer.Execute(True); + Break; + end; + end; + end; + +var + WasAlreadyOpen: Boolean; +begin + if not Item.Enabled then begin + if (View.FParentView = nil) and not View.FIsPopup then + View.EndModal; + Exit; + end; + if IsPtInButtonPart(X, Y) then begin + if IsToolbarStyle then begin + View.CancelChildPopups; + View.SetCapture; + View.Invalidate(Self); + end; + end + else begin + WasAlreadyOpen := (View.FOpenViewer = Self); + if View.OpenChildPopup(False) then begin + if WasAlreadyOpen and ((View.FParentView = nil) and not View.FIsPopup) then + MouseDownOnMenu := True; + if (ssDouble in Shift) and not(tbisCombo in Item.ItemStyle) then + HandleDefaultDoubleClick(View.FOpenViewerView); + end; + end; +end; + +procedure TTBItemViewer.MouseMove(X, Y: Integer); +begin +end; + +procedure TTBItemViewer.MouseUp(X, Y: Integer; MouseWasDownOnMenu: Boolean); +var + HadCapture, IsToolbarItem: Boolean; +begin + HadCapture := View.FCapture; + View.CancelCapture; + IsToolbarItem := (View.FParentView = nil) and not View.FIsPopup; + if not View.FMouseOverSelected or not Item.Enabled or + (tbisClicksTransparent in Item.ItemStyle) then begin + if IsToolbarItem then + View.EndModal; + Exit; + end; + if (tbisSubmenu in Item.ItemStyle) and not IsPtInButtonPart(X, Y) then begin + if IsToolbarItem and MouseWasDownOnMenu then + View.EndModal; + end + else begin + { it's a 'normal' item } + if not IsToolbarStyle or HadCapture then + Execute(True); + end; +end; + +procedure TTBItemViewer.MouseWheel(WheelDelta, X, Y: Integer); +begin +end; + +procedure TTBItemViewer.LosingCapture; +begin + View.Invalidate(Self); +end; + +procedure TTBItemViewer.Entering; +begin + if Assigned(Item.FOnSelect) then + Item.FOnSelect(Item, Self, True); +end; + +procedure TTBItemViewer.Leaving; +begin + if Assigned(Item.FOnSelect) then + Item.FOnSelect(Item, Self, False); +end; + +procedure TTBItemViewer.KeyDown(var Key: Word; Shift: TShiftState); +begin +end; + +function TTBItemViewer.ScreenToClient(const P: TPoint): TPoint; +begin + Result := View.FWindow.ScreenToClient(P); + Dec(Result.X, BoundsRect.Left); + Dec(Result.Y, BoundsRect.Top); +end; + +function TTBItemViewer.UsesSameWidth: Boolean; +{ If UsesSameWidth returns True, the item viewer's width will be expanded to + match the widest item viewer on the same view whose UsesSameWidth method + also returns True. } +begin + Result := (tboImageAboveCaption in Item.FEffectiveOptions) and + (tboSameWidth in Item.FEffectiveOptions) and IsToolbarSize; +end; + +function TTBItemViewer.DoExecute: Boolean; +{ Low-level 'execute' handler. Returns True if the caller should call + GivePriority on the viewer (normally, if the 'execute' operation was a + success and the modal loop is ending). } +begin + View.EndModalWithClick(Self); + Result := True; +end; + +procedure TTBItemViewer.Execute(AGivePriority: Boolean); +{ Calls DoExecute and, if applicable, View.GivePriority. Note that it is up to + the caller to check the viewer's visibility and enabled state. } +begin + if DoExecute and AGivePriority then + View.GivePriority(Self); +end; + +function TTBItemViewer.GetAccRole: Integer; +{ Returns the MSAA "role" of the viewer. } +const + { Constants from OleAcc.h } + ROLE_SYSTEM_CLIENT = $a; + ROLE_SYSTEM_MENUITEM = $c; + ROLE_SYSTEM_SEPARATOR = $15; + ROLE_SYSTEM_PUSHBUTTON = $2b; + ROLE_SYSTEM_BUTTONMENU = $39; +begin + if Item is TTBControlItem then + Result := ROLE_SYSTEM_CLIENT + else if tbisSeparator in Item.ItemStyle then + Result := ROLE_SYSTEM_SEPARATOR + else if View.IsPopup or (vsMenuBar in View.Style) then + Result := ROLE_SYSTEM_MENUITEM + else if tbisSubmenu in Item.ItemStyle then + Result := ROLE_SYSTEM_BUTTONMENU + else + Result := ROLE_SYSTEM_PUSHBUTTON; +end; + +function TTBItemViewer.GetAccValue(var Value: WideString): Boolean; +{ Gets the MSAA "value" text of the viewer. Returns True if something was + assigned to Value, or False if the viewer does not possess a "value". } +begin + Result := False; +end; + + +{ TTBView } + +constructor TTBView.Create(AOwner: TComponent; AParentView: TTBView; + AParentItem: TTBCustomItem; AWindow: TWinControl; + AIsToolbar, ACustomizing, AUsePriorityList: Boolean); +begin + {$IFDEF CLR} + { TB2Acc's IAccessible implementations must be called from the same thread + that created the view, so verify that the program has [STAThread] } + CheckThreadingModel(System.Threading.ApartmentState.STA); + {$ENDIF} + inherited Create(AOwner); + FViewers := TList.Create; + FBackgroundColor := clDefault; + FCustomizing := ACustomizing; + FIsPopup := not AIsToolbar; + FIsToolbar := AIsToolbar; + FNewViewersGetHighestPriority := True; + FParentView := AParentView; + FParentItem := AParentItem; + if Assigned(FParentItem) then begin + //FIsToolbar := FIsToolbar or FParentItem.FDisplayAsToolbar; + FParentItem.RegisterNotification(LinkNotification); + FParentItem.FreeNotification(Self); + end; + FUsePriorityList := AUsePriorityList; + FWindow := AWindow; + UpdateCurParentItem; +end; + +destructor TTBView.Destroy; +begin + CloseChildPopups; + if Assigned(FAccObjectInstance) then begin + FAccObjectInstance.ClientIsDestroying; + { Get rid of our own reference to FAccObjectInstance. Normally the + reference count will be now be zero and FAccObjectInstance will be + freed, unless MSAA still holds a reference. } + {$IFNDEF CLR} + FAccObjectInstance._Release; + {$ENDIF} + FAccObjectInstance := nil; + end; + { If parent view is a toolbar, invalidate the open item so that it's + redrawn back in the "up" position } + if Assigned(ParentView) and ParentView.FIsToolbar then begin + Include(ParentView.FState, vsNoAnimation); + if Assigned(ParentView.FOpenViewer) then + ParentView.Invalidate(ParentView.FOpenViewer); + end; + if Assigned(FCurParentItem) then + FCurParentItem.UnregisterNotification(ItemNotification); + if Assigned(FParentItem) then + FParentItem.UnregisterNotification(LinkNotification); + inherited; + FPriorityList.Free; + FreeViewers; + FreeAndNil(FViewers); + { Now that we're destroyed, "focus" the parent view } + if Assigned(FParentView) then + FParentView.NotifyFocusEvent; +end; + +function TTBView.GetAccObject: TTBBaseAccObject; +begin + if FAccObjectInstance = nil then begin + if not InitializeOleAcc then begin + Result := nil; + Exit; + end; + FAccObjectInstance := TTBViewAccObject.Create(Self); + { Strictly as an optimization, take a reference for ourself and keep it + for the lifetime of the view. (Destroy calls _Release.) } + {$IFNDEF CLR} + FAccObjectInstance._AddRef; + {$ENDIF} + end; + Result := FAccObjectInstance; +end; + +function TTBView.HandleWMGetObject(var Message: TMessage): Boolean; +begin + { Note: In a 64-bit build, object identifiers can come in either + sign-extended or zero-extended from 32 to 64 bits. Clip to 32 bits here + to ensure we accept both forms. } + if (ClipToLongint(Message.LParam) = Longint(OBJID_CLIENT)) and InitializeOleAcc then begin + Message.Result := LresultFromObjectFunc( + {$IFNDEF CLR} ITBAccessible {$ELSE} TypeOf(ITBAccessible).GUID {$ENDIF}, + Message.WParam, GetAccObject); + Result := True; + end + else + Result := False; +end; + +procedure TTBView.UpdateCurParentItem; +var + Value: TTBCustomItem; +begin + Value := ItemContainingItems(FParentItem); + if FCurParentItem <> Value then begin + CloseChildPopups; + if Assigned(FCurParentItem) then + FCurParentItem.UnregisterNotification(ItemNotification); + FCurParentItem := Value; + if Assigned(Value) then + Value.RegisterNotification(ItemNotification); + RecreateAllViewers; + if Assigned(Value) and not(csDesigning in Value.ComponentState) then + InitiateActions; + end; +end; + +procedure TTBView.InitiateActions; +var + I: Integer; +begin + { Use a 'while' instead of a 'for' since an InitiateAction implementation + may add/delete items } + I := 0; + while I < FViewers.Count do begin + Viewers[I].Item.InitiateAction; + Inc(I); + end; +end; + +procedure TTBView.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if Operation = opRemove then begin + if AComponent = FParentItem then begin + FParentItem := nil; + UpdateCurParentItem; + if Assigned(FParentView) then + FParentView.CloseChildPopups; + end + else if AComponent = FOpenViewerWindow then begin + FOpenViewerWindow := nil; + FOpenViewerView := nil; + FOpenViewer := nil; + end + else if AComponent = FChevronParentView then + FChevronParentView := nil; + end +end; + +function TTBView.ContainsView(AView: TTBView): Boolean; +begin + while Assigned(AView) and (AView <> Self) do + AView := AView.FParentView; + Result := Assigned(AView); +end; + +function TTBView.GetRootView: TTBView; +begin + Result := Self; + while Assigned(Result.FParentView) do + Result := Result.FParentView; +end; + +function TTBView.GetParentToolbarView: TTBView; +begin + Result := Self; + while Assigned(Result) and not Result.FIsToolbar do + Result := Result.FParentView; +end; + +function TTBView.GetViewer(Index: Integer): TTBItemViewer; +begin + if (Index < 0) or (Index >= FViewers.Count) then begin + TTBCustomItem.IndexError; + Result := nil; + Exit; + end; + Result := TTBItemViewer(FViewers.List[Index]); +end; + +function TTBView.GetViewerCount: Integer; +begin + Result := FViewers.Count; +end; + +procedure TTBView.FreeViewers; +var + I: Integer; + Viewer: TTBItemViewer; +begin + if Assigned(FViewers) then begin + for I := FViewers.Count-1 downto 0 do begin + Viewer := Viewers[I]; + FViewers.Delete(I); + Viewer.Free; + end; + end; +end; + +procedure TTBView.InvalidatePositions; +begin + if FValidated then begin + FValidated := False; + if Assigned(FWindow) and FWindow.HandleAllocated then + InvalidateRect(FWindow.Handle, nil, True); + end; +end; + +procedure TTBView.ValidatePositions; +begin + if not FValidated then + UpdatePositions; +end; + +procedure TTBView.TryValidatePositions; +begin + if (FUpdating = 0) and + (not Assigned(FParentItem) or not(csLoading in FParentItem.ComponentState)) and + (not Assigned(FParentItem.Owner) or not(csLoading in FParentItem.Owner.ComponentState)) then + ValidatePositions; +end; + +(*procedure TTBView.TryRevalidatePositions; +begin + if FValidated then begin + if FUpdating = 0 then begin + FreePositions; + UpdatePositions; + end + else + InvalidatePositions; + end; +end;*) + +function TTBView.Find(Item: TTBCustomItem): TTBItemViewer; +var + I: Integer; +begin + for I := 0 to FViewers.Count-1 do + if Viewers[I].Item = Item then begin + Result := Viewers[I]; + Exit; + end; + raise ETBItemError.Create(STBViewerNotFound); +end; + +function TTBView.IndexOf(AViewer: TTBItemViewer): Integer; +var + I: Integer; +begin + if Assigned(AViewer) then + for I := 0 to FViewers.Count-1 do + if FViewers.List[I] = AViewer then begin + Result := I; + Exit; + end; + Result := -1; +end; + +procedure TTBView.DeletingViewer(Viewer: TTBItemViewer); +begin + if FSelected = Viewer then + FSelected := nil; + if FOpenViewer = Viewer then + CloseChildPopups; +end; + +procedure TTBView.RecreateItemViewer(const I: Integer); +var + OldViewer, NewViewer: TTBItemViewer; + J: Integer; +begin + OldViewer := Viewers[I]; + DeletingViewer(OldViewer); + NewViewer := OldViewer.Item.GetItemViewerClass(Self).Create(Self, + OldViewer.Item, OldViewer.FGroupLevel); + FViewers[I] := NewViewer; + if Assigned(FPriorityList) then begin + J := FPriorityList.IndexOf(OldViewer); + if J <> -1 then + FPriorityList[J] := NewViewer; + end; + OldViewer.Free; +end; + +function TTBView.InsertItemViewers(const NewIndex: Integer; + const AItem: TTBCustomItem; const AGroupLevel: Integer; + const AddToPriorityList, TopOfPriorityList: Boolean): Integer; +var + NewViewer: TTBItemViewer; + LinkItem: TTBCustomItem; + I: Integer; +begin + if AGroupLevel > MaxGroupLevel then begin + Result := 0; + Exit; + end; + + FViewers.Expand; + NewViewer := AItem.GetItemViewerClass(Self).Create(Self, AItem, + AGroupLevel); + FViewers.Insert(NewIndex, NewViewer); + if AddToPriorityList and FUsePriorityList then begin + if not TopOfPriorityList then + AddToList(FPriorityList, NewViewer) + else + { When new items are inserted programmatically at run-time, place + them at the top of FPriorityList } + AddToFrontOfList(FPriorityList, NewViewer); + end; + Result := 1; + + { If a new group item is being inserted, insert all its child items too } + if not FCustomizing and (tbisEmbeddedGroup in AItem.ItemStyle) then begin + LinkItem := ItemContainingItems(AItem); + for I := 0 to LinkItem.Count-1 do begin + Inc(Result, InsertItemViewers(NewIndex + Result, LinkItem.Items[I], + AGroupLevel + 1, AddToPriorityList, TopOfPriorityList)); + end; + end; +end; + +procedure TTBView.ItemNotification(Ancestor: TTBCustomItem; Relayed: Boolean; + Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); + + procedure ItemInserted; + var + NewLevel, Start, InsertPoint, Last: Integer; + GroupItem, NextItem: TTBCustomItem; + Found, SearchAgain: Boolean; + begin + InvalidatePositions; + NewLevel := 0; + Start := 0; + if Ancestor = FCurParentItem then + InsertPoint := FViewers.Count + else begin + { Ancestor <> FCurParentItem, so apparently an item has been inserted + inside a group item } + repeat + Found := False; + while Start < FViewers.Count do begin + GroupItem := Viewers[Start].Item; + if (tbisEmbeddedGroup in GroupItem.ItemStyle) and (GroupItem = Ancestor) then begin + NewLevel := Viewers[Start].FGroupLevel + 1; + Inc(Start); + Found := True; + Break; + end; + Inc(Start); + end; + if not Found then + { Couldn't find Ancestor; it shouldn't get here } + Exit; + InsertPoint := Start; + SearchAgain := False; + while (InsertPoint < FViewers.Count) and + (Viewers[InsertPoint].FGroupLevel >= NewLevel) do begin + if (Viewers[InsertPoint].Item = Item) and + (Viewers[InsertPoint].FGroupLevel = NewLevel) then begin + { If the item we were going to insert already exists, then there + must be multiple instances of the same group item. This can + happen when are two group items on the same toolbar each + linking to the same submenu item, with the submenu item + containing a group item of its own, and an item is inserted + inside that. } + SearchAgain := True; + Break; + end; + Inc(InsertPoint); + end; + until not SearchAgain; + end; + if InsertPoint = FViewers.Count then begin + { Don't add items after the chevron or MDI buttons item } + Dec(InsertPoint, FInternalViewersAtEnd); + if InsertPoint < 0 then + InsertPoint := 0; { just in case? } + end; + { If the new item wasn't placed at the end, adjust InsertPoint accordingly } + if Index < Item.Parent.Count-1 then begin + Last := InsertPoint; + InsertPoint := Start; + NextItem := Item.Parent.Items[Index+1]; + while (InsertPoint < Last) and + ((Viewers[InsertPoint].Item <> NextItem) or + (Viewers[InsertPoint].FGroupLevel <> NewLevel)) do + Inc(InsertPoint); + end; + InsertItemViewers(InsertPoint, Item, NewLevel, True, + not(csLoading in Item.ComponentState) and FNewViewersGetHighestPriority); + end; + + procedure ItemDeleting; + + procedure DeleteItem(DeleteIndex: Integer); + var + Viewer: TTBItemViewer; + begin + Viewer := Viewers[DeleteIndex]; + DeletingViewer(Viewer); + RemoveFromList(FPriorityList, Viewer); + FreeAndNil(Viewer); + FViewers.Delete(DeleteIndex); + end; + + var + I: Integer; + DeleteLevel: Integer; + begin + InvalidatePositions; + I := 0; + DeleteLevel := 0; + while I < FViewers.Count do begin + if DeleteLevel > 0 then begin + if Viewers[I].FGroupLevel >= DeleteLevel then begin + DeleteItem(I); + Continue; + end + else + DeleteLevel := 0; + end; + if Viewers[I].Item = Item then begin + { Delete the item, and any group item children afterward } + DeleteLevel := Viewers[I].FGroupLevel + 1; + DeleteItem(I); + Continue; + end; + Inc(I); + end; + end; + +var + I: Integer; +begin + case Action of + tbicInserted: ItemInserted; + tbicDeleting: ItemDeleting; + tbicSubitemsChanged: begin + { If Relayed=True, LinkSubitems must have changed on a child group + item. Currently there isn't any optimized way of handling this + situation; just recreate all viewers. } + if Relayed then + RecreateAllViewers; + end; + tbicSubitemsBeginUpdate: BeginUpdate; + tbicSubitemsEndUpdate: EndUpdate; + tbicInvalidate: begin + for I := 0 to FViewers.Count-1 do + if Viewers[I].Item = Item then + Invalidate(Viewers[I]); + end; + tbicInvalidateAndResize: InvalidatePositions; + tbicRecreateItemViewers: begin + InvalidatePositions; + for I := 0 to FViewers.Count-1 do + if Viewers[I].Item = Item then + RecreateItemViewer(I); + end; + tbicSubMenuImagesChanged: ImagesChanged; + else + { Prevent TryValidatePositions from being called below on Actions other than + those listed above. Currently there are no other Actions, but for forward + compatibility, we should ignore unknown Actions completely. } + Exit; + end; + TryValidatePositions; +end; + +procedure TTBView.LinkNotification(Ancestor: TTBCustomItem; Relayed: Boolean; + Action: TTBItemChangedAction; Index: Integer; Item: TTBCustomItem); +{ This notification procedure watches for tbicSubitemsChanged notifications + from FParentItem } +begin + case Action of + tbicSubitemsChanged: begin + { LinkSubitems may have changed on FParentItem, e.g. on the root item + of a toolbar, so see if FCurParentItem needs updating } + UpdateCurParentItem; + end; + tbicSubMenuImagesChanged: begin + { In case the images were inherited from the actual parent instead of + the linked parent... } + if FParentItem <> FCurParentItem then + ImagesChanged; + end; + end; +end; + +procedure TTBView.ImagesChanged; +begin + InvalidatePositions; + TryValidatePositions; + if Assigned(FOpenViewerView) then + FOpenViewerView.ImagesChanged; +end; + +procedure TTBView.GivePriority(AViewer: TTBItemViewer); +{ Move item to top of priority list. Rearranges items if necessary. } +var + I: Integer; +begin + if Assigned(FChevronParentView) then begin + I := AViewer.Index + FChevronParentView.FInternalViewersAtFront; + if I < FChevronParentView.FViewers.Count then { range check just in case } + FChevronParentView.GivePriority(FChevronParentView.Viewers[I]); + Exit; + end; + if Assigned(FPriorityList) then begin + I := FPriorityList.IndexOf(AViewer); + if I <> -1 then begin + FPriorityList.Move(I, 0); + if not FValidated or AViewer.OffEdge then + UpdatePositions; + end; + end; + { Call GivePriority on parent view, so that if an item on a submenu is + clicked, the parent item of the submenu gets priority. } + if Assigned(FParentView) and Assigned(FParentView.FOpenViewer) then + FParentView.GivePriority(FParentView.FOpenViewer); +end; + +function TTBView.HighestPriorityViewer: TTBItemViewer; +{ Returns index of first visible, non-separator item at top of priority list, + or -1 if there are no items found } +var + I: Integer; + J: TTBItemViewer; +begin + ValidatePositions; + Result := nil; + if Assigned(FPriorityList) then begin + for I := 0 to FPriorityList.Count-1 do begin + J := TTBItemViewer(FPriorityList[I]); + if J.Show and not(tbisSeparator in J.Item.ItemStyle) then begin + Result := J; + Break; + end; + end; + end + else begin + for I := 0 to FViewers.Count-1 do begin + J := Viewers[I]; + if J.Show and not(tbisSeparator in J.Item.ItemStyle) then begin + Result := J; + Break; + end; + end; + end; +end; + +procedure TTBView.StartTimer(const ATimer: TTBViewTimerID; + const Interval: Integer); +{ Starts a timer. Stops any previously set timer of the same ID first. + Note: WM_TIMER messages generated by timers set by the method are handled + in PopupMessageLoop. } +begin + StopTimer(ATimer); + if (FWindow is TTBPopupWindow) and FWindow.HandleAllocated then begin + SetTimer(FWindow.Handle, ViewTimerBaseID + Ord(ATimer), Interval, nil); + Include(FActiveTimers, ATimer); + end; +end; + +procedure TTBView.StopAllTimers; +var + I: TTBViewTimerID; +begin + for I := Low(I) to High(I) do + StopTimer(I); +end; + +procedure TTBView.StopTimer(const ATimer: TTBViewTimerID); +begin + if ATimer in FActiveTimers then begin + if (FWindow is TTBPopupWindow) and FWindow.HandleAllocated then + KillTimer(FWindow.Handle, ViewTimerBaseID + Ord(ATimer)); + Exclude(FActiveTimers, ATimer); + end; +end; + +function TTBView.OpenChildPopup(const SelectFirstItem: Boolean): Boolean; +var + Item: TTBCustomItem; +begin + StopTimer(tiClose); + StopTimer(tiOpen); + if FSelected <> FOpenViewer then begin + CloseChildPopups; + if Assigned(FSelected) then begin + Item := FSelected.Item; + if Item.Enabled and (tbisSubmenu in Item.ItemStyle) then + Item.CreatePopup(Self, FSelected, not FIsToolbar, SelectFirstItem, + False, Point(0, 0), tbpaLeft); + end; + end; + Result := Assigned(FOpenViewer); +end; + +procedure TTBView.CloseChildPopups; +begin + if Assigned(FOpenViewerView) then + FOpenViewerView.CloseChildPopups; + StopTimer(tiClose); + FOpenViewerWindow.Free; + FOpenViewerWindow := nil; + FOpenViewerView := nil; + FOpenViewer := nil; +end; + +procedure TTBView.CancelChildPopups; +begin + if FIsToolbar then + Exclude(FState, vsDropDownMenus); + CloseChildPopups; +end; + +function TTBView.ViewerFromPoint(const P: TPoint): TTBItemViewer; +var + I: Integer; +begin + ValidatePositions; + for I := 0 to FViewers.Count-1 do begin + if Viewers[I].Show and + PtInRect(Viewers[I].BoundsRect, P) then begin + Result := Viewers[I]; + Exit; + end; + end; + Result := nil; +end; + +procedure TTBView.NotifyFocusEvent; +{ Notifies Active Accessibility of a change in "focus". Has no effect if the + view or the root view lacks the vsModal state, or if the modal loop is + ending (EndModal* was called). } +var + I, ChildID, J: Integer; +begin + { Note: We don't notify about windows not yet shown (e.g. a popup menu that + is still initializing) because that would probably confuse screen readers. + Also allocating a window handle at this point *might* not be a good idea. } + if (vsModal in FState) and (vsModal in GetRootView.FState) and + not IsModalEnding and + FWindow.HandleAllocated and IsWindowVisible(FWindow.Handle) then begin + if Assigned(FSelected) and FSelected.IsAccessible then + I := IndexOf(FSelected) + else + I := -1; + if (I < 0) and Assigned(FParentView) then begin + { If we have no selected item, report the the selected item on the parent + view as having the "focus". + Note: With standard menus, when you go from having a selection to no + selection on a submenu, it sends two focus events - first with the + client window as having the focus, then with the parent item. I + figure that's probably a bug, so I don't try to emulate that behavior + here. } + FParentView.NotifyFocusEvent; + end + else begin + if I >= 0 then begin + { Convert viewer index into a one-based child index. + (TTBViewAccObject.get_accChild does the inverse.) } + ChildID := 1; + for J := 0 to I-1 do + if Viewers[J].IsAccessible then + Inc(ChildID); + end + else begin + { If there is no (accessible) selection and no parent view, report + the client window itself as being "focused". This is what happens + when a standard context menu has no selection. } + ChildID := CHILDID_SELF; + end; + CallNotifyWinEvent(EVENT_OBJECT_FOCUS, FWindow.Handle, OBJID_CLIENT, ChildID); + end; + end; +end; + +procedure TTBView.SetSelected(Value: TTBItemViewer); +begin + Select(Value, False); +end; + +procedure TTBView.Select(Value: TTBItemViewer; ViaMouse: Boolean); +{ Sets the current selection. + When the selection is changing it will also, if necessary, open/close child + popups. How exactly this works depends on the setting of ViaMouse. If + ViaMouse is True it will delay the opening/closing of popups using timers. } +var + OldSelected: TTBItemViewer; + NewMouseOverSelected: Boolean; + P: TPoint; +begin + OldSelected := FSelected; + if Value <> OldSelected then begin + { If there's a new selection and the parent item on the parent view + isn't currently selected, select it. Also stop any timer running on + the parent view. } + if Assigned(Value) and Assigned(FParentView) and + Assigned(FParentView.FOpenViewer) and + (FParentView.FSelected <> FParentView.FOpenViewer) then begin + FParentView.Selected := FParentView.FOpenViewer; + FParentView.StopTimer(tiClose); + FParentView.StopTimer(tiOpen); + end; + + { Handle automatic closing of child popups } + if vsModal in FState then begin + { If the view is a toolbar, or if the new selection didn't come from + the mouse, close child popups immediately } + if FIsToolbar or not ViaMouse then begin + { Always stop any close timer because CloseChildPopups may not be + called below } + StopTimer(tiClose); + if Value <> FOpenViewer then + { ^ But don't close if selection is returning to the open item. + Needed for the "FParentView.Selected := FParentView.FOpenViewer" + line above to work. } + CloseChildPopups; + end + else begin + { Otherwise, delay-close any child popup } + if Assigned(FOpenViewerView) and not(tiClose in FActiveTimers) then + StartTimer(tiClose, GetMenuShowDelay); + end; + end; + + CancelCapture; + if Assigned(OldSelected) then + OldSelected.Leaving; + FSelected := Value; + FSelectedViaMouse := ViaMouse; + end; + + NewMouseOverSelected := False; + if Assigned(Value) and Assigned(FWindow) then begin + P := GetMessagePosAsPoint; + if FindDragTarget(P, True) = FWindow then begin + P := FWindow.ScreenToClient(P); + NewMouseOverSelected := (ViewerFromPoint(P) = Value); + if NewMouseOverSelected and FCapture and + not Value.IsPtInButtonPart(P.X - Value.BoundsRect.Left, + P.Y - Value.BoundsRect.Top) then + NewMouseOverSelected := False; + end; + end; + + if Value <> OldSelected then begin + FMouseOverSelected := NewMouseOverSelected; + if Assigned(OldSelected) and (tbisRedrawOnSelChange in OldSelected.Item.ItemStyle) then + Invalidate(OldSelected); + if Assigned(Value) then begin + if tbisRedrawOnSelChange in Value.Item.ItemStyle then + Invalidate(Value); + Value.Entering; + end; + NotifyFocusEvent; + + { Handle automatic opening of a child popup } + if vsModal in FState then begin + { If the view is a toolbar, immediately open any child popup } + if FIsToolbar then begin + if Assigned(Value) then begin + if ViaMouse and Assigned(FParentView) then begin + { On chevron popups, always drop down menus when mouse passes + over them, like Office 2000 } + Include(FState, vsDropDownMenus); + end; + if (vsDropDownMenus in FState) and + (ViaMouse or not(tbisNoAutoOpen in Value.Item.ItemStyle)) then + OpenChildPopup(not ViaMouse); + end; + end + else begin + { Otherwise, delay-open any child popup if the selection came from + the mouse } + StopTimer(tiOpen); + if ViaMouse and Assigned(Value) and (tbisSubmenu in Value.Item.ItemStyle) then + StartTimer(tiOpen, GetMenuShowDelay); + end; + end; + end + else if FMouseOverSelected <> NewMouseOverSelected then begin + FMouseOverSelected := NewMouseOverSelected; + if Assigned(Value) and FCapture and (tbisRedrawOnMouseOverChange in Value.Item.ItemStyle) then + Invalidate(Value); + end; +end; + +procedure TTBView.UpdateSelection(const P: TPoint; const AllowNewSelection: Boolean); +{ Called in response to a mouse movement, this method updates the current + selection, updates the vsMouseInWindow view state, and enables/disables + scroll timers. } + + function IsPtInScrollArrow(ADownArrow: Boolean): Boolean; + var + P2: TPoint; + R: TRect; + begin + Result := False; + if (vsModal in FState) and (vsMouseInWindow in FState) and not FCapture and + (P.X <> Low(Integer)) then begin + P2 := FWindow.ScreenToClient(P); + R := FWindow.ClientRect; + if PtInRect(R, P2) then begin + if ADownArrow then + Result := FShowDownArrow and (P2.Y >= R.Bottom - tbMenuScrollArrowHeight) + else + Result := FShowUpArrow and (P2.Y < tbMenuScrollArrowHeight); + end; + end; + end; + +var + NewSelected, ViewerAtPoint: TTBItemViewer; + P2: TPoint; + MouseWasInWindow: Boolean; +begin + ValidatePositions; + + if FCapture then begin + { If we have the capture, don't allow the selection to change. And always + set vsMouseInWindow so that if the mouse is released outside the window, + the "remove the selection" code below will be reached the next time + UpdateSelection is called. } + NewSelected := FSelected; + Include(FState, vsMouseInWindow); + end + else begin + { If modal, default to keeping the existing selection } + if vsModal in FState then + NewSelected := FSelected + else + NewSelected := nil; + + { Is the mouse inside the window? } + MouseWasInWindow := vsMouseInWindow in FState; + if (P.X <> Low(Integer)) and Assigned(FWindow) and (FindDragTarget(P, True) = FWindow) then begin + { If we're a popup window and the mouse is inside, default to no selection } + if FIsPopup then + NewSelected := nil; + Include(FState, vsMouseInWindow); + if AllowNewSelection or Assigned(FSelected) then begin + P2 := FWindow.ScreenToClient(P); + ViewerAtPoint := ViewerFromPoint(P2); + if Assigned(ViewerAtPoint) then + NewSelected := ViewerAtPoint; + end; + end + else begin + Exclude(FState, vsMouseInWindow); + { If we're a popup window and the mouse just moved outside the window + while no submenu was open or a non-submenu-displaying item was + selected, remove the selection } + if FIsPopup and Assigned(NewSelected) and MouseWasInWindow and + (not Assigned(FOpenViewerView) or not(tbisSubmenu in NewSelected.Item.ItemStyle)) then + NewSelected := nil; + end; + end; + + { Now we set the new Selected value } + Select(NewSelected, True); + + { Update scroll arrow timers } + if IsPtInScrollArrow(False) then begin + StopTimer(tiScrollDown); + if not(tiScrollUp in FActiveTimers) then + StartTimer(tiScrollUp, 100); + end + else if IsPtInScrollArrow(True) then begin + StopTimer(tiScrollUp); + if not(tiScrollDown in FActiveTimers) then + StartTimer(tiScrollDown, 100); + end + else begin + StopTimer(tiScrollUp); + StopTimer(tiScrollDown); + end; +end; + +procedure TTBView.RecreateAllViewers; +var + Item: TTBCustomItem; + I: Integer; +begin + { Since the FViewers list is being rebuilt, FOpenViewer and FSelected + will no longer be valid, so ensure they're set to nil. } + CloseChildPopups; + Selected := nil; + + InvalidatePositions; + + FreeAndNil(FPriorityList); + FreeViewers; + FInternalViewersAtFront := 0; + FInternalViewersAtEnd := 0; + + { MDI system menu item } + Item := GetMDISystemMenuItem; + if Assigned(Item) then + Inc(FInternalViewersAtFront, InsertItemViewers(FViewers.Count, Item, 0, + False, False)); + + { Items } + if Assigned(FCurParentItem) then begin + for I := 0 to FCurParentItem.Count-1 do + InsertItemViewers(FViewers.Count, FCurParentItem.Items[I], 0, + True, False); + end; + + { MDI buttons item } + Item := GetMDIButtonsItem; + if Assigned(Item) then begin + for I := 0 to Item.Count-1 do + Inc(FInternalViewersAtEnd, InsertItemViewers(FViewers.Count, + Item.Items[I], 0, False, False)); + end; + + { Chevron item } + Item := GetChevronItem; + if Assigned(Item) then + Inc(FInternalViewersAtEnd, InsertItemViewers(FViewers.Count, Item, 0, + False, False)); +end; + +function TTBView.CalculatePositions(const CanMoveControls: Boolean; + const AOrientation: TTBViewOrientation; + AWrapOffset, AChevronOffset, AChevronSize: Integer; + var ABaseSize, TotalSize: TPoint; + var AWrappedLines: Integer): Boolean; +{ Returns True if the positions have changed } +type + TTempPosition = record + BoundsRect: TRect; + Show, OffEdge, LineSep, Clipped, SameWidth: Boolean; + { Include an Integer field to enforce Integer alignment of the record + (which we don't get by default due to TRect being wrongly declared as + 'packed'). Needed to avoid alignment fault on Delphi.NET 2007 IA-64. } + DummyAlignment: Integer; + end; + TTempPositionArrayItem = record + Pos: TTempPosition; + end; +var + DC: HDC; + LeftX, TopY, CurX, CurY: Integer; + NewPositions: array of TTempPositionArrayItem; + GroupSplit, DidWrap: Boolean; + LineStart, HighestHeightOnLine, HighestWidthOnLine: Integer; + + function GetSizeOfGroup(const StartingIndex: Integer): Integer; + var + I: Integer; + begin + Result := 0; + for I := StartingIndex to FViewers.Count-1 do begin + with NewPositions[I] do begin + if not Pos.Show then + Continue; + if tbisSeparator in Viewers[I].Item.ItemStyle then + Break; + if AOrientation <> tbvoVertical then + Inc(Result, Pos.BoundsRect.Right) + else + Inc(Result, Pos.BoundsRect.Bottom); + end; + end; + end; + + procedure Mirror; + { Reverses the horizontal ordering (i.e. first item becomes last) } + var + I, NewRight: Integer; + begin + for I := 0 to FViewers.Count-1 do + with NewPositions[I] do + if Pos.Show then begin + NewRight := TotalSize.X - Pos.BoundsRect.Left; + Pos.BoundsRect.Left := TotalSize.X - Pos.BoundsRect.Right; + Pos.BoundsRect.Right := NewRight; + end; + end; + + procedure HandleMaxHeight; + { Decreases, if necessary, the height of the view to FMaxHeight, and adjusts + the visibility of the scroll arrows } + var + MaxOffset, I, MaxTop, MaxBottom: Integer; + begin + FShowUpArrow := False; + FShowDownArrow := False; + if (FMaxHeight > 0) and (TotalSize.Y > FMaxHeight) then begin + MaxOffset := TotalSize.Y - FMaxHeight; + if FScrollOffset > MaxOffset then + FScrollOffset := MaxOffset; + if FScrollOffset < 0 then + FScrollOffset := 0; + FShowUpArrow := (FScrollOffset > 0); + FShowDownArrow := (FScrollOffset < MaxOffset); + MaxTop := 0; + if FShowUpArrow then + MaxTop := tbMenuScrollArrowHeight; + MaxBottom := FMaxHeight; + if FShowDownArrow then + Dec(MaxBottom, tbMenuScrollArrowHeight); + for I := 0 to FViewers.Count-1 do begin + with NewPositions[I] do begin + if not IsRectEmpty(Pos.BoundsRect) then begin + OffsetRect(Pos.BoundsRect, 0, -FScrollOffset); + if Pos.Show and + ((Pos.BoundsRect.Top < MaxTop) or + (Pos.BoundsRect.Bottom > MaxBottom)) then begin + Pos.Show := False; + Pos.Clipped := True; + end; + end; + end; + end; + TotalSize.Y := FMaxHeight; + end + else + FScrollOffset := 0; + end; + + procedure FinalizeLine(const LineEnd: Integer; const LastLine: Boolean); + var + I, RightAlignStart: Integer; + Item: TTBCustomItem; + IsButton: Boolean; + Z: Integer; + begin + if LineStart <> -1 then begin + if DidWrap and (FChevronParentView = nil) then begin + { When wrapping on a docked toolbar, extend TotalSize.X/Y to + AWrapOffset so that the toolbar always fills the whole row } + if (AOrientation = tbvoHorizontal) and (TotalSize.X < AWrapOffset) then + TotalSize.X := AWrapOffset + else if (AOrientation = tbvoVertical) and (TotalSize.Y < AWrapOffset) then + TotalSize.Y := AWrapOffset; + end; + RightAlignStart := -1; + for I := LineStart to LineEnd do begin + with NewPositions[I] do begin + if not Pos.Show then + Continue; + Item := Viewers[I].Item; + if (RightAlignStart < 0) and (tbisRightAlign in Item.ItemStyle) then + RightAlignStart := I; + IsButton := FIsToolbar or (tboToolbarSize in Item.FEffectiveOptions); + if FIsToolbar then begin + if LastLine and not DidWrap and (AOrientation <> tbvoFloating) then begin + { In case the toolbar is docked next to a taller/wider toolbar... } + HighestWidthOnLine := TotalSize.X; + HighestHeightOnLine := TotalSize.Y; + end; + { Make separators on toolbars as tall/wide as the tallest/widest item } + if tbisSeparator in Item.ItemStyle then begin + if AOrientation <> tbvoVertical then + Pos.BoundsRect.Bottom := Pos.BoundsRect.Top + HighestHeightOnLine + else + Pos.BoundsRect.Right := Pos.BoundsRect.Left + HighestWidthOnLine; + end + else begin + { Center the item } + if AOrientation <> tbvoVertical then begin + Z := (HighestHeightOnLine - (Pos.BoundsRect.Bottom - Pos.BoundsRect.Top)) div 2; + Inc(Pos.BoundsRect.Top, Z); + Inc(Pos.BoundsRect.Bottom, Z); + end + else begin + Z := (HighestWidthOnLine - (Pos.BoundsRect.Right - Pos.BoundsRect.Left)) div 2; + Inc(Pos.BoundsRect.Left, Z); + Inc(Pos.BoundsRect.Right, Z); + end; + end; + end + else begin + { Make items in a menu as wide as the widest item } + if not IsButton then begin + with Pos.BoundsRect do Right := Left + HighestWidthOnLine; + end; + end; + end; + end; + if RightAlignStart >= 0 then begin + Z := 0; + for I := LineEnd downto RightAlignStart do begin + with NewPositions[I] do begin + if not Pos.Show then + Continue; + if AOrientation <> tbvoVertical then + Z := Min(AWrapOffset, TotalSize.X) - Pos.BoundsRect.Right + else + Z := Min(AWrapOffset, TotalSize.Y) - Pos.BoundsRect.Bottom; + end; + Break; + end; + if Z > 0 then begin + for I := RightAlignStart to LineEnd do begin + with NewPositions[I] do begin + if not Pos.Show then + Continue; + if AOrientation <> tbvoVertical then begin + Inc(Pos.BoundsRect.Left, Z); + Inc(Pos.BoundsRect.Right, Z); + end + else begin + Inc(Pos.BoundsRect.Top, Z); + Inc(Pos.BoundsRect.Bottom, Z); + end; + end; + end; + end; + end; + end; + LineStart := -1; + HighestHeightOnLine := 0; + HighestWidthOnLine := 0; + end; + + procedure PositionItem(const CurIndex: Integer; var Pos: TTempPosition); + var + O, X, Y: Integer; + IsLineSep, Vert: Boolean; + begin + if LineStart = -1 then begin + LineStart := CurIndex; + HighestHeightOnLine := 0; + HighestWidthOnLine := 0; + end; + IsLineSep := False; + Vert := (AOrientation = tbvoVertical); + if not Vert then + O := CurX + else + O := CurY; + if (AWrapOffset > 0) and (O > 0) then begin + if not Vert then + Inc(O, Pos.BoundsRect.Right) + else + Inc(O, Pos.BoundsRect.Bottom); + if (tbisSeparator in Viewers[CurIndex].Item.ItemStyle) and + ((GroupSplit and not(tbisNoLineBreak in Viewers[CurIndex].Item.ItemStyle)) + or (O + GetSizeOfGroup(CurIndex+1) > AWrapOffset)) then begin + DidWrap := True; + Inc(AWrappedLines); + if not Vert then begin + CurX := 0; + Inc(CurY, HighestHeightOnLine); + end + else begin + CurY := 0; + Inc(CurX, HighestWidthOnLine); + end; + FinalizeLine(CurIndex-1, False); + LineStart := CurIndex+1; + if not Vert then begin + Pos.BoundsRect.Right := 0; + Pos.BoundsRect.Bottom := tbLineSpacing; + end + else begin + Pos.BoundsRect.Right := tbLineSpacing; + Pos.BoundsRect.Bottom := 0; + end; + Pos.LineSep := True; + IsLineSep := True; + end + else if O > AWrapOffset then begin + { proceed to next row } + DidWrap := True; + Inc(AWrappedLines); + if not Vert then begin + CurX := LeftX; + Inc(CurY, HighestHeightOnLine); + end + else begin + CurY := TopY; + Inc(CurX, HighestWidthOnLine); + end; + GroupSplit := True; + FinalizeLine(CurIndex-1, False); + LineStart := CurIndex; + end; + end; + if Pos.BoundsRect.Bottom > HighestHeightOnLine then + HighestHeightOnLine := Pos.BoundsRect.Bottom; + if Pos.BoundsRect.Right > HighestWidthOnLine then + HighestWidthOnLine := Pos.BoundsRect.Right; + X := CurX; + Y := CurY; + if X < 0 then X := 0; + if Y < 0 then Y := 0; + OffsetRect(Pos.BoundsRect, X, Y); + if IsLineSep then begin + if not Vert then begin + CurX := LeftX; + Inc(CurY, tbLineSpacing); + end + else begin + CurY := TopY; + Inc(CurX, tbLineSpacing); + end; + GroupSplit := False; + end; + end; + +var + SaveOrientation: TTBViewOrientation; + ChevronItem: TTBCustomItem; + CalcCanvas: TCanvas; + LastWasSep, LastWasButton, IsButton, IsControl: Boolean; + Item: TTBCustomItem; + Ctl: TControl; + ChangedBold: Boolean; + I, HighestSameWidthViewerWidth, Total, J, TotalVisibleItems: Integer; + IsFirst: Boolean; + Viewer: TTBItemViewer; + UseChevron, NonControlsOffEdge, TempViewerCreated: Boolean; + Margins: TRect; +label FoundItemToHide; +begin + SaveOrientation := FOrientation; + AWrappedLines := 1; + ChevronItem := GetChevronItem; + DC := 0; + CalcCanvas := nil; + try + FOrientation := AOrientation; + + CalcCanvas := TCanvas.Create; + DC := GetDC(0); + CalcCanvas.Handle := DC; + CalcCanvas.Font.Assign(GetFont); + + SetLength(NewPositions, FViewers.Count); + + { Figure out which items should be shown } + LastWasSep := True; { set to True initially so it won't show leading seps } + for I := 0 to FViewers.Count-1 do begin + Item := Viewers[I].Item; + IsControl := Item is TTBControlItem; + with NewPositions[I] do begin + { Pos.Show is initially False since SetLength initializes to zero } + if Item = ChevronItem then + Continue; + if Assigned(FChevronParentView) then begin + if IsControl then + Continue; + FChevronParentView.ValidatePositions; + J := I + FChevronParentView.FInternalViewersAtFront; + if J < FChevronParentView.FViewers.Count then + { range check just in case } + Viewer := FChevronParentView.Viewers[J] + else + Viewer := nil; + if (Viewer = nil) or (not Viewer.OffEdge and not(tbisSeparator in Item.ItemStyle)) then + Continue; + end; + if not IsControl then begin + if not(tbisEmbeddedGroup in Item.ItemStyle) or FCustomizing then begin + Pos.Show := Item.Visible; + { Don't display two consecutive separators } + if Pos.Show then begin + if (tbisSeparator in Item.ItemStyle) and LastWasSep then + Pos.Show := False; + LastWasSep := tbisSeparator in Item.ItemStyle; + end; + end; + end + else begin + { Controls can only be rendered on a single Parent, so only + include the control if its parent is currently equal to + FWindow } + Ctl := TTBControlItem(Item).FControl; + if Assigned(Ctl) and Assigned(FWindow) and (Ctl.Parent = FWindow) and + (Ctl.Visible or (csDesigning in Ctl.ComponentState)) then begin + Pos.Show := True; + LastWasSep := False; + end; + end; + end; + end; + + { Hide any trailing separators, so that they aren't included in the + base size } + for I := FViewers.Count-1 downto 0 do begin + with NewPositions[I] do + if Pos.Show then begin + if not(tbisSeparator in Viewers[I].Item.ItemStyle) then + Break; + Pos.Show := False; + end; + end; + + { Calculate sizes of all the items } + HighestSameWidthViewerWidth := 0; + for I := 0 to FViewers.Count-1 do begin + Item := Viewers[I].Item; + IsControl := Item is TTBControlItem; + with NewPositions[I] do begin + { Pos.BoundsRect is currently empty since SetLength initializes to zero } + if not Pos.Show then + Continue; + if not IsControl then begin + ChangedBold := False; + if tboDefault in Item.EffectiveOptions then + with CalcCanvas.Font do + if not(fsBold in Style) then begin + ChangedBold := True; + Style := Style + [fsBold]; + end; + Viewer := Viewers[I]; + TempViewerCreated := False; + if Item.NeedToRecreateViewer(Viewer) then begin + if CanMoveControls then begin + RecreateItemViewer(I); + Viewer := Viewers[I]; + end + else begin + Viewer := Item.GetItemViewerClass(Self).Create(Self, Item, 0); + TempViewerCreated := True; + end; + end; + try + Viewer.CalcSize(CalcCanvas, Pos.BoundsRect.Right, Pos.BoundsRect.Bottom); + if Viewer.UsesSameWidth then begin + Pos.SameWidth := True; + if (Pos.BoundsRect.Right > HighestSameWidthViewerWidth) then + HighestSameWidthViewerWidth := Pos.BoundsRect.Right; + end; + finally + if TempViewerCreated then + Viewer.Free; + end; + if ChangedBold then + with CalcCanvas.Font do + Style := Style - [fsBold]; + end + else begin + Ctl := TTBControlItem(Item).FControl; + Pos.BoundsRect.Right := Ctl.Width; + Pos.BoundsRect.Bottom := Ctl.Height; + end; + end; + end; + + { Increase widths of SameWidth items if necessary. Also calculate + ABaseSize.X (or Y). } + ABaseSize.X := 0; + ABaseSize.Y := 0; + for I := 0 to FViewers.Count-1 do begin + with NewPositions[I] do begin + if Pos.SameWidth and (Pos.BoundsRect.Right < HighestSameWidthViewerWidth) then + Pos.BoundsRect.Right := HighestSameWidthViewerWidth; + if AOrientation <> tbvoVertical then + Inc(ABaseSize.X, Pos.BoundsRect.Right) + else + Inc(ABaseSize.Y, Pos.BoundsRect.Bottom); + end; + end; + + { Hide partially visible items, mark them as 'OffEdge' } + if AOrientation <> tbvoVertical then + Total := ABaseSize.X + else + Total := ABaseSize.Y; + NonControlsOffEdge := False; + UseChevron := Assigned(ChevronItem) and (AChevronOffset > 0) and + (Total > AChevronOffset); + if UseChevron then begin + Dec(AChevronOffset, AChevronSize); + while Total > AChevronOffset do begin + { Count number of items. Stop loop if <= 1 } + TotalVisibleItems := 0; + for I := FViewers.Count-1 downto 0 do begin + if NewPositions[I].Pos.Show and not(tbisSeparator in Viewers[I].Item.ItemStyle) then + Inc(TotalVisibleItems); + end; + if TotalVisibleItems <= 1 then + Break; + { Hide any trailing separators } + for I := FViewers.Count-1 downto 0 do begin + if NewPositions[I].Pos.Show then begin + if not(tbisSeparator in Viewers[I].Item.ItemStyle) then + Break; + NewPositions[I].Pos.Show := False; + if AOrientation <> tbvoVertical then + Dec(Total, NewPositions[I].Pos.BoundsRect.Right) + else + Dec(Total, NewPositions[I].Pos.BoundsRect.Bottom); + goto FoundItemToHide; + end; + end; + { Find an item to hide } + if Assigned(FPriorityList) then + I := FPriorityList.Count-1 + else + I := FViewers.Count-1; + while I >= 0 do begin + if Assigned(FPriorityList) then begin + Viewer := TTBItemViewer(FPriorityList[I]); + J := Viewer.Index; + end + else begin + Viewer := Viewers[I]; + J := I; + end; + if NewPositions[J].Pos.Show and not(tbisSeparator in Viewer.Item.ItemStyle) then begin + NewPositions[J].Pos.Show := False; + NewPositions[J].Pos.OffEdge := True; + if AOrientation <> tbvoVertical then + Dec(Total, NewPositions[J].Pos.BoundsRect.Right) + else + Dec(Total, NewPositions[J].Pos.BoundsRect.Bottom); + if not NonControlsOffEdge and not(Viewer.Item is TTBControlItem) then + NonControlsOffEdge := True; + goto FoundItemToHide; + end; + Dec(I); + end; + Break; { prevent endless loop } + FoundItemToHide: + { Don't show two consecutive separators } + LastWasSep := True; { set to True initially so it won't show leading seps } + for J := 0 to FViewers.Count-1 do begin + Item := Viewers[J].Item; + with NewPositions[J] do begin + if Pos.Show then begin + if (tbisSeparator in Item.ItemStyle) and LastWasSep then begin + Pos.Show := False; + if AOrientation <> tbvoVertical then + Dec(Total, Pos.BoundsRect.Right) + else + Dec(Total, Pos.BoundsRect.Bottom); + end; + LastWasSep := tbisSeparator in Item.ItemStyle; + end; + end; + end; + end; + end; + + { Hide any trailing separators after items were hidden } + for I := FViewers.Count-1 downto 0 do begin + with NewPositions[I] do + if Pos.Show then begin + if not(tbisSeparator in Viewers[I].Item.ItemStyle) then + Break; + Pos.Show := False; + end; + end; + + { Set the ABaseSize.Y (or X) *after* items were hidden } + for I := 0 to FViewers.Count-1 do begin + with NewPositions[I] do + if Pos.Show then begin + if AOrientation <> tbvoVertical then begin + if Pos.BoundsRect.Bottom > ABaseSize.Y then + ABaseSize.Y := Pos.BoundsRect.Bottom; + end + else begin + if Pos.BoundsRect.Right > ABaseSize.X then + ABaseSize.X := Pos.BoundsRect.Right; + end; + end; + end; + + { On menus, set all non-separator items to be as tall as the tallest item } + {if not FIsToolbar then begin + J := 0; + for I := 0 to FViewers.Count-1 do begin + Item := Viewers[I].Item; + with NewPositions[I] do + if Pos.Show and not(tbisSeparator in Item.ItemStyle) and + not(tboToolbarSize in Item.FEffectiveOptions) and + (Pos.BoundsRect.Bottom - Pos.BoundsRect.Top > J) then + J := Pos.BoundsRect.Bottom - Pos.BoundsRect.Top; + end; + for I := 0 to FViewers.Count-1 do begin + Item := Viewers[I].Item; + with NewPositions[I] do + if Pos.Show and not(tbisSeparator in Item.ItemStyle) and + not(tboToolbarSize in Item.FEffectiveOptions) then + Pos.BoundsRect.Bottom := Pos.BoundsRect.Top + J; + end; + end;} + + { Calculate the position of the items } + GetMargins(AOrientation, Margins); + LeftX := Margins.Left; + TopY := Margins.Top; + if AWrapOffset > 0 then begin + Dec(AWrapOffset, Margins.Right); + if AWrapOffset < 1 then AWrapOffset := 1; + end; + CurX := LeftX; + CurY := TopY; + GroupSplit := False; + DidWrap := False; + LastWasButton := FIsToolbar; + LineStart := -1; + for I := 0 to FViewers.Count-1 do begin + Item := Viewers[I].Item; + with NewPositions[I] do begin + if not Pos.Show then + Continue; + IsButton := FIsToolbar or (tboToolbarSize in Item.FEffectiveOptions); + if LastWasButton and not IsButton then begin + { On a menu, if last item was a button and the current item isn't, + proceed to next row } + CurX := LeftX; + CurY := TotalSize.Y; + end; + LastWasButton := IsButton; + PositionItem(I, NewPositions[I].Pos); + if IsButton and (AOrientation <> tbvoVertical) then + Inc(CurX, Pos.BoundsRect.Right - Pos.BoundsRect.Left) + else + Inc(CurY, Pos.BoundsRect.Bottom - Pos.BoundsRect.Top); + if Pos.BoundsRect.Right > TotalSize.X then + TotalSize.X := Pos.BoundsRect.Right; + if Pos.BoundsRect.Bottom > TotalSize.Y then + TotalSize.Y := Pos.BoundsRect.Bottom; + end; + end; + if FViewers.Count <> 0 then + FinalizeLine(FViewers.Count-1, True); + Inc(TotalSize.X, Margins.Right); + Inc(TotalSize.Y, Margins.Bottom); + if AOrientation = tbvoVertical then + Mirror; + HandleMaxHeight; + if CanMoveControls then begin + for I := 0 to FViewers.Count-1 do begin + Item := Viewers[I].Item; + if Item is TTBControlItem then begin + if NewPositions[I].Pos.Show then begin + Ctl := TTBControlItem(Item).FControl; + if not EqualRect(NewPositions[I].Pos.BoundsRect, Ctl.BoundsRect) then + Ctl.BoundsRect := NewPositions[I].Pos.BoundsRect; + end + else if NewPositions[I].Pos.OffEdge or NewPositions[I].Pos.Clipped then begin + { Simulate hiding of OddEdge controls by literally moving them + off the edge. Do the same for Clipped controls. } + Ctl := TTBControlItem(Item).FControl; + Ctl.SetBounds(FWindow.ClientWidth, FWindow.ClientHeight, + Ctl.Width, Ctl.Height); + end; + end; + end; + end; + { Set size of line separators } + if FIsToolbar then + for I := 0 to FViewers.Count-1 do begin + Item := Viewers[I].Item; + with NewPositions[I] do + if Pos.Show and (tbisSeparator in Item.ItemStyle) and + Pos.LineSep then begin + if AOrientation <> tbvoVertical then + Pos.BoundsRect.Right := TotalSize.X + else + Pos.BoundsRect.Bottom := TotalSize.Y; + end; + end; + + { Position the chevron item } + if UseChevron then begin + if CanMoveControls then + ChevronItem.Enabled := NonControlsOffEdge; + NewPositions[FViewers.Count-1].Pos.Show := True; + I := AChevronOffset; + if AOrientation <> tbvoVertical then begin + if I < TotalSize.X then + I := TotalSize.X; + NewPositions[FViewers.Count-1].Pos.BoundsRect := Bounds(I, 0, + AChevronSize, TotalSize.Y); + end + else begin + if I < TotalSize.Y then + I := TotalSize.Y; + NewPositions[FViewers.Count-1].Pos.BoundsRect := Bounds(0, I, + TotalSize.X, AChevronSize); + end; + end; + + { Commit changes } + Result := False; + if CanMoveControls then begin + for I := 0 to FViewers.Count-1 do begin + Viewer := Viewers[I]; + with NewPositions[I] do begin + if not Result and + (not EqualRect(Viewer.BoundsRect, Pos.BoundsRect) or + (Viewer.Show <> Pos.Show) or + ((tbisLineSep in Viewer.State) <> Pos.LineSep)) then + Result := True; + Viewer.FBoundsRect := Pos.BoundsRect; + Viewer.FShow := Pos.Show; + Viewer.FOffEdge := Pos.OffEdge; + Viewer.FClipped := Pos.Clipped; + if Pos.LineSep then + Include(Viewer.State, tbisLineSep) + else + Exclude(Viewer.State, tbisLineSep); + end; + end; + end; + finally + FOrientation := SaveOrientation; + if Assigned(CalcCanvas) then + CalcCanvas.Handle := 0; + if DC <> 0 then ReleaseDC(0, DC); + CalcCanvas.Free; + end; + if (ABaseSize.X = 0) or (ABaseSize.Y = 0) then begin + { If there are no visible items... } + {}{scale this?} + ABaseSize.X := 23; + ABaseSize.Y := 22; + if TotalSize.X < 23 then TotalSize.X := 23; + if TotalSize.Y < 22 then TotalSize.Y := 22; + end; +end; + +procedure TTBView.DoUpdatePositions(var ASize: TPoint); +{ This is called by UpdatePositions } +var + WrappedLines: Integer; +begin + { Don't call InvalidatePositions before CalculatePositions so that + endless recursion doesn't happen if an item's CalcSize uses a method that + calls ValidatePositions } + CalculatePositions(True, FOrientation, FWrapOffset, FChevronOffset, + FChevronSize, FBaseSize, ASize, WrappedLines); + FValidated := True; + { Need to call ValidateRect before AutoSize, otherwise Windows will + erase the client area during a resize } + if FWindow.HandleAllocated then + ValidateRect(FWindow.Handle, nil); + AutoSize(ASize.X, ASize.Y); + if FWindow.HandleAllocated then + DoubleBufferedRepaint(FWindow.Handle); +end; + +function TTBView.UpdatePositions: TPoint; +{ Called whenever the size or orientation of a view changes. When items are + added or removed from the view, InvalidatePositions must be called instead, + otherwise the view may not be redrawn properly. } +begin + Result.X := 0; + Result.Y := 0; + DoUpdatePositions(Result); +end; + +procedure TTBView.AutoSize(AWidth, AHeight: Integer); +begin +end; + +function TTBView.GetChevronItem: TTBCustomItem; +begin + Result := nil; +end; + +procedure TTBView.GetMargins(AOrientation: TTBViewOrientation; + var Margins: TRect); +begin + if AOrientation = tbvoFloating then begin + Margins.Left := 4; + Margins.Top := 2; + Margins.Right := 4; + Margins.Bottom := 1; + end + else begin + Margins.Left := 0; + Margins.Top := 0; + Margins.Right := 0; + Margins.Bottom := 0; + end; +end; + +function TTBView.GetMDIButtonsItem: TTBCustomItem; +begin + Result := nil; +end; + +function TTBView.GetMDISystemMenuItem: TTBCustomItem; +begin + Result := nil; +end; + +function TTBView.GetFont: TFont; +begin + if Assigned(ToolbarFont) then + Result := ToolbarFont + else begin + { ToolbarFont is destroyed during unit finalization, but in rare cases + this method may end up being called from ValidatePositions *after* + unit finalization if Application.Run is never called; see the + "EConvertError" newsgroup thread. We can't return nil because that would + cause an exception in the calling function, so just return the window + font. It's not the *right* font, but it shouldn't matter since the app + is exiting anyway. } + Result := {$IFNDEF CLR}TControlAccess{$ENDIF}(FWindow).Font; + end; +end; + +procedure TTBView.DrawItem(Viewer: TTBItemViewer; DrawTo: TCanvas; + Offscreen: Boolean); +const + COLOR_MENUHILIGHT = 29; + clMenuHighlight = TColor(COLOR_MENUHILIGHT or $80000000); +var + Bmp: TBitmap; + DrawToDC, BmpDC: HDC; + DrawCanvas: TCanvas; + R1, R2, R3: TRect; + IsOpen, IsSelected, IsPushed: Boolean; + ToolbarStyle: Boolean; + UseDisabledShadow: Boolean; + SaveIndex, SaveIndex2: Integer; + WindowOrg: TPoint; + BkColor: TColor; +begin + ValidatePositions; + + if tbisInvalidated in Viewer.State then begin + Offscreen := True; + Exclude(Viewer.State, tbisInvalidated); + end; + + R1 := Viewer.BoundsRect; + if not Viewer.Show or IsRectEmpty(R1) or (Viewer.Item is TTBControlItem) then + Exit; + R2 := R1; + OffsetRect(R2, -R2.Left, -R2.Top); + + IsOpen := FOpenViewer = Viewer; + IsSelected := (FSelected = Viewer); + IsPushed := IsSelected and (IsOpen or (FMouseOverSelected and FCapture)); + ToolbarStyle := Viewer.IsToolbarStyle; + + DrawToDC := DrawTo.Handle; + Bmp := nil; + { Must deselect any currently selected handles before calling SaveDC, because + if they are left selected and DeleteObject gets called on them after the + SaveDC call, it will fail on Win9x/Me, and thus leak GDI resources. } + DrawTo.Refresh; + SaveIndex := SaveDC(DrawToDC); + try + IntersectClipRect(DrawToDC, R1.Left, R1.Top, R1.Right, R1.Bottom); + GetClipBox(DrawToDC, R3); + if IsRectEmpty(R3) then + Exit; + + if not Offscreen then begin + MoveWindowOrg(DrawToDC, R1.Left, R1.Top); + { Tweak the brush origin so that the checked background drawn behind + checked items always looks the same regardless of whether the item + is positioned on an even or odd Left or Top coordinate. } + if GetWindowOrgEx(DrawToDC, WindowOrg) then + SetBrushOrgEx(DrawToDC, -WindowOrg.X, -WindowOrg.Y, nil); + DrawCanvas := DrawTo; + end + else begin + Bmp := TBitmap.Create; + Bmp.Width := R2.Right; + Bmp.Height := R2.Bottom; + DrawCanvas := Bmp.Canvas; + BmpDC := DrawCanvas.Handle; + SaveIndex2 := SaveDC(BmpDC); + SetWindowOrgEx(BmpDC, R1.Left, R1.Top, nil); + FWindow.Perform(WM_ERASEBKGND, WPARAM(BmpDC), 0); + RestoreDC(BmpDC, SaveIndex2); + end; + + { Initialize brush } + if not ToolbarStyle and IsSelected then begin + {$IFNDEF TB2K_USE_STRICT_O2K_MENU_STYLE} + if AreFlatMenusEnabled then + { Windows XP uses a different fill color for selected menu items when + flat menus are enabled } + DrawCanvas.Brush.Color := clMenuHighlight + else + {$ENDIF} + DrawCanvas.Brush.Color := clHighlight; + end + else + DrawCanvas.Brush.Style := bsClear; + + { Initialize font } + DrawCanvas.Font.Assign(GetFont); + if Viewer.Item.Enabled then begin + if not ToolbarStyle and IsSelected then + DrawCanvas.Font.Color := clHighlightText + else begin + if ToolbarStyle then + DrawCanvas.Font.Color := clBtnText + else + DrawCanvas.Font.Color := tbMenuTextColor; + end; + UseDisabledShadow := False; + end + else begin + DrawCanvas.Font.Color := clGrayText; + { Use the disabled shadow if either: + 1. The item is a toolbar-style item. + 2. The item is not selected, and the background color equals the + button-face color. + 3. The gray-text color is the same as the background color. + Note: Windows actually uses dithered text in this case. } + BkColor := ColorToRGB({$IFNDEF CLR}TControlAccess{$ENDIF}(FWindow).Color); + UseDisabledShadow := ToolbarStyle or + (not IsSelected and (BkColor = ColorToRGB(clBtnFace))) or + (ColorToRGB(clGrayText) = BkColor); + end; + + Viewer.Paint(DrawCanvas, R2, IsSelected, IsPushed, UseDisabledShadow); + + if Offscreen then + BitBlt(DrawToDC, R1.Left, R1.Top, Bmp.Width, Bmp.Height, DrawCanvas.Handle, + 0, 0, SRCCOPY); + finally + DrawTo.Refresh; { must do this before a RestoreDC } + RestoreDC(DrawToDC, SaveIndex); + Bmp.Free; + end; +end; + +procedure TTBView.DrawSubitems(ACanvas: TCanvas); +var + ClipRect: TRect; + + procedure DoDraw(const AViewer: TTBItemViewer); + var + Temp: TRect; + begin + { Speed optimization: Only call DrawItem on viewers that intersect the + canvas's clipping rectangle. Without this check, moving the mouse across + a toolbar with thousands of visible items uses 100% of the CPU. } + if AViewer.Show and IntersectRect(Temp, ClipRect, AViewer.BoundsRect) then + DrawItem(AViewer, ACanvas, False) + else begin + { Not going to draw the item. Go ahead and clear the tbisInvalidated + flag if it's set so it won't needlessly double-buffer next time. } + Exclude(AViewer.State, tbisInvalidated); + end; + end; + +var + I: Integer; +begin + ValidatePositions; + ClipRect := ACanvas.ClipRect; + + { Draw non-selected items before drawing the selected item, so that when the + selection is changing there's no brief window in which two items appear + to be selected } + for I := 0 to FViewers.Count-1 do begin + if (vsDrawInOrder in FState) or (Viewers[I] <> FSelected) then + DoDraw(Viewers[I]); + end; + if not(vsDrawInOrder in FState) and Assigned(FSelected) then + DoDraw(FSelected); + + Exclude(FState, vsDrawInOrder); +end; + +procedure TTBView.Invalidate(AViewer: TTBItemViewer); +begin + if not FValidated or not Assigned(FWindow) or not FWindow.HandleAllocated then + Exit; + if AViewer.Show and not IsRectEmpty(AViewer.BoundsRect) and + not(AViewer.Item is TTBControlItem) then begin + Include(AViewer.State, tbisInvalidated); + InvalidateRect(FWindow.Handle, {$IFNDEF CLR}@{$ENDIF} AViewer.BoundsRect, False); + end; +end; + +procedure TTBView.SetAccelsVisibility(AShowAccels: Boolean); +var + I: Integer; + Viewer: TTBItemViewer; +begin + { Always show accels when keyboard cues are enabled } + AShowAccels := AShowAccels or not(vsUseHiddenAccels in FStyle) or + AreKeyboardCuesEnabled; + if AShowAccels <> (vsShowAccels in FState) then begin + if AShowAccels then + Include(FState, vsShowAccels) + else + Exclude(FState, vsShowAccels); + if Assigned(FWindow) and FWindow.HandleAllocated and + IsWindowVisible(FWindow.Handle) then + { ^ the visibility check is just an optimization } + for I := 0 to FViewers.Count-1 do begin + Viewer := Viewers[I]; + if Viewer.CaptionShown and + (FindAccelChar(Viewer.GetCaptionText) <> #0) then + Invalidate(Viewer); + end; + end; +end; + +function TTBView.FirstSelectable: TTBItemViewer; +var + FirstViewer: TTBItemViewer; +begin + Result := NextSelectable(nil, True); + if Assigned(Result) then begin + FirstViewer := Result; + while tbisDontSelectFirst in Result.Item.ItemStyle do begin + Result := NextSelectable(Result, True); + if Result = FirstViewer then + { don't loop endlessly if all items have the tbisDontSelectFirst style } + Break; + end; + end; +end; + +function TTBView.NextSelectable(CurViewer: TTBItemViewer; + GoForward: Boolean): TTBItemViewer; +var + I, J: Integer; +begin + ValidatePositions; + Result := nil; + if FViewers.Count = 0 then Exit; + J := -1; + I := IndexOf(CurViewer); + while True do begin + if GoForward then begin + Inc(I); + if I >= FViewers.Count then I := 0; + end + else begin + Dec(I); + if I < 0 then I := FViewers.Count-1; + end; + if J = -1 then + J := I + else + if I = J then + Exit; + if (Viewers[I].Show or Viewers[I].Clipped) and Viewers[I].Item.Visible and + (tbisSelectable in Viewers[I].Item.ItemStyle) then + Break; + end; + Result := Viewers[I]; +end; + +function TTBView.NextSelectableWithAccel(CurViewer: TTBItemViewer; + Key: Char; RequirePrimaryAccel: Boolean; var IsOnlyItemWithAccel: Boolean): TTBItemViewer; + + function IsAccelItem(const Index: Integer; + const Primary, EnabledItems: Boolean): Boolean; + var + S: String; + LastAccel: Char; + Viewer: TTBItemViewer; + Item: TTBCustomItem; + begin + Result := False; + Viewer := Viewers[Index]; + Item := Viewer.Item; + if (Viewer.Show or Viewer.Clipped) and (tbisSelectable in Item.ItemStyle) and + (Item.Enabled = EnabledItems) and + Item.Visible and Viewer.CaptionShown then begin + S := Viewer.GetCaptionText; + if S <> '' then begin + LastAccel := FindAccelChar(S); + if Primary then begin + if LastAccel <> #0 then + Result := (CharToLower(LastAccel) = CharToLower(Key)); + end + else + if (LastAccel = #0) and (Key <> ' ') then + Result := (CharToLower(S[1]) = CharToLower(Key)); + end; + end; + end; + + function FindAccel(I: Integer; + const Primary, EnabledItems: Boolean): Integer; + var + J: Integer; + begin + Result := -1; + J := -1; + while True do begin + Inc(I); + if I >= FViewers.Count then I := 0; + if J = -1 then + J := I + else + if I = J then + Break; + if IsAccelItem(I, Primary, EnabledItems) then begin + Result := I; + Break; + end; + end; + end; + +var + Start, I: Integer; + Primary, EnabledItems: Boolean; +begin + ValidatePositions; + Result := nil; + IsOnlyItemWithAccel := False; + if FViewers.Count = 0 then Exit; + + Start := IndexOf(CurViewer); + for Primary := True downto False do + if not RequirePrimaryAccel or Primary then + for EnabledItems := True downto False do begin + I := FindAccel(Start, Primary, EnabledItems); + if I <> -1 then begin + Result := Viewers[I]; + IsOnlyItemWithAccel := not EnabledItems or + (FindAccel(I, Primary, EnabledItems) = I); + Exit; + end; + end; +end; + +procedure TTBView.EnterToolbarLoop(Options: TTBEnterToolbarLoopOptions); +var + ModalHandler: TTBModalHandler; +begin + if vsModal in FState then Exit; + ModalHandler := TTBModalHandler.Create(FWindow.Handle); + try + { remove all states except... } + FState := FState * [vsShowAccels]; + try + Include(FState, vsModal); + { Must ensure that DoneAction is reset to tbdaNone *before* calling + NotifyFocusEvent so that the IsModalEnding call it makes won't return + True } + FDoneActionData.DoneAction := tbdaNone; + { Now that the vsModal state has been added, send an MSAA focus event } + if Assigned(Selected) then + NotifyFocusEvent; + ModalHandler.Loop(Self, tbetMouseDown in Options, + tbetExecuteSelected in Options, tbetFromMSAA in Options, False); + finally + { Remove vsModal state from the root view before any TTBView.Destroy + methods get called (as a result of the CloseChildPopups call below), + so that NotifyFocusEvent becomes a no-op } + Exclude(FState, vsModal); + StopAllTimers; + CloseChildPopups; + UpdateSelection(Point(Low(Integer), Low(Integer)), True); + end; + finally + ModalHandler.Free; + end; + SetAccelsVisibility(False); + ProcessDoneAction(FDoneActionData, False); +end; + +procedure TTBView.SetCustomizing(Value: Boolean); +begin + if FCustomizing <> Value then begin + FCustomizing := Value; + RecreateAllViewers; + end; +end; + +procedure TTBView.BeginUpdate; +begin + Inc(FUpdating); +end; + +procedure TTBView.EndUpdate; +begin + Dec(FUpdating); + if FUpdating = 0 then + TryValidatePositions; +end; + +procedure TTBView.GetOffEdgeControlList(const List: TList); +var + I: Integer; + Item: TTBCustomItem; +begin + for I := 0 to FViewers.Count-1 do begin + Item := Viewers[I].Item; + if (Item is TTBControlItem) and Viewers[I].OffEdge and + (TTBControlItem(Item).FControl is TWinControl) then + List.Add(TTBControlItem(Item).FControl); + end; +end; + +procedure TTBView.SetCapture; +begin + FCapture := True; +end; + +procedure TTBView.CancelCapture; +begin + if FCapture then begin + FCapture := False; + LastPos.X := Low(LastPos.X); + if Assigned(FSelected) then + FSelected.LosingCapture; + end; +end; + +procedure TTBView.KeyDown(var Key: Word; Shift: TShiftState); + + procedure SelNextItem(const ParentView: TTBView; const GoForward: Boolean); + begin + ParentView.Selected := ParentView.NextSelectable(ParentView.FSelected, + GoForward); + ParentView.ScrollSelectedIntoView; + end; + + procedure HelpKey; + var + V: TTBView; + ContextID: Integer; + begin + ContextID := 0; + V := Self; + while Assigned(V) do begin + if Assigned(V.FSelected) then begin + ContextID := V.FSelected.Item.HelpContext; + if ContextID <> 0 then Break; + end; + V := V.FParentView; + end; + if ContextID <> 0 then + EndModalWithHelp(ContextID); + end; + +var + ParentTBView: TTBView; +begin + ParentTBView := GetParentToolbarView; + case Key of + VK_TAB: begin + SelNextItem(Self, GetKeyState(VK_SHIFT) >= 0); + end; + VK_RETURN: begin + ExecuteSelected(True); + end; + VK_MENU, VK_F10: begin + EndModal; + end; + VK_ESCAPE: begin + Key := 0; + if FParentView = nil then + EndModal + else + FParentView.CancelChildPopups; + end; + VK_LEFT, VK_RIGHT: begin + if (Self = ParentTBView) and (Orientation = tbvoVertical) then + OpenChildPopup(True) + else if Key = VK_LEFT then begin + if Assigned(ParentTBView) and (ParentTBView.Orientation <> tbvoVertical) then begin + if (Self = ParentTBView) or + (FParentView = ParentTBView) then + SelNextItem(ParentTBView, False) + else + FParentView.CloseChildPopups; + end + else begin + if Assigned(FParentView) then + FParentView.CancelChildPopups; + end; + end + else begin + if ((Self = ParentTBView) or not OpenChildPopup(True)) and + (Assigned(ParentTBView) and (ParentTBView.Orientation <> tbvoVertical)) then begin + { If we're on ParentTBView, or if the selected item can't display + a submenu, proceed to next item on ParentTBView } + SelNextItem(ParentTBView, True); + end; + end; + end; + VK_UP, VK_DOWN: begin + if (Self = ParentTBView) and (Orientation <> tbvoVertical) then + OpenChildPopup(True) + else + SelNextItem(Self, Key = VK_DOWN); + end; + VK_HOME, VK_END: begin + Selected := NextSelectable(nil, Key = VK_HOME); + ScrollSelectedIntoView; + end; + VK_F1: HelpKey; + else + Exit; { don't set Key to 0 for unprocessed keys } + end; + Key := 0; +end; + +function TTBView.IsModalEnding: Boolean; +begin + Result := (GetRootView.FDoneActionData.DoneAction <> tbdaNone); +end; + +procedure TTBView.EndModal; +var + RootView: TTBView; +begin + RootView := GetRootView; + RootView.FDoneActionData.DoneAction := tbdaCancel; +end; + +procedure TTBView.EndModalWithClick(AViewer: TTBItemViewer); +var + RootView: TTBView; +begin + RootView := GetRootView; + RootView.FDoneActionData.ClickItem := AViewer.Item; + RootView.FDoneActionData.Sound := AViewer.FView.FIsPopup; + RootView.FDoneActionData.DoneAction := tbdaClickItem; +end; + +procedure TTBView.EndModalWithHelp(AContextID: Integer); +var + RootView: TTBView; +begin + RootView := GetRootView; + RootView.FDoneActionData.ContextID := AContextID; + RootView.FDoneActionData.DoneAction := tbdaHelpContext; +end; + +procedure TTBView.EndModalWithSystemMenu(AWnd: HWND; AKey: Word); +var + RootView: TTBView; +begin + RootView := GetRootView; + RootView.FDoneActionData.Wnd := AWnd; + RootView.FDoneActionData.Key := AKey; + RootView.FDoneActionData.DoneAction := tbdaOpenSystemMenu; +end; + +procedure TTBView.ExecuteSelected(AGivePriority: Boolean); +{ Normally called after an Enter or accelerator key press on the view, this + method 'executes' or opens the selected item. It ends the modal loop, except + when a submenu is opened. } +var + Item: TTBCustomItem; +begin + if Assigned(FSelected) and FSelected.Item.Enabled then begin + Item := FSelected.Item; + if (tbisCombo in Item.ItemStyle) or not OpenChildPopup(True) then begin + if tbisSelectable in Item.ItemStyle then + FSelected.Execute(AGivePriority) + else + EndModal; + end + end + else + EndModal; + {$IFNDEF CLR} + Exit; asm db 0,'Toolbar2000 (C) 1998-2008 Jordan Russell',0 end; + {$ENDIF} +end; + +procedure TTBView.Scroll(ADown: Boolean); +var + CurPos, NewPos, I: Integer; +begin + ValidatePositions; + if ADown then begin + NewPos := High(NewPos); + CurPos := FMaxHeight - tbMenuScrollArrowHeight; + for I := 0 to FViewers.Count-1 do begin + with Viewers[I] do + if Clipped and not(tbisSeparator in Item.ItemStyle) and + (BoundsRect.Bottom < NewPos) and (BoundsRect.Bottom > CurPos) then + NewPos := BoundsRect.Bottom; + end; + if NewPos = High(NewPos) then + Exit; + Dec(NewPos, FMaxHeight - tbMenuScrollArrowHeight); + end + else begin + NewPos := Low(NewPos); + CurPos := tbMenuScrollArrowHeight; + for I := 0 to FViewers.Count-1 do begin + with Viewers[I] do + if Clipped and not(tbisSeparator in Item.ItemStyle) and + (BoundsRect.Top > NewPos) and (BoundsRect.Top < CurPos) then + NewPos := BoundsRect.Top; + end; + if NewPos = Low(NewPos) then + Exit; + Dec(NewPos, tbMenuScrollArrowHeight); + end; + Inc(FScrollOffset, NewPos); + UpdatePositions; +end; + +procedure TTBView.ScrollSelectedIntoView; +begin + ValidatePositions; + if (FSelected = nil) or not FSelected.Clipped then + Exit; + + if FSelected.BoundsRect.Top < tbMenuScrollArrowHeight then begin + Dec(FScrollOffset, tbMenuScrollArrowHeight - FSelected.BoundsRect.Top); + UpdatePositions; + end + else if FSelected.BoundsRect.Bottom > FMaxHeight - tbMenuScrollArrowHeight then begin + Dec(FScrollOffset, (FMaxHeight - tbMenuScrollArrowHeight) - + FSelected.BoundsRect.Bottom); + UpdatePositions; + end; +end; + +procedure TTBView.SetUsePriorityList(Value: Boolean); +begin + if FUsePriorityList <> Value then begin + FUsePriorityList := Value; + RecreateAllViewers; + end; +end; + +function TTBView.GetCaptureWnd: HWND; +begin + Result := GetRootView.FCaptureWnd; +end; + +procedure TTBView.CancelMode; +var + View: TTBView; +begin + EndModal; + + { Hide all parent/child popup windows. Can't actually destroy them using + CloseChildPopups because this method may be called while inside + TTBEditItemViewer's message loop, and it could result in the active + TTBEditItemViewer instance being destroyed (leading to an AV). } + View := Self; + while Assigned(View.FOpenViewerView) do + View := View.FOpenViewerView; + repeat + View.StopAllTimers; + if View.FWindow is TTBPopupWindow then + View.FWindow.Visible := False; + View := View.FParentView; + until View = nil; + + { Note: This doesn't remove the selection from a top-level toolbar item. + Unfortunately, we can't do 'Selected := nil' because it would destroy + child popups and that must'nt happen for the reason stated above. } +end; + +procedure TTBView.HandleHintShowMessage(var Message: TCMHintShow); + + procedure UpdateInfo(var Info: {$IFDEF JR_D12}Controls.{$ENDIF} THintInfo); + var + V: TTBItemViewer; + begin + Info.HintStr := ''; + V := ViewerFromPoint(Info.CursorPos); + if Assigned(V) then begin + Info.CursorRect := V.BoundsRect; + Info.HintStr := V.GetHintText; + Info.HintData := V; + end; + end; + +{$IFNDEF CLR} +begin + UpdateInfo(Message.HintInfo^); +end; +{$ELSE} +var + Info: THintInfo; +begin + Info := Message.HintInfo; + UpdateInfo(Info); + Message.HintInfo := Info; +end; +{$ENDIF} + + +{ TTBModalHandler } + +constructor TTBModalHandler.Create(AExistingWnd: HWND); + + procedure RemoveFocusIfOnOtherThread; + { This ensures that the message loop will receive key messages when an Adobe + Reader (8.1.2) control embedded in a TWebBrowser is currently focused. + The Reader control is actually hosted in a separate thread (in a separate + process, AcroRd32.exe). When Alt/Alt+[letter] is pressed, Reader calls + GetAncestor(..., GA_ROOT) and forwards the WM_SYSCOMMAND/WM_SYSCHAR + message to that window using SendMessage (not PostMessage, for some + reason). The focus, however, is left on the Reader control. Consequently, + any keystrokes will generate key messages in the Reader thread's queue + instead of ours. To avoid that, call SetFocus(0) to remove the focus if + it's currently on another thread's window. When no window has the focus, + key messages will be posted to the active window, which *should* be a + form owned by the same thread as us. } + var + FocusWnd: HWND; + begin + FocusWnd := GetFocus; + if (FocusWnd <> 0) and + (GetWindowThreadProcessId(FocusWnd, nil) <> GetCurrentThreadId) then begin + FSaveFocusWnd := FocusWnd; + SetFocus(0); + end; + end; + +begin + inherited Create; + LastPos := GetMessagePosAsPoint; + if AExistingWnd <> 0 then + FWnd := AExistingWnd + else begin + FWnd := {$IFDEF ALLOCHWND_CLASSES}Classes.{$ENDIF} AllocateHWnd(WndProc); + FCreatedWnd := True; + end; + RemoveFocusIfOnOtherThread; + { Like standard menus, don't allow other apps to steal the focus during + our modal loop. This also prevents us from losing activation when + "active window tracking" is enabled and the user moves the mouse over + another application's window. } + CallLockSetForegroundWindow(True); + SetCapture(FWnd); + SetCursor(LoadCursor(0, IDC_ARROW)); + CallNotifyWinEvent(EVENT_SYSTEM_MENUSTART, FWnd, OBJID_CLIENT, CHILDID_SELF); + FInited := True; +end; + +destructor TTBModalHandler.Destroy; +begin + CallLockSetForegroundWindow(False); + if FWnd <> 0 then begin + if GetCapture = FWnd then + ReleaseCapture; + if FInited then + CallNotifyWinEvent(EVENT_SYSTEM_MENUEND, FWnd, OBJID_CLIENT, CHILDID_SELF); + if FCreatedWnd then + {$IFDEF ALLOCHWND_CLASSES}Classes.{$ENDIF} DeallocateHWnd(FWnd); + end; + if (FSaveFocusWnd <> 0) and (GetFocus = 0) then + SetFocus(FSaveFocusWnd); + inherited; +end; + +procedure TTBModalHandler.WndProc(var Msg: TMessage); +begin + Msg.Result := DefWindowProc(FWnd, Msg.Msg, Msg.WParam, Msg.LParam); + if (Msg.Msg = WM_CANCELMODE) and Assigned(FRootPopup) then begin + try + { We can receive a WM_CANCELMODE message during a modal loop if a dialog + pops up. Respond by hiding menus to make it look like the modal loop + has returned, even though it really hasn't yet. + Note: Similar code in TTBCustomToolbar.WMCancelMode. } + FRootPopup.View.CancelMode; + except + Application.HandleException(Self); + end; + end; +end; + +procedure TTBModalHandler.Loop(const RootView: TTBView; + const AMouseDown, AExecuteSelected, AFromMSAA, TrackRightButton: Boolean); +var + OriginalActiveWindow: HWND; + + function GetActiveView: TTBView; + begin + Result := RootView; + while Assigned(Result.FOpenViewerView) do + Result := Result.FOpenViewerView; + end; + + function GetCaptureView: TTBView; + begin + Result := RootView; + while Assigned(Result) and not Result.FCapture do + Result := Result.FOpenViewerView; + end; + + procedure UpdateAllSelections(const P: TPoint; const AllowNewSelection: Boolean); + var + View, CapView: TTBView; + begin + View := GetActiveView; + CapView := GetCaptureView; + while Assigned(View) do begin + if (CapView = nil) or (View = CapView) then + View.UpdateSelection(P, AllowNewSelection); + View := View.FParentView; + end; + end; + + function GetSelectedViewer(var AView: TTBView; var AViewer: TTBItemViewer): Boolean; + { Returns True if AViewer <> nil. } + var + View: TTBView; + begin + { Look for a capture item first } + AView := GetCaptureView; + if Assigned(AView) then + AViewer := AView.FSelected + else begin + AView := nil; + AViewer := nil; + View := RootView; + repeat + if Assigned(View.FSelected) and View.FMouseOverSelected then begin + AView := View; + AViewer := View.FSelected; + Break; + end; + if vsMouseInWindow in View.FState then begin + { ...there is no current selection, but the mouse is still in the + window. This can happen if the mouse is over the non-client area + of the toolbar or popup window, or in an area not containing an + item. } + AView := View; + Break; + end; + View := View.FOpenViewerView; + until View = nil; + end; + Result := Assigned(AViewer); + end; + + function ContinueLoop: Boolean; + begin + { Don't continue if the mouse capture is lost, if a (modeless) top-level + window is shown causing the active window to change, or if EndModal* was + called. } + Result := (GetCapture = FWnd) and (GetActiveWindow = OriginalActiveWindow) + and not RootView.IsModalEnding; + end; + + function SendKeyEvent(const View: TTBView; var Key: Word; + const Shift: TShiftState): Boolean; + begin + Result := True; + if Assigned(View.FSelected) then begin + View.FSelected.KeyDown(Key, Shift); + if RootView.IsModalEnding then + Exit; + end; + if Key <> 0 then begin + View.KeyDown(Key, Shift); + if RootView.IsModalEnding then + Exit; + end; + Result := False; + end; + + procedure DoHintMouseMessage(const Ctl: TControl; const P: TPoint); + var + M: TMessage; + begin + {$IFDEF CLR} + M := TMessage.Create; + {$ENDIF} + M.Msg := WM_MOUSEMOVE; + M.WParam := 0; + M.LParam := MAKELPARAM(Word(P.X), Word(P.Y)); + M.Result := 0; + Application.HintMouseMessage(Ctl, M); + end; + + procedure MouseMoved; + var + Cursor: HCURSOR; + View: TTBView; + Viewer: TTBItemViewer; + P: TPoint; + begin + UpdateAllSelections(LastPos, True); + Cursor := 0; + if GetSelectedViewer(View, Viewer) then begin + P := View.FWindow.ScreenToClient(LastPos); + if ((vsAlwaysShowHints in View.FStyle) or + (tboShowHint in Viewer.Item.FEffectiveOptions)) and not View.FCapture then begin + { Display popup hint for the item. Update is called + first to minimize flicker caused by the hiding & + showing of the hint window. } + View.FWindow.Update; + DoHintMouseMessage(View.FWindow, P); + end + else + Application.CancelHint; + Dec(P.X, Viewer.BoundsRect.Left); + Dec(P.Y, Viewer.BoundsRect.Top); + Viewer.GetCursor(P, Cursor); + end + else + Application.CancelHint; + if Cursor = 0 then + Cursor := LoadCursor(0, IDC_ARROW); + SetCursor(Cursor); + if Assigned(Viewer) then + Viewer.MouseMove(P.X, P.Y); + end; + + procedure UpdateAppHint; + var + View: TTBView; + begin + View := RootView; + while Assigned(View.FOpenViewerView) and Assigned(View.FOpenViewerView.FSelected) do + View := View.FOpenViewerView; + if Assigned(View.FSelected) then + Application.Hint := GetLongHint(View.FSelected.Item.Hint) + else + Application.Hint := ''; + end; + + procedure HandleTimer(const View: TTBView; const ID: TTBViewTimerID); + begin + case ID of + tiOpen: begin + { Similar to standard menus, always close child popups, even if + Selected = OpenViewer. + Note: CloseChildPopups and OpenChildPopup will stop the tiClose + and tiOpen timers respectively. } + View.CloseChildPopups; + View.OpenChildPopup(False); + end; + tiClose: begin + { Note: CloseChildPopups stops the tiClose timer. } + View.CloseChildPopups; + end; + tiScrollUp: begin + if View.FShowUpArrow then + View.Scroll(False) + else + View.StopTimer(tiScrollUp); + end; + tiScrollDown: begin + if View.FShowDownArrow then + View.Scroll(True) + else + View.StopTimer(tiScrollDown); + end; + end; + end; + +var + MouseDownOnMenu: Boolean; + Msg: TMsg; + P: TPoint; + Ctl: TControl; + View: TTBView; + ConvertedKey: Char; + IsOnlyItemWithAccel: Boolean; + MouseIsDown: Boolean; + Key: Word; + Shift: TShiftState; + Viewer: TTBItemViewer; +begin + RootView.FDoneActionData.DoneAction := tbdaNone; + RootView.ValidatePositions; + try + try + RootView.FCaptureWnd := FWnd; + MouseDownOnMenu := False; + if AMouseDown then begin + P := RootView.FSelected.ScreenToClient(GetMessagePosAsPoint); + RootView.FSelected.MouseDown([], P.X, P.Y, MouseDownOnMenu); + if RootView.IsModalEnding then + Exit; + MouseDownOnMenu := False; { never set MouseDownOnMenu to True on first click } + end + else if AExecuteSelected then begin + RootView.ExecuteSelected(not AFromMSAA); + if RootView.IsModalEnding then + Exit; + end; + OriginalActiveWindow := GetActiveWindow; + while ContinueLoop do begin + TBUpdateAnimation; + { Examine the next message before popping it out of the queue } + if not PeekMessage(Msg, 0, 0, 0, PM_NOREMOVE) then begin + { No message available; wait for one to arrive } + if TBIsAnimationInProgress then + { While animating, if no message arrives within 1 ms, loop back and + call TBUpdateAnimation again to see if it's ready for a new frame. + Note: We don't use a timer to call TBUpdateAnimation because on + Windows 98, timers only have a resolution of 55 ms in my tests, + too poor for smooth animation. (timeBeginPeriod does not help.) + Sleep and MsgWaitForMultipleObjects, on the other hand, appear to + have a resolution of 5 ms by default. (Better resolution is + possible with a call to timeBeginPeriod, but we don't need it.) + Note: On 2000/XP, timers and Sleep both have a resolution of 10-15 + ms by default. } + MsgWaitForMultipleObjects(0, {$IFNDEF CLR} THandle(nil^) {$ELSE} [] {$ENDIF}, + False, 1, QS_ALLINPUT) + else + WaitMessage; + Continue; + end; + case Msg.message of + WM_LBUTTONDOWN, WM_RBUTTONDOWN: begin + P := Msg.pt; + Ctl := FindDragTarget(P, True); + { Was the mouse not clicked on a popup, or was it clicked on a + popup that is not a child of RootView? + (The latter can happen when in customization mode, for example, + if the user right-clicks a popup menu being customized and + the context menu is displayed.) } + if not(Ctl is TTBPopupWindow) or + not RootView.ContainsView(TTBPopupWindow(Ctl).View) then begin + { If the root view is a popup, or if the root view is a toolbar + and the user clicked outside the toolbar or in its non-client + area (e.g. on its drag handle), exit } + if RootView.FIsPopup or (Ctl <> RootView.FWindow) or + not PtInRect(RootView.FWindow.ClientRect, RootView.FWindow.ScreenToClient(P)) then + Exit + else + if Msg.message = WM_LBUTTONDOWN then begin + { If the user clicked inside a toolbar on anything but an + item, exit } + UpdateAllSelections(P, True); + if (RootView.FSelected = nil) or not RootView.FMouseOverSelected or + (tbisClicksTransparent in RootView.FSelected.Item.ItemStyle) then + Exit; + end; + end; + end; + end; + { Now pop the message out of the queue } + if not PeekMessage(Msg, 0, Msg.message, Msg.message, PM_REMOVE or PM_NOYIELD) then + Continue; + case Msg.message of + $4D: + { This undocumented message is sent to the focused window when + F1 is pressed. Windows handles it by sending a WM_HELP message + to the same window. We don't want this to happen while a menu + is up, so swallow the message. } + ; + WM_CONTEXTMENU: + { Windows still sends WM_CONTEXTMENU messages for "context menu" + keystrokes even if WM_KEYUP messages are never dispatched, + so it must specifically ignore this message } + ; + WM_KEYFIRST..WM_KEYLAST: begin + Application.CancelHint; + MouseIsDown := (GetKeyState(VK_LBUTTON) < 0) or + (TrackRightButton and (GetKeyState(VK_RBUTTON) < 0)); + case Msg.message of + WM_KEYDOWN, WM_SYSKEYDOWN: + begin + if Msg.wParam = VK_PROCESSKEY then + { Don't let IME process the key } + Msg.wParam := WPARAM(ImmGetVirtualKey(Msg.hwnd)); + Key := Word(Msg.wParam); + if not MouseIsDown or (Key = VK_F1) then begin + if SendKeyEvent(GetActiveView, Key, + KeyDataToShiftState(ClipToLongint(Msg.lParam))) then + Exit; + { If it's not handled by a KeyDown method, translate + it into a WM_*CHAR message } + if Key <> 0 then + TranslateMessage(Msg); + end; + end; + WM_CHAR, WM_SYSCHAR: + if not MouseIsDown then begin + Key := Word(Msg.wParam); + View := GetActiveView; + {$IFDEF CLR} + { On .NET, under Windows 9x/Me we must convert the character + code from ANSI->Unicode. (We shouldn't get any double-byte + characters due to our VK_PROCESSKEY handling above.) } + if Marshal.SystemDefaultCharSize = 1 then + ConvertedKey := Encoding.GetEncoding(GetInputLocaleCodePage). + GetChars([Byte(Key)])[0] + else + {$ENDIF} + ConvertedKey := Chr(Key); + Viewer := View.NextSelectableWithAccel(View.FSelected, + ConvertedKey, False, IsOnlyItemWithAccel); + if Viewer = nil then begin + if (Key in [VK_SPACE, Ord('-')]) and + not RootView.FIsPopup and (View = RootView) and + (GetActiveWindow <> 0) then begin + RootView.EndModalWithSystemMenu(GetActiveWindow, Key); + Exit; + end + else + MessageBeep(0); + end + else begin + View.Selected := Viewer; + View.ScrollSelectedIntoView; + if IsOnlyItemWithAccel then + View.ExecuteSelected(True); + end; + end; + end; + end; + WM_TIMER: + begin + Ctl := FindControl(Msg.hwnd); + if Assigned(Ctl) and (Ctl is TTBPopupWindow) and + (Msg.wParam >= ViewTimerBaseID + Ord(Low(TTBViewTimerID))) and + (Msg.wParam <= ViewTimerBaseID + Ord(High(TTBViewTimerID))) then begin + if Assigned(TTBPopupWindow(Ctl).FView) then + HandleTimer(TTBPopupWindow(Ctl).FView, + TTBViewTimerID(Msg.wParam - ViewTimerBaseID)); + end + else + DispatchMessage(Msg); + end; + $118: ; + { ^ Like standard menus, don't dispatch WM_SYSTIMER messages + (the internal Windows message used for things like caret + blink and list box scrolling). } + WM_MOUSEFIRST..WM_MOUSELAST: + case Msg.message of + WM_MOUSEMOVE: begin + if (Msg.pt.X <> LastPos.X) or (Msg.pt.Y <> LastPos.Y) then begin + LastPos := Msg.pt; + MouseMoved; + end; + end; + WM_MOUSEWHEEL: + if GetSelectedViewer(View, Viewer) then begin + P := Viewer.ScreenToClient(Msg.pt); + Viewer.MouseWheel(Smallint(Msg.wParam shr 16), P.X, P.Y); + end; + WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, WM_RBUTTONDOWN: + if (Msg.message <> WM_RBUTTONDOWN) or TrackRightButton then begin + Application.CancelHint; + MouseDownOnMenu := False; + Exclude(RootView.FState, vsIgnoreFirstMouseUp); + UpdateAllSelections(Msg.pt, True); + if GetSelectedViewer(View, Viewer) then begin + if Msg.message <> WM_LBUTTONDBLCLK then + Shift := [] + else + Shift := [ssDouble]; + P := Viewer.ScreenToClient(Msg.pt); + Viewer.MouseDown(Shift, P.X, P.Y, MouseDownOnMenu); + LastPos := GetMessagePosAsPoint; + end; + end; + WM_LBUTTONUP, WM_RBUTTONUP: + if (Msg.message = WM_LBUTTONUP) or TrackRightButton then begin + UpdateAllSelections(Msg.pt, False); + { ^ False is used so that when a popup menu is + displayed with the cursor currently inside it, the item + under the cursor won't be accidentally selected when the + user releases the button. The user must move the mouse at + at least one pixel (generating a WM_MOUSEMOVE message), + and then release the button. } + if not GetSelectedViewer(View, Viewer) then begin + { Mouse was not released over any item. Cancel out of the + loop if it's outside all views, or is inside unused + space on a topmost toolbar } + if not Assigned(View) or + ((View = RootView) and RootView.FIsToolbar) then begin + if not(vsIgnoreFirstMouseUp in RootView.FState) then + Exit + else + Exclude(RootView.FState, vsIgnoreFirstMouseUp); + end; + end + else begin + P := Viewer.ScreenToClient(Msg.pt); + Viewer.MouseUp(P.X, P.Y, MouseDownOnMenu); + end; + end; + end; + else + DispatchMessage(Msg); + end; + if not ContinueLoop then + Exit; + if LastPos.X = Low(LastPos.X) then begin + { The capture was released; generate a fake mouse movement to update + the selection } + LastPos := GetMessagePosAsPoint; + MouseMoved; + end; + UpdateAppHint; + end; + finally + RootView.CancelCapture; + end; + finally + RootView.FCaptureWnd := 0; + Application.Hint := ''; + { Make sure there are no outstanding WM_*CHAR messages } + RemoveMessages(WM_CHAR, WM_DEADCHAR); + RemoveMessages(WM_SYSCHAR, WM_SYSDEADCHAR); + { Nor any outstanding 'send WM_HELP' messages caused by an earlier press + of the F1 key } + RemoveMessages($4D, $4D); + end; +end; + + +{ TTBPopupView } + +procedure TTBPopupView.AutoSize(AWidth, AHeight: Integer); +begin + with FWindow do + SetBounds(Left, Top, AWidth + (PopupMenuWindowNCSize * 2), + AHeight + (PopupMenuWindowNCSize * 2)); +end; + +function TTBPopupView.GetFont: TFont; +begin + Result := (Owner as TTBPopupWindow).Font; +end; + + +{ TTBPopupWindow } + +constructor TTBPopupWindow.CreatePopupWindow(AOwner: TComponent; + const AParentView: TTBView; const AItem: TTBCustomItem; + const ACustomizing: Boolean); +begin + inherited Create(AOwner); + Visible := False; + SetBounds(0, 0, 320, 240); + ControlStyle := ControlStyle - [csCaptureMouse]; + ShowHint := True; + Color := tbMenuBkColor; + FView := GetViewClass.Create(Self, AParentView, AItem, Self, False, + ACustomizing, False); + Include(FView.FState, vsModal); + + { Inherit the font from the parent view, or use the system menu font if + there is no parent view } + if Assigned(AParentView) then + Font.Assign(AParentView.GetFont) + else + Font.Assign(ToolbarFont); + + { Inherit the accelerator visibility state from the parent view. If there + is no parent view (i.e. it's a standalone popup menu), then default to + hiding accelerator keys, but change this in CreateWnd if the last input + came from the keyboard. } + if Assigned(AParentView) then begin + if vsUseHiddenAccels in AParentView.FStyle then + Include(FView.FStyle, vsUseHiddenAccels); + if vsShowAccels in AParentView.FState then + Include(FView.FState, vsShowAccels); + end + else + Include(FView.FStyle, vsUseHiddenAccels); + + if Application.Handle <> 0 then + { Use Application.Handle if possible so that the taskbar button for the app + doesn't pop up when a TTBEditItem on a popup menu is focused } + ParentWindow := Application.Handle + else + { When Application.Handle is zero, use GetDesktopWindow() as the parent + window, not zero, otherwise UpdateControlState won't show the window } + ParentWindow := GetDesktopWindow; +end; + +destructor TTBPopupWindow.Destroy; +begin + Destroying; + { Before destroying the window handle we need to close any child popups so + that pixels behind the popups are properly restored without generating a + WM_PAINT message. } + if Assigned(FView) then + FView.CloseChildPopups; + { Ensure window handle is destroyed *before* FView is freed, since + DestroyWindowHandle calls CallNotifyWinEvent which may result in + FView.HandleWMObject being called } + if HandleAllocated then + DestroyWindowHandle; + FreeAndNil(FView); + inherited; +end; + +function TTBPopupWindow.GetViewClass: TTBViewClass; +begin + Result := TTBPopupView; +end; + +procedure TTBPopupWindow.CreateParams(var Params: TCreateParams); +const + CS_DROPSHADOW = $00020000; +begin + inherited; + with Params do begin + Style := (Style and not (WS_CHILD or WS_GROUP or WS_TABSTOP)) or WS_POPUP; + ExStyle := ExStyle or WS_EX_TOPMOST or WS_EX_TOOLWINDOW; + WindowClass.Style := WindowClass.Style or CS_SAVEBITS; + { Enable drop shadow effect on Windows XP and later } + if IsWindowsXP then + WindowClass.Style := WindowClass.Style or CS_DROPSHADOW; + end; +end; + +procedure TTBPopupWindow.CreateWnd; +const + WM_CHANGEUISTATE = $0127; + WM_QUERYUISTATE = $0129; + UIS_INITIALIZE = 3; + UISF_HIDEACCEL = $2; +var + B: Boolean; +begin + inherited; + { On a top-level popup window, send WM_CHANGEUISTATE & WM_QUERYUISTATE + messages to the window to see if the last input came from the keyboard + and if the accelerator keys should be shown } + if (FView.ParentView = nil) and not FAccelsVisibilitySet then begin + FAccelsVisibilitySet := True; + SendMessage(Handle, WM_CHANGEUISTATE, UIS_INITIALIZE, 0); + B := (SendMessage(Handle, WM_QUERYUISTATE, 0, 0) and UISF_HIDEACCEL = 0); + FView.SetAccelsVisibility(B); + end; +end; + +procedure TTBPopupWindow.DestroyWindowHandle; +begin + { Before destroying the window handle, we must stop any animation, otherwise + the animation thread will use an invalid handle } + TBEndAnimation(WindowHandle); + { Cleanly destroy any timers before the window handle is destroyed } + if Assigned(FView) then + FView.StopAllTimers; + CallNotifyWinEvent(EVENT_SYSTEM_MENUPOPUPEND, WindowHandle, OBJID_CLIENT, + CHILDID_SELF); + inherited; +end; + +procedure TTBPopupWindow.WMGetObject(var Message: TMessage); +begin + if not FView.HandleWMGetObject(Message) then + inherited; +end; + +procedure TTBPopupWindow.CMShowingChanged(var Message: TMessage); +const + ShowFlags: array[Boolean] of UINT = ( + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_HIDEWINDOW, + SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_SHOWWINDOW); + SPI_GETMENUFADE = $1012; +var + Blend: Boolean; +begin + { Must override TCustomForm/TForm's CM_SHOWINGCHANGED handler so that the + form doesn't get activated when Visible is set to True. } + + { Handle animation. NOTE: I do not recommend trying to enable animation on + Windows 95 and NT 4.0 because there's a difference in the way the + SetWindowPos works on those versions. See the comment in the + TBStartAnimation function of TB2Anim.pas. } + {$IFNDEF TB2K_NO_ANIMATION} + if ((FView.ParentView = nil) or not(vsNoAnimation in FView.FParentView.FState)) and + Showing and (FView.Selected = nil) and not IsWindowVisible(WindowHandle) and + GetSystemParametersInfoBool(SPI_GETMENUANIMATION, False) then begin + Blend := GetSystemParametersInfoBool(SPI_GETMENUFADE, False); + if Blend or (FAnimationDirection <> []) then begin + TBStartAnimation(WindowHandle, Blend, FAnimationDirection); + Exit; + end; + end; + {$ENDIF} + + { No animation... } + if not Showing then begin + { Call TBEndAnimation to ensure WS_EX_LAYERED style is removed before + hiding, otherwise windows under the popup window aren't repainted + properly. } + TBEndAnimation(WindowHandle); + end; + SetWindowPos(WindowHandle, 0, 0, 0, 0, 0, ShowFlags[Showing]); +end; + +procedure TTBPopupWindow.WMEraseBkgnd(var Message: TWMEraseBkgnd); +begin + { May be necessary in some cases... } + TBEndAnimation(WindowHandle); + inherited; +end; + +procedure TTBPopupWindow.WMPaint(var Message: TWMPaint); +begin + { Must abort animation when a WM_PAINT message is received } + TBEndAnimation(WindowHandle); + inherited; +end; + +procedure TTBPopupWindow.Paint; +begin + FView.DrawSubitems(Canvas); + PaintScrollArrows; +end; + +procedure TTBPopupWindow.PaintScrollArrows; + + procedure DrawArrow(const R: TRect; ADown: Boolean); + var + X, Y: Integer; + P: array[0..2] of TPoint; + begin + X := (R.Left + R.Right) div 2; + Y := (R.Top + R.Bottom) div 2; + Dec(Y); + P[0].X := X-3; + P[0].Y := Y; + P[1].X := X+3; + P[1].Y := Y; + P[2].X := X; + P[2].Y := Y; + if ADown then + Inc(P[2].Y, 3) + else begin + Inc(P[0].Y, 3); + Inc(P[1].Y, 3); + end; + Canvas.Pen.Color := tbMenuTextColor; + Canvas.Brush.Color := tbMenuTextColor; + Canvas.Polygon(P); + end; + +begin + if FView.FShowUpArrow then + DrawArrow(Rect(0, 0, ClientWidth, tbMenuScrollArrowHeight), False); + if FView.FShowDownArrow then + DrawArrow(Bounds(0, ClientHeight - tbMenuScrollArrowHeight, + ClientWidth, tbMenuScrollArrowHeight), True); +end; + +procedure TTBPopupWindow.WMClose(var Message: TWMClose); +begin + { do nothing -- ignore Alt+F4 keypresses } +end; + +procedure TTBPopupWindow.WMNCCalcSize(var Message: TWMNCCalcSize); + + procedure ApplyToRect(var R: TRect); + begin + InflateRect(R, -PopupMenuWindowNCSize, -PopupMenuWindowNCSize); + end; + +{$IFDEF CLR} +var + Params: TNCCalcSizeParams; +{$ENDIF} +begin + {$IFNDEF CLR} + ApplyToRect(Message.CalcSize_Params.rgrc[0]); + {$ELSE} + Params := Message.CalcSize_Params; + ApplyToRect(Params.rgrc0); + Message.CalcSize_Params := Params; + {$ENDIF} + inherited; +end; + +procedure PopupWindowNCPaintProc(Wnd: HWND; DC: HDC; AppData: TObject); +var + R: TRect; + {$IFNDEF TB2K_USE_STRICT_O2K_MENU_STYLE} + Brush: HBRUSH; + {$ENDIF} +begin + GetWindowRect(Wnd, R); OffsetRect(R, -R.Left, -R.Top); + {$IFNDEF TB2K_USE_STRICT_O2K_MENU_STYLE} + if not AreFlatMenusEnabled then begin + {$ENDIF} + DrawEdge(DC, R, EDGE_RAISED, BF_RECT or BF_ADJUST); + FrameRect(DC, R, GetSysColorBrush(COLOR_BTNFACE)); + {$IFNDEF TB2K_USE_STRICT_O2K_MENU_STYLE} + end + else begin + FrameRect(DC, R, GetSysColorBrush(COLOR_BTNSHADOW)); + Brush := CreateSolidBrush(ColorToRGB(TTBPopupWindow(AppData).Color)); + InflateRect(R, -1, -1); + FrameRect(DC, R, Brush); + InflateRect(R, -1, -1); + FrameRect(DC, R, Brush); + DeleteObject(Brush); + end; + {$ENDIF} +end; + +procedure TTBPopupWindow.WMNCPaint(var Message: TMessage); +var + DC: HDC; +begin + DC := GetWindowDC(Handle); + try + SelectNCUpdateRgn(Handle, DC, HRGN(Message.WParam)); + PopupWindowNCPaintProc(Handle, DC, Self); + finally + ReleaseDC(Handle, DC); + end; +end; + +procedure TTBPopupWindow.WMPrint(var Message: TMessage); +begin + HandleWMPrint(Handle, Message, PopupWindowNCPaintProc, Self); +end; + +procedure TTBPopupWindow.WMPrintClient(var Message: + {$IFNDEF CLR} TMessage {$ELSE} TWMPrintClient {$ENDIF}); +begin + HandleWMPrintClient(PaintHandler, Message); +end; + +procedure TTBPopupWindow.CMHintShow(var Message: TCMHintShow); +begin + FView.HandleHintShowMessage(Message); +end; + + +{ TTBItemContainer } + +constructor TTBItemContainer.Create(AOwner: TComponent); +begin + inherited; + FItem := TTBRootItem.Create(Self); + FItem.ParentComponent := Self; +end; + +destructor TTBItemContainer.Destroy; +begin + FItem.Free; + inherited; +end; + +function TTBItemContainer.GetItems: TTBCustomItem; +begin + Result := FItem; +end; + +procedure TTBItemContainer.GetChildren(Proc: TGetChildProc; Root: TComponent); +begin + FItem.GetChildren(Proc, Root); +end; + +function TTBItemContainer.GetImages: TCustomImageList; +begin + Result := FItem.SubMenuImages; +end; + +procedure TTBItemContainer.SetImages(Value: TCustomImageList); +begin + FItem.SubMenuImages := Value; +end; + + +{ TTBPopupMenu } + +constructor TTBPopupMenu.Create(AOwner: TComponent); +begin + inherited; + FItem := GetRootItemClass.Create(Self); + FItem.ParentComponent := Self; + FItem.OnClick := RootItemClick; +end; + +destructor TTBPopupMenu.Destroy; +begin + FItem.Free; + inherited; +end; + +function TTBPopupMenu.GetItems: TTBCustomItem; +begin + Result := FItem; +end; + +procedure TTBPopupMenu.GetChildren(Proc: TGetChildProc; Root: TComponent); +begin + FItem.GetChildren(Proc, Root); +end; + +procedure TTBPopupMenu.SetChildOrder(Child: TComponent; Order: Integer); +begin + FItem.SetChildOrder(Child, Order); +end; + +function TTBPopupMenu.GetRootItemClass: TTBRootItemClass; +begin + Result := TTBRootItem; +end; + +function TTBPopupMenu.GetImages: TCustomImageList; +begin + Result := FItem.SubMenuImages; +end; + +function TTBPopupMenu.GetLinkSubitems: TTBCustomItem; +begin + Result := FItem.LinkSubitems; +end; + +function TTBPopupMenu.GetOptions: TTBItemOptions; +begin + Result := FItem.Options; +end; + +procedure TTBPopupMenu.SetImages(Value: TCustomImageList); +begin + FItem.SubMenuImages := Value; +end; + +procedure TTBPopupMenu.SetLinkSubitems(Value: TTBCustomItem); +begin + FItem.LinkSubitems := Value; +end; + +procedure TTBPopupMenu.SetOptions(Value: TTBItemOptions); +begin + FItem.Options := Value; +end; + +procedure TTBPopupMenu.RootItemClick(Sender: TObject); +begin + if Sender = FItem then + Sender := Self; + DoPopup(Sender); +end; + +{$IFNDEF JR_D5} +procedure TTBPopupMenu.DoPopup(Sender: TObject); +begin + if Assigned(OnPopup) then OnPopup(Sender); +end; +{$ENDIF} + +procedure TTBPopupMenu.Popup(X, Y: Integer); +begin + PopupEx(X, Y, False); +end; + +function TTBPopupMenu.PopupEx(X, Y: Integer; + ReturnClickedItemOnly: Boolean = False): TTBCustomItem; +begin + {$IFDEF JR_D5} + {$IFDEF JR_D9} + SetPopupPoint(Point(X, Y)); + {$ELSE} + PPoint(@PopupPoint)^ := Point(X, Y); + {$ENDIF} + {$ENDIF} + Result := FItem.Popup(X, Y, TrackButton = tbRightButton, + TTBPopupAlignment(Alignment), ReturnClickedItemOnly); +end; + +function TTBPopupMenu.IsShortCut(var Message: TWMKey): Boolean; +begin + Result := FItem.IsShortCut(Message); +end; + + +{ TTBImageList } + +constructor TTBCustomImageList.Create(AOwner: TComponent); +begin + inherited; + FCheckedImagesChangeLink := TChangeLink.Create; + FCheckedImagesChangeLink.OnChange := ImageListChanged; + FDisabledImagesChangeLink := TChangeLink.Create; + FDisabledImagesChangeLink.OnChange := ImageListChanged; + FHotImagesChangeLink := TChangeLink.Create; + FHotImagesChangeLink.OnChange := ImageListChanged; + FImagesBitmap := TBitmap.Create; + FImagesBitmap.OnChange := ImagesBitmapChanged; + FImagesBitmapMaskColor := clFuchsia; +end; + +destructor TTBCustomImageList.Destroy; +begin + FreeAndNil(FImagesBitmap); + FreeAndNil(FHotImagesChangeLink); + FreeAndNil(FDisabledImagesChangeLink); + FreeAndNil(FCheckedImagesChangeLink); + inherited; +end; + +procedure TTBCustomImageList.ImagesBitmapChanged(Sender: TObject); +begin + if not ImagesBitmap.Empty then begin + Clear; + AddMasked(ImagesBitmap, FImagesBitmapMaskColor); + end; +end; + +procedure TTBCustomImageList.ImageListChanged(Sender: TObject); +begin + Change; +end; + +{$IFDEF CLR} +procedure TTBCustomImageList.WriteLeft(Writer: TWriter); +begin + Writer.WriteInteger(DesignInfo shr 16); +end; + +procedure TTBCustomImageList.WriteTop(Writer: TWriter); +begin + Writer.WriteInteger(DesignInfo and $FFFF); +end; +{$ENDIF} + +procedure TTBCustomImageList.DefineProperties(Filer: TFiler); +{$IFNDEF CLR} +type + TProc = procedure(ASelf: TObject; Filer: TFiler); +{$ELSE} +var + Ancestor: TComponent; + AncestorInfo: Longint; + DesignInfo: Longint; +{$ENDIF} +begin + if (Filer is TReader) or FImagesBitmap.Empty then + inherited + else begin + {$IFNDEF CLR} + { Bypass TCustomImageList.DefineProperties when we've got an ImageBitmap } + TProc(@TComponentAccess.DefineProperties)(Self, Filer); + {$ELSE} + { On .NET I'm not aware of any way to bypass an inherited method, so we + have to handle DefineProperties all by ourself. The following code is + copied from TComponentHelper.DefineProperties, with references to + private fields changed and the Read* methods removed. } + AncestorInfo := 0; + DesignInfo := Self.DesignInfo; + Ancestor := TComponent(Filer.Ancestor); + if Ancestor <> nil then + AncestorInfo := Ancestor.DesignInfo; + Filer.DefineProperty('Left', nil, WriteLeft, (DesignInfo and $FFFF) <> + (AncestorInfo and $FFFF)); + Filer.DefineProperty('Top', nil, WriteTop, (DesignInfo shr 16) <> + (AncestorInfo shr 16)); + {$ENDIF} + end; +end; + +procedure TTBCustomImageList.DrawState(Canvas: TCanvas; X, Y, Index: Integer; + Enabled, Selected, Checked: Boolean); +begin + if not Enabled and Assigned(DisabledImages) then + DisabledImages.Draw(Canvas, X, Y, Index) + else if Checked and Assigned(CheckedImages) then + CheckedImages.Draw(Canvas, X, Y, Index, Enabled) + else if Selected and Assigned(HotImages) then + HotImages.Draw(Canvas, X, Y, Index, Enabled) + else + Draw(Canvas, X, Y, Index, Enabled); +end; + +procedure TTBCustomImageList.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if Operation = opRemove then begin + if AComponent = CheckedImages then CheckedImages := nil; + if AComponent = DisabledImages then DisabledImages := nil; + if AComponent = HotImages then HotImages := nil; + end; +end; + +procedure TTBCustomImageList.ChangeImages(var AImageList: TCustomImageList; + Value: TCustomImageList; AChangeLink: TChangeLink); +begin + if Value = Self then + Value := nil; + if AImageList <> Value then begin + if Assigned(AImageList) then + AImageList.UnregisterChanges(AChangeLink); + AImageList := Value; + if Assigned(Value) then begin + Value.RegisterChanges(AChangeLink); + Value.FreeNotification(Self); + end; + { Don't call Change while loading because it causes the Delphi IDE to + think the form has been modified (?). Also, don't call Change while + destroying since there's no reason to. } + if not(csLoading in ComponentState) and + not(csDestroying in ComponentState) then + Change; + end; +end; + +procedure TTBCustomImageList.SetCheckedImages(Value: TCustomImageList); +begin + ChangeImages(FCheckedImages, Value, FCheckedImagesChangeLink); +end; + +procedure TTBCustomImageList.SetDisabledImages(Value: TCustomImageList); +begin + ChangeImages(FDisabledImages, Value, FDisabledImagesChangeLink); +end; + +procedure TTBCustomImageList.SetHotImages(Value: TCustomImageList); +begin + ChangeImages(FHotImages, Value, FHotImagesChangeLink); +end; + +procedure TTBCustomImageList.SetImagesBitmap(Value: TBitmap); +begin + FImagesBitmap.Assign(Value); +end; + +procedure TTBCustomImageList.SetImagesBitmapMaskColor(Value: TColor); +begin + if FImagesBitmapMaskColor <> Value then begin + FImagesBitmapMaskColor := Value; + ImagesBitmapChanged(nil); + end; +end; + + +{ TTBBaseAccObject } + +{ According to the MSAA docs: + "With Active Accessibility 2.0, servers can return E_NOTIMPL from IDispatch + methods and Active Accessibility will implement the IAccessible interface + for them." + And there was much rejoicing. } + +{$IFNDEF CLR} +function TTBBaseAccObject.GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; +begin + Result := E_NOTIMPL; +end; + +function TTBBaseAccObject.GetTypeInfo(Index, LocaleID: Integer; + out TypeInfo): HResult; +begin + Result := E_NOTIMPL; +end; + +function TTBBaseAccObject.GetTypeInfoCount(out Count: Integer): HResult; +begin + Result := E_NOTIMPL; +end; + +function TTBBaseAccObject.Invoke(DispID: Integer; const IID: TGUID; + LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo, + ArgErr: Pointer): HResult; +begin + Result := E_NOTIMPL; +end; +{$ENDIF} + + +{ Initialization & finalization } + +procedure TBInitToolbarSystemFont; +var + NonClientMetrics: TNonClientMetrics; +begin + if GetSystemNonClientMetrics(NonClientMetrics) then + ToolbarFont.Handle := CreateFontIndirect(NonClientMetrics.lfMenuFont); +end; + +initialization + ToolbarFont := TFont.Create; + TBInitToolbarSystemFont; +finalization + DestroyClickWnd; + FreeAndNil(ToolbarFont); +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2MDI.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2MDI.pas new file mode 100644 index 0000000..09ec768 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2MDI.pas @@ -0,0 +1,714 @@ +unit TB2MDI; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2MDI.pas,v 1.15 2008/04/23 21:54:37 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + Menus, TB2Item, TB2Toolbar; + +type + TTBMDIButtonsItem = class; + TTBMDISystemMenuItem = class; + + TTBMDIHandler = class(TComponent) + private + FButtonsItem: TTBMDIButtonsItem; + FSystemMenuItem: TTBMDISystemMenuItem; + FToolbar: TTBCustomToolbar; + procedure SetToolbar(Value: TTBCustomToolbar); + protected + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property Toolbar: TTBCustomToolbar read FToolbar write SetToolbar; + end; + + TTBMDIWindowItem = class(TTBCustomItem) + private + FForm: TForm; + FOnUpdate: TNotifyEvent; + FWindowMenu: TMenuItem; + procedure ItemClick(Sender: TObject); + procedure SetForm(AForm: TForm); + protected + procedure EnabledChanged; override; + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(AOwner: TComponent); override; + procedure InitiateAction; override; + published + property Enabled; + property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate; + end; + + TTBMDISystemMenuItem = class(TTBCustomItem) + private + FImageList: TImageList; + procedure CommandClick(Sender: TObject); + protected + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + public + constructor Create(AOwner: TComponent); override; + procedure Click; override; + end; + + TTBMDISystemMenuItemViewer = class(TTBItemViewer) + protected + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); + override; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + end; + + TTBMDIButtonType = (tbmbMinimize, tbmbRestore, tbmbClose); + + TTBMDIButtonItem = class(TTBCustomItem) + private + FButtonType: TTBMDIButtonType; + protected + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + public + constructor Create(AOwner: TComponent); override; + end; + + TTBMDIButtonItemViewer = class(TTBItemViewer) + protected + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); + override; + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + end; + + TTBMDISepItem = class(TTBSeparatorItem) + protected + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + end; + + TTBMDISepItemViewer = class(TTBSeparatorItemViewer) + protected + procedure CalcSize(const Canvas: TCanvas; var AWidth, AHeight: Integer); + override; + end; + + TTBMDIButtonsItem = class(TTBCustomItem) + private + FMinimizeItem: TTBMDIButtonItem; + FRestoreItem: TTBMDIButtonItem; + FCloseItem: TTBMDIButtonItem; + FSep1, FSep2: TTBMDISepItem; + procedure InvalidateSystemMenuItem; + procedure ItemClick(Sender: TObject); + procedure UpdateState(W: HWND; Maximized: Boolean); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + +implementation + +uses + {$IFDEF CLR} System.Text, System.Runtime.InteropServices, WinUtils, {$ENDIF} + TB2Common, TB2Consts, CommCtrl; + +type + TTBCustomToolbarAccess = class(TTBCustomToolbar); + +function GetMenuItemStr(const AMenu: HMENU; const APos: Integer): String; +{$IFNDEF CLR} +var + Buf: array[0..1023] of Char; +begin + if GetMenuString(AMenu, APos, Buf, SizeOf(Buf) div SizeOf(Buf[0]), MF_BYPOSITION) > 0 then + Result := Buf + else + Result := ''; +end; +{$ELSE} +var + Buf: StringBuilder; +begin + Buf := StringBuilder.Create(1024); + if GetMenuString(AMenu, APos, Buf, Buf.Capacity, MF_BYPOSITION) > 0 then + Result := Buf.ToString + else + Result := ''; +end; +{$ENDIF} + + +{ TTBMDIHandler } + +constructor TTBMDIHandler.Create(AOwner: TComponent); +begin + inherited; + FSystemMenuItem := TTBMDISystemMenuItem.Create(Self); + FButtonsItem := TTBMDIButtonsItem.Create(Self); +end; + +destructor TTBMDIHandler.Destroy; +begin + Toolbar := nil; + inherited; +end; + +procedure TTBMDIHandler.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if (AComponent = FToolbar) and (Operation = opRemove) then + Toolbar := nil; +end; + +procedure TTBMDIHandler.SetToolbar(Value: TTBCustomToolbar); +var + Rebuild: Boolean; +begin + if FToolbar <> Value then begin + if Assigned(FToolbar) then begin + Rebuild := False; + if TTBCustomToolbarAccess(FToolbar).FMDIButtonsItem = FButtonsItem then begin + TTBCustomToolbarAccess(FToolbar).FMDIButtonsItem := nil; + Rebuild := True; + end; + if TTBCustomToolbarAccess(FToolbar).FMDISystemMenuItem = FSystemMenuItem then begin + TTBCustomToolbarAccess(FToolbar).FMDISystemMenuItem := nil; + Rebuild := True; + end; + if Rebuild and Assigned(FToolbar.View) then + FToolbar.View.RecreateAllViewers; + end; + FToolbar := Value; + if Assigned(Value) then begin + Value.FreeNotification(Self); + TTBCustomToolbarAccess(Value).FMDIButtonsItem := FButtonsItem; + TTBCustomToolbarAccess(Value).FMDISystemMenuItem := FSystemMenuItem; + Value.View.RecreateAllViewers; + end; + end; +end; + + +{ TTBMDISystemMenuItem } + +constructor TTBMDISystemMenuItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle + [tbisSubMenu, tbisDontSelectFirst] - + [tbisRedrawOnSelChange, tbisRedrawOnMouseOverChange]; + Caption := '&-'; + + {$R TB2MDI.res} + FImageList := TImageList.Create(Self); + FImageList.Handle := ImageList_LoadBitmap(HInstance, 'TB2SYSMENUIMAGES', + 16, 0, clSilver); + SubMenuImages := FImageList; +end; + +function TTBMDISystemMenuItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TTBMDISystemMenuItemViewer; +end; + +procedure TTBMDISystemMenuItem.Click; +var + I: Integer; + Form: TForm; + M: HMENU; + State: UINT; + ID: Word; + Item: TTBCustomItem; +begin + inherited; + Clear; + if Application.MainForm = nil then + Exit; + Form := Application.MainForm.ActiveMDIChild; + if Form = nil then + Exit; + M := GetSystemMenu(Form.Handle, False); + for I := 0 to GetMenuItemCount(M)-1 do begin + State := GetMenuState(M, I, MF_BYPOSITION); + if State and MF_SEPARATOR <> 0 then + Add(TTBSeparatorItem.Create(Self)) + else begin + Item := TTBCustomItem.Create(Self); + if State and MF_GRAYED <> 0 then + Item.Enabled := False; + Item.Caption := GetMenuItemStr(M, I); + ID := Word(GetMenuItemID(M, I)); + Item.Tag := {$IFDEF CLR}TTag{$ENDIF}(ID); + case ID and $FFF0 of + SC_RESTORE: Item.ImageIndex := 3; + SC_MINIMIZE: Item.ImageIndex := 2; + SC_MAXIMIZE: Item.ImageIndex := 1; + SC_CLOSE: begin + Item.ImageIndex := 0; + Item.Options := Item.Options + [tboDefault]; + end; + end; + Item.OnClick := CommandClick; + Add(Item); + end; + end; +end; + +procedure TTBMDISystemMenuItem.CommandClick(Sender: TObject); +var + Form: TForm; +begin + if Assigned(Application.MainForm) then begin + Form := Application.MainForm.ActiveMDIChild; + if Assigned(Form) then + SendMessage(Form.Handle, WM_SYSCOMMAND, Word(TTBCustomItem(Sender).Tag), + LPARAM(GetMessagePos())); + end; +end; + + +{ TTBMDISystemMenuItemViewer } + +procedure TTBMDISystemMenuItemViewer.CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); +begin + AWidth := GetSystemMetrics(SM_CXSMICON) + 2; + AHeight := GetSystemMetrics(SM_CYSMICON) + 2; +end; + +procedure TTBMDISystemMenuItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); + + function GetIconHandle: HICON; + var + Form: TForm; + begin + Result := 0; + if Assigned(Application.MainForm) then begin + Form := Application.MainForm.ActiveMDIChild; + if Assigned(Form) then + Result := Form.Icon.Handle; + end; + if Result = 0 then + Result := Application.Icon.Handle; + if Result = 0 then + Result := LoadIcon(0, IDI_APPLICATION); + end; + +var + R: TRect; + TempIcon: HICON; +begin + R := ClientAreaRect; + InflateRect(R, -1, -1); + TempIcon := CopyImage(GetIconHandle, IMAGE_ICON, R.Right - R.Left, + R.Bottom - R.Top, LR_COPYFROMRESOURCE); + DrawIconEx(Canvas.Handle, R.Left, R.Top, TempIcon, 0, 0, 0, 0, DI_NORMAL); + DestroyIcon(TempIcon); +end; + + +{ TTBMDIButtonItem } + +constructor TTBMDIButtonItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle - [tbisSelectable, tbisRedrawOnSelChange] + + [tbisRightAlign]; +end; + +function TTBMDIButtonItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TTBMDIButtonItemViewer; +end; + + +{ TTBMDIButtonItemViewer } + +procedure TTBMDIButtonItemViewer.CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); +begin + if NewStyleControls then begin + AWidth := GetSystemMetrics(SM_CXMENUSIZE) - 2; + if AWidth < 0 then AWidth := 0; + AHeight := GetSystemMetrics(SM_CYMENUSIZE) - 4; + if AHeight < 0 then AHeight := 0; + end + else begin + AWidth := 16; + AHeight := 14; + end; +end; + +procedure TTBMDIButtonItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); +const + ButtonTypeFlags: array[TTBMDIButtonType] of UINT = (DFCS_CAPTIONMIN, + DFCS_CAPTIONRESTORE, DFCS_CAPTIONCLOSE); + PushedFlags: array[Boolean] of UINT = (0, DFCS_PUSHED); + EnabledFlags: array[Boolean] of UINT = (DFCS_INACTIVE, 0); +begin + DrawFrameControl(Canvas.Handle, ClientAreaRect, DFC_CAPTION, + ButtonTypeFlags[TTBMDIButtonItem(Item).FButtonType] or + PushedFlags[IsPushed] or EnabledFlags[Item.Enabled]); +end; + + +{ TTBMDISepItem } + +function TTBMDISepItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TTBMDISepItemViewer; +end; + + +{ TTBMDISepItemViewer } + +procedure TTBMDISepItemViewer.CalcSize(const Canvas: TCanvas; + var AWidth, AHeight: Integer); +begin + if View.Orientation <> tbvoVertical then begin + AWidth := 2; + AHeight := 6; + end + else begin + AWidth := 6; + AHeight := 2; + end; +end; + + +{ TTBMDIButtonsItem } + +var + CBTHookHandle: HHOOK; + MDIButtonsItems: TList; + +function WindowIsMDIChild(W: HWND): Boolean; +var + I: Integer; + MainForm, ChildForm: TForm; +begin + MainForm := Application.MainForm; + if Assigned(MainForm) then + for I := 0 to MainForm.MDIChildCount-1 do begin + ChildForm := MainForm.MDIChildren[I]; + if ChildForm.HandleAllocated and (ChildForm.Handle = W) then begin + Result := True; + Exit; + end; + end; + Result := False; +end; + +function CBTHook(Code: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; +{$IFNDEF CLR} stdcall; {$ENDIF} +var + Maximizing: Boolean; + WindowPlacement: TWindowPlacement; + I: Integer; +begin + case Code of + HCBT_SETFOCUS: begin + if WindowIsMDIChild(HWND(WParam)) and Assigned(MDIButtonsItems) then begin + for I := 0 to MDIButtonsItems.Count-1 do + TTBMDIButtonsItem(MDIButtonsItems[I]).InvalidateSystemMenuItem; + end; + end; + HCBT_MINMAX: begin + if WindowIsMDIChild(HWND(WParam)) and Assigned(MDIButtonsItems) and + (Word(LParam) in [SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_MINIMIZE, SW_RESTORE]) then begin + Maximizing := (Word(LParam) = SW_MAXIMIZE); + if (Word(LParam) = SW_RESTORE) and not IsZoomed(HWND(WParam)) then begin + {$IFNDEF CLR} + WindowPlacement.length := SizeOf(WindowPlacement); + {$ELSE} + WindowPlacement.length := Marshal.SizeOf(TypeOf(TWindowPlacement)); + {$ENDIF} + GetWindowPlacement(HWND(WParam), {$IFNDEF CLR}@{$ENDIF} WindowPlacement); + Maximizing := (WindowPlacement.flags and WPF_RESTORETOMAXIMIZED <> 0); + end; + for I := 0 to MDIButtonsItems.Count-1 do + TTBMDIButtonsItem(MDIButtonsItems[I]).UpdateState(HWND(WParam), + Maximizing); + end; + end; + HCBT_DESTROYWND: begin + if WindowIsMDIChild(HWND(WParam)) and Assigned(MDIButtonsItems) then begin + for I := 0 to MDIButtonsItems.Count-1 do + TTBMDIButtonsItem(MDIButtonsItems[I]).UpdateState(HWND(WParam), + False); + end; + end; + end; + Result := CallNextHookEx(CBTHookHandle, Code, WParam, LParam); +end; + +const + { Note: On .NET, we must keep a reference to the delegate alive for as long + as the hook is installed, otherwise the GC will collect it and the app + will crash. Storing the delegate in a typed constant will do the trick. } + CBTHookDelegate: TFNHookProc = CBTHook; + +constructor TTBMDIButtonsItem.Create(AOwner: TComponent); + + function CreateItem(const AType: TTBMDIButtonType): TTBMDIButtonItem; + begin + Result := TTBMDIButtonItem.Create(Self); + Result.FButtonType := AType; + Result.OnClick := ItemClick; + end; + +begin + inherited; + ItemStyle := ItemStyle + [tbisEmbeddedGroup]; + FMinimizeItem := CreateItem(tbmbMinimize); + FRestoreItem := CreateItem(tbmbRestore); + FCloseItem := CreateItem(tbmbClose); + FSep1 := TTBMDISepItem.Create(Self); + FSep1.Blank := True; + FSep1.ItemStyle := FSep1.ItemStyle + [tbisRightAlign, tbisNoLineBreak]; + FSep2 := TTBMDISepItem.Create(Self); + FSep2.Blank := True; + FSep2.ItemStyle := FSep2.ItemStyle + [tbisRightAlign, tbisNoLineBreak]; + Add(FSep1); + Add(FMinimizeItem); + Add(FRestoreItem); + Add(FSep2); + Add(FCloseItem); + UpdateState(0, False); + if not(csDesigning in ComponentState) then begin + AddToList(MDIButtonsItems, Self); + if CBTHookHandle = 0 then + CBTHookHandle := SetWindowsHookEx(WH_CBT, CBTHookDelegate, 0, GetCurrentThreadId); + end; +end; + +destructor TTBMDIButtonsItem.Destroy; +begin + RemoveFromList(MDIButtonsItems, Self); + if (MDIButtonsItems = nil) and (CBTHookHandle <> 0) then begin + UnhookWindowsHookEx(CBTHookHandle); + CBTHookHandle := 0; + end; + inherited; +end; + +procedure TTBMDIButtonsItem.UpdateState(W: HWND; Maximized: Boolean); +var + HasMaxChild, VisibilityChanged: Boolean; + + procedure UpdateVisibleEnabled(const Item: TTBCustomItem; + const AEnabled: Boolean); + begin + if (Item.Visible <> HasMaxChild) or (Item.Enabled <> AEnabled) then begin + Item.Visible := HasMaxChild; + Item.Enabled := AEnabled; + VisibilityChanged := True; + end; + end; + +var + MainForm, ActiveMDIChild, ChildForm: TForm; + I: Integer; +begin + HasMaxChild := False; + ActiveMDIChild := nil; + if not(csDesigning in ComponentState) then begin + MainForm := Application.MainForm; + if Assigned(MainForm) then begin + for I := 0 to MainForm.MDIChildCount-1 do begin + ChildForm := MainForm.MDIChildren[I]; + if ChildForm.HandleAllocated and + (((ChildForm.Handle = W) and Maximized) or + ((ChildForm.Handle <> W) and IsZoomed(ChildForm.Handle))) then begin + HasMaxChild := True; + Break; + end; + end; + ActiveMDIChild := MainForm.ActiveMDIChild; + end; + end; + + VisibilityChanged := False; + UpdateVisibleEnabled(TTBMDIHandler(Owner).FSystemMenuItem, True); + UpdateVisibleEnabled(FSep1, True); + UpdateVisibleEnabled(FMinimizeItem, (ActiveMDIChild = nil) or + (GetWindowLong(ActiveMDIChild.Handle, GWL_STYLE) and WS_MINIMIZEBOX <> 0)); + UpdateVisibleEnabled(FRestoreItem, True); + UpdateVisibleEnabled(FSep2, True); + UpdateVisibleEnabled(FCloseItem, True); + + if VisibilityChanged and Assigned((Owner as TTBMDIHandler).FToolbar) then begin + TTBMDIHandler(Owner).FToolbar.View.InvalidatePositions; + TTBMDIHandler(Owner).FToolbar.View.TryValidatePositions; + end; +end; + +procedure TTBMDIButtonsItem.ItemClick(Sender: TObject); +var + MainForm, ChildForm: TForm; + Cmd: WPARAM; +begin + MainForm := Application.MainForm; + if Assigned(MainForm) then begin + ChildForm := MainForm.ActiveMDIChild; + if Assigned(ChildForm) then begin + { Send WM_SYSCOMMAND messages so that we get sounds } + if Sender = FRestoreItem then + Cmd := SC_RESTORE + else if Sender = FCloseItem then + Cmd := SC_CLOSE + else + Cmd := SC_MINIMIZE; + SendMessage(ChildForm.Handle, WM_SYSCOMMAND, Cmd, LPARAM(GetMessagePos())); + end; + end; +end; + +procedure TTBMDIButtonsItem.InvalidateSystemMenuItem; +var + View: TTBView; +begin + if Assigned((Owner as TTBMDIHandler).FToolbar) then begin + View := TTBMDIHandler(Owner).FToolbar.View; + View.Invalidate(View.Find(TTBMDIHandler(Owner).FSystemMenuItem)); + end; +end; + + +{ TTBMDIWindowItem } + +constructor TTBMDIWindowItem.Create(AOwner: TComponent); +var + Form: TForm; +begin + inherited; + ItemStyle := ItemStyle + [tbisEmbeddedGroup]; + Caption := STBMDIWindowItemDefCaption; + FWindowMenu := TMenuItem.Create(Self); + + if not(csDesigning in ComponentState) then begin + { Need to set WindowMenu before MDI children are created. Otherwise the + list incorrectly shows the first 9 child windows, even if window 10+ is + active. } + Form := Application.MainForm; + if (Form = nil) and (Screen.FormCount > 0) then + Form := Screen.Forms[0]; + SetForm(Form); + end; +end; + +procedure TTBMDIWindowItem.GetChildren(Proc: TGetChildProc; Root: TComponent); +begin +end; + +procedure TTBMDIWindowItem.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = FForm) then + SetForm(nil); +end; + +procedure TTBMDIWindowItem.SetForm(AForm: TForm); +begin + if FForm <> AForm then begin + if Assigned(FForm) and (FForm.WindowMenu = FWindowMenu) then + FForm.WindowMenu := nil; + FForm := AForm; + if Assigned(FForm) then + FForm.FreeNotification(Self); + end; + if Assigned(FForm) then + FForm.WindowMenu := FWindowMenu; +end; + +procedure TTBMDIWindowItem.EnabledChanged; +var + I: Integer; +begin + inherited; + for I := 0 to Count-1 do + Items[I].Enabled := Enabled; +end; + +procedure TTBMDIWindowItem.InitiateAction; +var + MainForm: TForm; + I: Integer; + M: HMENU; + Item: TTBCustomItem; + ItemCount: Integer; +begin + inherited; + if csDesigning in ComponentState then + Exit; + MainForm := Application.MainForm; + if Assigned(MainForm) then + SetForm(MainForm); + if FForm = nil then + Exit; + if FForm.ClientHandle <> 0 then + { This is needed, otherwise windows selected on the More Windows dialog + don't move back into the list } + SendMessage(FForm.ClientHandle, WM_MDIREFRESHMENU, 0, 0); + M := FWindowMenu.Handle; + ItemCount := GetMenuItemCount(M) - 1; + if ItemCount < 0 then + ItemCount := 0; + while Count < ItemCount do begin + Item := TTBCustomItem.Create(Self); + Item.Enabled := Enabled; + Item.OnClick := ItemClick; + Add(Item); + end; + while Count > ItemCount do + Items[Count-1].Free; + for I := 0 to ItemCount-1 do begin + Item := Items[I]; + Item.Tag := {$IFDEF CLR}TTag{$ENDIF}(Word(GetMenuItemID(M, I+1))); + Item.Caption := GetMenuItemStr(M, I+1); + Item.Checked := GetMenuState(M, I+1, MF_BYPOSITION) and MF_CHECKED <> 0; + end; + if Assigned(FOnUpdate) then + FOnUpdate(Self); +end; + +procedure TTBMDIWindowItem.ItemClick(Sender: TObject); +var + Form: TForm; +begin + Form := Application.MainForm; + if Assigned(Form) then + PostMessage(Form.Handle, WM_COMMAND, Word(TTBCustomItem(Sender).Tag), 0); +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2MDI.res b/official/2.2.2+2.4.2/TB2K/Source/TB2MDI.res new file mode 100644 index 0000000..4a62035 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/TB2MDI.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2MRU.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2MRU.pas new file mode 100644 index 0000000..86f0bca --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2MRU.pas @@ -0,0 +1,417 @@ +unit TB2MRU; + +{ + Toolbar2000 + Copyright (C) 1998-2006 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2MRU.pas,v 1.24 2006/03/12 23:11:59 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + TB2Item, IniFiles, Registry; + +type + TTBMRUListClickEvent = procedure(Sender: TObject; const Filename: String) of object; + + TTBMRUList = class(TComponent) + private + FAddFullPath: Boolean; + FContainer: TTBCustomItem; + FHidePathExtension: Boolean; + FList: TStrings; + FMaxItems: Integer; + FOnChange: TNotifyEvent; + FOnClick: TTBMRUListClickEvent; + FPrefix: String; + procedure ClickHandler(Sender: TObject); + procedure SetHidePathExtension(Value: Boolean); + procedure SetList(Value: TStrings); + procedure SetMaxItems(Value: Integer); + protected + property Container: TTBCustomItem read FContainer; + function GetItemClass: TTBCustomItemClass; virtual; + procedure SetItemCaptions; virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Add(Filename: String); + procedure Remove(const Filename: String); + procedure LoadFromIni(Ini: TCustomIniFile; const Section: String); + procedure LoadFromRegIni(Ini: TRegIniFile; const Section: String); + procedure SaveToIni(Ini: TCustomIniFile; const Section: String); + procedure SaveToRegIni(Ini: TRegIniFile; const Section: String); + published + { MaxItems must be published before Items } + property AddFullPath: Boolean read FAddFullPath write FAddFullPath default True; + property HidePathExtension: Boolean read FHidePathExtension write SetHidePathExtension default True; + property MaxItems: Integer read FMaxItems write SetMaxItems default 4; + property Items: TStrings read FList write SetList; + property OnClick: TTBMRUListClickEvent read FOnClick write FOnClick; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + property Prefix: String read FPrefix write FPrefix; + end; + + TTBMRUListItem = class(TTBCustomItem) + private + FMRUList: TTBMRUList; + procedure SetMRUList(Value: TTBMRUList); + protected + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(AOwner: TComponent); override; + published + property MRUList: TTBMRUList read FMRUList write SetMRUList; + //property Caption; + //property LinkSubitems; + end; + +implementation + +uses + {$IFDEF CLR} System.Text, System.IO, {$ENDIF} + TB2Common, TB2Consts, CommDlg; + +procedure ChangeFileNameToTitle(var S: String); +{$IFNDEF CLR} +var + Buf: array[0..MAX_PATH-1] of Char; +begin + if GetFileTitle(PChar(S), Buf, SizeOf(Buf) div SizeOf(Buf[0])) = 0 then + S := Buf; +end; +{$ELSE} +var + Buf: StringBuilder; +begin + Buf := StringBuilder.Create(MAX_PATH); + if GetFileTitle(S, Buf, Buf.Capacity) = 0 then + S := Buf.ToString; +end; +{$ENDIF} + + +{ TTBMRUListStrings } + +type + TTBMRUListStrings = class(TStrings) + private + FInternalList: TStrings; + FMRUList: TTBMRUList; + procedure Changed; + public + constructor Create; + destructor Destroy; override; + procedure Clear; override; + procedure Delete(Index: Integer); override; + function Get(Index: Integer): String; override; + function GetCount: Integer; override; + function IndexOf(const S: String): Integer; override; + procedure Insert(Index: Integer; const S: String); override; + procedure Move(CurIndex, NewIndex: Integer); override; + procedure Put(Index: Integer; const S: String); override; + end; + +constructor TTBMRUListStrings.Create; +begin + inherited; + FInternalList := TStringList.Create; +end; + +destructor TTBMRUListStrings.Destroy; +begin + inherited; + FInternalList.Free; +end; + +procedure TTBMRUListStrings.Changed; +begin + if Assigned(FMRUList.FOnChange) and + not(csLoading in FMRUList.ComponentState) then + FMRUList.FOnChange(FMRUList); +end; + +procedure TTBMRUListStrings.Clear; +var + I: Integer; +begin + for I := FInternalList.Count-1 downto 0 do + Delete(I); +end; + +procedure TTBMRUListStrings.Delete(Index: Integer); +begin + FMRUList.FContainer[Index].Free; + FInternalList.Delete(Index); + FMRUList.SetItemCaptions; + Changed; +end; + +function TTBMRUListStrings.Get(Index: Integer): String; +begin + Result := FInternalList[Index]; +end; + +function TTBMRUListStrings.GetCount: Integer; +begin + Result := FInternalList.Count; +end; + +function TTBMRUListStrings.IndexOf(const S: String): Integer; +begin + { This is identical to TStrings.IndexOf except we use SameFileName. } + for Result := 0 to GetCount - 1 do + {$IFDEF JR_D6} + if SameFileName(Get(Result), S) then Exit; + {$ELSE} + if AnsiCompareFileName(Get(Result), S) = 0 then Exit; + {$ENDIF} + Result := -1; +end; + +procedure TTBMRUListStrings.Insert(Index: Integer; const S: String); +var + Item: TTBCustomItem; +begin + Item := FMRUList.GetItemClass.Create(FMRUList.FContainer); + Item.OnClick := FMRUList.ClickHandler; + FMRUList.FContainer.Insert(Index, Item); + FInternalList.Insert(Index, S); + FMRUList.SetItemCaptions; + Changed; +end; + +procedure TTBMRUListStrings.Move(CurIndex, NewIndex: Integer); +begin + FInternalList.Move(CurIndex, NewIndex); + FMRUList.FContainer.Move(CurIndex, NewIndex); + FMRUList.SetItemCaptions; + Changed; +end; + +procedure TTBMRUListStrings.Put(Index: Integer; const S: String); +begin + FInternalList[Index] := S; + FMRUList.SetItemCaptions; + Changed; +end; + + +{ TTBMRUList } + +constructor TTBMRUList.Create(AOwner: TComponent); +begin + inherited; + FAddFullPath := True; + FHidePathExtension := True; + FMaxItems := 4; + FPrefix := 'MRU'; + FList := TTBMRUListStrings.Create; + TTBMRUListStrings(FList).FMRUList := Self; + FContainer := TTBCustomItem.Create(nil); +end; + +destructor TTBMRUList.Destroy; +begin + FContainer.Free; + FList.Free; + inherited; +end; + +procedure TTBMRUList.Add(Filename: String); +var + I: Integer; +begin + if AddFullPath then + Filename := ExpandFileName(Filename); + { If Filename is already in the MRU list, move it to the top } + I := FList.IndexOf(Filename); + if I <> -1 then begin + if I > 0 then + FList.Move(I, 0); + FList[0] := Filename; { ...in case the capitalization changed } + end + else + FList.Insert(0, Filename); +end; + +procedure TTBMRUList.Remove(const Filename: String); +var + I: Integer; +begin + I := FList.IndexOf(Filename); + if I <> -1 then + FList.Delete(I); +end; + +procedure TTBMRUList.LoadFromIni(Ini: TCustomIniFile; const Section: String); +var + I: Integer; + S: String; +begin + FList.Clear; + for I := 1 to FMaxItems do begin + S := Ini.ReadString(Section, FPrefix + IntToStr(I), ''); + if S <> '' then + FList.Add(S); + end; +end; + +procedure TTBMRUList.LoadFromRegIni(Ini: TRegIniFile; const Section: String); +var + I: Integer; + S: String; +begin + FList.Clear; + for I := 1 to FMaxItems do begin + S := Ini.ReadString(Section, FPrefix + IntToStr(I), ''); + if S <> '' then + FList.Add(S); + end; +end; + +procedure TTBMRUList.SaveToIni(Ini: TCustomIniFile; const Section: String); +var + I: Integer; +begin + for I := 1 to FMaxItems do begin + if I <= FList.Count then + Ini.WriteString(Section, FPrefix + IntToStr(I), FList[I-1]) + else + Ini.DeleteKey(Section, FPrefix + IntToStr(I)); + end; +end; + +procedure TTBMRUList.SaveToRegIni(Ini: TRegIniFile; const Section: String); +var + I: Integer; +begin + for I := 1 to FMaxItems do begin + if I <= FList.Count then + Ini.WriteString(Section, FPrefix + IntToStr(I), FList[I-1]) + else + Ini.DeleteKey(Section, FPrefix + IntToStr(I)); + end; +end; + +procedure TTBMRUList.SetItemCaptions; +var + I, J: Integer; + Key: Char; + S: String; +begin + while FList.Count > FMaxItems do + FList.Delete(FList.Count-1); + for I := 0 to FContainer.Count-1 do begin + Key := #0; + if I < 9 then + Key := Chr(Ord('1') + I) + else begin + { No more numbers; try letters } + J := I - 9; + if J < 26 then + Key := Chr(Ord('A') + J); + end; + S := FList[I]; + if HidePathExtension then + ChangeFileNameToTitle(S); + S := EscapeAmpersands(S); + if Key <> #0 then + FContainer[I].Caption := Format('&%s %s', [Key, S]) + else + FContainer[I].Caption := S; + end; +end; + +procedure TTBMRUList.ClickHandler(Sender: TObject); +var + I: Integer; +begin + I := FContainer.IndexOf(TTBCustomItem(Sender)); + if I <> -1 then begin + if I > 0 then + FList.Move(I, 0); + if Assigned(FOnClick) then + FOnClick(Self, FList[0]); + end; +end; + +procedure TTBMRUList.SetHidePathExtension(Value: Boolean); +begin + if FHidePathExtension <> Value then begin + FHidePathExtension := Value; + SetItemCaptions; + end; +end; + +procedure TTBMRUList.SetList(Value: TStrings); +begin + FList.Assign(Value); +end; + +procedure TTBMRUList.SetMaxItems(Value: Integer); +begin + FMaxItems := Value; + SetItemCaptions; +end; + +function TTBMRUList.GetItemClass: TTBCustomItemClass; +begin + Result := TTBCustomItem; +end; + + +{ TTBMRUListItem } + +constructor TTBMRUListItem.Create(AOwner: TComponent); +begin + inherited; + ItemStyle := ItemStyle + [tbisEmbeddedGroup]; + Caption := STBMRUListItemDefCaption; +end; + +procedure TTBMRUListItem.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (AComponent = FMRUList) and (Operation = opRemove) then + SetMRUList(nil); +end; + +procedure TTBMRUListItem.SetMRUList(Value: TTBMRUList); +begin + if FMRUList <> Value then begin + FMRUList := Value; + if Assigned(FMRUList) then begin + Value.FreeNotification(Self); + LinkSubitems := FMRUList.FContainer; + end + else + LinkSubitems := nil; + end; +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2OleMarshal.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2OleMarshal.pas new file mode 100644 index 0000000..fdca5c3 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2OleMarshal.pas @@ -0,0 +1,203 @@ +unit TB2OleMarshal; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2OleMarshal.pas,v 1.4 2008/09/17 18:04:09 jr Exp $ + + This unit implements the TTBStandardOleMarshalObject class, an exact clone of + .NET Framework 2.0's StandardOleMarshalObject class, which isn't available + on the .NET Framework 1.1-based Delphi 2006. + On Delphi 2007, I had planned to switch to StandardOleMarshalObject, but it + turns out there's a bug that causes it raise AV's on x64 & IA-64 (seen as + E_POINTER on the client side). Coincidentally, TTBStandardOleMarshalObject + does not suffer from this bug (even though it was intended to be an exact + clone!). + + The class "replaces the standard common language runtime (CLR) free-threaded + marshaler with the standard OLE STA marshaler." It "prevents calls made into + a hosting object by OLE from entering threads other than the UI thread." + For more information, see: + http://msdn2.microsoft.com/system.runtime.interopservices.standardolemarshalobject.aspx +} + +interface + +{$I TB2Ver.inc} + +uses + System.Runtime.InteropServices, Windows; + +type + { Our declaration for IMarshal } + [ComImport, + GuidAttribute('00000003-0000-0000-C000-000000000046'), + InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] + ITBMarshal = interface + [PreserveSig] + function GetUnmarshalClass([MarshalAs(UnmanagedType.LPStruct)] riid: Guid; + pv: IntPtr; dwDestContext: Longint; pvDestContext: IntPtr; + mshlflags: Longint; out pCid: Guid): HRESULT; + [PreserveSig] + function GetMarshalSizeMax([MarshalAs(UnmanagedType.LPStruct)] riid: Guid; + pv: IntPtr; dwDestContext: Longint; pvDestContext: IntPtr; + mshlflags: Longint; out pSize: Longint): HRESULT; + [PreserveSig] + function MarshalInterface([in, MarshalAs(UnmanagedType.Interface)] pStm: TObject; + [MarshalAs(UnmanagedType.LPStruct)] riid: Guid; pv: IntPtr; + dwDestContext: Longint; pvDestContext: IntPtr; mshlflags: Longint): HRESULT; + [PreserveSig] + function UnmarshalInterface([in, MarshalAs(UnmanagedType.Interface)] pStm: TObject; + [MarshalAs(UnmanagedType.LPStruct)] riid: Guid; out ppv: IntPtr): HRESULT; + [PreserveSig] + function ReleaseMarshalData([in, MarshalAs(UnmanagedType.Interface)] pStm: TObject): HRESULT; + [PreserveSig] + function DisconnectObject(dwReserved: Longint): HRESULT; + end; + + TTBStandardOleMarshalObject = class(System.MarshalByRefObject, ITBMarshal) + private + function GetStdMarshaller(const riid: Guid; const dwDestContext: Longint; + const mshlflags: Longint): IntPtr; + { IMarshal } + function GetUnmarshalClass(riid: Guid; pv: IntPtr; dwDestContext: Longint; + pvDestContext: IntPtr; mshlflags: Longint; out pCid: Guid): HRESULT; + function GetMarshalSizeMax(riid: Guid; pv: IntPtr; dwDestContext: Longint; + pvDestContext: IntPtr; mshlflags: Longint; out pSize: Longint): HRESULT; + function MarshalInterface(pStm: TObject; riid: Guid; pv: IntPtr; + dwDestContext: Longint; pvDestContext: IntPtr; mshlflags: Longint): HRESULT; + function UnmarshalInterface(pStm: TObject; riid: Guid; out ppv: IntPtr): HRESULT; + function ReleaseMarshalData(pStm: TObject): HRESULT; + function DisconnectObject(dwReserved: Longint): HRESULT; + end; + +implementation + +{ Note: According to http://blogs.msdn.com/cbrumme/archive/2003/04/15/51335.aspx + the Marshal.ReleaseComObject(pStm) calls are needed to work around a "quirk + of OLE32 on some versions of the operating system". } + +uses + System.Security; + +const + ole32 = 'ole32.dll'; + +[SuppressUnmanagedCodeSecurity, DllImport(ole32, CharSet = CharSet.Unicode, EntryPoint = 'CoGetMarshalSizeMax')] +function _CoGetMarshalSizeMax(out pulSize: Longint; + [in, MarshalAs(UnmanagedType.LPStruct)] riid: Guid; pUnk: IntPtr; + dwDestContext: Longint; pvDestContext: IntPtr; + mshlflags: Longint): HRESULT; external; +[SuppressUnmanagedCodeSecurity, DllImport(ole32, CharSet = CharSet.Unicode, EntryPoint = 'CoGetStandardMarshal')] +function _CoGetStandardMarshal([in, MarshalAs(UnmanagedType.LPStruct)] iid: Guid; + pUnk: IntPtr; dwDestContext: Longint; pvDestContext: IntPtr; + mshlflags: Longint; out ppMarshal: IntPtr): HRESULT; external; +[SuppressUnmanagedCodeSecurity, DllImport(ole32, CharSet = CharSet.Unicode, EntryPoint = 'CoMarshalInterface')] +function _CoMarshalInterface([in, MarshalAs(UnmanagedType.Interface)] pStm: TObject; + [in, MarshalAs(UnmanagedType.LPStruct)] riid: Guid; pUnk: IntPtr; + dwDestContext: Longint; pvDestContext: IntPtr; + mshlflags: Longint): HRESULT; external; + +function TTBStandardOleMarshalObject.GetStdMarshaller(const riid: Guid; + const dwDestContext: Longint; const mshlflags: Longint): IntPtr; +var + V_1: IntPtr; +begin + Result := nil; + V_1 := Marshal.GetIUnknownForObject(Self); + if V_1 <> nil then begin + try + if _CoGetStandardMarshal(riid, V_1, dwDestContext, nil, mshlflags, Result) = S_OK then + Exit; + finally + Marshal.Release(V_1); + end; + end; + { Note: Localizing this message isn't necessary because a user will never + see it; the .NET runtime will catch it and translate it into a + COR_E_EXCEPTION HRESULT. } + raise InvalidOperationException.Create('TTBStandardOleMarshalObject.GetStdMarshaller failed'); +end; + +function TTBStandardOleMarshalObject.GetUnmarshalClass(riid: Guid; pv: IntPtr; + dwDestContext: Longint; pvDestContext: IntPtr; mshlflags: Longint; + out pCid: Guid): HRESULT; +begin + { StandardOleMarshalObject does "pCid := TypeOf(IStdMarshal).GUID" here, but + we haven't declared IStdMarshal anywhere, so create a fresh Guid } + pCid := Guid.Create('00000017-0000-0000-C000-000000000046'); { CLSID_StdMarshal } + Result := S_OK; +end; + +function TTBStandardOleMarshalObject.GetMarshalSizeMax(riid: Guid; pv: IntPtr; + dwDestContext: Longint; pvDestContext: IntPtr; mshlflags: Longint; + out pSize: Longint): HRESULT; +var + V_0: IntPtr; +begin + V_0 := GetStdMarshaller(riid, dwDestContext, mshlflags); + try + Result := _CoGetMarshalSizeMax(pSize, riid, V_0, dwDestContext, pvDestContext, mshlflags); + finally + Marshal.Release(V_0); + end; +end; + +function TTBStandardOleMarshalObject.MarshalInterface(pStm: TObject; riid: Guid; + pv: IntPtr; dwDestContext: Longint; pvDestContext: IntPtr; + mshlflags: Longint): HRESULT; +var + V_0: IntPtr; +begin + V_0 := GetStdMarshaller(riid, dwDestContext, mshlflags); + try + Result := _CoMarshalInterface(pStm, riid, V_0, dwDestContext, pvDestContext, mshlflags); + finally + Marshal.Release(V_0); + if pStm <> nil then + Marshal.ReleaseComObject(pStm); + end; +end; + +function TTBStandardOleMarshalObject.UnmarshalInterface(pStm: TObject; + riid: Guid; out ppv: IntPtr): HRESULT; +begin + ppv := nil; + if pStm <> nil then + Marshal.ReleaseComObject(pStm); + Result := E_NOTIMPL; +end; + +function TTBStandardOleMarshalObject.ReleaseMarshalData(pStm: TObject): HRESULT; +begin + if pStm <> nil then + Marshal.ReleaseComObject(pStm); + Result := E_NOTIMPL; +end; + +function TTBStandardOleMarshalObject.DisconnectObject(dwReserved: Longint): HRESULT; +begin + Result := E_NOTIMPL; +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.dcr b/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.dcr new file mode 100644 index 0000000..ec4d2e1 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.dcr differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.hpp b/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.hpp new file mode 100644 index 0000000..0344ed2 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.hpp @@ -0,0 +1,53 @@ +// CodeGear C++Builder +// Copyright (c) 1995, 2008 by CodeGear +// All rights reserved + +// (DO NOT EDIT: machine generated header) 'Tb2reg.pas' rev: 20.00 + +#ifndef Tb2regHPP +#define Tb2regHPP + +#pragma delphiheader begin +#pragma option push +#pragma option -w- // All warnings off +#pragma option -Vx // Zero-length empty class member functions +#pragma pack(push,8) +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit +#include // Pascal unit + +//-- user supplied ----------------------------------------------------------- + +namespace Tb2reg +{ +//-- type declarations ------------------------------------------------------- +//-- var, const, procedure --------------------------------------------------- +extern PACKAGE void __fastcall TBRegisterClasses(Classes::TPersistentClass const *AClasses, const int AClasses_Size); +extern PACKAGE void __fastcall Register(void); + +} /* namespace Tb2reg */ +using namespace Tb2reg; +#pragma pack(pop) +#pragma option pop + +#pragma delphiheader end. +//-- end unit ---------------------------------------------------------------- +#endif // Tb2regHPP diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.pas new file mode 100644 index 0000000..3cacb90 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Reg.pas @@ -0,0 +1,317 @@ +unit TB2Reg; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Reg.pas,v 1.32 2008/09/18 19:08:40 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, SysUtils, Classes, Graphics, Controls, Dialogs, ActnList, ImgList, + {$IFDEF JR_D6} DesignIntf, DesignEditors, VCLEditors, {$ELSE} DsgnIntf, {$ENDIF} + TB2Toolbar, TB2ToolWindow, TB2Dock, TB2Item, TB2ExtItems, TB2MRU, TB2MDI, + TB2DsgnItemEditor; + +procedure Register; +procedure TBRegisterClasses(const AClasses: array of TPersistentClass); + +implementation + +{$IFDEF CLR} +{ Delphi.NET doesn't use DCR files for component icons } +{$R 'Icons\TTBBackground.bmp'} +{$R 'Icons\TTBBackground16.bmp'} +{$R 'Icons\TTBDock.bmp'} +{$R 'Icons\TTBDock16.bmp'} +{$R 'Icons\TTBImageList.bmp'} +{$R 'Icons\TTBImageList16.bmp'} +{$R 'Icons\TTBItemContainer.bmp'} +{$R 'Icons\TTBItemContainer16.bmp'} +{$R 'Icons\TTBMDIHandler.bmp'} +{$R 'Icons\TTBMDIHandler16.bmp'} +{$R 'Icons\TTBMRUList.bmp'} +{$R 'Icons\TTBMRUList16.bmp'} +{$R 'Icons\TTBPopupMenu.bmp'} +{$R 'Icons\TTBPopupMenu16.bmp'} +{$R 'Icons\TTBToolbar.bmp'} +{$R 'Icons\TTBToolbar16.bmp'} +{$R 'Icons\TTBToolWindow.bmp'} +{$R 'Icons\TTBToolWindow16.bmp'} +{$ENDIF} + +uses + {$IFDEF CLR} WinUtils, {$ENDIF} + ImgEdit; + +{$IFDEF JR_D5} + +{ TTBImageIndexPropertyEditor } + +{ Unfortunately TComponentImageIndexPropertyEditor seems to be gone in + Delphi 6, so we have to use our own image index property editor class } + +type + TTBImageIndexPropertyEditor = class(TIntegerProperty + {$IFDEF JR_D6} , ICustomPropertyListDrawing {$ENDIF}) + public + function GetAttributes: TPropertyAttributes; override; + procedure GetValues(Proc: TGetStrProc); override; + function GetImageListAt(Index: Integer): TCustomImageList; virtual; + + // ICustomPropertyListDrawing + procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas; + var AHeight: Integer); {$IFNDEF JR_D6} override; {$ENDIF} + procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas; + var AWidth: Integer); {$IFNDEF JR_D6} override; {$ENDIF} + procedure ListDrawValue(const Value: string; ACanvas: TCanvas; + const ARect: TRect; ASelected: Boolean); {$IFNDEF JR_D6} override; {$ENDIF} + end; + +function TTBImageIndexPropertyEditor.GetAttributes: TPropertyAttributes; +begin + Result := [paMultiSelect, paValueList, paRevertable]; +end; + +function TTBImageIndexPropertyEditor.GetImageListAt(Index: Integer): TCustomImageList; +begin + Result := nil; +end; + +procedure TTBImageIndexPropertyEditor.GetValues(Proc: TGetStrProc); +var + ImgList: TCustomImageList; + I: Integer; +begin + ImgList := GetImageListAt(0); + if Assigned(ImgList) then + for I := 0 to ImgList.Count-1 do + Proc(IntToStr(I)); +end; + +procedure TTBImageIndexPropertyEditor.ListDrawValue(const Value: string; + ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); +var + ImgList: TCustomImageList; + X: Integer; +begin + ImgList := GetImageListAt(0); + ACanvas.FillRect(ARect); + X := ARect.Left + 2; + if Assigned(ImgList) then begin + ImgList.Draw(ACanvas, X, ARect.Top + 2, StrToInt(Value)); + Inc(X, ImgList.Width); + end; + ACanvas.TextOut(X + 3, ARect.Top + 1, Value); +end; + +procedure TTBImageIndexPropertyEditor.ListMeasureHeight(const Value: string; + ACanvas: TCanvas; var AHeight: Integer); +var + ImgList: TCustomImageList; +begin + ImgList := GetImageListAt(0); + AHeight := ACanvas.TextHeight(Value) + 2; + if Assigned(ImgList) and (ImgList.Height + 4 > AHeight) then + AHeight := ImgList.Height + 4; +end; + +procedure TTBImageIndexPropertyEditor.ListMeasureWidth(const Value: string; + ACanvas: TCanvas; var AWidth: Integer); +var + ImgList: TCustomImageList; +begin + ImgList := GetImageListAt(0); + AWidth := ACanvas.TextWidth(Value) + 4; + if Assigned(ImgList) then + Inc(AWidth, ImgList.Width); +end; + +{ TTBItemImageIndexPropertyEditor } + +type + TTBItemImageIndexPropertyEditor = class(TTBImageIndexPropertyEditor) + public + function GetImageListAt(Index: Integer): TCustomImageList; override; + end; + +function TTBItemImageIndexPropertyEditor.GetImageListAt(Index: Integer): TCustomImageList; +var + C: TPersistent; + Item: TTBCustomItem; +begin + Result := nil; + { ? I'm guessing that the Index parameter is a component index (one that + would be passed to the GetComponent function). } + C := GetComponent(Index); + if C is TTBCustomItem then begin + Item := TTBCustomItem(C); + repeat + Result := Item.Images; + if Assigned(Result) then + Break; + Item := Item.Parent; + if Item = nil then + Break; + Result := Item.SubMenuImages; + until Assigned(Result); + end; +end; + +{$ENDIF} + +{ TTBImageListEditor } + +type + TTBImageListEditor = class(TComponentEditor) + public + procedure Edit; override; + procedure ExecuteVerb(Index: Integer); override; + function GetVerb(Index: Integer): String; override; + function GetVerbCount: Integer; override; + end; + +procedure TTBImageListEditor.Edit; +var + ImgList: TTBImageList; +begin + ImgList := Component as TTBImageList; + if not ImgList.ImagesBitmap.Empty then begin + if MessageDlg('The image list''s ImagesBitmap property has ' + + 'a bitmap assigned. Because of this, any changes you make in the ' + + 'Image List Editor will not be preserved when the form is saved.'#13#10#13#10 + + 'Do you want to open the editor anyway?', mtWarning, + [mbYes, mbNo], 0) <> mrYes then + Exit; + end; + EditImageList(ImgList); +end; + +procedure TTBImageListEditor.ExecuteVerb(Index: Integer); +begin + if Index = 0 then + Edit; +end; + +function TTBImageListEditor.GetVerbCount: Integer; +begin + Result := 1; +end; + +function TTBImageListEditor.GetVerb(Index: Integer): String; +begin + if Index = 0 then + Result := 'ImageList Editor...' + else + Result := ''; +end; + + +procedure TBRegisterClasses(const AClasses: array of TPersistentClass); +{$IFDEF CLR} +var + I: Integer; + FoundClass: TPersistentClass; +{$ENDIF} +begin + {$IFDEF CLR} + { Hack for Delphi.NET (2006): If you recompile an already-installed package + the IDE doesn't unload the old package before installing the new one. + Therefore, we must search for and unregister any existing classes before + registering new ones, to avoid having two incompatible sets of classes + registered at the same time. + Without this, if we rebuild tb2kdsgn_dn10 (which implicitly reloads + tb2k_dn10) and then attempt to open the Demo project's main form in the + IDE, we get a "Toolbar item cannot be inserted into container of type + TTBToolbar" exception inside TTBCustomItem.SetParentComponent, because + apparently the TTBToolbar class it's trying to use is located in the new + assembly, while the item class is located in the old assembly. + Note: It appears that this issue only affects registered classes; there + is no need for an "UnRegisterComponents" call. } + for I := High(AClasses) downto Low(AClasses) do begin + { Unregister all classes with the same name } + while True do begin + FoundClass := GetClass(AClasses[I].ClassName); + if FoundClass = nil then + Break; + UnRegisterClass(FoundClass); + end; + end; + {$ENDIF} + RegisterClasses(AClasses); +end; + +procedure Register; +begin + { Note: On Delphi.NET 2006, it's possible for this procedure to be called + a second time on the same tb2kdsgn instance. See comments in + TBRegisterItemClass. } + + RegisterComponents('Toolbar2000', [TTBDock, TTBToolbar, TTBToolWindow, + TTBPopupMenu, TTBImageList, TTBItemContainer, TTBBackground, TTBMRUList, + TTBMDIHandler]); + {$IFDEF JR_D4} + RegisterActions('', [TTBEditAction], nil); + {$ENDIF} + RegisterNoIcon([TTBCustomItem]); + TBRegisterClasses([TTBItem, TTBGroupItem, TTBSubmenuItem, TTBSeparatorItem, + TTBEditItem, TTBMRUListItem, TTBControlItem, TTBMDIWindowItem, + TTBVisibilityToggleItem]); + + RegisterComponentEditor(TTBCustomToolbar, TTBItemsEditor); + RegisterComponentEditor(TTBItemContainer, TTBItemsEditor); + RegisterComponentEditor(TTBPopupMenu, TTBItemsEditor); + RegisterComponentEditor(TTBImageList, TTBImageListEditor); + RegisterPropertyEditor(TypeInfo(TTBRootItem), nil, '', TTBItemsPropertyEditor); + {$IFDEF JR_D5} + RegisterPropertyEditor(TypeInfo(TImageIndex), TTBCustomItem, 'ImageIndex', + TTBItemImageIndexPropertyEditor); + {$ENDIF} + {$IFDEF JR_D6} + { TShortCut properties show up like Integer properties in Delphi 6 + without this... } + RegisterPropertyEditor(TypeInfo(TShortCut), TTBCustomItem, '', + TShortCutProperty); + {$ENDIF} + + { Link in images for the toolbar buttons } + {$IFNDEF CLR} + {$R TB2DsgnItemEditor.res} + {$ELSE} + {$R 'Icons\TB2DsgnEditorImages.bmp'} + {$R 'Icons\TTBEditItem.bmp'} + {$R 'Icons\TTBGroupItem.bmp'} + {$R 'Icons\TTBMDIWindowItem.bmp'} + {$R 'Icons\TTBMRUListItem.bmp'} + {$ENDIF} + TBRegisterItemClass(TTBEditItem, 'New &Edit', HInstance); + TBRegisterItemClass(TTBGroupItem, 'New &Group Item', HInstance); + TBRegisterItemClass(TTBMRUListItem, 'New &MRU List Item', HInstance); + TBRegisterItemClass(TTBMDIWindowItem, 'New MDI &Windows List', HInstance); + TBRegisterItemClass(TTBVisibilityToggleItem, 'New &Visibility-Toggle Item', HInstance); +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2ResCursors.res b/official/2.2.2+2.4.2/TB2K/Source/TB2ResCursors.res new file mode 100644 index 0000000..e09ab15 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/Source/TB2ResCursors.res differ diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2ToolWindow.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2ToolWindow.pas new file mode 100644 index 0000000..90d5592 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2ToolWindow.pas @@ -0,0 +1,258 @@ +unit TB2ToolWindow; + +{ + Toolbar2000 + Copyright (C) 1998-2005 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2ToolWindow.pas,v 1.18 2005/01/06 03:56:50 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + Windows, Classes, Graphics, Controls, TB2Dock; + +type + { TTBToolWindow } + + TTBToolWindow = class(TTBCustomDockableWindow) + private + FMinClientWidth, FMinClientHeight, FMaxClientWidth, FMaxClientHeight: Integer; + FBarHeight, FBarWidth: Integer; + function CalcSize(ADock: TTBDock): TPoint; + function GetClientAreaWidth: Integer; + procedure SetClientAreaWidth(Value: Integer); + function GetClientAreaHeight: Integer; + procedure SetClientAreaHeight(Value: Integer); + procedure SetClientAreaSize(AWidth, AHeight: Integer); + protected + function DoArrange(CanMoveControls: Boolean; PreviousDockType: TTBDockType; + NewFloating: Boolean; NewDock: TTBDock): TPoint; override; + procedure GetBaseSize(var ASize: TPoint); override; + procedure GetMinMaxSize(var AMinClientWidth, AMinClientHeight, + AMaxClientWidth, AMaxClientHeight: Integer); override; + procedure Paint; override; + procedure SizeChanging(const AWidth, AHeight: Integer); override; + public + constructor Create(AOwner: TComponent); override; + + procedure ReadPositionData(const Data: TTBReadPositionData); override; + procedure WritePositionData(const Data: TTBWritePositionData); override; + published + property ActivateParent; + property Align; + property Anchors; + property BorderStyle; + property Caption; + property Color; + property CloseButton; + property CloseButtonWhenDocked; + property ClientAreaHeight: Integer read GetClientAreaHeight write SetClientAreaHeight; + property ClientAreaWidth: Integer read GetClientAreaWidth write SetClientAreaWidth; + property CurrentDock; + property DefaultDock; + property DockableTo; + property DockMode; + property DockPos; + property DockRow; + property DragHandleStyle; + property FloatingMode; + property Font; + property FullSize; + property HideWhenInactive; + property LastDock; + property MaxClientHeight: Integer read FMaxClientHeight write FMaxClientHeight default 0; + property MaxClientWidth: Integer read FMaxClientWidth write FMaxClientWidth default 0; + property MinClientHeight: Integer read FMinClientHeight write FMinClientHeight default 32; + property MinClientWidth: Integer read FMinClientWidth write FMinClientWidth default 32; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property Resizable; + property ShowCaption; + property ShowHint; + property Stretch; + property SmoothDrag; + property TabOrder; + property UseLastDock; + {}{property Version;} + property Visible; + + property OnClose; + property OnCloseQuery; + {$IFDEF JR_D5} + property OnContextPopup; + {$ENDIF} + property OnDragDrop; + property OnDragOver; + property OnDockChanged; + property OnDockChanging; + property OnDockChangingHidden; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnMove; + property OnRecreated; + property OnRecreating; + property OnResize; + property OnVisibleChanged; + end; + +implementation + +const + { Constants for TTBToolWindow-specific registry values. Do not localize! } + rvClientWidth = 'ClientWidth'; + rvClientHeight = 'ClientHeight'; + + +{ TTBToolWindow } + +constructor TTBToolWindow.Create(AOwner: TComponent); +begin + inherited; + FMinClientWidth := 32; + FMinClientHeight := 32; + { Initialize the client size to 32x32 } + SetBounds(Left, Top, 32, 32); +end; + +procedure TTBToolWindow.Paint; +var + R: TRect; +begin + { Draw dotted border in design mode } + if csDesigning in ComponentState then + with Canvas do begin + R := ClientRect; + Pen.Style := psDot; + Pen.Color := clBtnShadow; + Brush.Style := bsClear; + Rectangle(R.Left, R.Top, R.Right, R.Bottom); + Pen.Style := psSolid; + end; +end; + +procedure TTBToolWindow.ReadPositionData(const Data: TTBReadPositionData); +begin + inherited; + { Restore ClientAreaWidth/ClientAreaHeight variables } + if Resizable then + with Data do + SetClientAreaSize(ReadIntProc(Name, rvClientWidth, FBarWidth, ExtraData), + ReadIntProc(Name, rvClientHeight, FBarHeight, ExtraData)); +end; + +procedure TTBToolWindow.WritePositionData(const Data: TTBWritePositionData); +begin + inherited; + { Write values of FBarWidth/FBarHeight } + with Data do begin + WriteIntProc(Name, rvClientWidth, FBarWidth, ExtraData); + WriteIntProc(Name, rvClientHeight, FBarHeight, ExtraData); + end; +end; + +procedure TTBToolWindow.GetMinMaxSize(var AMinClientWidth, AMinClientHeight, + AMaxClientWidth, AMaxClientHeight: Integer); +begin + AMinClientWidth := FMinClientWidth; + AMinClientHeight := FMinClientHeight; + AMaxClientWidth := FMaxClientWidth; + AMaxClientHeight := FMaxClientHeight; +end; + +procedure TTBToolWindow.SizeChanging(const AWidth, AHeight: Integer); +begin + FBarWidth := AWidth; + if Parent <> nil then Dec(FBarWidth, Width - ClientWidth); + FBarHeight := AHeight; + if Parent <> nil then Dec(FBarHeight, Height - ClientHeight); +end; + +function TTBToolWindow.CalcSize(ADock: TTBDock): TPoint; +begin + Result.X := FBarWidth; + Result.Y := FBarHeight; + if Assigned(ADock) and (FullSize or Stretch) then begin + { If docked and stretching, return the minimum size so that the toolbar + can shrink below FBarWidth/FBarHeight } + if not(ADock.Position in [dpLeft, dpRight]) then + Result.X := FMinClientWidth + else + Result.Y := FMinClientHeight; + end; +end; + +procedure TTBToolWindow.GetBaseSize(var ASize: TPoint); +begin + ASize := CalcSize(CurrentDock); +end; + +function TTBToolWindow.DoArrange(CanMoveControls: Boolean; + PreviousDockType: TTBDockType; NewFloating: Boolean; NewDock: TTBDock): TPoint; +begin + Result := CalcSize(NewDock); +end; + +function TTBToolWindow.GetClientAreaWidth: Integer; +begin + if Parent = nil then + Result := Width + else + Result := ClientWidth; +end; + +procedure TTBToolWindow.SetClientAreaWidth(Value: Integer); +begin + SetClientAreaSize(Value, ClientAreaHeight); +end; + +function TTBToolWindow.GetClientAreaHeight: Integer; +begin + if Parent = nil then + Result := Height + else + Result := ClientHeight; +end; + +procedure TTBToolWindow.SetClientAreaHeight(Value: Integer); +begin + SetClientAreaSize(ClientAreaWidth, Value); +end; + +procedure TTBToolWindow.SetClientAreaSize(AWidth, AHeight: Integer); +var + Client: TRect; +begin + if Parent = nil then + SetBounds(Left, Top, AWidth, AHeight) + else begin + Client := GetClientRect; + SetBounds(Left, Top, Width - Client.Right + AWidth, + Height - Client.Bottom + AHeight); + end; +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Toolbar.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Toolbar.pas new file mode 100644 index 0000000..2264fd5 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Toolbar.pas @@ -0,0 +1,1794 @@ +unit TB2Toolbar; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Toolbar.pas,v 1.126 2008/06/23 18:05:47 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +uses + {$IFDEF JR_D9} Types, {$ENDIF} + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, ImgList, + Menus, ActnList, + TB2Item, TB2Dock; + +type + TTBCustomToolbar = class; + TTBChevronItem = class; + TTBChevronItemClass = class of TTBChevronItem; + + TTBToolbarViewClass = class of TTBToolbarView; + TTBToolbarView = class(TTBView) + private + FToolbar: TTBCustomToolbar; + protected + procedure AutoSize(AWidth, AHeight: Integer); override; + procedure DoUpdatePositions(var ASize: TPoint); override; + function GetChevronItem: TTBCustomItem; override; + function GetMDIButtonsItem: TTBCustomItem; override; + function GetMDISystemMenuItem: TTBCustomItem; override; + public + constructor Create(AOwner: TComponent; AParentView: TTBView; + AParentItem: TTBCustomItem; AWindow: TWinControl; + AIsToolbar, ACustomizing, AUsePriorityList: Boolean); override; + function GetFont: TFont; override; + procedure InvalidatePositions; override; + end; + + TTBChevronPriorityForNewItems = (tbcpHighest, tbcpLowest); + + TTBCustomToolbar = class(TTBCustomDockableWindow, ITBItems) + private + FBaseSize: TPoint; + FChevronItem: TTBChevronItem; + FChevronMoveItems: Boolean; + FChevronPriorityForNewItems: TTBChevronPriorityForNewItems; + FDisableAlignArrange: Integer; + FFloatingWidth: Integer; + FIgnoreMouseLeave: Boolean; + FItem: TTBRootItem; + FLastWrappedLines: Integer; + FMenuBar: Boolean; + FOnShortCut: TShortCutEvent; + FProcessShortCuts: Boolean; + FMainWindowHookInstalled: Boolean; + FShrinkMode: TTBShrinkMode; + FSizeData: TObject; + FSystemFont: Boolean; + FUpdateActions: Boolean; + + procedure CancelHover; + function CalcChevronOffset(const ADock: TTBDock; + const AOrientation: TTBViewOrientation): Integer; + function CalcWrapOffset(const ADock: TTBDock): Integer; + function CreateWrapper(Index: Integer; Ctl: TControl): TTBControlItem; + function FindWrapper(Ctl: TControl): TTBControlItem; + function GetChevronHint: String; + function GetImages: TCustomImageList; + function GetItems: TTBCustomItem; + function GetLinkSubitems: TTBCustomItem; + function GetOptions: TTBItemOptions; + procedure InstallMainWindowHook; + function IsChevronHintStored: Boolean; + class function MainWindowHook(var Message: TMessage): Boolean; {$IFDEF CLR} static; {$ENDIF} + procedure SetChevronHint(const Value: String); + procedure SetChevronMoveItems(Value: Boolean); + procedure SetChevronPriorityForNewItems(Value: TTBChevronPriorityForNewItems); + procedure SetFloatingWidth(Value: Integer); + procedure SetImages(Value: TCustomImageList); + procedure SetLinkSubitems(Value: TTBCustomItem); + procedure SetMainWindowHook; + procedure SetMenuBar(Value: Boolean); + procedure SetOptions(Value: TTBItemOptions); + procedure SetProcessShortCuts(Value: Boolean); + procedure SetShrinkMode(Value: TTBShrinkMode); + procedure SetSystemFont(Value: Boolean); + procedure UninstallMainWindowHook; + procedure UpdateViewProperties; + + procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED; + {$IFNDEF CLR} + procedure CMControlChange(var Message: TCMControlChange); message CM_CONTROLCHANGE; + procedure CMControlListChange(var Message: TCMControlListChange); message CM_CONTROLLISTCHANGE; + {$ENDIF} + procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED; + procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR; + procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY; + procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW; + procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; + procedure CMShowHintChanged(var Message: TMessage); message CM_SHOWHINTCHANGED; + procedure CMWinIniChange(var Message: TWMWinIniChange); message CM_WININICHANGE; + procedure WMCancelMode(var Message: TWMCancelMode); message WM_CANCELMODE; + procedure WMGetObject(var Message: TMessage); message WM_GETOBJECT; + procedure WMMouseLeave(var Message: TMessage); message WM_MOUSELEAVE; + procedure WMNCMouseMove(var Message: TWMNCMouseMove); message WM_NCMOUSEMOVE; + {$IFNDEF JR_D5} + procedure WMRButtonUp(var Message: TWMRButtonUp); message WM_RBUTTONUP; + {$ENDIF} + procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR; + procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND; + protected + FMDIButtonsItem: TTBCustomItem; + FMDISystemMenuItem: TTBCustomItem; + FView: TTBToolbarView; + procedure AlignControls(AControl: TControl; var Rect: TRect); override; + procedure BuildPotentialSizesList(SizesList: TList); dynamic; + {$IFDEF CLR} + procedure ControlChange(Inserting: Boolean; Child: TControl); override; + procedure ControlListChange(Inserting: Boolean; Child: TControl); override; + {$ENDIF} + procedure ControlExistsAtPos(const P: TPoint; var ControlExists: Boolean); + override; + function DoArrange(CanMoveControls: Boolean; PreviousDockType: TTBDockType; + NewFloating: Boolean; NewDock: TTBDock): TPoint; override; + {$IFDEF JR_D5} + procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); override; + {$ENDIF} + procedure GetBaseSize(var ASize: TPoint); override; + procedure GetMinBarSize(var MinimumSize: TPoint); + procedure GetMinShrinkSize(var AMinimumSize: Integer); override; + function GetShrinkMode: TTBShrinkMode; override; + function GetChevronItemClass: TTBChevronItemClass; dynamic; + function GetItemClass: TTBRootItemClass; dynamic; + function GetViewClass: TTBToolbarViewClass; dynamic; + procedure Loaded; override; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); override; + procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + procedure Paint; override; + procedure ResizeBegin(ASizeHandle: TTBSizeHandle); override; + procedure ResizeTrack(var Rect: TRect; const OrigRect: TRect); override; + procedure ResizeTrackAccept; override; + procedure ResizeEnd; override; + procedure SetChildOrder(Child: TComponent; Order: Integer); override; + + property SystemFont: Boolean read FSystemFont write SetSystemFont default True; + property OnShortCut: TShortCutEvent read FOnShortCut write FOnShortCut; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure BeginUpdate; + procedure EndUpdate; + procedure CreateWrappersForAllControls; + procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; + procedure GetTabOrderList(List: TList); override; + procedure InitiateAction; override; + function IsShortCut(var Message: TWMKey): Boolean; + function KeyboardOpen(Key: Char; RequirePrimaryAccel: Boolean): Boolean; + procedure ReadPositionData(const Data: TTBReadPositionData); override; + procedure WritePositionData(const Data: TTBWritePositionData); override; + + property ChevronHint: String read GetChevronHint write SetChevronHint stored IsChevronHintStored; + property ChevronMoveItems: Boolean read FChevronMoveItems write SetChevronMoveItems default True; + property ChevronPriorityForNewItems: TTBChevronPriorityForNewItems read FChevronPriorityForNewItems + write SetChevronPriorityForNewItems default tbcpHighest; + property FloatingWidth: Integer read FFloatingWidth write SetFloatingWidth default 0; + property Images: TCustomImageList read GetImages write SetImages; + property Items: TTBRootItem read FItem; + property LinkSubitems: TTBCustomItem read GetLinkSubitems write SetLinkSubitems; + property Options: TTBItemOptions read GetOptions write SetOptions default []; + property MenuBar: Boolean read FMenuBar write SetMenuBar default False; + property ProcessShortCuts: Boolean read FProcessShortCuts write SetProcessShortCuts default False; + property ShrinkMode: TTBShrinkMode read FShrinkMode write SetShrinkMode default tbsmChevron; + property UpdateActions: Boolean read FUpdateActions write FUpdateActions default True; + property View: TTBToolbarView read FView; + published + property Hint stored False; { Hint is set dynamically; don't save it } + end; + + TTBToolbar = class(TTBCustomToolbar) + published + property ActivateParent; + property Align; + property Anchors; + property AutoResize; + property BorderStyle; + property Caption; + property ChevronHint; + property ChevronMoveItems; + property ChevronPriorityForNewItems; + property CloseButton; + property CloseButtonWhenDocked; + property Color; + property CurrentDock; + property DefaultDock; + property DockableTo; + property DockMode; + property DockPos; + property DockRow; + property DragHandleStyle; + property FloatingMode; + property FloatingWidth; + property Font; + property FullSize; + property HideWhenInactive; + property Images; + property Items; + property LastDock; + property LinkSubitems; + property MenuBar; + property Options; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ProcessShortCuts; + property Resizable; + property ShowCaption; + property ShowHint; + property ShrinkMode; + property SmoothDrag; + property Stretch; + property SystemFont; + property TabOrder; + property UpdateActions; + property UseLastDock; + property Visible; + + property OnClose; + property OnCloseQuery; + {$IFDEF JR_D5} + property OnContextPopup; + {$ENDIF} + property OnDragDrop; + property OnDragOver; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnMove; + property OnRecreated; + property OnRecreating; + property OnDockChanged; + property OnDockChanging; + property OnDockChangingHidden; + property OnResize; + property OnShortCut; + property OnVisibleChanged; + end; + +{ TTBChevronItem & TTBChevronItemViewer } + + TTBChevronItem = class(TTBCustomItem) + private + FToolbar: TTBCustomToolbar; + function GetDefaultHint: String; + protected + function GetChevronParentView: TTBView; override; + function GetItemViewerClass(AView: TTBView): TTBItemViewerClass; override; + public + constructor Create(AOwner: TComponent); override; + end; + + TTBChevronItemViewer = class(TTBItemViewer) + protected + procedure Paint(const Canvas: TCanvas; const ClientAreaRect: TRect; + IsSelected, IsPushed, UseDisabledShadow: Boolean); override; + end; + +const + tbChevronSize = 12; + + +implementation + +uses + {$IFDEF CLR} System.Runtime.InteropServices, System.Text, {$ENDIF} + TB2Consts, TB2Common, TB2Hook; + +const + { Constants for TTBCustomToolbar-specific registry values. Do not localize! } + rvFloatRightX = 'FloatRightX'; + DockTypeToOrientation: array[TTBDockType] of TTBViewOrientation = + (tbvoHorizontal, tbvoFloating, tbvoHorizontal, tbvoVertical); + +type + { Used internally by the TTBCustomToolbar.Resize* methods } + TToolbarSizeData = class + public + SizeHandle: TTBSizeHandle; + NewSizes: TList; { List of valid new sizes. Items are casted into TSmallPoints } + OrigWidth, OrigHeight, NCXDiff: Integer; + CurRightX: Integer; + DisableSensCheck, OpSide: Boolean; + DistanceToSmallerSize, DistanceToLargerSize: Integer; + end; + + +procedure HookProc(Code: THookProcCode; Wnd: HWND; WParam: WPARAM; + LParam: LPARAM); +var + Msg: {$IFNDEF CLR} PMsg {$ELSE} TMsg {$ENDIF}; + MainForm: TForm; +begin + { Work around an annoying Windows or VCL bug. If you close all MDI child + windows, the MDI client window gets the focus, and when it has the focus, + pressing Alt+[char] doesn't send a WM_SYSCOMMAND message to the form for + some reason. It seems silly to have to use a hook for this, but I don't + see a better workaround. + Also, route Alt+- to the main form so that when an MDI child form is + maximized, Alt+- brings up the TB2k MDI system menu instead of the + system's. } + if Code = hpGetMessage then begin + {$IFNDEF CLR} + Msg := PMsg(LParam); + {$ELSE} + Msg := TMsg(Marshal.PtrToStructure(IntPtr(LParam), TypeOf(TMsg))); + {$ENDIF} + if (Msg.message = WM_SYSCHAR) and (Msg.hwnd <> 0) then begin + { Note: On Windows NT/2000/XP, even though we install the hook using + SetWindowsHookExW, Msg.wParam may either be an ANSI character or a + Unicode character, due to an apparent bug on these platforms. It is + an ANSI character when the message passes through a separate + SetWindowsHookExA-installed WH_GETMESSAGE hook first, and that hook + calls us via CallNextHookEx. Windows apparently "forgets" to convert + the character from ANSI back to Unicode in this case. + We can't convert the character code because there seems to be no way + to detect whether it is ANSI or Unicode. So we can't really do much + with Msg.wParam, apart from comparing it against character codes that + are the same between ANSI and Unicode, such as '-'. } + MainForm := Application.MainForm; + if Assigned(MainForm) and MainForm.HandleAllocated and (GetCapture = 0) and + ((Msg.hwnd = MainForm.ClientHandle) or + ((Msg.wParam = Ord('-')) and (MainForm.ClientHandle <> 0) and + IsChild(MainForm.ClientHandle, Msg.hwnd))) then begin + { Redirect the message to the main form. + Note: Unfortunately, due to a bug in Windows NT 4.0 (and not + 2000/XP/9x/Me), modifications to the message don't take effect if + another WH_GETMESSAGE hook has been installed above this one. + (The bug is that CallNextHookEx copies lParam^ to a local buffer, but + does not propogate the changes made by the hook back to lParam^ when + it returns.) I don't know of any clean workaround, other than to + ensure other WH_GETMESSAGE hooks are installed *before* + Toolbar2000's. } + Msg.hwnd := MainForm.Handle; + {$IFDEF CLR} + Marshal.StructureToPtr(TObject(Msg), IntPtr(LParam), False); + {$ENDIF} + end; + end; + end; +end; + +constructor TTBChevronItem.Create(AOwner: TComponent); +begin + inherited; + FToolbar := AOwner as TTBCustomToolbar; + ItemStyle := ItemStyle + [tbisSubMenu, tbisNoAutoOpen]; + Hint := GetDefaultHint; + Caption := EscapeAmpersands(GetShortHint(Hint)); +end; + +function TTBChevronItem.GetChevronParentView: TTBView; +begin + Result := FToolbar.FView; +end; + +function TTBChevronItem.GetDefaultHint: String; +begin + Result := STBChevronItemMoreButtonsHint; +end; + +function TTBChevronItem.GetItemViewerClass(AView: TTBView): TTBItemViewerClass; +begin + Result := TTBChevronItemViewer; +end; + +procedure TTBChevronItemViewer.Paint(const Canvas: TCanvas; + const ClientAreaRect: TRect; IsSelected, IsPushed, UseDisabledShadow: Boolean); +const + HorzPattern: array[0..15] of Byte = + ($CC, 0, $66, 0, $33, 0, $66, 0, $CC, 0, 0, 0, 0, 0, 0, 0); + VertPattern: array[0..15] of Byte = + ($88, 0, $D8, 0, $70, 0, $20, 0, $88, 0, $D8, 0, $70, 0, $20, 0); +var + DC: HDC; + R2: TRect; + TempBmp: TBitmap; + + procedure DrawPattern(const Color, Offset: Integer); + begin + SelectObject(DC, GetSysColorBrush(Color)); + BitBlt(DC, R2.Left, R2.Top + Offset, R2.Right - R2.Left, + R2.Bottom - R2.Top, TempBmp.Canvas.Handle, 0, 0, $00E20746 {ROP_DSPDxax}); + end; + +begin + DC := Canvas.Handle; + R2 := ClientAreaRect; + if Item.Enabled then begin + if IsPushed then + DrawEdge(DC, R2, BDR_SUNKENOUTER, BF_RECT) + else if IsSelected and not(csDesigning in Item.ComponentState) then + DrawEdge(DC, R2, BDR_RAISEDINNER, BF_RECT); + end; + + if View.Orientation <> tbvoVertical then begin + R2.Top := 4; + R2.Bottom := R2.Top + 5; + Inc(R2.Left, 2); + R2.Right := R2.Left + 8; + end + else begin + R2.Left := R2.Right - 9; + R2.Right := R2.Left + 5; + Inc(R2.Top, 2); + R2.Bottom := R2.Top + 8; + end; + if IsPushed then + OffsetRect(R2, 1, 1); + TempBmp := TBitmap.Create; + try + if View.Orientation = tbvoVertical then + TempBmp.Handle := CreateMonoBitmap(8, 8, VertPattern) + else + TempBmp.Handle := CreateMonoBitmap(8, 8, HorzPattern); + SetTextColor(DC, clBlack); + SetBkColor(DC, clWhite); + if Item.Enabled then + DrawPattern(COLOR_BTNTEXT, 0) + else begin + DrawPattern(COLOR_BTNHIGHLIGHT, 1); + DrawPattern(COLOR_BTNSHADOW, 0); + end; + finally + TempBmp.Free; + end; +end; + + +{ TTBToolbarView } + +constructor TTBToolbarView.Create(AOwner: TComponent; AParentView: TTBView; + AParentItem: TTBCustomItem; AWindow: TWinControl; + AIsToolbar, ACustomizing, AUsePriorityList: Boolean); +begin + FToolbar := AOwner as TTBCustomToolbar; + inherited; +end; + +procedure TTBToolbarView.AutoSize(AWidth, AHeight: Integer); +begin + FToolbar.FBaseSize := BaseSize; + if FToolbar.IsAutoResized then + FToolbar.ChangeSize(AWidth, AHeight); +end; + +procedure TTBToolbarView.DoUpdatePositions(var ASize: TPoint); +begin + { Reset CurrentSize because it probably won't be valid after positions + are recalculated [2001-06-24] } + FToolbar.CurrentSize := 0; + FToolbar.GetMinBarSize(ASize); + { On FullSize toolbars, increase ASize.X/Y to WrapOffset so that + right-aligned items always appear at the right edge even when the toolbar + isn't wrapping } + if FToolbar.FullSize then begin + if (Orientation = tbvoHorizontal) and (ASize.X < WrapOffset) then + ASize.X := WrapOffset + else if (Orientation = tbvoVertical) and (ASize.Y < WrapOffset) then + ASize.Y := WrapOffset; + end; + { Increment FDisableAlignArrange so that we don't recursively arrange when + CalculatePositions moves controls } + Inc(FToolbar.FDisableAlignArrange); + try + inherited; + finally + Dec(FToolbar.FDisableAlignArrange); + end; +end; + +procedure TTBToolbarView.InvalidatePositions; +begin + { Reset CurrentSize because it probably won't be valid after positions + are recalculated [2001-06-04] } + FToolbar.CurrentSize := 0; + inherited; +end; + +function TTBToolbarView.GetFont: TFont; +begin + if not FToolbar.SystemFont then + Result := FToolbar.Font + else + Result := inherited GetFont; +end; + +function TTBToolbarView.GetChevronItem: TTBCustomItem; +begin + Result := FToolbar.FChevronItem; +end; + +function TTBToolbarView.GetMDIButtonsItem: TTBCustomItem; +begin + Result := FToolbar.FMDIButtonsItem; +end; + +function TTBToolbarView.GetMDISystemMenuItem: TTBCustomItem; +begin + Result := FToolbar.FMDISystemMenuItem; +end; + + +{ TTBCustomToolbar } + +type + {}TTBCustomItemAccess = class(TTBCustomItem); + TTBItemViewerAccess = class(TTBItemViewer); + +constructor TTBCustomToolbar.Create(AOwner: TComponent); +begin + inherited; + ControlStyle := ControlStyle + [csAcceptsControls, csActionClient] - + [csCaptureMouse]; + DockableWindowStyles := DockableWindowStyles - [tbdsResizeEightCorner, + tbdsResizeClipCursor]; + FItem := GetItemClass.Create(Self); + FItem.ParentComponent := Self; + FChevronItem := GetChevronItemClass.Create(Self); + FChevronItem.LinkSubitems := FItem; + FChevronMoveItems := True; + FView := GetViewClass.Create(Self, nil, FItem, Self, True, False, + not(csDesigning in ComponentState)); + FView.BackgroundColor := clBtnFace; + FUpdateActions := True; + FShrinkMode := tbsmChevron; + FSystemFont := True; + Color := clBtnFace; + SetBounds(Left, Top, 23, 22);{} +end; + +destructor TTBCustomToolbar.Destroy; +begin + { Call Destroying to ensure csDestroying is in ComponentState now. Only + needed for Delphi 4 and earlier since Delphi 5 calls Destroying in + TComponent.BeforeDestruction } + Destroying; + UninstallHookProc(Self, HookProc); + UninstallMainWindowHook; + FreeAndNil(FView); + FreeAndNil(FChevronItem); + FreeAndNil(FItem); + inherited; +end; + +function TTBCustomToolbar.GetItems: TTBCustomItem; +begin + Result := FItem; +end; + +function TTBCustomToolbar.GetItemClass: TTBRootItemClass; +begin + Result := TTBRootItem; +end; + +function TTBCustomToolbar.GetViewClass: TTBToolbarViewClass; +begin + Result := TTBToolbarView; +end; + +function TTBCustomToolbar.GetChevronItemClass: TTBChevronItemClass; +begin + Result := TTBChevronItem; +end; + +procedure TTBCustomToolbar.CreateWrappersForAllControls; +{ Create wrappers for any controls that don't already have them } +var + L: TList; + I, J, C: Integer; +begin + if ControlCount = 0 then + Exit; + L := TList.Create; + try + L.Capacity := ControlCount; + for I := 0 to ControlCount-1 do + L.Add(Controls[I]); + C := FItem.Count-1; + for I := 0 to C do + if FItem[I] is TTBControlItem then begin + J := L.IndexOf(TTBControlItem(FItem[I]).Control); + if J <> -1 then + L[J] := nil; + end; + for I := 0 to L.Count-1 do + if Assigned(L[I]) then + CreateWrapper(FItem.Count, TControl(L[I])); + finally + L.Free; + end; +end; + +procedure TTBCustomToolbar.Loaded; +begin + CreateWrappersForAllControls; + inherited; +end; + +procedure TTBCustomToolbar.GetChildren(Proc: TGetChildProc; Root: TComponent); +begin + TTBCustomItemAccess(TTBCustomItem(FItem)).GetChildren(Proc, Root); + inherited; +end; + +procedure TTBCustomToolbar.SetChildOrder(Child: TComponent; Order: Integer); +begin + if Child is TTBCustomItem then + TTBCustomItemAccess(TTBCustomItem(FItem)).SetChildOrder(Child, Order); +end; + +procedure TTBCustomToolbar.AlignControls(AControl: TControl; var Rect: TRect); +{ VCL calls this whenever any child controls in the toolbar are moved, sized, + inserted, etc., and also when the toolbar is resized. } +begin + if FDisableAlignArrange = 0 then + Arrange; +end; + +procedure TTBCustomToolbar.InitiateAction; +begin + inherited; + {}{ also add this to popupmenu(?) } + { Update visible top-level items } + if FUpdateActions then + FView.InitiateActions; +end; + +procedure TTBCustomToolbar.CMColorChanged(var Message: TMessage); +begin + { Synchronize FView.BackgroundColor with the new color } + if Assigned(FView) then + FView.BackgroundColor := Color; + inherited; +end; + +function TTBCustomToolbar.CreateWrapper(Index: Integer; + Ctl: TControl): TTBControlItem; +var + I: Integer; + S: String; +begin + Result := TTBControlItem.Create(Owner); + Result.Control := Ctl; + if (csDesigning in ComponentState) and Assigned(Owner) then begin + { Needs a name for compatibility with form inheritance } + I := 1; + while True do begin + S := Format('TBControlItem%d', [I]); + if Owner.FindComponent(S) = nil then + Break; + Inc(I); + end; + Result.Name := S; + end; + FItem.Insert(Index, Result); +end; + +function TTBCustomToolbar.FindWrapper(Ctl: TControl): TTBControlItem; +var + I: Integer; + Item: TTBCustomItem; +begin + Result := nil; + for I := 0 to FItem.Count-1 do begin + Item := FItem[I]; + if (Item is TTBControlItem) and + (TTBControlItem(Item).Control = Ctl) then begin + Result := TTBControlItem(Item); + Break; + end; + end; +end; + +{$IFNDEF CLR} +procedure TTBCustomToolbar.CMControlChange(var Message: TCMControlChange); +{$ELSE} +procedure TTBCustomToolbar.ControlChange(Inserting: Boolean; Child: TControl); +{$ENDIF} +{ A CM_CONTROLCHANGE handler must be used instead of a CM_CONTROLLISTCHANGE + handler because when a CM_CONTROLLISTCHANGE message is sent it is relayed to + *all* parents. CM_CONTROLCHANGE messages are only sent to the immediate + parent. } + + procedure HandleControlChange(Inserting: Boolean; Child: TControl); + begin + { Don't automatically create TTBControlItem wrappers if the component + is loading or being updated to reflect changes in an ancestor form, + because wrappers will be streamed in } + if Inserting and not(csLoading in ComponentState) and + not(csUpdating in ComponentState) and + (FindWrapper(Child) = nil) then + CreateWrapper(FItem.Count, Child); + end; + +begin + inherited; + {$IFNDEF CLR} + HandleControlChange(Message.Inserting, Message.Control); + {$ELSE} + HandleControlChange(Inserting, Child); + {$ENDIF} +end; + +{$IFNDEF CLR} +procedure TTBCustomToolbar.CMControlListChange(var Message: TCMControlListChange); +{$ELSE} +procedure TTBCustomToolbar.ControlListChange(Inserting: Boolean; Child: TControl); +{$ENDIF} +{ Don't handle deletions inside CM_CONTROLCHANGE because CM_CONTROLCHANGE is + sent *before* a control begins removing itself from its parent. (It used + to handle both insertions and deletions inside CM_CONTROLCHANGE but this + caused AV's.) } + + procedure HandleControlListChange(Inserting: Boolean; Child: TControl); + var + Item: TTBControlItem; + begin + if not Inserting and Assigned(FItem) then begin + while True do begin + Item := FindWrapper(Child); + if Item = nil then Break; + { The control is being removed the control, not necessarily destroyed, + so set DontFreeControl to True } + Item.DontFreeControl := True; + Item.Free; + end; + end; + end; + +begin + inherited; + {$IFNDEF CLR} + HandleControlListChange(Message.Inserting, Message.Control); + {$ELSE} + HandleControlListChange(Inserting, Child); + {$ENDIF} +end; + +procedure TTBCustomToolbar.CMHintShow(var Message: TCMHintShow); +{ Since the items on a toolbar aren't "real" controls, it needs a CM_HINTSHOW + handler for their hints to be displayed. } +begin + FView.HandleHintShowMessage(Message); +end; + +procedure TTBCustomToolbar.CMShowHintChanged(var Message: TMessage); +begin + inherited; + if ShowHint then + FView.Style := FView.Style + [vsAlwaysShowHints] + else + FView.Style := FView.Style - [vsAlwaysShowHints]; +end; + +procedure TTBCustomToolbar.WMGetObject(var Message: TMessage); +begin + if not FView.HandleWMGetObject(Message) then + inherited; +end; + +procedure TTBCustomToolbar.WMSetCursor(var Message: TWMSetCursor); +var + P: TPoint; + Viewer: TTBItemViewer; + Cursor: HCURSOR; +begin + if not(csDesigning in ComponentState) and + (Message.CursorWnd = WindowHandle) and + (Smallint(Message.HitTest) = HTCLIENT) then begin + { Note: This should not change the selection, because we can receive this + message during a modal loop if a user sets "Screen.Cursor := crDefault" + inside a submenu's OnClick handler (which really isn't recommended, as + it won't necessarily restore the cursor we set originally). } + GetCursorPos(P); + P := ScreenToClient(P); + Viewer := FView.ViewerFromPoint(P); + if Assigned(Viewer) then begin + Cursor := 0; + Dec(P.X, Viewer.BoundsRect.Left); + Dec(P.Y, Viewer.BoundsRect.Top); + TTBItemViewerAccess(Viewer).GetCursor(P, Cursor); + if Cursor <> 0 then begin + SetCursor(Cursor); + Message.Result := 1; + Exit; + end; + end; + end; + inherited; +end; + +procedure TTBCustomToolbar.WMSysCommand(var Message: TWMSysCommand); +var + ConvertedKey: Char; +begin + if FMenuBar and CanFocus then + with Message do + if (CmdType and $FFF0 = SC_KEYMENU) and (Key <> VK_SPACE) and + (GetCapture = 0) then begin + {$IFNDEF CLR} + {$IFDEF JR_WIDESTR} + { Under Unicode Win32 VCL, no conversion required } + WideChar(ConvertedKey) := WideChar(Key); + {$ELSE} + if Win32Platform = VER_PLATFORM_WIN32_NT then begin + { On Windows NT 4/2000/XP, Key is a wide character, so we have to + convert it. Pressing Alt+N in a Russian input locale, for example, + results in a Key value of $0442. + This could perhaps be considered a bug in Windows NT since the + character codes in other messages such as WM_SYSCHAR aren't left + in Unicode form. + The conversion isn't done with the system code page, but rather + with the code page of the currently active input locale, like + Windows does when sending WM_(SYS)CHAR messages. } + if WideCharToMultiByte(GetInputLocaleCodePage, 0, @WideChar(Key), 1, + @AnsiChar(ConvertedKey), 1, nil, nil) <> 1 then + Exit; { shouldn't fail, but if it does, we can't continue } + end + else begin + { On Windows 95/98/Me, Key is not a wide character. } + AnsiChar(ConvertedKey) := AnsiChar(Key); + end; + {$ENDIF} + {$ELSE} + if Marshal.SystemDefaultCharSize = 2 then begin + { Strings are Unicode on .NET, so no need to downconvert to ANSI } + ConvertedKey := WideChar(Key); + end + else begin + { On Windows 98/Me, we have to convert ANSI->Unicode, using the + code page of the currently active input locale } + ConvertedKey := Encoding.GetEncoding(GetInputLocaleCodePage). + GetChars([Byte(Key)])[0]; + end; + {$ENDIF} + if not KeyboardOpen(ConvertedKey, False) then begin + if Key = Ord('-') then Exit; + MessageBeep(0); + end; + Result := 1; + end; +end; + +procedure TTBCustomToolbar.Paint; +var + R: TRect; +begin + { Draw dotted border in design mode on undocked toolbars } + if not Docked and (csDesigning in ComponentState) then + with Canvas do begin + R := ClientRect; + Pen.Style := psDot; + Pen.Color := clBtnShadow; + Brush.Style := bsClear; + Rectangle(R.Left, R.Top, R.Right, R.Bottom); + Pen.Style := psSolid; + end; + FView.DrawSubitems(Canvas); +end; + +procedure TTBCustomToolbar.CMDialogKey(var Message: TCMDialogKey); +begin + if not(csDesigning in ComponentState) and + (Message.CharCode = VK_MENU) and FMenuBar and CanFocus then + FView.SetAccelsVisibility(True); + inherited; +end; + +procedure TTBCustomToolbar.CMDialogChar(var Message: TCMDialogChar); +begin + { On toolbars that aren't menu bars, handle CM_DIALOGCHAR instead of + WM_SYSCOMMAND. + Note: We have to check for csDesigning because on Delphi 2005/2006 we get + CM_DIALOG* messages if Alt+[key] is pressed while a form with a toolbar is + open in the embedded designer, and a tab other than Design is currently + selected (e.g., Code). } + if not(csDesigning in ComponentState) and + not FMenuBar and CanFocus and (Message.CharCode <> 0) then + if KeyboardOpen(Chr(Message.CharCode), True) then begin + Message.Result := 1; + Exit; + end; + inherited; +end; + +procedure TTBCustomToolbar.CancelHover; +begin + if not MouseCapture then + FView.UpdateSelection(Point(Low(Integer), Low(Integer)), True); +end; + +procedure TTBCustomToolbar.CMMouseLeave(var Message: TMessage); +begin + CancelHover; + inherited; +end; + +{$IFDEF JR_D5} +procedure TTBCustomToolbar.DoContextPopup(MousePos: TPoint; + var Handled: Boolean); +begin + CancelHover; + inherited; +end; +{$ENDIF} + +{$IFNDEF JR_D5} +{ Delphi 4 and earlier don't have a DoContextPopup method; we instead have to + trap WM_RBUTTONUP to determine if a popup menu (might) be displayed } +procedure TTBCustomToolbar.WMRButtonUp(var Message: TWMRButtonUp); +begin + CancelHover; + inherited; +end; +{$ENDIF} + +procedure TTBCustomToolbar.MouseMove(Shift: TShiftState; X, Y: Integer); +var + P: TPoint; + Item: TTBCustomItem; +begin + if not(csDesigning in ComponentState) then begin + P := ClientToScreen(Point(X, Y)); + FView.UpdateSelection(P, True); + if Assigned(FView.Selected) then begin + Item := FView.Selected.Item; + if not(tboLongHintInMenuOnly in Item.EffectiveOptions) then + Hint := Item.Hint + else + Hint := ''; + end + else + Hint := ''; + end; + { Call TrackMouseEvent to be sure that we are notified when the mouse leaves + the window. We won't get a CM_MOUSELEAVE message if the mouse moves + directly from the toolbar to another application's window } + CallTrackMouseEvent(Handle, TME_LEAVE); + inherited; +end; + +procedure TTBCustomToolbar.WMCancelMode(var Message: TWMCancelMode); +begin + inherited; + { We can receive a WM_CANCELMODE message during a modal loop if a dialog + pops up. Respond by hiding menus to make it look like the modal loop + has returned, even though it really hasn't yet. + Note: Similar code in TTBModalHandler.WndProc. } + if vsModal in FView.State then + FView.CancelMode; +end; + +procedure TTBCustomToolbar.WMMouseLeave(var Message: TMessage); +begin + { A WM_MOUSELEAVE handler is necessary because the control won't get a + CM_MOUSELEAVE message if the user presses Alt+Space. Also, CM_MOUSELEAVE + messages are also not sent if the application is in a + Application.ProcessMessages loop. } + if not FIgnoreMouseLeave then + CancelHover; + inherited; +end; + +procedure TTBCustomToolbar.WMNCMouseMove(var Message: TWMNCMouseMove); +begin + Hint := ''; + CancelHover; + inherited; +end; + +function TTBCustomToolbar.KeyboardOpen(Key: Char; + RequirePrimaryAccel: Boolean): Boolean; +var + I: TTBItemViewer; + IsOnlyItemWithAccel: Boolean; +begin + Result := False; + { Sanity check: Bail out early if re-entered } + if vsModal in FView.State then + Exit; + I := nil; + FView.SetAccelsVisibility(True); + try + if Key = #0 then begin + I := FView.FirstSelectable; + if I = nil then Exit; + FView.Selected := I; + FView.EnterToolbarLoop([]); + end + else begin + I := FView.NextSelectableWithAccel(nil, Key, RequirePrimaryAccel, + IsOnlyItemWithAccel); + if (I = nil) or not I.Item.Enabled then + Exit; + if IsOnlyItemWithAccel then begin + FView.Selected := I; + FView.EnterToolbarLoop([tbetExecuteSelected]); + end + else if FMenuBar then begin + FView.Selected := I; + FView.EnterToolbarLoop([]); + end + else + Exit; + end; + Result := True; + finally + if Assigned(I) then + FView.SetAccelsVisibility(False); + end; +end; + +procedure TTBCustomToolbar.MouseDown(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); +var + OldParent: TWinControl; + P: TPoint; + Item: TTBCustomItem; +begin + OldParent := Parent; + inherited; + if Parent <> OldParent then + { if the inherited handler (TTBDockableWindow.MouseDown) changed the Parent + (due to the toolbar moving between docks), nothing else should be done } + Exit; + if not(csDesigning in ComponentState) and (Button = mbLeft) then begin + P := ClientToScreen(Point(X, Y)); + FView.UpdateSelection(P, True); + if Assigned(FView.Selected) then begin + Item := FView.Selected.Item; + if not(tbisClicksTransparent in TTBCustomItemAccess(Item).ItemStyle) then begin + FIgnoreMouseLeave := True; + try + FView.EnterToolbarLoop([tbetMouseDown]); + finally + FIgnoreMouseLeave := False; + end; + end; + end; + end; +end; + +procedure TTBCustomToolbar.CMFontChanged(var Message: TMessage); +begin + inherited; + if not FSystemFont then + Arrange; +end; + +function TTBCustomToolbar.GetChevronHint: String; +begin + Result := FChevronItem.Hint; +end; + +procedure TTBCustomToolbar.SetChevronHint(const Value: String); +begin + FChevronItem.Hint := Value; + FChevronItem.Caption := EscapeAmpersands(GetShortHint(Value)); +end; + +procedure TTBCustomToolbar.SetChevronMoveItems(Value: Boolean); +begin + if FChevronMoveItems <> Value then begin + FChevronMoveItems := Value; + FView.UsePriorityList := Value and not(csDesigning in ComponentState); + end; +end; + +procedure TTBCustomToolbar.SetChevronPriorityForNewItems(Value: TTBChevronPriorityForNewItems); +begin + FChevronPriorityForNewItems := Value; + FView.NewViewersGetHighestPriority := (Value = tbcpHighest); +end; + +function TTBCustomToolbar.IsChevronHintStored: Boolean; +begin + Result := (FChevronItem.Hint <> FChevronItem.GetDefaultHint); +end; + +function TTBCustomToolbar.GetImages: TCustomImageList; +begin + Result := FItem.SubMenuImages; +end; + +procedure TTBCustomToolbar.SetImages(Value: TCustomImageList); +begin + FItem.SubMenuImages := Value; +end; + +function TTBCustomToolbar.GetLinkSubitems: TTBCustomItem; +begin + Result := FItem.LinkSubitems; +end; + +procedure TTBCustomToolbar.SetLinkSubitems(Value: TTBCustomItem); +begin + FItem.LinkSubitems := Value; +end; + +procedure TTBCustomToolbar.SetMenuBar(Value: Boolean); +begin + if FMenuBar <> Value then begin + FMenuBar := Value; + if Value then begin + ControlStyle := ControlStyle + [csMenuEvents]; + FView.Style := FView.Style + [vsMenuBar, vsUseHiddenAccels]; + end + else begin + ControlStyle := ControlStyle - [csMenuEvents]; + FView.Style := FView.Style - [vsMenuBar, vsUseHiddenAccels]; + end; + if not(csLoading in ComponentState) then begin + FullSize := Value; + if Value then + ShrinkMode := tbsmWrap + else + ShrinkMode := tbsmChevron; + CloseButton := not Value; + ProcessShortCuts := Value; + end; + if Value and not(csDesigning in ComponentState) then + InstallHookProc(Self, HookProc, [hpGetMessage]) + else + UninstallHookProc(Self, HookProc); + SetMainWindowHook; + end; +end; + +function TTBCustomToolbar.GetOptions: TTBItemOptions; +begin + Result := FItem.Options; +end; + +procedure TTBCustomToolbar.SetOptions(Value: TTBItemOptions); +begin + FItem.Options := Value; +end; + +procedure TTBCustomToolbar.SetProcessShortCuts(Value: Boolean); +begin + if FProcessShortCuts <> Value then begin + FProcessShortCuts := Value; + SetMainWindowHook; + end; +end; + +procedure TTBCustomToolbar.SetSystemFont(Value: Boolean); +begin + if FSystemFont <> Value then begin + FSystemFont := Value; + Arrange; + end; +end; + +procedure TTBCustomToolbar.SetShrinkMode(Value: TTBShrinkMode); +begin + if FShrinkMode <> Value then begin + FShrinkMode := Value; + if Docked then + CurrentDock.ArrangeToolbars + else if not Floating then + Arrange; + end; +end; + +procedure TTBCustomToolbar.SetFloatingWidth(Value: Integer); +begin + if FFloatingWidth <> Value then begin + FFloatingWidth := Value; + if Floating then begin + UpdateViewProperties; + Arrange; + end; + end; +end; + +function TTBCustomToolbar.CalcWrapOffset(const ADock: TTBDock): Integer; +begin + if ADock = nil then + Result := FFloatingWidth + else begin + if FShrinkMode = tbsmWrap then begin + if not(ADock.Position in [dpLeft, dpRight]) then + Result := ADock.Width - ADock.NonClientWidth - NonClientWidth + else + Result := ADock.Height - ADock.NonClientHeight - NonClientHeight; + end + else + Result := 0; + end; +end; + +function TTBCustomToolbar.CalcChevronOffset(const ADock: TTBDock; + const AOrientation: TTBViewOrientation): Integer; +begin + if (FShrinkMode = tbsmChevron) and Docked and (ADock = CurrentDock) then begin + Result := CurrentSize; + { Subtract non-client size } + if AOrientation <> tbvoVertical then + Dec(Result, NonClientWidth) + else + Dec(Result, NonClientHeight); + if Result < 0 then + Result := 0; { in case CurrentSize wasn't properly initialized yet } + end + else + Result := 0; +end; + +procedure TTBCustomToolbar.UpdateViewProperties; +var + DT: TTBDockType; +begin + DT := TBGetDockTypeOf(CurrentDock, Floating); + FView.Orientation := DockTypeToOrientation[DT]; + FView.ChevronSize := tbChevronSize; + if Assigned(CurrentDock) or Floating then begin + FView.ChevronOffset := CalcChevronOffset(CurrentDock, FView.Orientation); + FView.WrapOffset := CalcWrapOffset(CurrentDock); + end + else begin + FView.ChevronOffset := 0; + FView.WrapOffset := 0; + { Only enable chevron/wrapping when the width of the toolbar is fixed } + if not AutoResize or ((akLeft in Anchors) and (akRight in Anchors)) then begin + if FShrinkMode = tbsmChevron then + FView.ChevronOffset := Width - NonClientWidth + else if FShrinkMode = tbsmWrap then + FView.WrapOffset := Width - NonClientWidth; + end; + end; +end; + +{}{DOCKING STUFF} + +procedure TTBCustomToolbar.ReadPositionData(const Data: TTBReadPositionData); +begin + inherited; + with Data do + FloatingWidth := ReadIntProc(Name, rvFloatRightX, 0, ExtraData); +end; + +procedure TTBCustomToolbar.WritePositionData(const Data: TTBWritePositionData); +begin + inherited; + with Data do + WriteIntProc(Name, rvFloatRightX, FFloatingWidth, ExtraData); +end; + +procedure TTBCustomToolbar.GetMinBarSize(var MinimumSize: TPoint); +var + WH: Integer; +begin + MinimumSize.X := 0; + MinimumSize.Y := 0; + if Docked then begin + WH := CurrentDock.GetMinRowSize(EffectiveDockRow, Self); + if not(CurrentDock.Position in [dpLeft, dpRight]) then + MinimumSize.Y := WH + else + MinimumSize.X := WH; + end; +end; + +procedure TTBCustomToolbar.GetBaseSize(var ASize: TPoint); +begin + FView.ValidatePositions; + ASize := FBaseSize; +end; + +function TTBCustomToolbar.DoArrange(CanMoveControls: Boolean; + PreviousDockType: TTBDockType; NewFloating: Boolean; NewDock: TTBDock): TPoint; +var + DT: TTBDockType; + O: TTBViewOrientation; + TempBaseSize: TPoint; +begin + //outputdebugstring (pchar(format('%s.DoArrange(%d)', [Name, Ord(CanMoveControls)]))); + if CanMoveControls then begin + UpdateViewProperties; + Result := FView.UpdatePositions; + end + else begin + DT := TBGetDockTypeOf(NewDock, NewFloating); + O := DockTypeToOrientation[DT]; + Result.X := 0; + Result.Y := 0; + FView.CalculatePositions(False, O, CalcWrapOffset(NewDock), + CalcChevronOffset(NewDock, O), tbChevronSize, TempBaseSize, Result, + FLastWrappedLines); + end; +end; + +procedure TTBCustomToolbar.ControlExistsAtPos(const P: TPoint; + var ControlExists: Boolean); +var + P2: TPoint; +begin + inherited; + if not ControlExists and not(csDesigning in ComponentState) then begin + P2 := ClientToScreen(P); + FView.UpdateSelection(P2, True); + if Assigned(FView.Selected) and + not(tbisClicksTransparent in TTBCustomItemAccess(FView.Selected.Item).ItemStyle) then + ControlExists := True; + end; +end; + +procedure TTBCustomToolbar.BuildPotentialSizesList(SizesList: TList); +var + Margins: TRect; + MinX, SaveWrapX: Integer; + X, PrevWrappedLines: Integer; + S: TPoint; + S2: TSmallPoint; +begin + View.GetMargins(tbvoFloating, Margins); + MinX := Margins.Left + Margins.Right; + SaveWrapX := FFloatingWidth; + try + { Add the widest size to the list } + FFloatingWidth := 0; + S := DoArrange(False, dtNotDocked, True, nil); + SizesList.Add(TListItemType(PointToSmallPoint(S))); + { Calculate and add rest of sizes to the list } + PrevWrappedLines := 1; + X := S.X-1; + while X >= MinX do begin + FFloatingWidth := X; + S := DoArrange(False, dtNotDocked, True, nil); + if S.X > X then { if it refuses to go any smaller } + Break + else + if X = S.X then begin + S2 := PointToSmallPoint(S); + if FLastWrappedLines <> PrevWrappedLines then + SizesList.Add(TListItemType(S2)) + else + SizesList[SizesList.Count-1] := TListItemType(S2); + PrevWrappedLines := FLastWrappedLines; + Dec(X); + end + else + X := S.X; + end; + finally + FFloatingWidth := SaveWrapX; + end; +end; + +function CompareSizesX(Item1, Item2: TListItemType): Integer; +begin + { Sorts in descending order } + Result := TSmallPoint(Item2).X - TSmallPoint(Item1).X; +end; + +function CompareSizesY(Item1, Item2: TListItemType): Integer; +begin + { Sorts in descending order } + Result := TSmallPoint(Item2).Y - TSmallPoint(Item1).Y; +end; + +procedure TTBCustomToolbar.ResizeBegin(ASizeHandle: TTBSizeHandle); +const + MaxDistance = 12; +var + I, NewSize: Integer; + S, N: TSmallPoint; + P: TPoint; +begin + inherited; + + FSizeData := TToolbarSizeData.Create; + + with TToolbarSizeData(FSizeData) do begin + SizeHandle := ASizeHandle; + OrigWidth := Parent.Width; + OrigHeight := Parent.Height; + NCXDiff := ClientToScreen(Point(0, 0)).X - Parent.Left; + CurRightX := FFloatingWidth; + DisableSensCheck := False; + OpSide := False; + + NewSizes := TList.Create; + BuildPotentialSizesList(NewSizes); + for I := 0 to NewSizes.Count-1 do begin + P := SmallPointToPoint(TSmallPoint(NewSizes[I])); + AddFloatingNCAreaToSize(P); + NewSizes[I] := TListItemType(PointToSmallPoint(P)); + end; + if ASizeHandle in [twshTop, twshBottom] then + NewSizes.Sort(CompareSizesY) + else + NewSizes.Sort(CompareSizesX); + + { Calculate distance in pixels to the nearest potential sizes smaller and + larger than the current size, up to a maximum of MaxDistance pixels. } + DistanceToSmallerSize := 0; + DistanceToLargerSize := 0; + for I := 0 to NewSizes.Count-1 do begin + S := TSmallPoint(NewSizes[I]); + if (S.X = OrigWidth) and (S.Y = OrigHeight) then begin + if I > 0 then begin + N := TSmallPoint(NewSizes[I-1]); + if ASizeHandle in [twshLeft, twshRight] then + NewSize := N.X - S.X + else + NewSize := N.Y - S.Y; + if NewSize > MaxDistance then + NewSize := MaxDistance; + DistanceToLargerSize := NewSize; + end; + if I < NewSizes.Count-1 then begin + N := TSmallPoint(NewSizes[I+1]); + if ASizeHandle in [twshLeft, twshRight] then + NewSize := S.X - N.X + else + NewSize := S.Y - N.Y; + if NewSize > MaxDistance then + NewSize := MaxDistance; + DistanceToSmallerSize := NewSize; + end; + Break; + end; + end; + end; +end; + +procedure TTBCustomToolbar.ResizeTrack(var Rect: TRect; const OrigRect: TRect); +var + Pos: TPoint; + NewOpSide: Boolean; + Reverse: Boolean; + I: Integer; + P: TSmallPoint; +begin + inherited; + + with TToolbarSizeData(FSizeData) do begin + Pos.X := Rect.Right - Rect.Left; + Pos.Y := Rect.Bottom - Rect.Top; + + { Like Office, don't change from the original size until the mouse is moved + a reasonable distance left/up or right/down. Without this, dragging the + mouse just one pixel in either direction would cause the toolbar to + change sizes. } + if SizeHandle in [twshLeft, twshRight] then + NewOpSide := Pos.X < OrigWidth + else + NewOpSide := Pos.Y < OrigHeight; + if (not DisableSensCheck) or (OpSide <> NewOpSide) then begin + DisableSensCheck := False; + OpSide := NewOpSide; + if SizeHandle in [twshLeft, twshRight] then begin + if (Pos.X > OrigWidth-DistanceToSmallerSize) and (Pos.X < OrigWidth+DistanceToLargerSize) then + Pos.X := OrigWidth; + end + else begin + if (Pos.Y > OrigHeight-DistanceToSmallerSize) and (Pos.Y < OrigHeight+DistanceToLargerSize) then + Pos.Y := OrigHeight; + end; + end; + + Rect := OrigRect; + + if SizeHandle in [twshLeft, twshRight] then + Reverse := Pos.X > OrigWidth + else + Reverse := Pos.Y > OrigHeight; + if not Reverse then + I := 0 + else + I := NewSizes.Count-1; + while True do begin + P := TSmallPoint(NewSizes[I]); + if SizeHandle in [twshLeft, twshRight] then begin + if (not Reverse and ((I = NewSizes.Count-1) or (Pos.X >= P.X))) or + (Reverse and ((I = 0) or (Pos.X <= P.X))) then begin + if I = 0 then + CurRightX := 0 + else + CurRightX := P.X - NCXDiff*2; + if SizeHandle = twshRight then + Rect.Right := Rect.Left + P.X + else + Rect.Left := Rect.Right - P.X; + Rect.Bottom := Rect.Top + P.Y; + DisableSensCheck := not EqualRect(Rect, OrigRect); + Break; + end; + end + else begin + if (not Reverse and ((I = NewSizes.Count-1) or (Pos.Y >= P.Y))) or + (Reverse and ((I = 0) or (Pos.Y <= P.Y))) then begin + if I = NewSizes.Count-1 then + CurRightX := 0 + else + CurRightX := P.X - NCXDiff*2; + if SizeHandle = twshBottom then + Rect.Bottom := Rect.Top + P.Y + else + Rect.Top := Rect.Bottom - P.Y; + Rect.Right := Rect.Left + P.X; + DisableSensCheck := not EqualRect(Rect, OrigRect); + Break; + end; + end; + if not Reverse then + Inc(I) + else + Dec(I); + end; + end; +end; + +procedure TTBCustomToolbar.ResizeTrackAccept; +begin + inherited; + FloatingWidth := TToolbarSizeData(FSizeData).CurRightX; +end; + +procedure TTBCustomToolbar.ResizeEnd; +begin + inherited; + if Assigned(FSizeData) then begin + with TToolbarSizeData(FSizeData) do + FreeAndNil(NewSizes); + FreeAndNil(FSizeData); + end; +end; + +function TTBCustomToolbar.GetShrinkMode: TTBShrinkMode; +begin + Result := FShrinkMode; +end; + +procedure TTBCustomToolbar.GetMinShrinkSize(var AMinimumSize: Integer); +var + I: TTBItemViewer; +begin + I := FView.HighestPriorityViewer; + if Assigned(I) then begin + if not(CurrentDock.Position in [dpLeft, dpRight]) then + AMinimumSize := I.BoundsRect.Right - I.BoundsRect.Left + else + AMinimumSize := I.BoundsRect.Bottom - I.BoundsRect.Top; + end; + if not(CurrentDock.Position in [dpLeft, dpRight]) then + Inc(AMinimumSize, NonClientWidth) + else + Inc(AMinimumSize, NonClientHeight); + Inc(AMinimumSize, tbChevronSize); +end; + +procedure TTBCustomToolbar.BeginUpdate; +begin + FView.BeginUpdate; +end; + +procedure TTBCustomToolbar.EndUpdate; +begin + FView.EndUpdate; +end; + +procedure TTBCustomToolbar.GetTabOrderList(List: TList); +var + CtlList: TList; + I, J: Integer; + CtlI, CtlJ: TWinControl; +begin + inherited; + { Remove off-edge items and their children from List } + CtlList := TList.Create; + try + FView.GetOffEdgeControlList(CtlList); + for I := 0 to CtlList.Count-1 do begin + CtlI := TWinControl(CtlList[I]); + J := 0; + while J < List.Count do begin + CtlJ := TWinControl(List[J]); + if (CtlJ = CtlI) or CtlI.ContainsControl(CtlJ) then + List.Delete(J) + else + Inc(J); + end; + end; + finally + CtlList.Free; + end; +end; + +procedure TTBCustomToolbar.CMWinIniChange(var Message: TWMWinIniChange); +begin + inherited; + if {$IFNDEF CLR}TMessage{$ENDIF}(Message).WParam = SPI_SETNONCLIENTMETRICS then begin + TBInitToolbarSystemFont; + Arrange; + end; +end; + +function TTBCustomToolbar.IsShortCut(var Message: TWMKey): Boolean; +begin + Result := False; + if Assigned(FOnShortCut) then + FOnShortCut(Message, Result); + Result := Result or FItem.IsShortCut(Message); +end; + +var + HookCount: Integer; + HookList: TList; + +class function TTBCustomToolbar.MainWindowHook(var Message: TMessage): Boolean; + + function GetActiveForm: TCustomForm; + var + Wnd: HWND; + Ctl: TWinControl; + begin + { Note: We don't use Screen.ActiveCustomForm because when an EXE calls a + DLL that shows a modal form, Screen.ActiveCustomForm doesn't change in + the EXE; it remains set to the last form that was active in the EXE. + Use FindControl(GetActiveWindow) instead to avoid this problem; it will + return nil when a form in another module is active. } + Result := nil; + Wnd := GetActiveWindow; + if Wnd <> 0 then begin + Ctl := FindControl(Wnd); + if Assigned(Ctl) and (Ctl is TCustomForm) then + Result := TCustomForm(Ctl); + end; + end; + + function HandleShortCutOnForm(const Form: TCustomForm): Boolean; + var + I: Integer; + Toolbar: TTBCustomToolbar; + {$IFDEF CLR} + KeyMsg: TWMKey; + {$ENDIF} + begin + Result := False; + if Form = nil then + Exit; + for I := 0 to HookList.Count-1 do begin + Toolbar := TTBCustomToolbar(HookList[I]); + if Toolbar.ProcessShortCuts and + (TBGetToolWindowParentForm(Toolbar) = Form) and + IsWindowEnabled(Form.Handle) then begin + {$IFNDEF CLR} + if Toolbar.IsShortCut(TWMKey(Message)) then begin + {$ELSE} + KeyMsg := TWMKey.Create(Message); + if Toolbar.IsShortCut(KeyMsg) then begin + {$ENDIF} + Message.Result := 1; + Result := True; + Exit; + end; + end; + end; + end; + + function TraverseControls(Container: TWinControl): Boolean; + var + I: Integer; + Control: TControl; + begin + Result := False; + if Container.Showing then + for I := 0 to Container.ControlCount - 1 do begin + Control := Container.Controls[I]; + if Control.Visible and Control.Enabled then begin + if (csMenuEvents in Control.ControlStyle) and + ((Control is TTBDock) or (Control is TTBCustomToolbar)) and + (Control.Perform(WM_SYSCOMMAND, TMessage(Message).WParam, + TMessage(Message).LParam) <> 0) or (Control is TWinControl) and + TraverseControls(TWinControl(Control)) then begin + Result := True; + Exit; + end; + end; + end; + end; + +var + ActiveForm: TCustomForm; + ActiveMDIChild: TForm; +begin + Result := False; + if (Message.Msg = CM_APPKEYDOWN) and Assigned(HookList) then begin + { Process shortcuts on toolbars. Search forms in this order: + 1. If the active form is an MDI parent form, the active MDI child form + if it has the focus. + 2. The active form. + 3. The main form. } + ActiveForm := GetActiveForm; + if Assigned(ActiveForm) and (ActiveForm is TForm) and + (TForm(ActiveForm).FormStyle = fsMDIForm) then begin + ActiveMDIChild := TForm(ActiveForm).ActiveMDIChild; + { Don't search the child form if a control on the MDI parent form is + currently focused (i.e. Screen.ActiveCustomForm <> ActiveMDIChild) } + if Assigned(ActiveMDIChild) and + (Screen.ActiveCustomForm = ActiveMDIChild) and + HandleShortCutOnForm(ActiveMDIChild) then begin + Result := True; + Exit; + end; + end; + if HandleShortCutOnForm(ActiveForm) then + Result := True + else begin + if (Application.MainForm <> ActiveForm) and + HandleShortCutOnForm(Application.MainForm) then + Result := True; + end; + end + else if Message.Msg = CM_APPSYSCOMMAND then begin + { Handle "Alt or Alt+[key] pressed on secondary form" case. If there's a + menu bar on the active form we want the keypress to go to it instead of + to the main form (the VCL's default handling). } + ActiveForm := GetActiveForm; + if Assigned(ActiveForm) and IsWindowEnabled(ActiveForm.Handle) and + IsWindowVisible(ActiveForm.Handle) and TraverseControls(ActiveForm) then begin + Message.Result := 1; + Result := True; + end; + end; +end; + +procedure TTBCustomToolbar.SetMainWindowHook; +begin + if (ProcessShortCuts or MenuBar) and not(csDesigning in ComponentState) then + InstallMainWindowHook + else + UninstallMainWindowHook; +end; + +procedure TTBCustomToolbar.InstallMainWindowHook; +begin + if FMainWindowHookInstalled then + Exit; + if HookCount = 0 then + Application.HookMainWindow(MainWindowHook); + Inc(HookCount); + AddToList(HookList, Self); + FMainWindowHookInstalled := True; +end; + +procedure TTBCustomToolbar.UninstallMainWindowHook; +begin + if not FMainWindowHookInstalled then + Exit; + FMainWindowHookInstalled := False; + RemoveFromList(HookList, Self); + Dec(HookCount); + if HookCount = 0 then + Application.UnhookMainWindow(MainWindowHook); +end; + +end. diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Ver.inc b/official/2.2.2+2.4.2/TB2K/Source/TB2Ver.inc new file mode 100644 index 0000000..f96696b --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Ver.inc @@ -0,0 +1,64 @@ +{ $jrsoftware: tb2k/Source/TB2Ver.inc,v 1.11 2008/09/13 21:06:45 jr Exp $ } + +{ Determine Delphi/C++Builder version } +{$IFNDEF VER90} { if it's not Delphi 2.0 } + {$IFNDEF VER93} { and it's not C++Builder 1.0 } + {$DEFINE JR_D3} { then it must be at least Delphi 3 or C++Builder 3 } + {$IFNDEF VER100} { if it's not Delphi 3.0 } + {$IFNDEF VER120} { Delphi 4/5's command line compiler doesn't like the ObjExportAll directive, so don't include it on Delphi 4/5 } + {$IFNDEF VER130} + {$ObjExportAll On} { <- needed for compatibility with run-time packages in C++Builder 3+ } + {$ENDIF} + {$ENDIF} + {$IFNDEF VER110} { and it's not C++Builder 3.0 } + {$DEFINE JR_D4} { then it must be at least Delphi 4 or C++Builder 4 } + {$IFNDEF VER120} {$IFNDEF VER125} { if it's not Delphi 4 or C++Builder 4 } + {$DEFINE JR_D5} { then it must be at least Delphi 5 or C++Builder 5 } + {$IFNDEF VER130} { if it's not Delphi 5 or C++Builder 5 } + {$DEFINE JR_D6} { then it must be at least Delphi 6 or C++Builder 6 } + {$IFNDEF VER140} { if it's not Delphi 6 or C++Builder 6 } + {$DEFINE JR_D7} { then it must be at least Delphi 7 } + {$IFNDEF VER150} { if it's not Delphi 7 } + {$DEFINE JR_D8} { then it must be at least Delphi 8 } + {$IFNDEF VER160} { if it's not Delphi 8 } + {$DEFINE JR_D9} { then it must be at least Delphi 9 (2005) } + {$IFNDEF VER170} { if it's not Delphi 9 (2005) } + {$DEFINE JR_D10} { then it must be at least Delphi 10 (2006) } + { Delphi 11 (2007) is an odd case: it defines VER180 and VER185 on Win32, and VER190 on .NET } + {$IFDEF VER185} { if it's Win32 Delphi 11 (2007) exactly } + {$DEFINE JR_D11} { then it must be at least Delphi 11 (2007) } + {$ENDIF} + {$IFNDEF VER180} { if it's neither Delphi 10 (2006) nor Win32 Delphi 11 (2007) } + {$DEFINE JR_D11} { then it must be at least Delphi 11 (2007) } + {$IFNDEF VER190} { if it's not .NET Delphi 11 (2007) } + {$DEFINE JR_D12} { then it must be at least Delphi 12 (2009) } + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +{$IFDEF JR_D6} + {$IF SizeOf(Char) > 1} + {$DEFINE JR_WIDESTR} { defined if String type = WideString } + {$IFEND} + {$IF not Defined(CLR) and (SizeOf(Pointer) <> 4)} + {$MESSAGE WARN 'This version of Toolbar2000 has not been tested on 64-bit Delphi for Win32'} + {$IFEND} +{$ENDIF} + +{$ALIGN ON} +{$BOOLEVAL OFF} +{$LONGSTRINGS ON} +{$TYPEDADDRESS OFF} +{$WRITEABLECONST ON} +{$IFDEF JR_D6} + {$WARN SYMBOL_PLATFORM OFF} +{$ENDIF} diff --git a/official/2.2.2+2.4.2/TB2K/Source/TB2Version.pas b/official/2.2.2+2.4.2/TB2K/Source/TB2Version.pas new file mode 100644 index 0000000..f9fb9c9 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/Source/TB2Version.pas @@ -0,0 +1,63 @@ +unit TB2Version; + +{ + Toolbar2000 + Copyright (C) 1998-2008 by Jordan Russell + All rights reserved. + + The contents of this file are subject to the "Toolbar2000 License"; you may + not use or distribute this file except in compliance with the + "Toolbar2000 License". A copy of the "Toolbar2000 License" may be found in + TB2k-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/TB2k-LICENSE.txt + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License (the "GPL"), in which case the provisions of the + GPL are applicable instead of those in the "Toolbar2000 License". A copy of + the GPL may be found in GPL-LICENSE.txt or at: + http://www.jrsoftware.org/files/tb2k/GPL-LICENSE.txt + If you wish to allow use of your version of this file only under the terms of + the GPL and not to allow others to use your version of this file under the + "Toolbar2000 License", indicate your decision by deleting the provisions + above and replace them with the notice and other provisions required by the + GPL. If you do not delete the provisions above, a recipient may use your + version of this file under either the "Toolbar2000 License" or the GPL. + + $jrsoftware: tb2k/Source/TB2Version.pas,v 1.69 2008/09/13 21:39:24 jr Exp $ +} + +interface + +{$I TB2Ver.inc} + +const + Toolbar2000Version = '2.2.2'; + Toolbar2000VersionPropText = 'Toolbar2000 version ' + Toolbar2000Version + {$IFDEF CLR} + ' (.NET)' {$ENDIF}; + +type + TToolbar2000Version = type string; + +implementation + +const + Sig: {$IFNDEF CLR} PAnsiChar {$ELSE} AnsiString {$ENDIF} = + '- ' + Toolbar2000VersionPropText + + {$IFDEF VER90} '/D2'+ {$ENDIF} {$IFDEF VER93} '/CB1'+ {$ENDIF} + {$IFDEF VER100} '/D3'+ {$ENDIF} {$IFDEF VER110} '/CB3'+ {$ENDIF} + {$IFDEF VER120} '/D4'+ {$ENDIF} {$IFDEF VER125} '/CB4'+ {$ENDIF} + {$IFNDEF BCB} {$IFDEF VER130} '/D5'+ {$ENDIF} {$ELSE} {$IFDEF VER130} '/CB5'+ {$ENDIF} {$ENDIF} + {$IFNDEF BCB} {$IFDEF VER140} '/D6'+ {$ENDIF} {$ELSE} {$IFDEF VER140} '/CB6'+ {$ENDIF} {$ENDIF} + {$IFNDEF BCB} {$IFDEF VER150} '/D7'+ {$ENDIF} {$ELSE} {$IFDEF VER150} '/CB7'+ {$ENDIF} {$ENDIF} + {$IFNDEF BCB} {$IFDEF VER170} '/D9'+ {$ENDIF} {$ELSE} {$IFDEF VER170} '/CB9'+ {$ENDIF} {$ENDIF} + {$IFNDEF VER185} {$IFNDEF BCB} {$IFDEF VER180} '/D10'+ {$ENDIF} {$ELSE} {$IFDEF VER180} '/CB10'+ {$ENDIF} {$ENDIF} {$ENDIF} + {$IFNDEF BCB} {$IFDEF VER185} '/D11'+ {$ENDIF} {$ELSE} {$IFDEF VER185} '/CB11'+ {$ENDIF} {$ENDIF} + {$IFNDEF BCB} {$IFDEF VER190} '/D11'+ {$ENDIF} {$ELSE} {$IFDEF VER190} '/CB11'+ {$ENDIF} {$ENDIF} + {$IFNDEF BCB} {$IFDEF VER200} '/D12'+ {$ENDIF} {$ELSE} {$IFDEF VER200} '/CB12'+ {$ENDIF} {$ENDIF} + ', Copyright (C) 1998-2008 by Jordan Russell -'; + +{$IFNDEF CLR} +initialization + Sig := Sig; +{$ENDIF} +end. diff --git a/official/2.2.2+2.4.2/TB2K/TB2k-LICENSE.txt b/official/2.2.2+2.4.2/TB2K/TB2k-LICENSE.txt new file mode 100644 index 0000000..47984b4 --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/TB2k-LICENSE.txt @@ -0,0 +1,61 @@ +Toolbar2000 License v3.2 +======================== + +"Author" herein refers to Jordan Russell (the creator of the Toolbar2000 +components). +"Software" refers to all files bearing this notice, as well as any other +files and source code included with Toolbar2000 (typically extracted from a +.zip archive), and all content in them, regardless of whether any +modifications have been made. + +Except where otherwise noted, all of the documentation and Software included +in the Toolbar2000 package is copyrighted by Jordan Russell (the Author). + +Copyright (C) 1998-2008 Jordan Russell. All rights reserved. + +Use and distribution of the software is permitted provided that all of the +following terms are accepted: + +1. The Software is provided "as-is," without any express or implied + warranty. In no event shall the Author be held liable for any damages + arising from the use of the Software. + +2. All redistributions of the Software's files must be in their original, + unmodified form. Distributions of modified versions of the files is not + permitted without express written permission of the Author. + +3. All redistributions of the Software's files must retain all copyright + notices and web site addresses that are currently in place, and must + include this list of conditions without modification. + +4. None of the Software's files may be redistributed for profit or as part + of another software package without express written permission of the + Author. + +5. You are permitted to Compile the Software into any kind of applications. + ("Compile" here refers to the automatic process of translating the + Software's source code into executable machine code by a compiler such + as the one included with Borland's Delphi or C++Builder.) + However, compilation into commercial or shareware applications, or any + applications that you or your organization are profiting from, requires + registration (payment) of the software. Such payment is made to the Author + of the Software (Jordan Russell). + For information on registering, see the Toolbar2000 documentation or this + web page: + http://www.jrsoftware.org/tb2kreg.php + +6. Redistribution of any of the Software's files in object form (including + but not limited to .DCU and .OBJ formats) is strictly prohibited without + express written permission of the Author. + +7. Full backward compatibility in future versions of the Software is not + guaranteed. In no event shall the Author be held liable for any + inconvenience or damages arising from lack of backward compatibility. + +If you do not agree to all of the above terms, you are not permitted to +use the Software in any way, and all copies of it must be deleted from your +system(s). + +Jordan Russell +jr-2008 AT jrsoftware.org +http://www.jrsoftware.org/ diff --git a/official/2.2.2+2.4.2/TB2K/tb2k.chm b/official/2.2.2+2.4.2/TB2K/tb2k.chm new file mode 100644 index 0000000..fb55b18 Binary files /dev/null and b/official/2.2.2+2.4.2/TB2K/tb2k.chm differ diff --git a/official/2.2.2+2.4.2/TB2K/whatsnew.htm b/official/2.2.2+2.4.2/TB2K/whatsnew.htm new file mode 100644 index 0000000..1a15e9d --- /dev/null +++ b/official/2.2.2+2.4.2/TB2K/whatsnew.htm @@ -0,0 +1,419 @@ + + + +Toolbar2000 Revision History + + + + + + + +
Toolbar2000
Revision History
+ +

Copyright © 1998-2008 Jordan Russell. All rights reserved.
+For conditions of distribution and use, see LICENSE.txt. +

+ +

2.2.2 (2008-09-25)

+
    +
  • Added support for Delphi 2009, C++Builder 2009, and Delphi 2007 on .NET.
  • +
  • Fix: When the Caption of a toolbar item was changed to a new value with the same dimensions as the old value, it didn't enable double-buffering when redrawing the toolbar, resulting in some flicker.
  • +
  • Fix: A MenuBar=False toolbar would inappropriately continue to respond to accelerator keys after Visible or Enabled was changed to False on one of its parents.
  • +
  • Fix: When an Adobe Reader control inside a TWebBrowser was focused, menus would not respond to keystrokes.
  • +
  • Internal tweaks and trivial fixes.
  • +
+ +

2.2.1 (2007-06-23)

+
    +
  • Packages for Delphi 2007 (Win32) are now included. (Currently they are identical to the existing Delphi 2006 packages; only the filenames have changed.)
  • +
  • Menu sounds: On Windows Vista, it now passes the SND_SYSTEM flag when calling PlaySound so that the volume is controlled by the "Windows Sounds" mixer control. Also, on all NT platforms, for consistency with native menus it no longer passes the SND_NOSTOP flag.
  • +
  • TTBEditItem: Published the InheritOptions, MaskOptions, and Options properties.
  • +
  • Improved painting performance on toolbars with hundreds or thousands of visible items.
  • +
  • Fix: Added workaround for bug in Windows Vista's DrawCaption API that caused the title bar text on floating toolbars to be drawn at the wrong coordinates when the Aero Glass theme was selected.
  • +
  • Fix: In version 2.2.0 on Delphi 4 and 5 only, an access violation would occur when the focus left a TTBEditItem. This was due to a code generation bug in the Delphi compiler.
  • +
  • Fix: Eliminated small memory leak when toolbars were dragged between docks on different forms (which, by default, isn't allowed).
  • +
  • Fix: On Windows 95/98/Me, right-clicking a floating toolbar's title bar would not display the toolbar's context menu.
  • +
  • Fix: If Toolbar2000 was built with range checking enabled (by default, this compiler option is disabled), it was possible to receive a range check error when navigating nested submenus with the mouse.
  • +
  • Internal tweaks and trivial fixes.
  • +
+ +

2.2.0 (2006-04-17)

+
    +
  • Toolbar2000 now supports VCL.NET projects on Delphi 2006. The behavior of Toolbar2000 under .NET should be 100% consistent with Win32; no changes are required to existing forms and code.
    +Refer to the Support for .NET topic in the help file for more information.
  • +
  • Added new overloaded versions of the TBIniLoadPositions and TBIniSavePositions functions that take already-instantiated TCustomIniFile's.
  • +
  • On Windows 2000 and later, it now uses Tahoma as the font on vertical toolbars when the system menu font is set to Microsoft Sans Serif. It had previously used Arial, but its Unicode coverage was found to be lacking (which matters on .NET, where strings are Unicode).
  • +
  • Fix: Items on floating MenuBar=False toolbars could not be accessed with Alt+[key].
  • +
  • Numerous internal tweaks and trivial fixes.
  • +
+ +
+ +

2.1.8 (2006-01-09)

+
    +
  • Updated the Delphi 2006 package to support C++Builder 2006 as well, and added installation instructions for C++Builder 2006 to the documentation.
  • +
  • For correctness, changed the "usage" setting on the run-time packages from "Designtime and runtime" to "Runtime only".
  • +
  • Enabled compiler optimization on the C++Builder packages. It was inadvertently disabled before; packages created in C++Builder have Pascal optimization turned off by default, and I didn't notice this until now.
  • +
  • Fix: The TB2Common unit wouldn't compile on Delphi 4.
  • +
+ +

2.1.7 (2005-12-17)

+
    +
  • Packages for Delphi 2006 are now included.
  • +
  • Improved performance of the design-time item editor, and fixed the Delphi 2005 issue where the Object Inspector would go back to the Name property each time a new item was added.
  • +
  • When loading/saving positions, it now silently ignores toolbars with no name (Name='') instead of raising an exception.
  • +
+ +

2.1.6 (2005-07-30)

+
    +
  • The captions of floating toolbars are now grayed when their parent forms are inactive (e.g., when a modal dialog is up).
  • +
  • Replaced various global "var"s with "threadvar"s to improve thread safety when Toolbar2000 is used in a browser-embedded ActiveForm. (Note that this can never be 100% safe because the VCL itself has some thread safety issues.)
  • +
  • Fix: When running on an Athlon 64 CPU with the Cool'n'Quiet feature enabled, menus animated at approximately half the expected speed when the CPU utilization was low. (Previously, it used QueryPerformanceCounter to time the animation, but with Cool'n'Quiet enabled, the rate at which the performance counter increments actually varies depending on the current CPU clock frequency. Now it uses GetTickCount instead.)
  • +
  • Fix: In the Delphi 2005 IDE, toolbar editor forms could fall behind the IDE's main form.
  • +
  • Fix: When an EXE contained a Toolbar2000 menu bar, and a modal Delphi form hosted in a DLL was currently active, pressing Alt would open the menu bar in the EXE even though the form containing the menu bar was disabled/inactive.
  • +
  • Fix: Fixed MSAA bug reported in "Accessibility issue with Window-Eyes" thread on newsgroup 2005-06-21.
  • +
  • Internal tweaks and trivial fixes.
  • +
+ +

2.1.5 (2004-12-13)

+
    +
  • Packages for Delphi 2005 are now included.
  • +
  • Added new RadioItem property to TTBCustomItem and descendants. Like the property of the same name on TMenuItem, it causes the item to display a circle instead of a check mark when the item is checked and no other image has been specified.
  • +
  • Like standard menus, it now prevents other applications from stealing the focus while a menu is open. This should make it fully compatible with Tweak UI's X-Mouse option.
  • +
  • If the application displays a modal dialog of its own while a menu is open, the menu will now be hidden.
  • +
  • TTBCustomDockableWindow and descendants: Made Canvas a public property.
  • +
  • Fix "ImageIndex on toolbutton incorrectly overriden by action's imageindex" issue reported on newsgroup 2004-09-02 by Anthony Egerton.
    +(Note: The problem described in the thread isn't Toolbar2000 specific. Standard menus and controls will continue to exhibit the same problem.)
  • +
  • TMainMenu/TPopupMenu converter: Now additionally transfers the AutoCheck, GroupIndex, and RadioItem properties.
  • +
  • Internal tweaks.
  • +
+ +

2.1.4 (2004-02-28)

+
    +
  • Toolbar2000 may now alternatively, at your option, be used and/or distributed under the terms of the GNU General Public License. Please see the updated LICENSE.txt file for more information on the two licensing options.
    +Note that if you choose the GPL license option, your application as a whole must also be licensed under the GPL. Therefore, you cannot choose the GPL license option if your application is proprietary/closed-source.
  • +
  • Reworded point 5 of the Toolbar2000 License for clarity.
  • +
  • Added new ChevronPriorityForNewItems property to TTBToolbar.
  • +
+ +

2.1.3 (2003-11-23)

+
    +
  • Added new tboNoAutoHint value to the Options property. When set, the automatic hint generation feature (introduced in 2.1.1) will be disabled.
  • +
  • On Windows NT/2000/XP, use SetWindowsHookExW instead of SetWindowsHookEx to work around apparent OS bug reported on the newsgroup by George Kyrou 2003-09-23.
  • +
  • Tweak to HookProc in TB2Toolbar.pas to avoid ANSI/Unicode character set issue with hooks on Windows NT/2000/XP.
  • +
  • Fix: When a TTBEditItem was focused, it didn't inherit the font settings from the parent toolbar.
  • +
+ +

2.1.2 (2003-08-10)

+
    +
  • It's now possible to nest "group" items such as TTBGroupItem. Previously, placing one group item inside another did not work.
  • +
  • Tweaked the automatic hint generation introduced in the last version: It now will not generate hints for submenu items unless the submenu item has the DropdownCombo property set to True or the submenu item has no visible caption.
  • +
  • TTBControlItem is no longer explicitly registered. There is a slim chance that this change may affect you if your application initially used one of the very early Toolbar2000 betas. In those early betas, Toolbar2000 did not assign to the Name property of TTBControlItem components it created. If you have unnamed TTBControlItem components on your forms, you must now assign them names, otherwise you might receive a "class not found" error message when running your application.
  • +
  • Fix: TTBEditItem would lose the focus when Alt+[keypad digit] was pressed.
  • +
  • Internal tweaks.
  • +
+ +

2.1.1-beta (2003-07-13)

+
    +
  • Now automatically supplies short hints for items with no short hint assigned to the Hint property. The hint is derived from the item's caption, with accelerator keys and any trailing colon or ellipsis stripped.
  • +
  • Shortcut text is now displayed in the hints of items that don't have associated Actions.
  • +
  • Fix: In TTBMRUList, "&" characters in filenames weren't escaped when assigning item captions.
  • +
  • MSAA-related tweaks: +
      +
    • Escape any "&" characters when assigning text to chevron item's Caption property.
    • +
    • Work around bug in Delphi/C++Builder 4's ShortCutToText function.
    • +
    +
  • +
  • Internal tweaks.
  • +
+ +

2.1.0-beta (2003-07-05)

+
    +
  • Microsoft Active Accessibility support for Toolbar2000's menus and toolbars. This exclusive feature will make your application's user interface more accessible to users who rely on screen readers. For more details, see the MSAA Support topic in the help file.
  • +
  • When new items are inserted programmatically at run-time, they are now placed at the top of the "priority list" instead of at the bottom. This means that new items will now be the last to move onto the chevron menu when all items can't fit on the toolbar.
  • +
  • On popup menus, accelerator keys are now properly hidden if the last input came from the mouse.
  • +
  • On TTBMDIButtonsItem, the biMinimize setting of BorderIcons on MDI child forms is now respected.
  • +
  • As a performance optimization, the default image base of the Delphi design and run-time packages have been changed from $400000 to $3F800000 and $3FC00000 respectively.
    +(The C++Builder packages remain at $400000 due to a design flaw in the C++Builder linker: it strips the image's relocation table whenever the base address is changed from $400000. DLLs must have relocation tables in order to load properly in all cases.)
  • +
  • Fix: When a top-level DropdownCombo=True submenu item is selected using Alt+[accelerator key] the item is now clicked instead of opened.
  • +
  • Fix: When F1 was pressed on a menu item and Toolbar2000 handled it, a WM_HELP message would still reach the parent form.
  • +
  • Fix: A focused TTBEditItem would lose the focus when Alt+Shift was pressed.
  • +
  • Many internal changes, most of them necessary for supporting MSAA as cleanly as possible.
  • +
+ +
+ +

2.0.16 (2003-03-28)

+
    +
  • Added new tboSameWidth value to the Options property. When set along with tboImageAboveCaption on two or more items on the same view, the items will be stretched as necessary so that they all have the width in pixels.
  • +
  • Added ChevronMoveItems property to TTBToolbar. Normally, when an item on a toolbar's chevron popup menu is clicked, the clicked item will move into the visible area of the toolbar in place of the least recently clicked item. Setting this property to False will disable that behavior.
  • +
  • TTBCustomItem.Click now checks the Enabled property before calling any event handlers, like TMenuItem.Click does.
  • +
  • TTBPopupMenu.Popup now sets the PopupPoint property.
  • +
  • Published OnContextPopup event properties on TTBDock, TTBToolbar, and TTBToolWindow.
  • +
  • Fixed issues with Russian characters as accelerator keys on Windows NT/2000/XP.
  • +
  • Internal tweaks and trivial fixes.
  • +
+ +

2.0.15 (2002-09-29)

+
    +
  • Packages for Delphi 7 are now included.
  • +
  • Revised the Toolbar2000 License Agreement.
  • +
  • TTBMRUList: Added new Remove method.
    +TTBMRUListStrings: IndexOf method now uses AnsiCompareFileName instead of AnsiCompareText.
  • +
  • Fix: The issue reported in the "Problem with tb2k in Com Server/ActiveX" thread on the newsgroup has been fixed.
  • +
  • Internal tweaks and trivial fixes.
  • +
+ +

2.0.14 (2002-05-10)

+
    +
  • Added new tboNoRotation value to Options property. When set, the item and its caption will not be rotated 270 degrees when docked vertically.
  • +
  • Added Move Up and Move Down commands to the design-time editor to make it easier to move items.
  • +
  • Chevron popup windows now wrap if they are too wide to fit on the screen.
  • +
  • A toolbar's LastDock property is no longer updated when the toolbar is dragged over but not dropped on a dock.
  • +
  • When arranging toolbars on a dock, row numbers that contain only invisible or undocked toolbars are no longer removed. This way, when the toolbars are shown/docked again, they stay on their row. This was how Toolbar97 worked.
  • +
  • A toolbar's DockRow and DockPos properties got updated if you dragged the toolbar over a dock but didn't drop it on the dock. Now it restores the original DockRow and DockPos settings when a toolbar is not dropped on a dock.
  • +
  • Fix: When arranging toolbars on a dock, there was a case where LimitToOneRow wasn't being checked.
  • +
  • Internal tweaks.
  • +
+ +

2.0.13 (2002-04-06)

+
    +
  • New item class: TTBVisibilityToggleItem. This item class controls the Visible property of a control, such as a TTBToolbar.
  • +
  • On menus, it now uses clGrayText to draw disabled text when the menu background color doesn't equal clBtnFace. (That is how standard menus work.)
  • +
  • On vertically docked toolbars, it now uses a vertical font if one is available so that Asian characters aren't drawn sideways.
  • +
  • Now, if at design time you double click a TTBToolbar or TTBPopupMenu that has its LinkSubitems property assigned, it asks if you want to edit the item specified by LinkSubitems instead.
  • +
  • TTBEditItem: The outermost border is now transparent when the item is not selected.
  • +
  • In the functions that load toolbar positions, it now compares the dock names with case insensitivity.
  • +
  • Added new demo project file for C++Builder 6 - DemoBCB6 - because DemoBCB doesn't seem to compile under C++Builder 6.
  • +
  • Internal tweaks.
  • +
+ +

2.0.12 (2002-03-06)

+
    +
  • Menus now display scroll arrows when they are too tall to fit on the screen.
  • +
  • Packages for C++Builder 6 are now included.
  • +
  • Minor tweaks and documentation updates.
  • +
+ +

2.0.11 (2002-02-23)

+
    +
  • Fix: The new Stretch property introduced in 2.0.10 had some bugs.
  • +
+ +

2.0.10 (2002-02-13)

+
    +
  • Added new Stretch property to TTBToolWindow and TTBToolbar. When True, the toolbar, when docked, will stretch to fill any unused space on the row.
  • +
  • On TTBToolbar, chevrons now display a "More Buttons" hint, like Office 2000. The hint text can be customized by changing the new ChevronHint property, or globally by changing STBChevronItemMoreButtonsHint in TB2Consts.pas.
  • +
  • The OnMove event of TTBToolbar/TTBToolWindow now gets fired when the bar is floating also.
  • +
  • Fix: TTBPopupMenu.OnPopup was being called twice when the popup was displayed - once with the TTBPopupMenu as the Sender, and once with the internal TTBRootItem as the Sender. Now, it's called only once with the TTBPopupMenu as the Sender.
  • +
  • Fix: TTBEditItem: Fixed double-click issue ("TB2k Strange Behaviour").
  • +
  • Internal tweaks.
  • +
+ +

2.0.9 (2002-01-11)

+
    +
  • Added new TTBImageList component. It is an enhanced version of the standard TImageList component, designed for use with the Toolbar2000 components. It adds the ability to use special images for different item states (hot, disabled, checked). It also adds the ability to load the images from a bitmap instead of using TImageList's normal streaming mechanism, which has problems with older COMCTL32.DLL versions.
  • +
  • Added new OnSelect property to TTBCustomItem and descendants. This event lets you trap when the mouse enters or leaves an item.
  • +
  • Added new CharCase and OnBeginEdit properties to TTBEditItem.
  • +
  • Added C++Builder version of the Demo project - DemoBCB.
  • +
  • Minor tweaks and fixes.
  • +
+ +

2.0.8 (2001-12-27)

+
    +
  • Now supports "flat" menu borders on Windows XP.
  • +
  • The background of a selected menu item's image is now filled with clBtnFace. This seems to look better with Windows XP's white menus.
  • +
  • Made chevron popups colored clBtnFace instead of clMenu. This seems to look better on Windows XP with themes enabled.
  • +
  • Fix: Fixed "stack overflow" problem that may have occurred if you had a floating TTBToolWindow and pressed Alt on the keyboard.
  • +
  • Fix: On Delphi 6 the ActionComponent property of an action now gets set properly when the action is fired from a TB2k item.
  • +
  • Removed some Windows NT 3.51 support code since NT 3.51 is now officially unsupported.
  • +
+ +

2.0.7 (2001-12-19)

+
    +
  • Menus now display drop-shadows on Windows XP if they are enabled in the Display Properties.
  • +
  • When a menu is up, keystrokes will no longer get processed by an IME if one was active.
    +Note: The ImmGetVirtualKey function is used, which is not available on Windows NT 3.51. Therefore, NT 3.51 is now officially unsupported. (It never was officially supported anyway.)
  • +
  • TTBToolbar: Added new published FloatingWidth property.
  • +
  • Fix: Accessing menu bars on non-main forms with the keyboard should now work.
  • +
  • Minor fixes.
  • +
+ +

2.0.6 (2001-11-14)

+
    +
  • When a shortcut key is pressed, it now sends OnPopup/OnClick events to the selected item's parents so that they can update the Enabled state of the item if needed.
  • +
  • The OnPopup event of TTBPopupMenu is now fired when one of its items' shortcut keys is pressed.
  • +
  • TTBPopupMenu now processes shortcuts.
  • +
  • Added OnUpdate event to TTBMDIWindowItem.
  • +
  • Minor fixes.
  • +
+ +

2.0.5 (2001-10-09)

+
    +
  • Toolbars that are neither docked nor floating can now wrap or display a chevron (ShrinkMode is no longer ignored). For it to work, you must do at least one of the following: set AutoResize to False, set Align to one of [alTop, alBottom, alClient], or add [akLeft, akRight] to Anchors (which is now a published property).
  • +
  • TTBToolWindow: Published the Align and Anchors properties.
  • +
  • Now allows F1 to be handled while the mouse button is down (an odd quirk of standard menus).
  • +
  • Now always streams out the Width & Height properties of a toolbar that is neither docked nor floating. Needed to properly support anchored toolbars.
  • +
  • Fix: Fixed a GDI resource leak in TB2Item that occurred on Windows 9x/Me due to an undocumented difference/bug in the way SaveDC works.
  • +
  • Fix: Fixed resource leak with TTBMDIHandler: it was trying to free an icon handle with DeleteObject instead of DestroyIcon.
  • +
  • Fix: Made TTBPopupWindow a TCustomControl descendant instead of a TForm descendant. This resolves the issue with the Application window's taskbar button reappearing after the program initially hid it.
  • +
  • Fix: When destroying a toolbar on a dock that had another toolbar on the same dock linked to one of the destroying toolbar's subitems, an AV may have occurred.
  • +
  • Fix: Fixed problem in TTBView.GivePriority.
  • +
+ +

2.0.4 (2001-09-30)

+
    +
  • Added new tboImageAboveCaption value to Options property. When set, the item's caption will be displayed underneath its image, making for an Internet Explorer-like appearance.
  • +
  • Added Options property to TTBPopupMenu.
  • +
  • Fix: It was possible to "click" disabled top-level items by pressing Alt+[accelchar].
  • +
  • Fix: Shortcut keys now work on toolbars that are on frames.
  • +
  • Fixed issue with TActiveForms: OnClick events were always executed in the context of the first thread.
  • +
  • Minor tweaks.
  • +
+ +

2.0.3 (2001-09-13)

+
    +
  • Added AutoCheck property to TTBCustomItem and descendants.
  • +
  • Added Prefix property to TTBMRUList.
  • +
  • Added Enabled property to TTBMDIWindowItem.
  • +
  • Published GroupIndex property on TTBSubmenuItem and TTBEditItem.
  • +
  • TTBView's Selected property is now writable.
  • +
  • Fix: Sealed minor memory leak that occurred when when a TTBMDIHandler component was created, or when the LinkSubItems property of a toolbar was changed.
  • +
  • Fix: Modifying a TTBBackground's bitmap after a dock that used the background was destroyed may have caused an AV.
  • +
  • Fix: Alt+- didn't work unless the two keys were pressed simultaneously.
  • +
  • Fix: Shortcuts didn't work if TTBToolbar.LinkSubitems was set.
  • +
  • Fix: MDI buttons didn't show when FullSize=False and ShrinkMode=tbsmWrap.
  • +
  • Fix: Unwrapped floating toolbars were a pixel too high.
  • +
  • Fix: Hopefully fixed Delphi 6 AV with design-time editor again.
  • +
+ +

2.0.2 (2001-08-19)

+
    +
  • Added new component: TTBMDIHandler, which adds the MDI system menu and minimize/restore/close buttons to a menu bar. See the documentation for details.
  • +
  • Added new item type: TTBMDIWindowItem, which expands to a list of available MDI child windows at run-time. This is intended to be placed at the end of an MDI application's Window menu, following a separator.
  • +
  • The design-time menu converter can now convert TPopupMenu's too.
  • +
  • The Alignment property of TTBPopupMenu is now respected. Also added optional Alignment parameter to the TTBCustomItem.Popup method.
  • +
  • Added TTBCustomItem.Clear method.
  • +
  • Now respects the system's "menu drop alignment" setting when dropping down menus.
  • +
  • Pressing Home or End on a toolbar or menu now moves the selection to the first or last item.
  • +
  • Fix: TTBToolWindow's that had their FullSize properties set to True weren't the correct size when undocked.
  • +
  • Fix: Now doesn't attempt to draw or invalidate TTBControlItem's. Fixes issue with Transparent=True TLabel's.
  • +
  • Fix: Now doesn't display the size-all cursor on DragHandle=dhNone toolbars.
  • +
  • Fix: The keyboard shortcuts for Cut/Copy/Paste in the design-time editor now work again.
  • +
  • Some minor internal tweaks.
  • +
+ +

2.0.1 (2001-08-04)

+
    +
  • Added slide/fade animation support. It is enabled automatically if the user has menu animation enabled in Windows.
  • +
  • On vertical toolbars, the tboDropdownArrow arrows are now drawn rotated and below the text.
  • +
  • Fix: When you have ProcessShortCuts=True toolbars on multiple forms, it now first looks for shortcuts on the active form's toolbars, and then the main form's toolbars. Previously, it looked on all forms' toolbars.
  • +
  • Fix: It wasn't loading item icons correctly after design-time code was moved to the tb2kdsgn package.
  • +
  • Fix: Setting EditOptions on TTBEditAction had no effect.
  • +
  • Some minor internal tweaks.
  • +
+ +

2.0.0 (2001-07-21)

+
    +
  • Revised the Toolbar2000 License Agreement.
  • +
  • Moved design-time units to separate tb2kdsgn_* packages so that tb2k_* may now be used as run-time packages.
  • +
  • Tweaked the component icons.
  • +
+ +
+ +

Beta Releases

+ +

2.0-BETA6 (2001-07-18)

+
    +
  • TTBMRUList: Added AddFullPath and HidePathExtension properties. Both are True by default. See documentation for details.
  • +
  • TTBMRUList: Added OnChange event.
  • +
  • Typing or pressing Enter on the design-time editor's tree view now activates the Object Inspector.
  • +
  • Fix: On Delphi 6, the ShortCut property of TTBCustomItem was showing up like an Integer property in Object Inspector, thanks to some change Borland made. Workaround added.
  • +
  • Fix: Removed call in design-time editor that appeared to cause AV's in certain cases.
  • +
+ +

2.0-BETA5 (2001-07-09)

+
    +
  • Now works around the Windows 2000 problem of delaying on the first PlaySound call by not calling PlaySound at all if there is no sound associated with the event.
  • +
  • Added LoadFromIni, LoadFromRegIni, SaveToIni, SaveToRegIni methods to TTBMRUList.
  • +
  • Updated documentation; added an index.
  • +
  • Updated demo project.
  • +
  • Fix: The change to the Click handling in 2.0-BETA4 broke exception handling.
  • +
  • Fix: The OnResize event was never fired.
  • +
  • A few very minor fixes and tweaks.
  • +
+ +

2.0-BETA4 (2001-07-01)

+
    +
  • Added UpdateActions property to TTBToolbar. Setting it to False can decrease CPU utilization. See the documentation for details.
  • +
  • Now, as with standard menus, when an item is clicked it posts a message to the queue so that the Click handler gets called when control returns to the message loop. This fixes the problem with modal forms not correctly getting the focus when an item is selected from a menu with the keyboard.
  • +
  • Fixed potential AV problem when Escape was pressed.
  • +
  • Improvements to design-time editor: +
      +
    • There's now an empty item at the end of the item list, similar to Delphi's menu editor. You can't (currently) type on this item item, but you can select it and press Insert to add a new item to the end.
    • +
    • You can now hold down Shift while pressing Insert or clicking one of the New buttons to add an item to the end instead of inserting it before the currently selected item.
    • +
    • Added keyboard shortcuts for New Subitem and New Separator.
    • +
    • Now selects root item when list view is focused and no item is selected.
    • +
    • After deleting the items, it now selects the item with the focus.
    • +
    +
  • +
+ +

2.0-BETA3 (2001-06-25)

+
    +
  • Context help (F1) is now supported on menu items.
  • +
  • Added a GroupIndex property to TTBCustomItem due to popular demand. See documentation for details on how it works.
  • +
  • Added a new ImageIndex property editor which is fully compatible with Delphi 6.
  • +
  • It now substitutes Arial for MS Sans Serif & Microsoft Sans Serif when drawing vertical text, instead of letting Windows pick a font.
  • +
  • Remarked out code in TTBDock.ArrangeToolbars that was there to work around a VCL alignment bug*, because it had some undesirable side effects. Now, if you want to avoid the bug, you need to right-click your alClient-aligned controls in the form designer and select "Send to Back." +
    * The VCL alignment bug: if a control is taller or wider than the client height or width of its parent, alClient-aligned controls may appear on top of the control, instead of being hidden from view.
  • +
  • Fix: When toolbars are dragged across a dock that has a background bitmap, they should no longer flicker.
  • +
  • Fix: The menu converter now transfers the Tag property.
  • +
  • Fix: The toolbar-dragging changes in 2.0-BETA2 broke the splitter.
  • +
  • Fix: Work around an annoying Windows or VCL bug. (If you close all MDI child windows, the MDI client window gets the focus, and when it has the focus, pressing Alt+[char] doesn't send a WM_SYSCOMMAND message to the form for some reason.)
  • +
  • Fix: In the design-time item editor, when a new item is created while the tree view has the focus, it now sets the focus to the list view so that the item becomes selected in Object Inspector.
  • +
  • Fix: On TTBDock, LimitToOneRow=True didn't actually limit to one row while dragging.
  • +
  • Various other minor tweaks and fixes.
  • +
+ +

2.0-BETA2 (2001-06-18)

+
    +
  • Delphi 6 is now supported. There is one limitation however: the ImageIndex property editor used by TTBCustomItem descendants had to be disabled because TComponentImageIndexPropertyEditor is gone in Delphi 6! Therefore, on Delphi 6, the dropdown lists of ImageIndex properties may not work correctly, at least for now.
  • +
  • Text on vertical toolbars is now drawn vertically!
  • +
  • Vastly improved the code that handles toolbar dragging. Previously, when you dragged a SmoothDrag=True docked toolbar over other docked toolbars, the toolbar may not have ended up on the row you were expecting. This was because the old code - ported from Toolbar97 - was not designed with smooth dragging in mind. Now it should function almost exactly like Office 2000.
  • +
  • TTBEditItem (and friends): Removed DisplayAsButton property; replaced with EditOptions property. Now, by default, edits on toolbars will automatically change into buttons when the toolbar is docked vertically. Add tboUseEditWhenVertical to EditOptions to disable this.
  • +
  • On wrapped toolbars, menus now pop out to the side which obscures the least amount of items, like Office 2000.
  • +
  • Up/Down/Left/Right arrow keys on vertical toolbars now work like Office 2000.
  • +
  • Fix: Hints on chevron popup's items didn't include shortcuts.
  • +
  • Fix: Deleting an item from a TTBMRUList via Items.Delete() did not refresh the keyboard shortcuts.
  • +
  • Fix: Fixed "Run-time creation of items and chevron" problem reported by Francois Rivierre.
  • +
  • Some very minor tweaks.
  • +
+ +

2.0-BETA1 (2001-06-12)

+
    +
  • Updated the Toolbar2000 License Agreement.
  • +
  • You can now display the version of Toolbar2000 by right-clicking a toolbar and selecting "Version".
  • +
  • Added an improved Demo project.
  • +
  • Made the margins of menu items a bit more like Office and standard menus.
  • +
  • Now includes size of a font's external leading when calculating an menu item's height.
  • +
  • Added workaround an apparent NT 4.0 & 2000 bug that was causing the right side of floating toolbars' non-client area to be painted incorrectly if the toolbar's width was greater than the screen width.
  • +
  • Various tweaks to the display of disabled toolbar & menu items.
  • +
+ + +