Initial commit: Complete open-source Decal rebuild

All 5 phases of the open-source Decal rebuild:

Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil)
Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs
  - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters
  - Decal.Core, DecalControls, DecalRender, D3DService
Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL
Phase 4: DenAgent WinForms tray application
Phase 5: WiX installer and build script

25 C# projects building with 0 errors.
Native C++ projects require VS 2022 + Windows SDK (x86).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erik 2026-02-08 18:27:56 +01:00
commit d1442e3747
1382 changed files with 170725 additions and 0 deletions

8
Native/CMakeLists.txt Normal file
View file

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.20)
project(DecalNative LANGUAGES CXX)
# Both DLLs must be built as x86 (32-bit)
# Usage: cmake -G "Visual Studio 17 2022" -A Win32 ..
add_subdirectory(InjectModern)
add_subdirectory(LauncherHookModern)

173
Native/Decal.dsw Normal file
View file

@ -0,0 +1,173 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Decal"=.\Decal\Decal.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "DecalControls"=.\DecalControls\DecalControls.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Inject
End Project Dependency
}}}
###############################################################################
Project: "DecalDat"=.\DecalDat\DecalDat.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Decal
End Project Dependency
}}}
###############################################################################
Project: "DecalFilters"=.\DecalFilters\DecalFilters.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name DecalNet
End Project Dependency
Begin Project Dependency
Project_Dep_Name DecalDat
End Project Dependency
}}}
###############################################################################
Project: "DecalInput"=.\DecalInput\DecalInput.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Decal
End Project Dependency
}}}
###############################################################################
Project: "DecalNet"=.\DecalNet\DecalNet.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Decal
End Project Dependency
}}}
###############################################################################
Project: "DenAgent"=.\DenAgent\DenAgent.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name DecalControls
End Project Dependency
Begin Project Dependency
Project_Dep_Name DecalFilters
End Project Dependency
Begin Project Dependency
Project_Dep_Name Inject
End Project Dependency
Begin Project Dependency
Project_Dep_Name Decal
End Project Dependency
Begin Project Dependency
Project_Dep_Name DecalDat
End Project Dependency
Begin Project Dependency
Project_Dep_Name DecalInput
End Project Dependency
Begin Project Dependency
Project_Dep_Name DecalNet
End Project Dependency
Begin Project Dependency
Project_Dep_Name PlainText
End Project Dependency
}}}
###############################################################################
Project: "Inject"=.\Inject\Inject.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Decal
End Project Dependency
}}}
###############################################################################
Project: "PlainText"=.\PlainText\PlainText.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Decal
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

210
Native/Decal.sln Normal file
View file

@ -0,0 +1,210 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Decal", "Decal\Decal.vcproj", "{FF9AA982-5BE3-460A-9AAE-913C02E9C184}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DecalControls", "DecalControls\DecalControls.vcproj", "{6B9C5380-3B50-4E72-B604-5089CB64B644}"
ProjectSection(ProjectDependencies) = postProject
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A} = {ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DecalDat", "DecalDat\DecalDat.vcproj", "{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}"
ProjectSection(ProjectDependencies) = postProject
{FF9AA982-5BE3-460A-9AAE-913C02E9C184} = {FF9AA982-5BE3-460A-9AAE-913C02E9C184}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DecalFilters", "DecalFilters\DecalFilters.vcproj", "{06884D36-8C17-46BF-8BA5-2466E97FB605}"
ProjectSection(ProjectDependencies) = postProject
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A} = {B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790} = {C1CC01C2-D2C7-4862-A143-14BCF1BE9790}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DecalInput", "DecalInput\DecalInput.vcproj", "{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}"
ProjectSection(ProjectDependencies) = postProject
{FF9AA982-5BE3-460A-9AAE-913C02E9C184} = {FF9AA982-5BE3-460A-9AAE-913C02E9C184}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DecalNet", "DecalNet\DecalNet.vcproj", "{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}"
ProjectSection(ProjectDependencies) = postProject
{FF9AA982-5BE3-460A-9AAE-913C02E9C184} = {FF9AA982-5BE3-460A-9AAE-913C02E9C184}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DenAgent", "DenAgent\DenAgent.vcproj", "{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}"
ProjectSection(ProjectDependencies) = postProject
{06884D36-8C17-46BF-8BA5-2466E97FB605} = {06884D36-8C17-46BF-8BA5-2466E97FB605}
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A} = {ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}
{6B9C5380-3B50-4E72-B604-5089CB64B644} = {6B9C5380-3B50-4E72-B604-5089CB64B644}
{FF9AA982-5BE3-460A-9AAE-913C02E9C184} = {FF9AA982-5BE3-460A-9AAE-913C02E9C184}
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A} = {B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD} = {85C9D7B0-AC89-4E79-B701-FDE85EE569CD}
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790} = {C1CC01C2-D2C7-4862-A143-14BCF1BE9790}
{726381FF-93C0-4846-A72C-1B1BA6D08643} = {726381FF-93C0-4846-A72C-1B1BA6D08643}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Inject", "Inject\Inject.vcproj", "{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}"
ProjectSection(ProjectDependencies) = postProject
{FF9AA982-5BE3-460A-9AAE-913C02E9C184} = {FF9AA982-5BE3-460A-9AAE-913C02E9C184}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PlainText", "PlainText\PlainText.vcproj", "{726381FF-93C0-4846-A72C-1B1BA6D08643}"
ProjectSection(ProjectDependencies) = postProject
{6B9C5380-3B50-4E72-B604-5089CB64B644} = {6B9C5380-3B50-4E72-B604-5089CB64B644}
{FF9AA982-5BE3-460A-9AAE-913C02E9C184} = {FF9AA982-5BE3-460A-9AAE-913C02E9C184}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LobbyHook", "LobbyHook\LobbyHook.vcproj", "{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "DecalInstaller", "DecalInstaller\DecalInstaller.vdproj", "{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
Release MinDependency = Release MinDependency
Release MinSize = Release MinSize
Unicode Debug = Unicode Debug
Unicode Release MinSize = Unicode Release MinSize
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Debug.ActiveCfg = Debug|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Debug.Build.0 = Debug|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Release.ActiveCfg = Release MinSize|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Release.Build.0 = Release MinSize|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Release MinDependency.ActiveCfg = Release MinDependency|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Release MinDependency.Build.0 = Release MinDependency|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Release MinSize.ActiveCfg = Release MinSize|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Release MinSize.Build.0 = Release MinSize|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Unicode Debug.ActiveCfg = Unicode Debug|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Unicode Debug.Build.0 = Unicode Debug|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Unicode Release MinSize.ActiveCfg = Unicode Release MinSize|Win32
{FF9AA982-5BE3-460A-9AAE-913C02E9C184}.Unicode Release MinSize.Build.0 = Unicode Release MinSize|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Debug.ActiveCfg = Debug|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Debug.Build.0 = Debug|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Release.ActiveCfg = Release MinDependency|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Release.Build.0 = Release MinDependency|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Release MinDependency.ActiveCfg = Release MinDependency|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Release MinDependency.Build.0 = Release MinDependency|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Release MinSize.ActiveCfg = Release MinDependency|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Release MinSize.Build.0 = Release MinDependency|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Unicode Debug.ActiveCfg = Debug|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Unicode Debug.Build.0 = Debug|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Unicode Release MinSize.ActiveCfg = Debug|Win32
{6B9C5380-3B50-4E72-B604-5089CB64B644}.Unicode Release MinSize.Build.0 = Debug|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Debug.ActiveCfg = Debug|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Debug.Build.0 = Debug|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Release.ActiveCfg = Release MinSize|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Release.Build.0 = Release MinSize|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Release MinDependency.ActiveCfg = Release MinDependency|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Release MinDependency.Build.0 = Release MinDependency|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Release MinSize.ActiveCfg = Release MinSize|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Release MinSize.Build.0 = Release MinSize|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Unicode Debug.ActiveCfg = Unicode Debug|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Unicode Debug.Build.0 = Unicode Debug|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Unicode Release MinSize.ActiveCfg = Unicode Release MinSize|Win32
{B6EAB7A5-BEB3-40B8-9150-9DA6A854628A}.Unicode Release MinSize.Build.0 = Unicode Release MinSize|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Debug.ActiveCfg = Debug|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Debug.Build.0 = Debug|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Release.ActiveCfg = Release MinDependency|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Release.Build.0 = Release MinDependency|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Release MinDependency.ActiveCfg = Release MinDependency|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Release MinDependency.Build.0 = Release MinDependency|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Release MinSize.ActiveCfg = Release MinDependency|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Release MinSize.Build.0 = Release MinDependency|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Unicode Debug.ActiveCfg = Debug|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Unicode Debug.Build.0 = Debug|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Unicode Release MinSize.ActiveCfg = Debug|Win32
{06884D36-8C17-46BF-8BA5-2466E97FB605}.Unicode Release MinSize.Build.0 = Debug|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Debug.ActiveCfg = Debug|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Debug.Build.0 = Debug|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Release.ActiveCfg = Release MinSize|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Release.Build.0 = Release MinSize|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Release MinDependency.ActiveCfg = Release MinDependency|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Release MinDependency.Build.0 = Release MinDependency|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Release MinSize.ActiveCfg = Release MinSize|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Release MinSize.Build.0 = Release MinSize|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Unicode Debug.ActiveCfg = Unicode Debug|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Unicode Debug.Build.0 = Unicode Debug|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Unicode Release MinSize.ActiveCfg = Unicode Release MinSize|Win32
{85C9D7B0-AC89-4E79-B701-FDE85EE569CD}.Unicode Release MinSize.Build.0 = Unicode Release MinSize|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Debug.ActiveCfg = Debug|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Debug.Build.0 = Debug|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Release.ActiveCfg = Release MinSize|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Release.Build.0 = Release MinSize|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Release MinDependency.ActiveCfg = Release MinDependency|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Release MinDependency.Build.0 = Release MinDependency|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Release MinSize.ActiveCfg = Release MinSize|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Release MinSize.Build.0 = Release MinSize|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Unicode Debug.ActiveCfg = Unicode Debug|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Unicode Debug.Build.0 = Unicode Debug|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Unicode Release MinSize.ActiveCfg = Unicode Release MinSize|Win32
{C1CC01C2-D2C7-4862-A143-14BCF1BE9790}.Unicode Release MinSize.Build.0 = Unicode Release MinSize|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Debug.ActiveCfg = Debug|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Debug.Build.0 = Debug|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Release.ActiveCfg = Release|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Release.Build.0 = Release|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Release MinDependency.ActiveCfg = Release|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Release MinDependency.Build.0 = Release|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Release MinSize.ActiveCfg = Release|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Release MinSize.Build.0 = Release|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Unicode Debug.ActiveCfg = Debug|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Unicode Debug.Build.0 = Debug|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Unicode Release MinSize.ActiveCfg = Release|Win32
{1358ED95-22A0-41E2-A23C-6C46B0BC97DF}.Unicode Release MinSize.Build.0 = Release|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Debug.ActiveCfg = Debug|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Debug.Build.0 = Debug|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Release.ActiveCfg = Release MinDependency|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Release.Build.0 = Release MinDependency|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Release MinDependency.ActiveCfg = Release MinDependency|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Release MinDependency.Build.0 = Release MinDependency|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Release MinSize.ActiveCfg = Release MinDependency|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Release MinSize.Build.0 = Release MinDependency|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Unicode Debug.ActiveCfg = Debug|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Unicode Debug.Build.0 = Debug|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Unicode Release MinSize.ActiveCfg = Release MinDependency|Win32
{ECE3BC74-9DBA-48CD-998C-A1A8031E5F6A}.Unicode Release MinSize.Build.0 = Release MinDependency|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Debug.ActiveCfg = Debug|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Debug.Build.0 = Debug|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Release.ActiveCfg = Release MinDependency|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Release.Build.0 = Release MinDependency|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Release MinDependency.ActiveCfg = Release MinDependency|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Release MinDependency.Build.0 = Release MinDependency|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Release MinSize.ActiveCfg = Release MinDependency|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Release MinSize.Build.0 = Release MinDependency|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Unicode Debug.ActiveCfg = Debug|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Unicode Debug.Build.0 = Debug|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Unicode Release MinSize.ActiveCfg = Release MinDependency|Win32
{726381FF-93C0-4846-A72C-1B1BA6D08643}.Unicode Release MinSize.Build.0 = Release MinDependency|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Debug.ActiveCfg = Debug|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Debug.Build.0 = Debug|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Release.ActiveCfg = Release|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Release.Build.0 = Release|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Release MinDependency.ActiveCfg = Release|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Release MinDependency.Build.0 = Release|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Release MinSize.ActiveCfg = Release|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Release MinSize.Build.0 = Release|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Unicode Debug.ActiveCfg = Debug|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Unicode Debug.Build.0 = Debug|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Unicode Release MinSize.ActiveCfg = Release|Win32
{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}.Unicode Release MinSize.Build.0 = Release|Win32
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Debug.ActiveCfg = Debug
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Debug.Build.0 = Debug
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Release.ActiveCfg = Release
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Release.Build.0 = Release
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Release MinDependency.ActiveCfg = Release
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Release MinDependency.Build.0 = Release
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Release MinSize.ActiveCfg = Release
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Release MinSize.Build.0 = Release
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Unicode Debug.ActiveCfg = Debug
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Unicode Debug.Build.0 = Debug
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Unicode Release MinSize.ActiveCfg = Release
{6C9FEFC9-C572-4FAC-A863-88A0AAFADD7D}.Unicode Release MinSize.Build.0 = Release
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

2618
Native/Decal/ACHooks.cpp Normal file

File diff suppressed because it is too large Load diff

355
Native/Decal/ACHooks.h Normal file
View file

@ -0,0 +1,355 @@
// ACHooks.h: Definition of the ACHooks class
#ifndef __ACHOOKS_H_
#define __ACHOOKS_H_
#include "resource.h" // main symbols
#include "Decal.h"
#include "DecalManager.h"
#include "DecalCP.h"
// the public key to unencrypt xmls
#include "..\include\DecalKey.h"
// .NET vs VC6.0 Compiler Config
#if _MSC_VER > 1200 // .NET
#import "..\Include\Inject.tlb"
#define IPSite DecalPlugins::IPluginSite
#else // Not .Net
#include "..\inject\Inject.h"
#define IPSite IPluginSite
#endif
struct sMemoryLocation
{
std::string Name;
long Location;
};
// qString struct for internal client strings - this is all cynica_l's work
struct qString
{
void **vTable;
char *Data;
long MaximumLength;
};
struct qSkill {
long vTable;
enum eTrainLevel Trained;
int TotalXP;
int FreePoints;
int Clicks;
int unk1;
int unk2; /* float? percent of total? */
float unk3;
};
struct qVital {
long vTable;
int Clicks;
int unk1;
int TotalXP;
int unk2;
};
struct qAttribute {
long vTable;
int Clicks;
int Start;
int TotalXP;
};
struct qPointerList
{
qPointerList *dd[1];
};
extern "C" bool DispatchChatMessage( char *pText, long *pdwColor );
extern "C" bool DispatchChatText( char *pText );
/////////////////////////////////////////////////////////////////////////////
// ACHooks
class ATL_NO_VTABLE cACHooks :
public CComObjectRoot,
public CComCoClass<cACHooks,&CLSID_ACHooks>,
public IConnectionPointContainerImpl<cACHooks>,
public IDispatchImpl<IACHooks, &IID_IACHooks, &LIBID_Decal>,
public CProxyIACHooksEvents< cACHooks >
{
public:
cACHooks();
~cACHooks();
DECLARE_REGISTRY_RESOURCEID(IDR_ACHooks)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cACHooks)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IACHooks)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cACHooks)
CONNECTION_POINT_ENTRY(DIID_IACHooksEvents)
END_CONNECTION_POINT_MAP()
private:
long* GetCs(long offs=0) ;
void DecryptXML( const char *szPath, std::string &szXML );
long m_Hooks ;
typedef std::map< std::string, sMemoryLocation > LocMap;
LocMap m_mLocationList;
bool m_bDecalRef;
bool m_bIdQueueRef;
bool m_bMismatch;
bool m_bPrevSelect;
long m_lPrevSelect[2];
bool m_bCurrentSelect;
long m_lCurrentSelect[2];
bool m_bChatMessageAddy;
long m_lChatMessageAddy;
bool m_bMouse;
long m_lMouse[4];
bool m_bCastSpell;
long m_lCastSpell;
bool m_bMoveItem;
long m_lMoveItem;
bool m_bSelectItem;
long m_lSelectItem;
bool m_bUseItem;
long m_lUseItem;
bool m_bAllYourBase;
long m_lAllYourBase;
bool m_bSetCombatState;
long m_lSetCombatState;
bool m_bCombatStateOffset;
long m_lCombatStateOffset;
bool m_bChatState;
long m_lChatState;
bool m_bRequestID;
long m_lRequestID;
bool m_bStackCount;
long m_lStackCount;
bool m_bTestFormula;
long m_lTestFormula;
long m_lTestFormulaVTable;
bool m_bVendorID;
long m_lVendorID;
bool m_bBusyState;
long m_lBusyState;
bool m_bBusyStateID;
long m_lBusyStateID;
bool m_bPointerState;
long m_lPointerState;
bool m_bMoveItemEx;
long m_lMoveItemEx;
bool m_bArea3DWidth;
long *m_lpArea3DWidth;
bool m_bArea3DHeight;
long *m_lpArea3DHeight;
bool m_bObjectFromGuid;
long m_lObjectFromGuid;
long m_lObjectFromGuidClass;
bool m_bFaceHeading;
long m_lMovementThingyParent;
long m_lMovementThingyOffset;
long m_lFaceHeading;
bool m_bSetAutorun;
long m_lSetAutorun;
bool m_bInternalStringConstructor;
bool m_bInternalStringDestructor;
bool m_bSendMessageToID;
bool m_bSendMessageToName;
bool m_bSendMessageToMask;
bool m_bLocalChatText;
bool m_bLocalChatEmote;
long m_lInternalStringConstructor;
long m_lInternalStringDestructor;
long m_lSendMessageToID;
long m_lSendMessageToName;
long m_lSendMessageToMask;
long m_lLocalChatText;
long m_lLocalChatEmote;
long m_lVitalBase;
bool m_bGetVital;
long m_lGetVital;
bool m_bGetAttribute;
long m_lGetAttribute;
bool m_bGetSkill;
long m_lGetSkill;
bool m_bLogout;
long m_lLogout;
bool m_bSecureTrade_Add;
long m_lSecureTrade_Add;
bool m_bSecureTrade_Add_Off1;
long m_lSecureTrade_Add_Off1;
bool m_bSecureTrade_Add_Off2;
long m_lSecureTrade_Add_Off2;
bool m_bGetSkillInfo;
long m_lGetSkillInfo, m_lGetSkillInfo_vT;
bool m_bGetAttributeInfo;
long m_lGetAttributeInfo, m_lGetAttributeInfo_vT;
bool m_bGetVitalInfo;
long m_lGetVitalInfo, m_lGetVitalInfo_vT;
bool m_bChatColor;
long m_lChatColor;
bool m_bSelectItemHook;
long m_lSelectItemHook;
bool m_bUstAddItem_Useable;
long m_lUstAddItem;
long m_lUstAddItem_Off1;
long m_lUstAddItem_Off2;
bool m_bRequestShortcircuit;
long m_lRequestShortcircuit1;
long m_lRequestShortcircuit2;
long m_lRequestShortcircuit3;
bool m_bToolTextHook;
long m_lToolTextHJ;
bool m_bToolText2Hook;
long m_lToolText2HJ;
long m_lIdleLoc;
bool m_bIdleLoc;
long m_lSlashDay;
bool m_bSlashDay;
unsigned int m_HooksEx[1];
unsigned int m_HookCount;
CComPtr< IDecal > m_pDecal;
public:
static cACHooks* s_pACHooks;
void InternalObjectDestroyed( DWORD dwGuid );
void InternalSelectItem( DWORD dwID );
void InternalShortcircuit( DWORD dwID );
bool InternalChatText( char *szText );
bool InternalChatMessage( char *szText, long lColor );
void InternalToolText( char *szText, VARIANT_BOOL bError );
void InternalToolTextAppend( char *szText, VARIANT_BOOL bError );
void SetHookEx(enum eAvailableHooksEx HookID);
CComPtr< IKitchenSink > m_pIdQueue;
STDMETHOD(MoveItemEx)(long lObjectID, long lDestinationID);
STDMETHOD(get_PointerState)(long *pVal);
STDMETHOD(get_BusyStateID)(long *pVal);
STDMETHOD(get_BusyState)(long *pVal);
STDMETHOD(get_VendorID)(long *pVal);
STDMETHOD(get_SelectedStackCount)(long lStackCount, long *pVal);
STDMETHOD(put_SelectedStackCount)(long lStackCount, long newVal);
STDMETHOD(GetFellowStats)(long lCharID);
STDMETHOD(UseItemEx)(long UseThis, long OnThis);
STDMETHOD(get_ChatState)(VARIANT_BOOL *pVal);
STDMETHOD(get_CombatState)(long *pVal);
STDMETHOD(SetCombatState)(long pVal);
STDMETHOD(UseItem)(long lObjectID, long lUseState);
STDMETHOD(UseItemRaw)(long lObjectID, long lUseState, long lUseMethod);
STDMETHOD(UseFociSpell)(long UseThis, long OnThis);
STDMETHOD(SelectItem)(long lObjectID);
STDMETHOD(MoveItem)(long lObjectID, long lPackID, long lSlot, VARIANT_BOOL bStack);
STDMETHOD(CastSpell)(long lSpellID, long lObjectID);
STDMETHOD(SetCursorPosition)(long lX, long lY);
STDMETHOD(RawChatOut)(BSTR szText, long lColor);
STDMETHOD(ChatOut)(BSTR szText, long lColor);
STDMETHOD(get_PreviousSelection)(long *pVal);
STDMETHOD(put_PreviousSelection)(long newVal);
STDMETHOD(get_CurrentSelection)(long *pVal);
STDMETHOD(put_CurrentSelection)(long newVal);
STDMETHOD(QueryMemLoc)(BSTR bstrName, long *pVal);
STDMETHOD(get_Heading)(double *pVal);
STDMETHOD(get_Landblock)(long *pVal);
STDMETHOD(get_LocationX)(double *pVal);
STDMETHOD(get_LocationY)(double *pVal);
STDMETHOD(get_LocationZ)(double *pVal);
STDMETHOD(DropItem)(long lObjectID);
STDMETHOD(get_HooksAvail)(long *pVal) ;
STDMETHOD(FaceHeading)(float fHeading, VARIANT_BOOL bUnknown, VARIANT_BOOL *pRetval);
STDMETHOD(get_Area3DWidth)(long *pVal);
STDMETHOD(get_Area3DHeight)(long *pVal);
STDMETHOD(ItemIsKnown)(long lGUID, VARIANT_BOOL* pRetval) ;
STDMETHOD(SendTell)(long lPlayerID, BSTR Message);
STDMETHOD(SendTellEx)(BSTR Name, BSTR Message);
STDMETHOD(SetAutorun)(VARIANT_BOOL bOnOff) ;
STDMETHOD(get_Vital)(long Vital, long* pVal);
STDMETHOD(get_Attribute)(long Attribute, long* pVal);
STDMETHOD(get_Skill)(long Skill, long* pVal);
STDMETHOD(LocalChatText)(BSTR Text);
STDMETHOD(LocalChatEmote)(BSTR EmoteText);
STDMETHOD(get_HooksAvailEx)(enum eAvailableHooksEx HookID, VARIANT_BOOL* pVal);
STDMETHOD(Logout)();
STDMETHOD(ToolText)(BSTR Text, VARIANT_BOOL bError);
STDMETHOD(ToolTextAppend)(BSTR Text, VARIANT_BOOL bError);
STDMETHOD(SetIdleTime)( double dIdleTimeout );
STDMETHOD(SetDecal)(IUnknown *pDecal);
STDMETHOD(SecureTrade_Add)(long ItemID, VARIANT_BOOL *pVal);
STDMETHOD(get_SkillTrainLevel)( eSkill SkillID, eTrainLevel *pVal );
STDMETHOD(get_SkillTotalXP)( eSkill SkillID, int *pVal );
STDMETHOD(get_SkillFreePoints)( eSkill SkillID, int *pVal );
STDMETHOD(get_SkillClicks)( eSkill SkillID, int *pVal );
STDMETHOD(get_AttributeClicks)( eAttribute AttributeID, int *pVal );
STDMETHOD(get_AttributeTotalXP)( eAttribute AttributeID, int *pVal );
STDMETHOD(get_AttributeStart)( eAttribute AttributeID, int *pVal );
STDMETHOD(get_VitalClicks)( eVital VitalID, int *pVal );
STDMETHOD(get_VitalTotalXP)( eVital VitalID, int *pVal );
HRESULT GetSkillInfo(eSkill SkillID, struct qSkill *Skill);
HRESULT GetAttributeInfo(eAttribute AttributeID, struct qAttribute *Attribute);
HRESULT GetVitalInfo(eVital VitalID, struct qVital *Vital);
STDMETHOD(RequestID)(long lObjectID);
STDMETHOD(IDQueueAdd)(long lObjectID);
STDMETHOD(SetIDFilter)(IKitchenSink* pIDFilter);
STDMETHOD(UstAddItem)(long lObjectID);
STDMETHOD(SendMessageByMask)(LONG lMask, BSTR szMessage);
STDMETHOD(SetDay)(VARIANT_BOOL bDay);
};
#endif // __ACHOOKS_H_

23
Native/Decal/ACHooks.rgs Normal file
View file

@ -0,0 +1,23 @@
HKCR
{
Decal.ACHooks.1 = s 'ACHooks Class'
{
CLSID = s '{CB8875CD-ABC2-42AD-8175-8908706EED37}'
}
Decal.ACHooks = s 'ACHooks Class'
{
CLSID = s '{CB8875CD-ABC2-42AD-8175-8908706EED37}'
}
NoRemove CLSID
{
ForceRemove {CB8875CD-ABC2-42AD-8175-8908706EED37} = s 'ACHooks Class'
{
ProgID = s 'Decal.ACHooks.1'
VersionIndependentProgID = s 'Decal.ACHooks'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'both'
}
}
}
}

View file

@ -0,0 +1,194 @@
// ActiveXSurrogate.cpp : Implementation of cActiveXSurrogate
#include "stdafx.h"
#include "Decal.h"
#include "ActiveXSurrogate.h"
// Duplicated from Inject.h to prevent circular dependency
class IPluginSite;
class __declspec(uuid("{BA3E677F-8E44-4829-982E-58BBBC5C5F9B}")) IPlugin
: public IUnknown
{
public:
STDMETHOD(Initialize)(IPluginSite *pSite, long) = 0;
STDMETHOD(Terminate)() = 0;
STDMETHOD(get_FriendlyName)(BSTR *pstrName) = 0;
};
/////////////////////////////////////////////////////////////////////////////
// cActiveXSurrogate
typedef HRESULT (__stdcall *pfnDllRegisterServer)();
typedef HRESULT (__stdcall *pfnDllUnregisterServer)();
STDMETHODIMP cActiveXSurrogate::Register(BSTR strFilename)
{
USES_CONVERSION;
LPCTSTR szFilename = OLE2T( strFilename );
// First, register the library
HMODULE hLib = ::LoadLibrary( szFilename );
if( hLib == NULL )
return E_FAIL;
pfnDllRegisterServer pfnReg = reinterpret_cast< pfnDllRegisterServer >( ::GetProcAddress( hLib, _T( "DllRegisterServer" ) ) );
HRESULT hRes = E_FAIL;
if( pfnReg != NULL )
hRes = pfnReg();
::FreeLibrary( hLib );
if( FAILED( hRes ) )
return hRes;
// Next open up the type library and look for suitable classes, they have
// to be creatable - then we make one and see if it implements IPlugin2
CComPtr< ITypeLib > pTypeLib;
hRes = ::LoadTypeLib( strFilename, &pTypeLib );
if( FAILED( hRes ) )
return hRes;
UINT nTypeInfoCount = pTypeLib->GetTypeInfoCount();
int nFound = 0;
for( UINT i = 0; i < nTypeInfoCount; ++ i )
{
TYPEKIND tk;
pTypeLib->GetTypeInfoType( i, &tk );
if( tk != TKIND_COCLASS )
// Only coclasses
continue;
CComPtr< ITypeInfo > pClass1;
pTypeLib->GetTypeInfo( i, &pClass1 );
TYPEATTR *pta;
pClass1->GetTypeAttr( &pta );
if( pta->wTypeFlags & TYPEFLAG_FCANCREATE )
{
// Create an instance of the plugin and see if it implements IPlugin
CComPtr< IUnknown > pUnkPlugin;
HRESULT hRes = pClass1->CreateInstance ( NULL, IID_IUnknown, reinterpret_cast< LPVOID * > ( &pUnkPlugin ) );
if ( SUCCEEDED ( hRes ) )
{
// Check for the IPlugin2 interface
CComPtr< IPlugin2 > pPlugin2;
if ( SUCCEEDED ( pUnkPlugin->QueryInterface ( &pPlugin2 ) ) )
{
// This is a plugin (anything that implements IPlugin2 is a plugin afterall, make the registry key
LPCSTR szCLSID;
LPOLESTR strCLSID;
::StringFromCLSID( pta->guid, &strCLSID );
szCLSID = OLE2T( strCLSID );
::CoTaskMemFree( strCLSID );
TCHAR szRegKey[ 255 ];
::_tcscat ( ::_tcscpy ( szRegKey, _T( "Software\\Decal\\Plugins\\" ) ), szCLSID );
RegKey key;
key.Create( HKEY_LOCAL_MACHINE, szRegKey );
CComBSTR strDescription;
pClass1->GetDocumentation( MEMBERID_NIL, NULL, &strDescription, NULL, NULL );
key.SetStringValue( NULL, OLE2T( strDescription ) );
key.SetStringValue( _T("File"), szFilename );
key.SetDWORDValue( _T( "Enabled" ), 1 );
key.SetStringValue( _T("Uninstall"), _T( "{7559F22F-C56F-4621-AE08-9C354D799D4B}" ) );
++ nFound;
}
else
{
CComPtr< IPlugin > pPlugin;
if ( SUCCEEDED( pUnkPlugin->QueryInterface ( &pPlugin ) ) )
{
// This is a V1 plugin - same registration, but use a surrogate
LPCSTR szCLSID;
LPOLESTR strCLSID;
::StringFromCLSID( pta->guid, &strCLSID );
szCLSID = OLE2T( strCLSID );
::CoTaskMemFree( strCLSID );
TCHAR szRegKey[ 255 ];
::_tcscat ( ::_tcscpy ( szRegKey, _T( "Software\\Decal\\Plugins\\" ) ), szCLSID );
RegKey key;
key.Create( HKEY_LOCAL_MACHINE, szRegKey );
CComBSTR strDescription;
pPlugin->get_FriendlyName( &strDescription );
// Friendly name
key.SetStringValue( NULL, OLE2T( strDescription ) );
// File for uninstalling
key.SetStringValue( _T( "File" ), szFilename );
// Enabled by default
key.SetDWORDValue( _T( "Enabled" ), 1 );
// This object uninstalls
key.SetStringValue( _T("Uninstall"), _T( "{7559F22F-C56F-4621-AE08-9C354D799D4B}" ));
// The V1 surrogate
key.SetStringValue( _T( "Surrogate" ), _T( "{3D837F6E-B5CA-4604-885F-7AB45FCFA62A}" ) );
++ nFound;
}
}
}
}
pClass1->ReleaseTypeAttr( pta );
}
return ( nFound > 0 ) ? S_OK : E_FAIL;
}
STDMETHODIMP cActiveXSurrogate::Uninstall()
{
USES_CONVERSION;
TCHAR szParent[ 255 ];
::_tcscat ( ::_tcscpy ( szParent, _T( "Software\\Decal\\Plugins\\" ) ), OLE2T( m_strGroup ) );
RegKey rk;
if( rk.Open( HKEY_LOCAL_MACHINE, szParent ) != ERROR_SUCCESS )
{
_ASSERT( FALSE );
return E_FAIL;
}
LPOLESTR strCLSID;
::StringFromCLSID( m_clsid, &strCLSID );
LPTSTR szCLSID = OLE2T( strCLSID );
::CoTaskMemFree( strCLSID );
if( rk.RecurseDeleteKey( szCLSID ) != ERROR_SUCCESS )
{
_ASSERT( FALSE );
return E_FAIL;
}
// Load the library and call DLL unreg server
LPCTSTR szFilename = OLE2T( m_strFile );
// First, register the library
HMODULE hLib = ::LoadLibrary( szFilename );
if( hLib == NULL )
return E_FAIL;
pfnDllUnregisterServer pfnReg = reinterpret_cast< pfnDllUnregisterServer >( ::GetProcAddress( hLib, _T( "DllUnregisterServer" ) ) );
HRESULT hRes = E_FAIL;
if( pfnReg != NULL )
hRes = pfnReg();
::FreeLibrary( hLib );
// Just call this to make sure the library isn't locked so the user
// can delete it after this point.
::CoFreeUnusedLibraries();
return hRes;
}

View file

@ -0,0 +1,84 @@
// ActiveXSurrogate.h : Declaration of the cActiveXSurrogate
#ifndef __ACTIVEXSURROGATE_H_
#define __ACTIVEXSURROGATE_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cActiveXSurrogate
class ATL_NO_VTABLE cActiveXSurrogate :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cActiveXSurrogate, &CLSID_ActiveXSurrogate>,
public IDecalFileSurrogate,
public IDecalUninstall
{
public:
cActiveXSurrogate()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_ACTIVEXSURROGATE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cActiveXSurrogate)
COM_INTERFACE_ENTRY(IDecalFileSurrogate)
COM_INTERFACE_ENTRY(IDecalUninstall)
END_COM_MAP()
CComBSTR m_strFile;
CComBSTR m_strGroup;
CLSID m_clsid;
public:
// IDecalFileSurrogate
STDMETHOD(get_Extension)( BSTR *pVal )
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
*pVal = T2BSTR( _T( "dll" ) );
return S_OK;
}
STDMETHOD(get_Description)( BSTR *pVal )
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
*pVal = T2BSTR( _T( "ActiveX Plugin" ) );
return S_OK;
}
STDMETHOD(Register)(BSTR strFilename);
// IDecalUninstall
STDMETHOD(Prepare)( IDecalEnum *pEnum )
{
// Get the class
pEnum->get_ComClass( &m_clsid );
// Get the file
static _bstr_t _strFile( _T( "File" ) );
CComVariant vFile;
pEnum->get_Property( _strFile, &vFile );
m_strFile = vFile.bstrVal;
// Get the group
pEnum->get_Group( &m_strGroup );
return S_OK;
}
STDMETHOD(Uninstall)();
};
#endif //__ACTIVEXSURROGATE_H_

View file

@ -0,0 +1,44 @@
HKCR
{
Decal.ActiveXSurrogate.1 = s 'ActiveXSurrogate Class'
{
CLSID = s '{7559F22F-C56F-4621-AE08-9C354D799D4B}'
}
Decal.ActiveXSurrogate = s 'ActiveXSurrogate Class'
{
CLSID = s '{7559F22F-C56F-4621-AE08-9C354D799D4B}'
CurVer = s 'Decal.ActiveXSurrogate.1'
}
NoRemove CLSID
{
ForceRemove {7559F22F-C56F-4621-AE08-9C354D799D4B} = s 'ActiveXSurrogate Class'
{
ProgID = s 'Decal.ActiveXSurrogate.1'
VersionIndependentProgID = s 'Decal.ActiveXSurrogate'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732}'
}
}
}
HKLM
{
NoRemove SOFTWARE
{
NoRemove Decal
{
NoRemove Surrogates
{
ForceRemove {7559F22F-C56F-4621-AE08-9C354D799D4B} = s 'ActiveX Plugin Surrogate'
{
val Enabled = d '1'
val Extension = s 'dll'
val Description = s 'ActiveX Surrogate'
}
}
}
}
}

79
Native/Decal/Decal.cpp Normal file
View file

@ -0,0 +1,79 @@
// Decal.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f Decalps.mk in the project directory.
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include <Decal.h>
#include <Decal_i.c>
#include "DecalManager.h"
#include "SurrogateRemove.h"
#include "ActiveXSurrogate.h"
#include "DecalRes.h"
#include "ACHooks.h"
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Decal, cDecal)
OBJECT_ENTRY(CLSID_SurrogateRemove, cSurrogateRemove)
OBJECT_ENTRY(CLSID_ActiveXSurrogate, cActiveXSurrogate)
OBJECT_ENTRY(CLSID_DecalRes, cDecalRes)
OBJECT_ENTRY(CLSID_ACHooks, cACHooks)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_Decal);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
_Module.Term();
}
return TRUE; // ok
}
/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return _Module.GetClassObject(rclsid, riid, ppv);
}
/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
return _Module.UnregisterServer(TRUE);
}

9
Native/Decal/Decal.def Normal file
View file

@ -0,0 +1,9 @@
; Decal.def : Declares the module parameters.
LIBRARY "Decal.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

263
Native/Decal/Decal.dsp Normal file
View file

@ -0,0 +1,263 @@
# Microsoft Developer Studio Project File - Name="Decal" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=Decal - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Decal.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Decal.mak" CFG="Decal - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Decal - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "Decal - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Decal - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD MTL /nologo /I "..\Include" /Oicf
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib version.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# Begin Custom Build - Performing registration
OutDir=.\..\Debug
TargetPath=\Decal\source\Debug\Decal.dll
InputPath=\Decal\source\Debug\Decal.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "Decal - Win32 Release MinSize"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseMinSize"
# PROP BASE Intermediate_Dir "ReleaseMinSize"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release"
# PROP Intermediate_Dir "ReleaseMinSize"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /Zi /Oa /Og /Oi /Os /Oy /Ob1 /Gf /Gy /I "..\Include" /D "_MBCS" /D "_ATL_DLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /c
# ADD MTL /nologo /I "..\Include" /Oicf
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib version.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libcmt.lib" /pdbtype:sept /libpath:"..\Release"
# Begin Custom Build - Performing registration
OutDir=.\..\Release
TargetPath=\Decal\source\Release\Decal.dll
InputPath=\Decal\source\Release\Decal.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ENDIF
# Begin Target
# Name "Decal - Win32 Debug"
# Name "Decal - Win32 Release MinSize"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ACHooks.cpp
# End Source File
# Begin Source File
SOURCE=.\ActiveXSurrogate.cpp
# End Source File
# Begin Source File
SOURCE=.\Decal.cpp
# End Source File
# Begin Source File
SOURCE=.\Decal.def
# End Source File
# Begin Source File
SOURCE=..\Include\Decal.idl
!IF "$(CFG)" == "Decal - Win32 Debug"
# ADD MTL /nologo /tlb "Decal.tlb" /h "..\Include\Decal.h" /iid "..\Include\Decal_i.c" /Oicf
!ELSEIF "$(CFG)" == "Decal - Win32 Release MinSize"
# ADD MTL /tlb "Decal.tlb" /h "..\Include\Decal.h" /iid "..\Include\Decal_i.c" /Oicf
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\Decal.rc
# End Source File
# Begin Source File
SOURCE=.\DecalEnum.cpp
# End Source File
# Begin Source File
SOURCE=.\DecalManager.cpp
# End Source File
# Begin Source File
SOURCE=.\DecalRes.cpp
# End Source File
# Begin Source File
SOURCE=.\PluginSite.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\SurrogateRemove.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ACHooks.h
# End Source File
# Begin Source File
SOURCE=.\ActiveXSurrogate.h
# End Source File
# Begin Source File
SOURCE=..\Include\ApiHook.h
# End Source File
# Begin Source File
SOURCE=.\DecalCP.h
# End Source File
# Begin Source File
SOURCE=.\DecalEnum.h
# End Source File
# Begin Source File
SOURCE=..\Include\DecalImpl.h
# End Source File
# Begin Source File
SOURCE=.\DecalManager.h
# End Source File
# Begin Source File
SOURCE=.\DecalRes.h
# End Source File
# Begin Source File
SOURCE=.\DecalVersion.h
# End Source File
# Begin Source File
SOURCE=.\PluginSite.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\SurrogateRemove.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\ACHooks.rgs
# End Source File
# Begin Source File
SOURCE=.\ActiveXSurrogate.rgs
# End Source File
# Begin Source File
SOURCE=.\Decal.rgs
# End Source File
# Begin Source File
SOURCE=.\DecalNode.rgs
# End Source File
# Begin Source File
SOURCE=.\DecalRes.rgs
# End Source File
# Begin Source File
SOURCE=.\PluginAdapterV1.rgs
# End Source File
# Begin Source File
SOURCE=.\SurrogateRemove.rgs
# End Source File
# End Group
# End Target
# End Project

157
Native/Decal/Decal.rc Normal file
View file

@ -0,0 +1,157 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "..\Include\DecalVersion.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""Decal.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
PRODUCTVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Decal Module"
VALUE "FileVersion", DECAL_VERSION_STRING
VALUE "InternalName", "Decal"
VALUE "LegalCopyright", "Copyright 2001-2002"
VALUE "OriginalFilename", "Decal.DLL"
VALUE "ProductName", "Decal Module"
VALUE "ProductVersion", DECAL_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_ACHooks REGISTRY "ACHooks.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "Decal"
IDS_ACHOOKS_DESC "ACHooks Class"
END
STRINGTABLE
BEGIN
IDE_INDEXOUTOFRANGE "The provided index is below 0 or greater than the number of items in the list."
IDE_BADINDEXTYPE "Index type must be an integer or a string."
IDE_CLASSNOTFOUND "The CLSID could not be found in the registry"
IDE_CLASSKEYNOTFOUND "The requested class key could not be found in the registry."
IDE_GROUPKEYNOTOPEN "Could not open group registry key."
IDE_INVALIDSUBKEYS "Could not count the number of subkeys."
IDE_BADITERATOR "The enumeration is before the beginning or after the end."
IDE_MOVEUPTOP "Cannot move up the top entry."
IDE_MOVEDOWNBOTTOM "Cannot move bottom item down."
IDE_SURROGATEDISABLED "The surrogate for this object is disabled, the object cannot be created."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Canada) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_DECAL REGISTRY "Decal.rgs"
IDR_SURROGATEREMOVE REGISTRY "SurrogateRemove.rgs"
IDR_ACTIVEXSURROGATE REGISTRY "ActiveXSurrogate.rgs"
IDR_DECALRES REGISTRY "DecalRes.rgs"
#endif // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "Decal.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

25
Native/Decal/Decal.rgs Normal file
View file

@ -0,0 +1,25 @@
HKCR
{
Decal.Decal.1 = s 'Decal Class'
{
CLSID = s '{4557D5A1-00DB-48F6-ACB3-4FEF30E2F358}'
}
Decal.Decal = s 'Decal Class'
{
CLSID = s '{4557D5A1-00DB-48F6-ACB3-4FEF30E2F358}'
CurVer = s 'Decal.Decal.1'
}
NoRemove CLSID
{
ForceRemove {4557D5A1-00DB-48F6-ACB3-4FEF30E2F358} = s 'Decal Class'
{
ProgID = s 'Decal.Decal.1'
VersionIndependentProgID = s 'Decal.Decal'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732}'
}
}
}

987
Native/Decal/Decal.vcproj Normal file
View file

@ -0,0 +1,987 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Decal"
SccProjectName=""
SccLocalPath=""
Keyword="AtlProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\..\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/Decal.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib"
OutputFile=".\..\Debug/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Debug/Decal.pdb"
SubSystem="2"
ImportLibrary=".\..\Debug/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Debug/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release MinSize|Win32"
OutputDirectory=".\..\Release"
IntermediateDirectory=".\ReleaseMinSize"
ConfigurationType="2"
UseOfMFC="0"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\ReleaseMinSize/Decal.pch"
AssemblerListingLocation=".\ReleaseMinSize/"
ObjectFile=".\ReleaseMinSize/"
ProgramDataBaseFileName=".\ReleaseMinSize/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib"
OutputFile=".\..\Release/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Release"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Release/Decal.pdb"
SubSystem="2"
ImportLibrary=".\..\Release/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Release/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Unicode Release MinSize|Win32"
OutputDirectory=".\ReleaseUMinSize"
IntermediateDirectory=".\ReleaseUMinSize"
ConfigurationType="2"
UseOfMFC="0"
UseOfATL="2"
ATLMinimizesCRunTimeLibraryUsage="TRUE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\ReleaseUMinSize/Decal.pch"
AssemblerListingLocation=".\ReleaseUMinSize/"
ObjectFile=".\ReleaseUMinSize/"
ProgramDataBaseFileName=".\ReleaseUMinSize/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib libctiny.lib"
OutputFile=".\ReleaseUMinSize/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Release"
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\ReleaseUMinSize/Decal.pdb"
SubSystem="2"
ImportLibrary=".\ReleaseUMinSize/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\ReleaseUMinSize/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Unicode Debug|Win32"
OutputDirectory=".\DebugU"
IntermediateDirectory=".\DebugU"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\DebugU/Decal.pch"
AssemblerListingLocation=".\DebugU/"
ObjectFile=".\DebugU/"
ProgramDataBaseFileName=".\DebugU/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib"
OutputFile=".\DebugU/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\DebugU/Decal.pdb"
SubSystem="2"
ImportLibrary=".\DebugU/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\DebugU/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release MinDependency|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
UseOfATL="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\ReleaseMinSize/Decal.pch"
AssemblerListingLocation=".\ReleaseMinDependency/"
ObjectFile=".\ReleaseMinDependency/"
ProgramDataBaseFileName=".\ReleaseMinDependency/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib"
OutputFile=".\..\Release/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Release"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Release/Decal.pdb"
SubSystem="2"
ImportLibrary=".\..\Release/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Release/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="ACHooks.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="ActiveXSurrogate.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="Decal.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="Decal.def">
</File>
<File
RelativePath="..\Include\Decal.idl">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
</File>
<File
RelativePath="Decal.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;$(NoInherit)"
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;$(NoInherit)"
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalEnum.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalManager.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalRes.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="PluginSite.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="SurrogateRemove.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="ACHooks.h">
</File>
<File
RelativePath="ActiveXSurrogate.h">
</File>
<File
RelativePath="..\Include\ApiHook.h">
</File>
<File
RelativePath="DecalCP.h">
</File>
<File
RelativePath="DecalEnum.h">
</File>
<File
RelativePath="..\Include\DecalImpl.h">
</File>
<File
RelativePath="..\Include\DecalKey.h">
</File>
<File
RelativePath="DecalManager.h">
</File>
<File
RelativePath="DecalRes.h">
</File>
<File
RelativePath="..\Include\DecalVersion.h">
</File>
<File
RelativePath="PluginSite.h">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
<File
RelativePath="SurrogateRemove.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="ACHooks.rgs">
</File>
<File
RelativePath="ActiveXSurrogate.rgs">
</File>
<File
RelativePath="Decal.rgs">
</File>
<File
RelativePath="DecalNode.rgs">
</File>
<File
RelativePath="DecalRes.rgs">
</File>
<File
RelativePath="PluginAdapterV1.rgs">
</File>
<File
RelativePath="SurrogateRemove.rgs">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

202
Native/Decal/DecalCP.h Normal file
View file

@ -0,0 +1,202 @@
#ifndef _DECALCP_H_
#define _DECALCP_H_
template <class T>
class CProxyIACHooksEvents : public IConnectionPointImpl<T, &DIID_IACHooksEvents, CComDynamicUnkArray>
{
public:
HRESULT Fire_ObjectDestroyed(LONG guid)
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[0] = guid;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
VARIANT_BOOL Fire_OnChatBoxMessage(BSTR bstrText, LONG lColor)
{
VARIANT_BOOL bEatProc = VARIANT_FALSE;
VARIANT_BOOL bEatLocal = VARIANT_FALSE;
HRESULT hr = S_OK;
T * pThis = static_cast<T *>(this);
int cConnections = m_vec.GetSize();
for (int iConnection = 0; iConnection < cConnections; iConnection++)
{
pThis->Lock();
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
IDispatch * pConnection = reinterpret_cast<IDispatch *>(punkConnection.p);
if (pConnection)
{
// operator= doesn't accept VARIANT_BOOL *
VARIANT vt;
::VariantInit(&vt);
vt.vt = VT_BYREF | VT_BOOL;
vt.pboolVal = &bEatLocal;
CComVariant avarParams[3];
avarParams[2] = bstrText;
avarParams[1] = lColor;
avarParams[0] = vt;
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 3, 0 };
hr = pConnection->Invoke(2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, &varResult, NULL, NULL);
if( bEatLocal == VARIANT_TRUE )
bEatProc = VARIANT_TRUE;
}
}
return bEatProc;
}
VARIANT_BOOL Fire_OnCommandLineText( BSTR bstrText )
{
VARIANT_BOOL bEatProc = VARIANT_FALSE;
VARIANT_BOOL bEatLocal = VARIANT_FALSE;
HRESULT hr = S_OK;
T * pThis = static_cast<T *>(this);
int cConnections = m_vec.GetSize();
for (int iConnection = 0; iConnection < cConnections; iConnection++)
{
pThis->Lock();
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
IDispatch * pConnection = reinterpret_cast<IDispatch *>(punkConnection.p);
if (pConnection)
{
// operator= doesn't accept VARIANT_BOOL *
VARIANT vt;
::VariantInit(&vt);
vt.vt = VT_BYREF | VT_BOOL;
vt.pboolVal = &bEatLocal;
CComVariant avarParams[2];
avarParams[1] = bstrText;
avarParams[0] = vt;
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 2, 0 };
hr = pConnection->Invoke(3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, &varResult, NULL, NULL);
if( bEatLocal == VARIANT_TRUE )
bEatProc = VARIANT_TRUE;
}
}
return bEatProc;
}
HRESULT Fire_OnSelectItem(LONG guid)
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[0] = guid;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
void Fire_OnToolText(BSTR bstrText, VARIANT_BOOL bError)
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
// operator= doesn't accept VARIANT_BOOL *
VARIANT vt;
::VariantInit(&vt);
vt.vt = VT_BYREF | VT_BOOL;
vt.pboolVal = &bError;
pvars[1] = bstrText;
pvars[0] = vt;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
void Fire_OnToolTextAppend(BSTR bstrText, VARIANT_BOOL bError)
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
// operator= doesn't accept VARIANT_BOOL *
VARIANT vt;
::VariantInit(&vt);
vt.vt = VT_BYREF | VT_BOOL;
vt.pboolVal = &bError;
pvars[1] = bstrText;
pvars[0] = vt;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
};
#endif

519
Native/Decal/DecalEnum.cpp Normal file
View file

@ -0,0 +1,519 @@
// DecalEnum.cpp : Implementation of cDecalEnum
#include "stdafx.h"
#include "Decal.h"
#include "DecalEnum.h"
/////////////////////////////////////////////////////////////////////////////
// cDecalEnum
cDecalEnum::~cDecalEnum()
{
// Write out the order if there were changes
if ( !m_bOrderChanged )
return;
USES_CONVERSION;
std::string strOrder;
strOrder.reserve ( m_keys.size () );
for ( cKeyList::iterator i = m_keys.begin (); i != m_keys.end(); ++ i )
strOrder += i->m_letter;
// Compile the new order from the
RegKey hkGroup;
if( hkGroup.Create( HKEY_LOCAL_MACHINE, m_strGroupKey.c_str() ) != ERROR_SUCCESS )
{
_ASSERTE ( FALSE );
return;
}
hkGroup.SetStringValue (_T("Order"), strOrder.c_str ());
}
bool cDecalEnum::Initialize( IDecal *pDecal, BSTR strKey )
{
_ASSERTE( pDecal != NULL );
USES_CONVERSION;
m_strGroupKey = "SOFTWARE\\Decal\\";
m_strGroupKey += OLE2A( strKey );
m_strGroup = strKey;
m_pDecal = pDecal;
m_nIndex = -1;
m_bOrderChanged = false;
return true;
}
HRESULT cDecalEnum::Advance( REFCLSID clsid )
{
// Assign a dummy letter
cKeyEntry ke;
ke.m_clsid = clsid;
ke.m_letter = _T( 'A' );
m_keys.reserve ( 1 );
m_keys.push_back ( ke );
return openKeyAt ( 0 );
}
HRESULT cDecalEnum::Begin()
{
USES_CONVERSION;
// Load and sort the list
RegKey hkGroup;
if( hkGroup.Create( HKEY_LOCAL_MACHINE, m_strGroupKey.c_str() ) != ERROR_SUCCESS )
return Error ( IDE_GROUPKEYNOTOPEN );
// Load the order string and prepare a new item string
std::string strIdentifiers( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,./;'[]-=`<>?:{}|_+`!@#$%^&*()" );
DWORD nMaxOrder = strIdentifiers.length ();
LPTSTR szOrder = reinterpret_cast< LPTSTR > ( _alloca ( sizeof ( TCHAR ) * nMaxOrder ) );
// Count the number of subkeys
DWORD dwSubkeys;
if ( ::RegQueryInfoKey ( hkGroup, NULL, NULL, NULL, &dwSubkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) != ERROR_SUCCESS )
return Error ( IDE_INVALIDSUBKEYS );
m_keys.reserve ( dwSubkeys );
LPTSTR szEndOrder;
// Load an existing order
if ( hkGroup.QueryStringValue (_T("Order"), szOrder, &nMaxOrder) == ERROR_SUCCESS )
{
szEndOrder = szOrder + ( nMaxOrder - 1 );
// Sort and merge the differences
std::string strOrder ( szOrder, szEndOrder );
std::sort ( strOrder.begin (), strOrder.end () );
std::string strMerged;
strMerged.reserve ( strIdentifiers.length () - ( nMaxOrder - 1 ) );
std::set_difference ( strIdentifiers.begin (), strIdentifiers.end (), strOrder.begin (), strOrder.end (), std::inserter ( strMerged, strMerged.end() ) );
// Reset the identifiers to exclude the currently used ones
strIdentifiers.swap ( strMerged );
}
else
{
szOrder[ 0 ] = _T( '\0' );
szEndOrder = szOrder;
}
std::string::iterator iNextID = strIdentifiers.begin ();
// Now we walk through the subkeys and insert in order
TCHAR szCLSID[ 64 ];
for ( int i = 0; ::RegEnumKey ( hkGroup, i, szCLSID, sizeof ( szCLSID ) ) == ERROR_SUCCESS; ++ i )
{
CLSID clsid;
HRESULT hRes = ::CLSIDFromString ( T2OLE ( szCLSID ), &clsid );
if ( FAILED ( hRes ) )
// Skip non-CLSID keys
continue;
RegKey hkItem;
if ( hkItem.Open ( hkGroup, szCLSID ) != ERROR_SUCCESS )
continue;
// Attempt to read the sequence indicator
TCHAR szSequence[ 4 ];
DWORD dwSequence = sizeof ( szSequence );
cKeyEntry ke;
ke.m_clsid = clsid;
if ( hkItem.QueryStringValue ( _T( "Order" ), szSequence, &dwSequence ) == ERROR_SUCCESS )
{
_ASSERTE ( szSequence[ 1 ] == _T( '\0' ) );
ke.m_letter = *szSequence;
insertKey ( ke, szOrder, szEndOrder );
continue;
}
// There's no sequence current, add on to the end
_ASSERTE ( iNextID != strIdentifiers.end () );
ke.m_letter = *( iNextID ++ );
m_keys.push_back ( ke );
TCHAR szVal[ 2 ] = { ke.m_letter, _T( '\0' ) };
hkItem.SetStringValue ( _T( "Order" ), szVal );
// The sequence is changed by adding items
m_bOrderChanged = true;
}
return S_OK;
}
void cDecalEnum::insertKey ( cKeyEntry &ke, TCHAR *szOrder, TCHAR *szEndOrder )
{
// Insert the item in the correct order into the list - first
// find the sequence number in the list
for ( TCHAR *szOrderIndex = szOrder; szOrderIndex != szEndOrder; ++ szOrderIndex )
if ( *szOrderIndex == ke.m_letter )
break;
if ( szOrderIndex == szEndOrder )
{
// This item is last, don't search for anything after
m_keys.push_back ( ke );
return;
}
// We have an insert, search for the member to insert before
for ( szOrderIndex = szOrderIndex + 1; szOrderIndex != szEndOrder; ++ szOrderIndex )
{
// Search for a matchinf item in the array
for ( cKeyList::iterator j = m_keys.begin(); j != m_keys.end(); ++ j )
{
if ( j->m_letter == *szOrderIndex )
{
m_keys.insert ( j, ke );
return;
}
}
}
// The next entry most likely hasn't been loaded yet - just append
m_keys.push_back ( ke );
}
HRESULT cDecalEnum::openKeyAt ( int nIndex )
{
USES_CONVERSION;
if ( m_key.m_hKey != NULL )
m_key.Close ();
LPOLESTR strClsid;
::StringFromCLSID( m_keys[ nIndex ].m_clsid, &strClsid );
LPCTSTR szClsid = OLE2T( strClsid );
::CoTaskMemFree( strClsid );
std::string strItemKey = m_strGroupKey + _T( "\\" );
strItemKey += szClsid;
if ( m_key.Open ( HKEY_LOCAL_MACHINE, strItemKey.c_str () ) != ERROR_SUCCESS )
return Error ( IDE_CLASSKEYNOTFOUND );
m_nIndex = nIndex;
return S_OK;
}
STDMETHODIMP cDecalEnum::get_FriendlyName(BSTR *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
TCHAR szName[ MAX_PATH ];
DWORD dwSize = MAX_PATH;
if( m_key.QueryStringValue( NULL, szName, &dwSize ) != ERROR_SUCCESS )
return E_FAIL;
*pVal = T2BSTR( szName );
return S_OK;
}
STDMETHODIMP cDecalEnum::get_ComClass(CLSID *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
*pVal = m_keys[ m_nIndex ].m_clsid;
return S_OK;
}
STDMETHODIMP cDecalEnum::get_Enabled(VARIANT_BOOL *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
DWORD dwEnabled;
if( m_key.QueryDWORDValue( _T("Enabled"), dwEnabled ) != ERROR_SUCCESS )
// Plugins are enabled when this value is ommitted
dwEnabled = TRUE;
*pVal = ( dwEnabled ) ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP cDecalEnum::put_Enabled(VARIANT_BOOL newVal)
{
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
if( m_key.SetDWORDValue( _T( "Enabled" ), ( ( newVal ) ? 1 : 0 ) ) != ERROR_SUCCESS )
return E_FAIL;
return S_OK;
}
STDMETHODIMP cDecalEnum::CreateInstance(REFIID iid, LPVOID *ppvItf)
{
CLSID clsidSurrogate;
if( FAILED( get_SurrogateClass( &clsidSurrogate ) ) )
{
_ASSERT( FALSE );
return E_FAIL;
}
if( clsidSurrogate == GUID_NULL )
{
// Create the object without a surrogate
CLSID clsidObject;
HRESULT hRes = get_ComClass( &clsidObject );
if( FAILED( hRes ) )
return hRes;
return ::CoCreateInstance( clsidObject, NULL, CLSCTX_INPROC_SERVER, iid, ppvItf );
}
// Create the surrogate object
CComPtr< IDecalEnum > pEnum;
static _bstr_t _strSurrogates ( _T( "Surrogates" ) );
HRESULT hRes = m_pDecal->get_Configuration ( _strSurrogates, clsidSurrogate, &pEnum );
if ( !SUCCEEDED ( hRes ) )
return hRes;
VARIANT_BOOL bEnabled;
hRes = pEnum->get_Enabled ( &bEnabled );
_ASSERTE ( SUCCEEDED ( hRes ) );
if ( !bEnabled )
return Error ( IDE_SURROGATEDISABLED );
CComPtr< IDecalSurrogate > pSurrogate;
hRes = pEnum->CreateInstance ( IID_IDecalSurrogate, reinterpret_cast< LPVOID * > ( &pSurrogate ) );
if( FAILED( hRes ) )
return hRes;
return pSurrogate->CreateInstance( this, iid, ppvItf );
}
STDMETHODIMP cDecalEnum::Next()
{
if ( m_nIndex == m_keys.size () - 1 )
{
// End of iteration
if ( m_key.m_hKey != NULL )
m_key.Close ();
return S_FALSE;
}
return openKeyAt ( m_nIndex + 1 );
}
STDMETHODIMP cDecalEnum::get_SurrogateClass(CLSID *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
TCHAR szName[ MAX_PATH + 1 ];
DWORD dwSize = MAX_PATH + 1;
if( m_key.QueryStringValue( _T("Surrogate"), szName, &dwSize ) != ERROR_SUCCESS )
{
// If the surrogate is not found, return the NULL guid
*pVal = GUID_NULL;
return S_OK;
}
return ::CLSIDFromString( T2OLE( szName ), pVal );
}
STDMETHODIMP cDecalEnum::get_ResourcePath(BSTR *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
TCHAR szName[ MAX_PATH ];
DWORD dwSize = MAX_PATH;
if( m_key.QueryStringValue( NULL, szName, &dwSize ) != ERROR_SUCCESS )
return E_FAIL;
*pVal = T2BSTR( szName );
return S_OK;
}
STDMETHODIMP cDecalEnum::get_Property(BSTR Name, VARIANT *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
LPCTSTR szValueName = OLE2T( Name );
// Get some info about the property
DWORD dwDataType;
if( ::RegQueryValueEx( m_key.m_hKey, szValueName, NULL, &dwDataType, NULL, NULL ) != ERROR_SUCCESS )
// We'll assume there's no value
return E_INVALIDARG;
switch( dwDataType )
{
case REG_DWORD:
{
DWORD dwValue;
if( m_key.QueryDWORDValue( szValueName, dwValue ) != ERROR_SUCCESS )
return E_FAIL;
pVal->vt = VT_I4;
pVal->lVal = dwValue;
return S_OK;
}
break;
case REG_EXPAND_SZ:
case REG_SZ:
{
TCHAR szValue[ MAX_PATH ];
DWORD dwSize = MAX_PATH;
if( m_key.QueryStringValue( szValueName, szValue, &dwSize ) != ERROR_SUCCESS )
return E_FAIL;
pVal->vt = VT_BSTR;
pVal->bstrVal = T2BSTR( szValue );
return S_OK;
}
break;
}
return E_INVALIDARG;
}
STDMETHODIMP cDecalEnum::get_Group(BSTR *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
*pVal = OLE2BSTR( m_strGroup );
return S_OK;
}
STDMETHODIMP cDecalEnum::Skip (REFCLSID clsid)
{
// Search our loaded list for the clsid
for ( cKeyList::iterator i = m_keys.begin (); i != m_keys.end(); ++ i )
{
if ( clsid == i->m_clsid )
return openKeyAt ( i - m_keys.begin() );
}
return Error ( IDE_CLASSNOTFOUND );
}
STDMETHODIMP cDecalEnum::MoveBefore(REFCLSID clsidBefore)
{
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
// Find the entry we're inserting before
for ( cKeyList::iterator i = m_keys.begin (); i != m_keys.end(); ++ i )
{
if ( i->m_clsid == clsidBefore )
break;
}
if ( i == m_keys.end () )
return Error ( IDE_CLASSNOTFOUND );
int nFoundIndex = i - m_keys.begin ();
if ( nFoundIndex == m_nIndex )
// No op
return S_FALSE;
if ( nFoundIndex > m_nIndex )
-- nFoundIndex;
cKeyEntry eRemoved = m_keys[ m_nIndex ];
m_keys.erase ( m_keys.begin () + m_nIndex );
m_keys.insert ( m_keys.begin () + nFoundIndex, eRemoved );
// Reset so we're still on the same item
m_nIndex = nFoundIndex;
m_bOrderChanged = true;
return S_OK;
}

76
Native/Decal/DecalEnum.h Normal file
View file

@ -0,0 +1,76 @@
// DecalEnum.h : Declaration of the cDecalEnum
#ifndef __DECALENUM_H_
#define __DECALENUM_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cDecalEnum
class ATL_NO_VTABLE cDecalEnum :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cDecalEnum, &CLSID_DecalEnum>,
public IDecalEnum
{
public:
cDecalEnum()
: m_nIndex( -1 )
{
}
~cDecalEnum();
DECLARE_REGISTRY_RESOURCEID(IDR_DECALENUM)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cDecalEnum)
COM_INTERFACE_ENTRY(IDecalEnum)
END_COM_MAP()
bool Initialize( IDecal *pDecal, BSTR strKey );
// Skip to a single key - next will terminate iteration
HRESULT Advance( REFCLSID clsid );
// Load an ordered list of keys
HRESULT Begin();
struct cKeyEntry
{
CLSID m_clsid;
TCHAR m_letter;
};
void insertKey ( cKeyEntry &ke, TCHAR *szOrder, TCHAR *szEndOrder );
HRESULT openKeyAt ( int nIndex );
typedef std::vector< cKeyEntry > cKeyList;
cKeyList m_keys;
int m_nIndex;
_bstr_t m_strGroup;
std::string m_strGroupKey;
RegKey m_key;
bool m_bOrderChanged;
// This member is purely for holdinga reference to the main decal object
// and keep this object from being orphaned
CComPtr< IDecal > m_pDecal;
// IDecalEnum
public:
STDMETHOD(MoveBefore)(REFCLSID clsidBefore);
STDMETHOD(get_Group)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(get_Property)(BSTR Name, /*[out, retval]*/ VARIANT *pVal);
STDMETHOD(get_ResourcePath)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(get_SurrogateClass)(/*[out, retval]*/ CLSID *pVal);
STDMETHOD(Next)();
STDMETHOD(CreateInstance)(REFIID iid, /*[out, retval, iid_is(iid)]*/ LPVOID *ppvItf);
STDMETHOD(get_Enabled)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Enabled)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_ComClass)(/*[out, retval]*/ CLSID *pVal);
STDMETHOD(get_FriendlyName)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(Skip)(REFCLSID clsid);
};
#endif //__DECALENUM_H_

View file

@ -0,0 +1,636 @@
// DecalManager.cpp : Implementation of cDecal
#include "stdafx.h"
#include "Decal.h"
#include "DecalManager.h"
#include "DecalEnum.h"
#include "PluginSite.h"
/////////////////////////////////////////////////////////////////////////////
// cDecal
HRESULT cDecal::convertToken( std::string &strToken, std::string &strOut )
{
USES_CONVERSION;
struct cPathRegistry
{
LPCTSTR szToken,
szKey,
szValue;
};
static cPathRegistry _paths[] = {
{ _T( "ac" ), _T( "SOFTWARE\\Microsoft\\Microsoft Games\\Asheron's Call\\1.00" ), _T( "Portal Dat" ) },
{ _T( "decal" ), _T( "SOFTWARE\\Decal\\Agent" ), _T( "AgentPath" ) } },
*_end_paths = _paths + sizeof( _paths ) / sizeof( cPathRegistry );
// There are two types of tokens, ones that contain a colon (object relative)
// and the other kind, which just gets looked up in the registry
int nColon = strToken.find_first_of( _T( ':' ) );
if( nColon == std::string::npos )
{
// Take the whole token string and look it up
for( cPathRegistry *pPath = _paths; pPath != _end_paths; ++ pPath )
{
if( strToken.compare( pPath->szToken ) != 0 )
continue;
// Found the path now look it up in the registry
DWORD dwCount = MAX_PATH;
TCHAR szBuffer[ MAX_PATH ];
RegKey key;
key.Open( HKEY_LOCAL_MACHINE, pPath->szKey );
key.QueryStringValue (pPath->szValue, szBuffer, &dwCount);
strOut += T2A( szBuffer );
return S_OK;
}
// Token not found
_ASSERT( FALSE );
return E_INVALIDARG;
}
// Attempt to convert the CLSID
LPOLESTR strCLSID = A2OLE( strToken.substr( nColon + 1 ).c_str() );
HRESULT hRes;
CLSID clsid;
if( strCLSID[ 0 ] == OLESTR( '{' ) )
hRes = ::CLSIDFromString( strCLSID, &clsid );
else
hRes = ::CLSIDFromProgID( strCLSID, &clsid );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
CComPtr< IDecalEnum > pEnum;
if( get_Configuration( _bstr_t( strToken.substr( 0, nColon ).c_str() ), clsid, &pEnum ) != S_OK )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
CComBSTR strResourcePath;
if( FAILED( pEnum->get_ResourcePath( &strResourcePath ) ) )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
strOut += OLE2A( strResourcePath );
return S_OK;
}
STDMETHODIMP cDecal::InitGraphics( IUnknown *pDirectDraw, IUnknown *pD3DDevice )
{
m_pD = static_cast< IDirectDraw4 * >( pDirectDraw );
m_pD3D = static_cast< IDirect3DDevice3 * >( pD3DDevice );
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( !( i->m_dwCaps & eServiceRender ) )
continue;
CComPtr< IDecalRender > pRender;
HRESULT hRes = i->m_p->QueryInterface( &pRender );
_ASSERTE( SUCCEEDED( hRes ) );
pRender->ChangeDirectX();
}
return S_OK;
}
STDMETHODIMP cDecal::get_DirectDraw(REFIID iid, VOID * * ppvItf)
{
return m_pD->QueryInterface( iid, ppvItf );
}
STDMETHODIMP cDecal::get_D3DDevice(REFIID iid, VOID * * ppvItf)
{
return m_pD3D->QueryInterface( iid, ppvItf );
}
STDMETHODIMP cDecal::get_HWND(LONG * pVal)
{
if (pVal == NULL)
return E_POINTER;
*pVal = reinterpret_cast< long >( m_hWnd );
return S_OK;
}
STDMETHODIMP cDecal::put_HWND( LONG newVal )
{
HWND newWnd = reinterpret_cast< HWND >( newVal );
if( newWnd != m_hWnd )
{
m_hWnd = newWnd;
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( !( i->m_dwCaps & eServiceRender ) )
continue;
CComPtr< IDecalRender > pRender;
HRESULT hRes = i->m_p->QueryInterface( &pRender );
_ASSERTE( SUCCEEDED( hRes ) );
pRender->ChangeHWND();
}
}
return S_OK;
}
STDMETHODIMP cDecal::get_Focus(VARIANT_BOOL * pVal)
{
if (pVal == NULL)
return E_POINTER;
*pVal = m_bFocus;
return S_OK;
}
STDMETHODIMP cDecal::put_Focus( VARIANT_BOOL newVal )
{
m_bFocus = newVal;
return S_OK;
}
STDMETHODIMP cDecal::get_ScreenSize(long *pWidth, long *pHeight)
{
if (pWidth == NULL || pHeight == NULL)
return E_POINTER;
RECT rc;
::GetClientRect( m_hWnd, &rc );
*pWidth = rc.right - rc.left;
*pHeight = rc.bottom - rc.top;
return S_OK;
}
STDMETHODIMP cDecal::MapPath(BSTR pPath, BSTR * pMapped)
{
USES_CONVERSION;
if (pMapped == NULL)
{
_ASSERT( FALSE );
return E_POINTER;
}
std::string str( OLE2A( pPath ) ),
strOut;
// If the base implementation, iterate over the %% pairs and make substitutions
// where appropriate
int nIterate = 0;
for( ;; )
{
int nStart = str.find_first_of( _T( '%' ), nIterate );
if( nStart == std::string::npos )
{
strOut += str.substr( nIterate );
break;
}
int nEnd = str.find_first_of( _T( '%' ), nStart + 1 );
HRESULT hRes = convertToken( str.substr( nStart + 1, nEnd - ( nStart + 1 ) ), strOut );
if( FAILED( hRes ) )
return hRes;
if( nEnd == std::string::npos )
{
// Unterminated '%'
_ASSERT( FALSE );
return E_INVALIDARG;
}
nIterate = nEnd + 1;
if( nIterate == str.length() )
{
// The string ended in a token, break now
break;
}
}
// We're done - convert the string
*pMapped = A2BSTR( strOut.c_str() );
return S_OK;
}
STDMETHODIMP cDecal::StartPlugins()
{
if( !m_bServicesStarted )
{
HRESULT hRes = StartServices();
if( FAILED( hRes ) )
return hRes;
}
if( m_bPluginsStarted )
return S_FALSE;
// Walk through the list of services and send the plugin start notification
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
i->m_p->BeforePlugins();
}
CComPtr< IDecalEnum > pEnumPlugins;
get_Configuration( _bstr_t( "Plugins" ), GUID_NULL, &pEnumPlugins );
while( pEnumPlugins->Next() == S_OK )
{
VARIANT_BOOL bEnabled;
pEnumPlugins->get_Enabled( &bEnabled );
if( !bEnabled )
continue;
cPlugin plugin;
pEnumPlugins->get_ComClass( &plugin.m_clsid );
// Attempt to make an instance of the plugin
CComPtr< IPlugin2 > pPlugin;
HRESULT hRes = pEnumPlugins->CreateInstance( __uuidof( IPlugin2 ), reinterpret_cast< void ** >( &pPlugin ) );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
continue;
}
CComObject< cPluginSite > *pSite;
CComObject< cPluginSite >::CreateInstance( &pSite );
CComPtr< IPluginSite2 > pSiteRef = pSite;
pSite->m_pPlugin = pPlugin;
pSite->m_pDecal = this;
hRes = pSite->m_pPlugin->Initialize( pSiteRef );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
continue;
}
plugin.m_pSite = pSite;
m_plugins.push_back( plugin );
// NOTE: If the plugin has not stored the IPluginSite2 interface pointer, it
// will immediately terminate
}
m_bPluginsStarted = true;
return S_OK;
}
STDMETHODIMP cDecal::StopPlugins()
{
if( !m_bPluginsStarted )
return S_FALSE;
IPluginSite2 **pSites = reinterpret_cast< IPluginSite2 ** > ( _alloca ( sizeof ( IPluginSite2 * ) * m_plugins.size () ) );
{
IPluginSite2 **i2 = pSites;
for( cPluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++ i, ++ i2 )
*i2 = i->m_pSite;
}
{
IPluginSite2 **end_sites = pSites + m_plugins.size ();
for ( IPluginSite2 **i = pSites; i != end_sites; ++ i )
( *i )->Unload ();
}
_ASSERTE ( m_plugins.empty () );
m_bPluginsStarted = false;
// Walk through the list of services and send the plugin start notification
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
i->m_p->AfterPlugins();
}
return S_OK;
}
STDMETHODIMP cDecal::get_Object(BSTR strPath, REFIID iid, LPVOID *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
USES_CONVERSION;
std::string str = OLE2A( strPath );
// OK, strPath is formated as such, {plugin|service}\{{clsid|progid}[\text]
int nOffset = str.find_first_of( _T( '\\' ) );
if( nOffset == std::string::npos )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
// Find the next backslash
int nclsid = str.find_first_of( _T( '\\' ), nOffset + 1 );
// Attempt to convert it to a CLSID
std::string strCLSID = str.substr( nOffset + 1, nclsid - ( nOffset + 1 ) );
CLSID clsid;
HRESULT hRes;
if( strCLSID[ 0 ] == _T( '{' ) )
hRes = ::CLSIDFromString( A2OLE( strCLSID.c_str() ), &clsid );
else
hRes = ::CLSIDFromProgID( A2OLE( strCLSID.c_str() ), &clsid );
if( FAILED( hRes ) )
{
// The substring could not be converted to a proper CLSID
_ASSERT( FALSE );
return E_INVALIDARG;
}
std::string collection = str.substr( 0, nOffset );
CComPtr< IUnknown > pObject;
if( collection.compare( "plugins" ) == 0 )
{
for( cPluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++ i )
{
if( i->m_clsid == clsid )
{
pObject = i->m_pSite->m_pPlugin;
break;
}
}
}
else if( collection.compare( "services" ) == 0 )
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( i->m_clsid == clsid )
{
pObject = i->m_p;
break;
}
}
}
else
{
// Invalid prefix
_ASSERT( FALSE );
return E_INVALIDARG;
}
if( pObject == NULL )
{
// Could not find a match for that clsid
_ASSERT( FALSE );
return E_INVALIDARG;
}
while( nclsid != std::string::npos )
{
CComPtr< IDecalDirectory > pDir;
HRESULT hRes = pObject->QueryInterface( &pDir );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
int nEndclsid = str.find_first_of( _T( '\\' ), nclsid + 1 );
pObject.Release();
hRes = pDir->Lookup( _bstr_t( str.substr( nclsid + 1, nEndclsid - ( nclsid + 1 ) ).c_str() ), &pObject );
if( FAILED( hRes ) )
return hRes;
nclsid = nEndclsid;
}
return pObject->QueryInterface( iid, pVal );
}
struct cItfCaps
{
const IID *iid;
DWORD m_dwMask;
};
STDMETHODIMP cDecal::StartServices()
{
static cItfCaps _service_caps[] = {
{ &IID_IDecalRender, eServiceRender } },
*_end_service_caps = _service_caps + sizeof( _service_caps ) / sizeof( cItfCaps );
if( m_bServicesStarted )
// They've already been started
return S_FALSE;
m_pHooks.CoCreateInstance( _bstr_t( "Decal.ACHooks" ), NULL, CLSCTX_INPROC_SERVER );
m_pHooks->SetDecal( reinterpret_cast< IUnknown * >( this ) );
CComPtr< IDecalEnum > pEnumServices;
get_Configuration( _bstr_t( "Services" ), GUID_NULL, &pEnumServices );
while( pEnumServices->Next() == S_OK )
{
VARIANT_BOOL bEnabled;
HRESULT hRes = pEnumServices->get_Enabled ( &bEnabled );
_ASSERTE ( SUCCEEDED ( hRes ) );
if ( !bEnabled )
continue;
cService service;
pEnumServices->get_ComClass( &service.m_clsid );
hRes = pEnumServices->CreateInstance( __uuidof( IDecalService ), reinterpret_cast< void ** >( &service.m_p ) );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
// Unlike plugins, all services must initialize correctly
return hRes;
}
hRes = service.m_p->Initialize( this );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
// The service could not initialize for some reason
return hRes;
}
service.m_dwCaps = 0;
CComPtr< IUnknown > pUnkCaps;
for( cItfCaps *i_caps = _service_caps; i_caps != _end_service_caps; ++ i_caps )
{
HRESULT hRes = service.m_p->QueryInterface( *i_caps->iid, reinterpret_cast< void ** >( &pUnkCaps ) );
if( SUCCEEDED( hRes ) )
{
service.m_dwCaps |= i_caps->m_dwMask;
pUnkCaps.Release();
}
}
m_services.push_back( service );
}
m_bServicesStarted = true;
return S_OK;
}
STDMETHODIMP cDecal::get_Configuration(BSTR strType, REFCLSID clsidAdvance, IDecalEnum **pVal)
{
if (pVal == NULL)
{
_ASSERT( FALSE );
return E_POINTER;
}
CComObject< cDecalEnum > *pEnum;
HRESULT hRes = CComObject< cDecalEnum >::CreateInstance( &pEnum );
if( FAILED( hRes ) )
return hRes;
CComPtr< IUnknown > pUnk = pEnum;
if( !pEnum->Initialize( this, strType ) )
return E_FAIL;
if( clsidAdvance != GUID_NULL )
{
HRESULT hRes = pEnum->Advance( clsidAdvance );
if ( FAILED ( hRes ) )
return hRes;
}
else
{
HRESULT hRes = pEnum->Begin();
if ( FAILED ( hRes ) )
return hRes;
}
return pUnk->QueryInterface( pVal );
}
STDMETHODIMP cDecal::StopServices()
{
if( m_bPluginsStarted )
StopPlugins( );
if( !m_bServicesStarted )
return S_FALSE;
try
{
while( !m_services.empty() )
{
cServiceList::iterator i = ( m_services.end() - 1 );
i->m_p->Terminate();
m_services.erase( i );
}
}
catch( ... )
{
}
if( m_pHooks.p )
m_pHooks.Release( );
return S_OK;
}
STDMETHODIMP cDecal::get_Plugin(REFCLSID clsid, REFIID iid, LPVOID *pVal)
{
for( cPluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++ i )
{
if( i->m_clsid == clsid )
return i->m_pSite->m_pPlugin->QueryInterface( iid, pVal );
}
return E_INVALIDARG;
}
STDMETHODIMP cDecal::get_Service(REFCLSID clsid, REFIID iid, LPVOID *pVal)
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( i->m_clsid == clsid )
return i->m_p->QueryInterface( iid, pVal );
}
return E_INVALIDARG;
}
STDMETHODIMP cDecal::Render2D()
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( !( i->m_dwCaps & eServiceRender ) )
continue;
CComPtr< IDecalRender > pRender;
HRESULT hRes = i->m_p->QueryInterface( &pRender );
_ASSERTE( SUCCEEDED( hRes ) );
pRender->Render2D();
}
return S_OK;
}
STDMETHODIMP cDecal::Render3D()
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( !( i->m_dwCaps & eServiceRender ) )
continue;
CComPtr< IDecalRender > pRender;
HRESULT hRes = i->m_p->QueryInterface( &pRender );
_ASSERTE( SUCCEEDED( hRes ) );
pRender->Render3D();
}
return S_OK;
}
STDMETHODIMP cDecal::get_Hooks(IACHooks** pVal)
{
if( m_pHooks == NULL )
return E_FAIL;
m_pHooks->QueryInterface( pVal );
return S_OK;
}

View file

@ -0,0 +1,99 @@
// DecalManager.h : Declaration of the cDecal
#ifndef __DECAL_H_
#define __DECAL_H_
#include "resource.h" // main symbols
class cPluginSite;
/////////////////////////////////////////////////////////////////////////////
// cDecal
class ATL_NO_VTABLE cDecal :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cDecal, &CLSID_Decal>,
public IDecal
{
public:
cDecal()
: m_pD( NULL ),
m_pD3D( NULL ),
m_hWnd( NULL ),
m_bFocus( VARIANT_FALSE ),
m_bServicesStarted( false ),
m_bPluginsStarted( false )
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_DECAL)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cDecal)
COM_INTERFACE_ENTRY(IDecal)
END_COM_MAP()
struct cService
{
CLSID m_clsid;
DWORD m_dwCaps;
CComPtr< IDecalService > m_p;
};
enum eServiceCaps
{
eServiceRender = 0x01
};
typedef std::vector< cService > cServiceList;
cServiceList m_services;
struct cPlugin
{
CLSID m_clsid;
cPluginSite *m_pSite;
};
typedef std::vector< cPlugin > cPluginList;
cPluginList m_plugins;
bool m_bServicesStarted,
m_bPluginsStarted;
IDirectDraw4 *m_pD;
IDirect3DDevice3 *m_pD3D;
HWND m_hWnd;
VARIANT_BOOL m_bFocus;
CComPtr< IACHooks > m_pHooks;
HRESULT convertToken( std::string &strToken, std::string &strOut );
public:
// IDecal
STDMETHOD(InitGraphics)( IUnknown *pDirectDraw, IUnknown *pD3DDevice );
STDMETHOD(get_DirectDraw)(REFIID iid, VOID * * ppvItf);
STDMETHOD(get_D3DDevice)(REFIID iid, VOID * * ppvItf);
STDMETHOD(Render3D)();
STDMETHOD(Render2D)();
STDMETHOD(get_HWND)(LONG * pVal);
STDMETHOD(put_HWND)(LONG newVal);
STDMETHOD(get_Focus)(VARIANT_BOOL *pVal);
STDMETHOD(put_Focus)(VARIANT_BOOL newVal);
STDMETHOD(get_ScreenSize)(long *pWidth, long *pHeight);
STDMETHOD(get_Object)(BSTR strPath, REFIID iid, /*[out, retval]*/ LPVOID *pVal);
STDMETHOD(MapPath)(BSTR pPath, BSTR * pMapped);
STDMETHOD(StartServices)();
STDMETHOD(StopServices)();
STDMETHOD(StartPlugins)();
STDMETHOD(StopPlugins)();
STDMETHOD(get_Configuration)(BSTR strType, /*[default(GUID_NULL)]*/ REFCLSID clsidAdvance, /*[out, retval]*/ IDecalEnum * *pVal);
STDMETHOD(get_Service)(REFCLSID clsid, REFIID iid, /*[out, retval]*/ LPVOID *pVal);
STDMETHOD(get_Plugin)(REFCLSID clsid, REFIID iid, /*[out, retval]*/ LPVOID *pVal);
STDMETHOD(get_Hooks)(IACHooks** pVal);
};
#endif //__DECAL_H_

152
Native/Decal/DecalRes.cpp Normal file
View file

@ -0,0 +1,152 @@
// DecalRes.cpp : Implementation of cDecalRes
#include "stdafx.h"
#include "Decal.h"
#include "DecalRes.h"
/////////////////////////////////////////////////////////////////////////////
// cDecalRes
HRESULT cDecalRes::getLibID( MSXML::IXMLDOMDocumentPtr &pdoc, GUID *pGUID )
{
_variant_t vlib = pdoc->selectSingleNode( _T( "/*/@lib" ) )->text;
if( vlib.vt == VT_NULL )
{
// lib is a required field
_ASSERT( FALSE );
return E_FAIL;
}
return ::CLSIDFromString( vlib.bstrVal, pGUID );
}
bool cDecalRes::getTypelibFilename( MSXML::IXMLDOMDocumentPtr &pdoc, BSTR *pbstrFilename )
{
USES_CONVERSION;
GUID libid;
HRESULT hRes = getLibID( pdoc, &libid );
if( FAILED( hRes ) )
return SUCCEEDED ( hRes );
// Look up the path of the typelib in the registry
hRes = ::QueryPathOfRegTypeLib( libid, 1, 0, 0, pbstrFilename );
if( SUCCEEDED( hRes ) )
return true;
// Otherwise, manufacture a type library filename
RegKey key;
key.Open( HKEY_LOCAL_MACHINE, _T( "Software\\Decal\\Agent" ) );
TCHAR szPath[ MAX_PATH ];
DWORD dwPath = MAX_PATH;
key.QueryStringValue (_T("PluginPath"), szPath, &dwPath);
if( szPath[ ::_tcslen( szPath ) - 1 ] != _T( '\\' ) )
::_tcscat( szPath, _T( "\\" ) );
_variant_t vName = pdoc->selectSingleNode( _T( "/*/@name" ) )->text;
if( vName.vt == VT_NULL )
::_tcscat( szPath, _T( "ErrorUnnamedTypelib.tlb" ) );
else
{
::_tcscat( szPath, OLE2T( vName.bstrVal ) );
::_tcscat( szPath, _T( ".tlb" ) );
}
*pbstrFilename = T2BSTR( szPath );
return false;
}
HRESULT cDecalRes::initTypelib( MSXML::IXMLDOMDocumentPtr &pdoc, BSTR strFilename )
{
HRESULT hRes = ::CreateTypeLib2( SYS_WIN32, strFilename, &m_pLib );
if( FAILED( hRes ) )
return hRes;
GUID libid;
hRes = getLibID( pdoc, &libid );
if( FAILED( hRes ) )
return hRes;
m_pLib->SetGuid( libid );
_variant_t vName = pdoc->selectSingleNode( _T( "/*/@name" ) )->text;
if( vName.vt == VT_NULL )
{
// Name is a required field
_ASSERT( FALSE );
return E_FAIL;
}
m_pLib->SetName( vName.bstrVal );
m_pLib->SetVersion( 1, 0 );
// One initialized typelib
return S_OK;
}
HRESULT cDecalRes::scanTemplate( MSXML::IXMLDOMElementPtr &ptemp, ITypeInfo **ppCoClass, ITypeInfo **ppSource )
{
// Get the IDs for the coclass, default interface and default source interface
_variant_t vIDCoClass = ptemp->getAttribute( _T( "class" ) ),
vIDEvent = ptemp->getAttribute( _T( "event" ) ),
vName = ptemp->getAttribute( _T( "name" ) );
if( vIDCoClass.vt == VT_NULL || vIDEvent.vt == VT_NULL || vName.vt == VT_NULL )
{
// Both of these are required
_ASSERT( FALSE );
return E_FAIL;
}
// Next convert them to GUIDs
CLSID idClass;
IID idEvent;
if( FAILED( ::CLSIDFromString( vIDCoClass.bstrVal, &idClass ) ) ||
FAILED( ::CLSIDFromString( vIDEvent.bstrVal, &idEvent ) ) )
{
// They must be converted to guids
_ASSERT( FALSE );
return E_FAIL;
}
// Now we make the coclass typeinfo, default source typeinfo, get the default interface typeinfo
// and slap them all together
CComPtr< ICreateTypeInfo > pCoClass;
m_pLib->CreateTypeInfo( vName.bstrVal, TKIND_COCLASS, &pCoClass );
pCoClass->SetGuid( idClass );
pCoClass->QueryInterface( ppCoClass );
CComPtr< ITypeInfo > pDefaultItf;
GetTypeInfo( 0, 0, &pDefaultItf );
HREFTYPE hrefDefaultItf;
pCoClass->AddRefTypeInfo( pDefaultItf, &hrefDefaultItf );
pCoClass->AddImplType( 0, hrefDefaultItf );
pCoClass->SetImplTypeFlags( 0, IMPLTYPEFLAG_FDEFAULT );
CComPtr< ICreateTypeInfo > pSourceItf;
_bstr_t strEvent( _T( "_" ) );
strEvent += vName.bstrVal;
strEvent += _T( "Events" );
m_pLib->CreateTypeInfo( strEvent, TKIND_DISPATCH, &pSourceItf );
pSourceItf->SetGuid( idEvent );
HREFTYPE hrefSourceItf;
pSourceItf->QueryInterface( ppSource );
pCoClass->AddRefTypeInfo( *ppSource, &hrefSourceItf );
pCoClass->AddImplType( 1, hrefSourceItf );
pCoClass->SetImplTypeFlags( 1, IMPLTYPEFLAG_FDEFAULT | IMPLTYPEFLAG_FSOURCE );
// Still incomplete
return S_OK;
}

337
Native/Decal/DecalRes.h Normal file
View file

@ -0,0 +1,337 @@
// DecalRes.h : Declaration of the cDecalRes
#ifndef __DECALRES_H_
#define __DECALRES_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cDecalRes
class ATL_NO_VTABLE cDecalRes :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cDecalRes, &CLSID_DecalRes>,
public IDispatchImpl<IDecalRes, &IID_IDecalRes, &LIBID_Decal>,
public IConnectionPoint,
public IConnectionPointContainer,
public IProvideClassInfo2
{
public:
cDecalRes()
: m_dwNextCookie( 1 )
{
}
// This object iterates over our one connection
// point.
class cEnumRes
: public CComObjectRootEx<CComMultiThreadModel>,
public IEnumConnectionPoints
{
public:
BEGIN_COM_MAP(cEnumRes)
COM_INTERFACE_ENTRY(IEnumConnectionPoints)
END_COM_MAP()
bool m_bEnd;
CComPtr< IConnectionPoint > m_pCP;
void init( IConnectionPoint *pCP )
{
m_pCP = pCP;
m_bEnd = false;
}
public:
// IEnumConnectionPoints
STDMETHOD(Next)( ULONG cConnections, IConnectionPoint **rgpcn, ULONG *pcFetched )
{
if( m_bEnd )
{
*pcFetched = 0;
return S_FALSE;
}
if( cConnections == 0 )
{
*pcFetched = 0;
return S_OK;
}
m_bEnd = true;
*pcFetched = 1;
return m_pCP->QueryInterface( rgpcn );
}
STDMETHOD(Skip)( ULONG cConnections )
{
if( cConnections == 0 )
return S_OK;
m_bEnd = true;
return S_OK;
}
STDMETHOD(Reset)()
{
m_bEnd = false;
return S_OK;
}
STDMETHOD(Clone)(IEnumConnectionPoints **ppNew )
{
CComObject< cEnumRes > *pEnum;
CComObject< cEnumRes >::CreateInstance( &pEnum );
pEnum->m_pCP = m_pCP;
pEnum->m_bEnd = m_bEnd;
return pEnum->QueryInterface( IID_IEnumConnectionPoints, reinterpret_cast< void ** >( ppNew ) );
}
};
// This object implements the event object - Fire resolves
// to dispatching an event to our parent. This object is added
// into the namespace of the resource.
class cResEvent
: public CComObjectRootEx<CComMultiThreadModel>,
public IDispatch
{
public:
BEGIN_COM_MAP(cResEvent)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
CComPtr< ITypeInfo > m_pItf;
cDecalRes *m_pRes;
DISPID m_dispid;
HRESULT load( MSXML::IXMLDOMElementPtr &pElement )
{
// TODO: load the dispid and Fire paramters and create the temporary typeinfo
}
public:
// IDispatch
STDMETHOD(GetTypeInfoCount)( UINT *pctinfo )
{
if( pctinfo == NULL )
return E_POINTER;
*pctinfo = 1;
return S_OK;
}
STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID, ITypeInfo **ppTI )
{
if( iTInfo != 0 )
return E_INVALIDARG;
if( ppTI == NULL )
return E_POINTER;
return m_pItf->QueryInterface( ppTI );
}
STDMETHOD(GetIDsOfNames)(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID, DISPID *rgDispID)
{
if( rgDispID == NULL || rgszNames == NULL )
// By spec
return E_POINTER;
if( !::InlineIsEqualGUID( riid, IID_NULL ) )
// By spec
return DISP_E_UNKNOWNINTERFACE;
static LPOLESTR _szFire = OLESTR( "Fire" );
for( UINT i = 0; i < cNames; ++ i )
{
if( ::wcscmp( _szFire, rgszNames[ i ] ) == 0 )
rgDispID[ i ] = 1;
else
rgDispID[ i ] = -1;
}
return S_OK;
}
STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *pArgError )
{
// Do all the checks in here
if( dispIdMember != 1 )
return DISP_E_MEMBERNOTFOUND;
if( !::InlineIsEqualGUID( riid, IID_NULL ) )
return DISP_E_UNKNOWNINTERFACE;
if( wFlags != DISPATCH_METHOD )
return DISP_E_MEMBERNOTFOUND;
return m_pRes->dispatchEvent( m_dispid, pDispParams, pVarResult, pExcepInfo, pArgError );
}
};
// Generated TypeInfo
CComPtr< ICreateTypeLib2 > m_pLib;
CComPtr< ITypeInfo > m_pCoClass;
CComPtr< ICreateTypeInfo > m_pSource;
HRESULT GetSourceIID( IID *pIID )
{
if( !m_pSource.p )
// Not yet initialized - bad
return E_FAIL;
CComPtr< ITypeInfo > pTI;
HRESULT hRes = m_pSource->QueryInterface( &pTI );
if( FAILED( hRes ) )
return hRes;
TYPEATTR *pTA;
pTI->GetTypeAttr( &pTA );
*pIID = pTA->guid;
pTI->ReleaseTypeAttr( pTA );
return S_OK;
}
// Connection point members
typedef std::deque< std::pair< DWORD, CComPtr< IDispatch > > > cCPList;
DWORD m_dwNextCookie;
cCPList m_cp;
HRESULT dispatchEvent( DISPID nID, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr )
{
// We simply pass the invoke on, the event object calling us
// will correctly remap the ID.
for( cCPList::iterator i = m_cp.begin(); i != m_cp.end(); ++ i )
i->second->Invoke( nID, IID_NULL, 0, DISPATCH_METHOD, pDispParams, pVarResult, pExcepInfo, puArgErr );
return S_OK;
}
// Series of methods to create the type library
HRESULT getLibID( MSXML::IXMLDOMDocumentPtr &pdoc, GUID *pGUID );
bool getTypelibFilename( MSXML::IXMLDOMDocumentPtr &pdoc, BSTR *pbstrFilename );
HRESULT initTypelib( MSXML::IXMLDOMDocumentPtr &pdoc, BSTR strFilename );
HRESULT scanTemplate( MSXML::IXMLDOMElementPtr &ptemp, ITypeInfo **ppCoClass, ITypeInfo **ppSource );
DECLARE_REGISTRY_RESOURCEID(IDR_DECALRES)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cDecalRes)
COM_INTERFACE_ENTRY(IDecalRes)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IConnectionPoint)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
END_COM_MAP()
// IDecalRes
public:
// IConnectionPointContainer
STDMETHOD(EnumConnectionPoints)( IEnumConnectionPoints **ppEnum )
{
CComObject< cEnumRes > *pEnum;
CComObject< cEnumRes >::CreateInstance( &pEnum );
pEnum->init( this );
return pEnum->QueryInterface( IID_IEnumConnectionPoints, reinterpret_cast< void ** >( ppEnum ) );
}
STDMETHOD(FindConnectionPoint)( REFIID iid, IConnectionPoint **ppCP )
{
if( ppCP == NULL )
return E_POINTER;
IID iidSource;
HRESULT hRes = GetSourceIID( &iidSource );
if( FAILED( hRes ) )
return hRes;
if( ::InlineIsEqualGUID( iid, GUID_NULL ) ||
::InlineIsEqualGUID( iid, iidSource ) )
{
// Return the connection point
return static_cast< IConnectionPoint * >( this )->QueryInterface( ppCP );
}
// Not found (duh, it's not the only connection)
return CONNECT_E_NOCONNECTION;
}
// IConnectionPoint
STDMETHOD(GetConnectionInterface)( IID *piid )
{
if( piid == NULL )
return E_POINTER;
return GetSourceIID( piid );
}
STDMETHOD(GetConnectionPointContainer)( IConnectionPointContainer **ppCPC )
{
return static_cast< IConnectionPoint * >( this )->QueryInterface( ppCPC );
}
STDMETHOD(Advise)(IUnknown *pUnk, DWORD *pdwCookie)
{
if( pdwCookie == NULL || pUnk == NULL )
return E_POINTER;
CComPtr< IDispatch > pDisp;
HRESULT hRes = pUnk->QueryInterface( &pDisp );
if( FAILED( hRes ) )
return hRes;
m_cp.push_back( cCPList::value_type( m_dwNextCookie, pDisp ) );
*pdwCookie = ( m_dwNextCookie ++ );
return S_OK;
}
STDMETHOD(Unadvise)( DWORD dwCookie )
{
// Find the matching cookie
for( cCPList::iterator i = m_cp.begin(); i != m_cp.end(); ++ i )
{
if( i->first == dwCookie )
{
m_cp.erase( i );
return S_OK;
}
}
return CONNECT_E_NOCONNECTION;
}
STDMETHOD(EnumConnections)(IEnumConnections **)
{
// We don't support enum'ing connections
return E_NOTIMPL;
}
// IProvideClassInfo
STDMETHOD(GetClassInfo)(ITypeInfo **ppTI)
{
return m_pCoClass->QueryInterface( ppTI );
}
// IProvideClassInfo2
STDMETHOD(GetGUID)(DWORD dwGuidKind, GUID *pGUID)
{
if( dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID )
return E_INVALIDARG;
if( pGUID == NULL )
return E_POINTER;
return GetSourceIID( pGUID );
}
};
#endif //__DECALRES_H_

26
Native/Decal/DecalRes.rgs Normal file
View file

@ -0,0 +1,26 @@
HKCR
{
Decal.DecalRes.1 = s 'DecalRes Class'
{
CLSID = s '{EA7BE91B-C98A-4138-8985-E22364BE8207}'
}
Decal.DecalRes = s 'DecalRes Class'
{
CLSID = s '{EA7BE91B-C98A-4138-8985-E22364BE8207}'
CurVer = s 'Decal.DecalRes.1'
}
NoRemove CLSID
{
ForceRemove {EA7BE91B-C98A-4138-8985-E22364BE8207} = s 'DecalRes Class'
{
ProgID = s 'Decal.DecalRes.1'
VersionIndependentProgID = s 'Decal.DecalRes'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732}'
}
}
}

11
Native/Decal/Decalps.def Normal file
View file

@ -0,0 +1,11 @@
LIBRARY "DecalPS"
DESCRIPTION 'Proxy/Stub DLL'
EXPORTS
DllGetClassObject @1 PRIVATE
DllCanUnloadNow @2 PRIVATE
GetProxyDllInfo @3 PRIVATE
DllRegisterServer @4 PRIVATE
DllUnregisterServer @5 PRIVATE

16
Native/Decal/Decalps.mk Normal file
View file

@ -0,0 +1,16 @@
Decalps.dll: dlldata.obj Decal_p.obj Decal_i.obj
link /dll /out:Decalps.dll /def:Decalps.def /entry:DllMain dlldata.obj Decal_p.obj Decal_i.obj \
kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \
.c.obj:
cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \
$<
clean:
@del Decalps.dll
@del Decalps.lib
@del Decalps.exp
@del dlldata.obj
@del Decal_p.obj
@del Decal_i.obj

View file

@ -0,0 +1,49 @@
// PluginSite.cpp : Implementation of cPluginSite
#include "stdafx.h"
#include "Decal.h"
#include "PluginSite.h"
#include "DecalManager.h"
/////////////////////////////////////////////////////////////////////////////
// cPluginSite
void cPluginSite::FinalRelease()
{
_ASSERTE( m_pDecal != NULL );
for( cDecal::cPluginList::iterator i = m_pDecal->m_plugins.begin(); i != m_pDecal->m_plugins.end(); ++ i )
{
if( i->m_pSite == this )
{
m_pDecal->m_plugins.erase( i );
return;
}
}
// Could not find ourself in the list (bad initialization?)
_ASSERT( FALSE );
}
STDMETHODIMP cPluginSite::Unload()
{
// Hold a reference to ourself, to keep everything 'together' until
// the method returns
CComPtr< IUnknown > pThis( this );
m_pPlugin->Terminate();
m_pPlugin.Release();
return S_OK;
}
STDMETHODIMP cPluginSite::get_Decal(IDecal **pVal)
{
return m_pDecal->QueryInterface( IID_IDecal, reinterpret_cast< void ** >( pVal ) );
}
STDMETHODIMP cPluginSite::get_Object(BSTR Path, LPDISPATCH *pVal)
{
return m_pDecal->get_Object( Path, IID_IDispatch, reinterpret_cast< void ** >( pVal ) );
}

42
Native/Decal/PluginSite.h Normal file
View file

@ -0,0 +1,42 @@
// PluginSite.h : Declaration of the cPluginSite
#ifndef __PLUGINSITE_H_
#define __PLUGINSITE_H_
#include "resource.h" // main symbols
class cDecal;
/////////////////////////////////////////////////////////////////////////////
// cPluginSite
class ATL_NO_VTABLE cPluginSite :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cPluginSite, &CLSID_PluginSite2>,
public IPluginSite2
{
public:
cPluginSite()
{
}
void FinalRelease();
DECLARE_REGISTRY_RESOURCEID(IDR_PLUGINSITE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cPluginSite)
COM_INTERFACE_ENTRY(IPluginSite2)
END_COM_MAP()
CComPtr< IPlugin2 > m_pPlugin;
cDecal *m_pDecal;
// IPluginSite2
public:
STDMETHOD(get_Object)(BSTR Path, /*[out, retval]*/ LPDISPATCH *pVal);
STDMETHOD(get_Decal)(/*[out, retval]*/ IDecal * *pVal);
STDMETHOD(Unload)();
};
#endif //__PLUGINSITE_H_

5
Native/Decal/StdAfx.cpp Normal file
View file

@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// stdafx.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

51
Native/Decal/StdAfx.h Normal file
View file

@ -0,0 +1,51 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__C8B6D65E_6F24_4AE7_A4BF_AFEF8775700C__INCLUDED_)
#define AFX_STDAFX_H__C8B6D65E_6F24_4AE7_A4BF_AFEF8775700C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#define _WIN32_WINDOWS 0x0410
#define _ATL_APARTMENT_THREADED
#define DIRECTINPUT_VERSION 0x600
#pragma warning(disable:4530)
#ifdef NDEBUG
#ifdef _ATL_DLL
#undef _ATL_DLL
#endif
#endif
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <comdef.h>
#include <atlcrypt.h>
#include <ddraw.h>
#include <d3d.h>
#include <string>
#include <list>
#include <map>
#include <vector>
#include <deque>
#include <algorithm>
#include <iterator>
#import <msxml.dll>
#include "../include/Helpers.h"
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C8B6D65E_6F24_4AE7_A4BF_AFEF8775700C__INCLUDED)

View file

@ -0,0 +1,8 @@
// SurrogateRemove.cpp : Implementation of cSurrogateRemove
#include "stdafx.h"
#include "Decal.h"
#include "SurrogateRemove.h"
/////////////////////////////////////////////////////////////////////////////
// cSurrogateRemove

View file

@ -0,0 +1,87 @@
// SurrogateRemove.h : Declaration of the cSurrogateRemove
#ifndef __SURROGATEREMOVE_H_
#define __SURROGATEREMOVE_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cSurrogateRemove
class ATL_NO_VTABLE cSurrogateRemove :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<cSurrogateRemove, &CLSID_SurrogateRemove>,
public IDecalUninstall
{
public:
cSurrogateRemove()
{
}
CComBSTR m_strGroup;
CLSID m_clsid;
_bstr_t m_strProgID;
DECLARE_REGISTRY_RESOURCEID(IDR_SURROGATEREMOVE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cSurrogateRemove)
COM_INTERFACE_ENTRY(IDecalUninstall)
END_COM_MAP()
// ISurrogateRemove
public:
// IDecalUninstall
STDMETHOD(Prepare)(IDecalEnum *pEnum)
{
pEnum->get_Group( &m_strGroup );
pEnum->get_ComClass( &m_clsid );
CComVariant vProgID;
pEnum->get_Property( _bstr_t( _T( "ProgID" ) ), &vProgID );
if( vProgID.vt == VT_BSTR )
m_strProgID = vProgID.bstrVal;
return S_OK;
}
STDMETHOD(Uninstall)()
{
USES_CONVERSION;
TCHAR szParent[ 255 ];
::_tcscat ( ::_tcscpy ( szParent, _T( "Software\\Decal\\" ) ), OLE2T( m_strGroup ) );
RegKey rk;
if( rk.Open( HKEY_LOCAL_MACHINE, szParent ) != ERROR_SUCCESS )
{
_ASSERT( FALSE );
return E_FAIL;
}
LPOLESTR strCLSID;
::StringFromCLSID( m_clsid, &strCLSID );
LPTSTR szCLSID = OLE2T( strCLSID );
::CoTaskMemFree( strCLSID );
if( rk.RecurseDeleteKey( szCLSID ) != ERROR_SUCCESS )
{
_ASSERT( FALSE );
return E_FAIL;
}
if( m_strProgID.length() > 0 )
{
LPTSTR szProgID = OLE2T( m_strProgID );
RegKey rkcls;
rkcls.Open( HKEY_CLASSES_ROOT, NULL );
rkcls.RecurseDeleteKey( szProgID );
}
return S_OK;
}
};
#endif //__SURROGATEREMOVE_H_

View file

@ -0,0 +1,25 @@
HKCR
{
Decal.SurrogateRemove.1 = s 'SurrogateRemove Class'
{
CLSID = s '{144FBF76-E7FB-4B41-AE19-6B5AB0E0A89B}'
}
Decal.SurrogateRemove = s 'SurrogateRemove Class'
{
CLSID = s '{144FBF76-E7FB-4B41-AE19-6B5AB0E0A89B}'
CurVer = s 'Decal.SurrogateRemove.1'
}
NoRemove CLSID
{
ForceRemove {144FBF76-E7FB-4B41-AE19-6B5AB0E0A89B} = s 'SurrogateRemove Class'
{
ProgID = s 'Decal.SurrogateRemove.1'
VersionIndependentProgID = s 'Decal.SurrogateRemove'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732}'
}
}
}

36
Native/Decal/resource.h Normal file
View file

@ -0,0 +1,36 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Decal.rc
//
#define IDS_PROJNAME 100
#define IDR_DECAL 101
#define IDR_PLUGINSITE 102
#define IDR_DECALENUM 103
#define IDR_SURROGATEREMOVE 104
#define IDR_ACTIVEXSURROGATE 105
#define IDR_DECALRES 106
#define IDR_DECALNODE 107
#define IDS_ACHOOKS_DESC 111
#define IDR_ACHooks 112
#define IDE_INDEXOUTOFRANGE2 512
#define IDE_INDEXOUTOFRANGE 513
#define IDE_BADINDEXTYPE 514
#define IDE_CLASSNOTFOUND 515
#define IDE_CLASSKEYNOTFOUND 516
#define IDE_GROUPKEYNOTOPEN 517
#define IDE_INVALIDSUBKEYS 518
#define IDE_BADITERATOR 519
#define IDE_MOVEUPTOP 520
#define IDE_MOVEDOWNBOTTOM 521
#define IDE_SURROGATEDISABLED 522
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 113
#endif
#endif

Binary file not shown.

View file

View file

View file

View file

@ -0,0 +1,197 @@
// BorderLayout.cpp : Implementation of cBorderLayout
#include "stdafx.h"
#include "DecalControls.h"
#include "BorderLayout.h"
/////////////////////////////////////////////////////////////////////////////
// cBorderLayout
void cBorderLayout::onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement )
{
static _bstr_t _strEdge = _T( "border" ),
_strCenter = _T( "center" );
static _variant_t
_strLeft = _T( "left" ),
_strRight = _T( "right" ),
_strTop = _T( "top" ),
_strBottom = _T( "bottom" );
// Walk through the list of children - select all elements
MSXML::IXMLDOMElementPtr pChild;
for( MSXML::IXMLDOMNodeListPtr pChildren = pElement->selectNodes( _T( "*" ) );
( pChild = pChildren->nextNode() ).GetInterfacePtr() != NULL; )
{
if( pChild->tagName == _strEdge )
{
// Attempt to extract the edge indicator and the size indicator
_variant_t vEdge = pChild->getAttribute( _T( "edge" ) ),
vSize = pChild->getAttribute( _T( "size" ) );
_ASSERTE( vEdge.vt != VT_NULL );
_ASSERTE( vSize.vt != VT_NULL );
// Got values, check if they're good
eBorderEdge eEdge;
if( _strLeft == vEdge )
eEdge = eEdgeLeft;
else if( vEdge == _strRight )
eEdge = eEdgeRight;
else if( vEdge == _strTop )
eEdge = eEdgeTop;
else if( vEdge == _strBottom )
eEdge = eEdgeBottom;
#ifdef _DEBUG
else
// Invalid value here
_ASSERTE( FALSE );
#endif
// Convert the size
try
{
long nSize = vSize;
// Cannot have a 0 or negative edge size
_ASSERTE( nSize > 0 );
cEdgePlacement ep = { eEdge, nSize, loadChildControl( pView, pChild->selectSingleNode( _T( "control" ) ) ) };
m_edges.push_back( ep );
}
catch( ... )
{
// The size could no be converted to a long value
_ASSERTE( FALSE );
}
}
else if( pChild->tagName == _strCenter )
{
// Make sure there isn't a center already created
_ASSERTE( m_nCenterID == -1 );
m_nCenterID = loadChildControl( pView, pChild->selectSingleNode( _T( "control" ) ) );
}
#ifdef _DEBUG
else
// This is an invalid child element type
_ASSERTE( FALSE );
#endif
}
}
void cBorderLayout::onChildDestroy( long nID )
{
// Check if this is the center
if( nID == m_nCenterID )
{
m_nCenterID = -1;
m_pSite->Reformat();
return;
}
// Check if it on an edge
for( cEdgePlacementList::iterator i = m_edges.begin(); i != m_edges.end(); ++ i )
{
if( i->m_nID == nID )
{
m_edges.erase( i );
m_pSite->Reformat();
break;
}
}
}
STDMETHODIMP cBorderLayout::CreateEdge(eBorderEdge eEdge, long nSize, ILayer *pSink)
{
_ASSERTE( nSize > 0 );
_ASSERTE( pSink != NULL );
LayerParams lp = { dispenseID(), { 0, 0, 0, 0 }, eRenderClipped };
m_pSite->CreateChild( &lp, pSink );
cEdgePlacement ep = { eEdge, nSize, lp.ID };
m_edges.push_back( ep );
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cBorderLayout::CreateCenter(ILayer *pSink)
{
_ASSERTE( m_nCenterID == -1 );
LayerParams lp = { dispenseID(), { 0, 0, 0, 0 }, eRenderClipped };
m_pSite->CreateChild( &lp, pSink );
m_nCenterID = lp.ID;
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cBorderLayout::Reformat()
{
// Walk through the list of edges in order and
// set their positions
RECT rcLayer;
m_pSite->get_Position( &rcLayer );
RECT rcClient = { 0, 0, rcLayer.right - rcLayer.left, rcLayer.bottom - rcLayer.top };
for( cEdgePlacementList::iterator i = m_edges.begin(); i != m_edges.end(); ++ i )
{
RECT rcPosition = rcClient;
switch( i->m_edge )
{
case eEdgeLeft:
rcPosition.right = rcPosition.left + i->m_nSize;
rcClient.left += i->m_nSize;
break;
case eEdgeTop:
rcPosition.bottom = rcPosition.top + i->m_nSize;
rcClient.top += i->m_nSize;
break;
case eEdgeRight:
rcPosition.left = rcPosition.right - i->m_nSize;
rcClient.right -= i->m_nSize;
break;
case eEdgeBottom:
rcPosition.top = rcPosition.bottom - i->m_nSize;
rcClient.bottom -= i->m_nSize;
break;
default:
// Invalid edge value
_ASSERTE( FALSE );
}
// Sanity checks to make sure we haven't overrun our area
//_ASSERTE( rcClient.bottom > rcClient.top );
_ASSERTE( rcClient.right > rcClient.left );
_ASSERTE( rcPosition.bottom > rcPosition.top );
_ASSERTE( rcPosition.right > rcPosition.left );
CComPtr< ILayerSite > pChild;
HRESULT hRes = m_pSite->get_Child( i->m_nID, ePositionByID, &pChild );
_ASSERTE( SUCCEEDED( hRes ) );
pChild->put_Position( &rcPosition );
}
if( m_nCenterID != -1 )
{
CComPtr< ILayerSite > pChild;
HRESULT hRes = m_pSite->get_Child( m_nCenterID, ePositionByID, &pChild );
_ASSERTE( SUCCEEDED( hRes ) );
pChild->put_Position( &rcClient );
}
return S_OK;
}

View file

@ -0,0 +1,73 @@
// BorderLayout.h : Declaration of the cBorderLayout
#ifndef __BORDERLAYOUT_H_
#define __BORDERLAYOUT_H_
#include "resource.h" // main symbols
#include "DecalControlsCP.h"
#include "ControlImpl.h"
/////////////////////////////////////////////////////////////////////////////
// cBorderLayout
class ATL_NO_VTABLE cBorderLayout :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cBorderLayout, &CLSID_BorderLayout>,
public ILayerImpl< cBorderLayout >,
public ILayoutImpl< cBorderLayout, IBorderLayout, &IID_ILayout, &LIBID_DecalControls >,
public IProvideClassInfo2Impl< &CLSID_BorderLayout, &DIID_IControlEvents, &LIBID_DecalControls >,
public IConnectionPointContainerImpl<cBorderLayout>,
public CProxyIControlEvents< cBorderLayout >
{
public:
cBorderLayout()
: m_nCenterID( -1 )
{
}
// Data members
struct cEdgePlacement
{
eBorderEdge m_edge;
long m_nSize;
long m_nID;
};
typedef std::list< cEdgePlacement > cEdgePlacementList;
cEdgePlacementList m_edges;
long m_nCenterID;
void onChildDestroy( long nID );
void onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement );
DECLARE_REGISTRY_RESOURCEID(IDR_BORDERLAYOUT)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cBorderLayout)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(ILayout)
COM_INTERFACE_ENTRY(IBorderLayout)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cBorderLayout)
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
END_CONNECTION_POINT_MAP()
public:
// IBorderLayout Methods
STDMETHOD(CreateCenter)(ILayer *pSink);
STDMETHOD(CreateEdge)(eBorderEdge eEdge, long nSize, ILayer *pSink);
// ILayerRender Methods
STDMETHOD(Reformat)();
};
#endif //__BORDERLAYOUT_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.BorderLayout.1 = s 'BorderLayout Class'
{
CLSID = s '{CA121762-31BB-4073-8597-33BAB4BDCAA3}'
}
DecalControls.BorderLayout = s 'BorderLayout Class'
{
CLSID = s '{CA121762-31BB-4073-8597-33BAB4BDCAA3}'
CurVer = s 'DecalControls.BorderLayout.1'
}
NoRemove CLSID
{
ForceRemove {CA121762-31BB-4073-8597-33BAB4BDCAA3} = s 'BorderLayout Class'
{
ProgID = s 'DecalControls.BorderLayout.1'
VersionIndependentProgID = s 'DecalControls.BorderLayout'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,114 @@
// CheckColumn.cpp : Implementation of cCheckColumn
#include "stdafx.h"
#include "DecalControls.h"
#include "CheckColumn.h"
/////////////////////////////////////////////////////////////////////////////
// cCheckColumn
STDMETHODIMP cCheckColumn::get_FixedWidth(VARIANT_BOOL *pVal)
{
*pVal = VARIANT_TRUE;
return S_OK;
}
STDMETHODIMP cCheckColumn::get_Width(long *pVal)
{
*pVal = 20;
return S_OK;
}
STDMETHODIMP cCheckColumn::put_Width(long newVal)
{
// m_Width = newVal;
return S_OK;
}
STDMETHODIMP cCheckColumn::Render(ICanvas *pCanvas, LPPOINT ptCell, long nColor)
{
_variant_t vCheck, vHidden;
bool bHidden, bCheck;
m_pList->get_Data( ptCell->x, ptCell->y, 0, &vCheck );
bCheck = vCheck.vt == VT_NULL ? false : static_cast<bool>(vCheck);
m_pList->get_Data( ptCell->x, ptCell->y, 1, &vHidden );
bHidden = vHidden.vt == VT_NULL ? false : static_cast<bool>(vHidden);
// Converted nicely now ...
// Find our checked and unchecked images
CComPtr< IIconCache > pIcons;
SIZE sz = { 13, 13 };
m_pSite->GetIconCache( &sz, &pIcons );
POINT pt = { 3, 3 };
if( !bHidden )
pIcons->DrawIcon( &pt, bCheck ? 0x0600128B : 0x0600128D, 0, pCanvas );
return S_OK;
}
STDMETHODIMP cCheckColumn::get_DataColumns(long *pVal)
{
*pVal = 2;
return S_OK;
}
STDMETHODIMP cCheckColumn::Initialize(IList *newVal, IPluginSite *pSite)
{
m_pList = newVal;
m_pSite = pSite;
return S_OK;
}
STDMETHODIMP cCheckColumn::SchemaLoad(IUnknown *pSchema)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP cCheckColumn::get_Height(long *pVal)
{
*pVal = 20;
return S_OK;
}
STDMETHODIMP cCheckColumn::Activate(LPPOINT ptCell)
{
_variant_t vCheck, vHidden;
bool bHidden, bCheck;
m_pList->get_Data( ptCell->x, ptCell->y, 0, &vCheck );
bCheck = vCheck.vt == VT_NULL ? false : static_cast<bool>(vCheck);
m_pList->get_Data( ptCell->x, ptCell->y, 1, &vHidden );
bHidden = vHidden.vt == VT_NULL ? false : static_cast<bool>(vHidden);
if( !bHidden )
m_pList->put_Data( ptCell->x, ptCell->y, 0, &_variant_t( !bCheck ) );
return S_OK;
}
STDMETHODIMP cCheckColumn::get_Color(long nRow, long *pVal)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP cCheckColumn::put_Color(long nRow, long newVal)
{
// TODO: Add your implementation code here
return S_OK;
}

View file

@ -0,0 +1,46 @@
// CheckColumn.h : Declaration of the cCheckColumn
#ifndef __CHECKCOLUMN_H_
#define __CHECKCOLUMN_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cCheckColumn
class ATL_NO_VTABLE cCheckColumn :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cCheckColumn, &CLSID_CheckColumn>,
public IListColumn
{
public:
cCheckColumn()
{
}
CComPtr< IList > m_pList;
CComPtr< IPluginSite > m_pSite;
DECLARE_REGISTRY_RESOURCEID(IDR_CHECKCOLUMN)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cCheckColumn)
COM_INTERFACE_ENTRY(IListColumn)
END_COM_MAP()
// IListColumn
public:
STDMETHOD(get_Color)(long nRow, /*[out, retval]*/ long *pVal);
STDMETHOD(put_Color)(long nRow, /*[in]*/ long newVal);
STDMETHOD(Activate)(LPPOINT ptCell);
STDMETHOD(get_Height)(/*[out, retval]*/ long *pVal);
STDMETHOD(SchemaLoad)(IUnknown *pSchema);
STDMETHOD(Initialize)(/*[in]*/ IList * newVal, IPluginSite *pSite);
STDMETHOD(get_DataColumns)(/*[out, retval]*/ long *pVal);
STDMETHOD(Render)(ICanvas *, LPPOINT ptCell, long nColor);
STDMETHOD(get_Width)(/*[out, retval]*/ long *pVal);
STDMETHOD(get_FixedWidth)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Width)(/*[in]*/ long newVal);
};
#endif //__CHECKCOLUMN_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.CheckColumn.1 = s 'DecalControls CheckColumn'
{
CLSID = s '{48E444F1-8E30-4E4C-B203-4C87FC901586}'
}
DecalControls.CheckColumn = s 'DecalControls CheckColumn'
{
CLSID = s '{48E444F1-8E30-4E4C-B203-4C87FC901586}'
CurVer = s 'DecalControls.CheckColumn.1'
}
NoRemove CLSID
{
ForceRemove {48E444F1-8E30-4E4C-B203-4C87FC901586} = s 'DecalControls CheckColumn'
{
ProgID = s 'DecalControls.CheckColumn.1'
VersionIndependentProgID = s 'DecalControls.CheckColumn'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
}
}
}

View file

@ -0,0 +1,349 @@
// Checkbox.cpp : Implementation of cCheckbox
#include "stdafx.h"
#include "DecalControls.h"
#include "Checkbox.h"
/////////////////////////////////////////////////////////////////////////////
// cCheckbox
cCheckbox::cCheckbox()
: m_bChecked( VARIANT_FALSE ),
m_bRightToLeft( VARIANT_FALSE ),
m_nTextColor( RGB( 0, 0, 0 ) ),
m_bPressed( VARIANT_FALSE ),
m_bMouseIn( VARIANT_FALSE )
{
}
STDMETHODIMP cCheckbox::get_Font(IFontCacheDisp **pVal)
{
_ASSERTE( pVal != NULL );
if( m_pFont.p == NULL )
*pVal = NULL;
else
m_pFont->QueryInterface( pVal );
return S_OK;
}
STDMETHODIMP cCheckbox::putref_Font(IFontCacheDisp *newVal)
{
_ASSERTE( newVal != NULL );
if( m_pFont.p )
m_pFont.Release();
HRESULT hRes = newVal->QueryInterface( &m_pFont );
_ASSERTE( SUCCEEDED( hRes ) );
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cCheckbox::get_Text(BSTR *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = OLE2BSTR( m_strText );
return S_OK;
}
STDMETHODIMP cCheckbox::put_Text(BSTR newVal)
{
_ASSERTE( newVal != NULL );
m_strText = newVal;
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cCheckbox::get_TextColor(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_nTextColor;
return S_OK;
}
STDMETHODIMP cCheckbox::put_TextColor(long newVal)
{
_ASSERTE( ( newVal & 0xFF000000L ) == 0 );
m_nTextColor = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cCheckbox::get_Checked(VARIANT_BOOL *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_bChecked;
return S_OK;
}
STDMETHODIMP cCheckbox::put_Checked(VARIANT_BOOL newVal)
{
if( m_bChecked == newVal )
return S_OK;
m_bChecked = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cCheckbox::get_RightToLeft(VARIANT_BOOL *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_bRightToLeft;
return S_OK;
}
STDMETHODIMP cCheckbox::put_RightToLeft(VARIANT_BOOL newVal)
{
m_bRightToLeft = newVal;
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cCheckbox::SchemaLoad(IView *pView, IUnknown *pSchema)
{
// First attempt to load the font
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
pPlugin->CreateFontSchema( 14, 0, pSchema, &m_pFont );
MSXML::IXMLDOMElementPtr pElement = pSchema;
_variant_t vText = pElement->getAttribute( _T( "text" ) ),
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
vRightToLeft = pElement->getAttribute( _T( "righttoleft" ) ),
vChecked = pElement->getAttribute( _T( "checked" ) ),
vOutline = pElement->getAttribute( _T( "outlinecolor" ) ),
vAntialias = pElement->getAttribute( _T( "aa" ) );
// Text must exist
_ASSERTE( vText.vt == VT_BSTR );
m_strText = vText.bstrVal;
if( vTextColor.vt != VT_NULL )
{
try
{
m_nTextColor = static_cast< long >( vTextColor );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vRightToLeft.vt != VT_NULL )
{
try
{
m_bRightToLeft = ( static_cast< bool >( vRightToLeft ) ) ? VARIANT_TRUE : VARIANT_FALSE;
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vChecked.vt != VT_NULL )
{
try
{
m_bChecked = ( static_cast< bool >( vChecked ) ) ? VARIANT_TRUE : VARIANT_FALSE;
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
m_nOutlineColor = 0;
m_bOutline = false;
if( vOutline.vt != VT_NULL )
{
try
{
m_bOutline = true;
m_nOutlineColor = static_cast< long >( vOutline );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
m_bAA = true;
if( vAntialias.vt != VT_NULL )
{
try
{
m_bAA = static_cast< bool >( vAntialias );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
return S_OK;
}
#define CHECK_SIZE 13
#define TEXT_OFFSET 4
STDMETHODIMP cCheckbox::Reformat()
{
if( m_pFont.p == NULL )
{
// No font was specified, create the default font
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
BSTR bstrFontName;
pPlugin->get_FontName(&bstrFontName);
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
}
RECT rc;
m_pSite->get_Position( &rc );
SIZE szText;
m_pFont->MeasureText( m_strText, &szText );
if( szText.cy >= CHECK_SIZE )
{
m_ptCheck.y = ( szText.cy - CHECK_SIZE ) / 2;
m_ptText.y = 0;
}
else
{
m_ptCheck.y = 0;
m_ptText.y = ( CHECK_SIZE - szText.cy ) / 2;
}
if( m_bRightToLeft )
{
m_ptText.x = ( rc.right - rc.left ) - ( CHECK_SIZE + TEXT_OFFSET ) - szText.cx;
m_ptCheck.x = ( rc.right - rc.left ) - CHECK_SIZE;
}
else
{
m_ptText.x = CHECK_SIZE + TEXT_OFFSET;
m_ptCheck.x = 0;
}
return S_OK;
}
STDMETHODIMP cCheckbox::Render( ICanvas *pCanvas )
{
bool bChecked = ( m_bPressed && m_bMouseIn ) ? !m_bChecked : !!m_bChecked;
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
CComPtr< IIconCache > pIcon;
SIZE szIcon = { CHECK_SIZE, CHECK_SIZE };
pPlugin->GetIconCache( &szIcon, &pIcon );
pIcon->DrawIcon( &m_ptCheck, ( bChecked ) ? 0x0600128B : 0x0600128D, 0, pCanvas );
long lFlags = 0;
if( m_bAA )
lFlags |= eAA;
if( m_bOutline )
lFlags |= eOutlined;
m_pFont->DrawTextEx( &m_ptText, m_strText, m_nTextColor, m_nOutlineColor, lFlags, pCanvas );
return S_OK;
}
STDMETHODIMP cCheckbox::MouseEnter(struct MouseState *)
{
_ASSERTE( !m_bMouseIn );
m_bMouseIn = VARIANT_TRUE;
if( m_bPressed )
{
_ASSERTE( m_pSite.p != NULL );
m_pSite->Invalidate();
}
return S_OK;
}
STDMETHODIMP cCheckbox::MouseExit(struct MouseState *)
{
_ASSERTE( m_bMouseIn );
m_bMouseIn = VARIANT_FALSE;
if( m_bPressed )
{
_ASSERTE( m_pSite.p != NULL );
m_pSite->Invalidate();
}
return S_OK;
}
STDMETHODIMP cCheckbox::MouseDown(struct MouseState *)
{
_ASSERTE( m_pSite != NULL );
m_bPressed = VARIANT_TRUE;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cCheckbox::MouseUp(struct MouseState *)
{
m_bPressed = VARIANT_FALSE;
long nID;
m_pSite->get_ID( &nID );
if( m_bMouseIn )
{
_ASSERTE( m_pSite.p != NULL );
m_bChecked = ( m_bChecked ) ? VARIANT_FALSE : VARIANT_TRUE;
m_pSite->Invalidate();
// NOTE: The command may destroy the control synchronously
// so we make a stack copy of the target in case our instance is destroyed
// for the purpose of completing the command
Fire_Change( nID, m_bChecked );
}
return S_OK;
}

View file

@ -0,0 +1,91 @@
// Checkbox.h : Declaration of the cCheckbox
#ifndef __CHECKBOX_H_
#define __CHECKBOX_H_
#include "resource.h" // main symbols
#include "DecalControlsCP.h"
#include "SinkImpl.h"
/////////////////////////////////////////////////////////////////////////////
// cCheckbox
class ATL_NO_VTABLE cCheckbox :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cCheckbox, &CLSID_Checkbox>,
public IControlImpl< cCheckbox, ICheckbox, &IID_ICheckbox, &LIBID_DecalControls >,
public ILayerMouseImpl,
public ILayerRenderImpl,
public ILayerImpl< cCheckbox >,
public ILayerSchema,
public IProvideClassInfo2Impl< &CLSID_Checkbox, &DIID_ICheckboxEvents, &LIBID_DecalControls >,
public IConnectionPointContainerImpl<cCheckbox>,
public CProxyICheckboxEvents< cCheckbox >
{
public:
cCheckbox();
_bstr_t m_strText;
CComPtr< IFontCache > m_pFont;
VARIANT_BOOL m_bChecked,
m_bRightToLeft;
long m_nTextColor, m_nOutlineColor;
bool m_bAA, m_bOutline;
POINT m_ptText,
m_ptCheck;
VARIANT_BOOL m_bPressed,
m_bMouseIn;
DECLARE_REGISTRY_RESOURCEID(IDR_CHECKBOX)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cCheckbox)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(ICheckbox)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cCheckbox)
CONNECTION_POINT_ENTRY(DIID_ICheckboxEvents)
END_CONNECTION_POINT_MAP()
public:
// ICheckbox Methods
STDMETHOD(get_RightToLeft)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_RightToLeft)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_Checked)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Checked)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_TextColor)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Text)(/*[in]*/ BSTR newVal);
STDMETHOD(get_Font)(/*[out, retval]*/ IFontCacheDisp * *pVal);
STDMETHOD(putref_Font)(/*[in]*/ IFontCacheDisp * newVal);
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
// ILayerRender Methods
STDMETHOD(Reformat)();
STDMETHOD(Render)(ICanvas *pCanvas);
// ILayerMouse Methods
STDMETHOD(MouseEnter)(struct MouseState *);
STDMETHOD(MouseExit)(struct MouseState *);
STDMETHOD(MouseDown)(struct MouseState *);
STDMETHOD(MouseUp)(struct MouseState *);
};
#endif //__CHECKBOX_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.Checkbox.1 = s 'Checkbox Class'
{
CLSID = s '{5AE37451-F79C-478A-834E-EDCF95F01B0E}'
}
DecalControls.Checkbox = s 'Checkbox Class'
{
CLSID = s '{5AE37451-F79C-478A-834E-EDCF95F01B0E}'
CurVer = s 'DecalControls.Checkbox.1'
}
NoRemove CLSID
{
ForceRemove {5AE37451-F79C-478A-834E-EDCF95F01B0E} = s 'Checkbox Class'
{
ProgID = s 'DecalControls.Checkbox.1'
VersionIndependentProgID = s 'DecalControls.Checkbox'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,426 @@
// Choice.cpp : Implementation of cChoice
#include "stdafx.h"
#include "DecalControls.h"
#include "Choice.h"
#include "ChoicePopup.h"
#include "ChoiceDropDown.h"
/////////////////////////////////////////////////////////////////////////////
// cChoice
cChoice::cChoice()
: m_nSelected( -1 ),
m_nHotSelect( -1 ),
m_nDropLines( 8 ),
m_bPopup( false ),
m_bMouseDown( false ),
m_bMouseOver( false )
{
}
void cChoice::setPopup( bool bPopup )
{
// Always reset hot select
m_bPopup = bPopup;
m_nHotSelect = -1;
if( bPopup )
{
long nID;
m_pSite->get_ID( &nID );
Fire_DropDown( nID );
m_pPopup->put_Popup( VARIANT_TRUE );
}
// Redraw everything
m_pSite->Reformat();
m_pSite->Invalidate();
}
void cChoice::onCreate()
{
CComPtr< IPluginSite > pPluginSite;
m_pSite->get_PluginSite( &pPluginSite );
// Create the image info
pPluginSite->LoadBitmapPortal( 0x06001276, &m_pInactive );
BSTR bstrFontName;
pPluginSite->get_FontName(&bstrFontName);
pPluginSite->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
// Create the dropdown
CComObject< cChoiceDropDown > *pDropDown;
CComObject< cChoiceDropDown >::CreateInstance( &pDropDown );
pDropDown->m_pChoice = this;
LayerParams lp = { 0, { -1, -1, 0, 0 }, 0 };
m_pSite->CreateChild( &lp, pDropDown );
m_pPopup = pDropDown->m_pSite;
// Create the scroller
CComPtr< ILayer > pScrollerLayer;
HRESULT hRes = ::CoCreateInstance( CLSID_Scroller, NULL, CLSCTX_INPROC_SERVER, IID_ILayer, reinterpret_cast< void ** >( &pScrollerLayer ) );
_ASSERTE( SUCCEEDED( hRes ) );
pScrollerLayer->QueryInterface( &m_pScroller );
// Create the scroller object
LayerParams lpScroller = { 0, { 0, 0, 0, 0 }, eRenderClipped };
m_pPopup->CreateChild( &lpScroller, pScrollerLayer );
// Configure the scroller
SIZE szLine = { 18, 1 };
m_pScroller->put_Increments( &szLine );
// Create the popup window
CComObject< cChoicePopup > *pPopup;
CComObject< cChoicePopup >::CreateInstance( &pPopup );
pPopup->m_pChoice = this;
m_pScroller->CreateClient( pPopup );
m_pPopup->put_Transparent( VARIANT_FALSE );
m_pSite->put_Transparent( VARIANT_FALSE );
}
void cChoice::onDestroy()
{
m_pPopup.Release();
m_pFont.Release();
m_pInactive.Release();
}
STDMETHODIMP cChoice::MouseUp(MouseState *)
{
m_bMouseDown = false;
if( m_bMouseOver )
{
setPopup( !m_bPopup );
if( !m_bPopup )
m_pPopup->put_Popup( VARIANT_FALSE );
}
return S_OK;
}
#define RENDER_LEFTSTRETCH 10
#define RENDER_RIGHTSTRETCH 7
#define ROW_HEIGHT 18
#define ICON_WIDTH 20
#define ICON_HEIGHT 19
STDMETHODIMP cChoice::Render(ICanvas *pCanvas)
{
// First draw the background
RECT rcPos;
m_pSite->get_Position( &rcPos );
SIZE szImage;
m_pInactive->get_Size( &szImage );
static POINT ptBack = { 0, 0 };
m_pInactive->StretchBlt( pCanvas, &ptBack, rcPos.right - rcPos.left, RENDER_LEFTSTRETCH, szImage.cx - RENDER_RIGHTSTRETCH );
if( m_nSelected != -1 )
{
// Draw the selected text
static POINT ptText = { 12, 2 };
m_pFont->DrawTextEx( &ptText, m_options[ m_nSelected ].m_strText, 0, 0, eAA, pCanvas );
}
// Draw the up/down icon
CComPtr< IPluginSite > pPluginSite;
m_pSite->get_PluginSite( &pPluginSite );
SIZE szIcon = { ICON_WIDTH, ICON_HEIGHT };
CComPtr< IIconCache > pIconCache;
pPluginSite->GetIconCache( &szIcon, &pIconCache );
POINT ptIcon = { rcPos.right - rcPos.left - ICON_WIDTH, 0 };
pIconCache->DrawIcon( &ptIcon, ( ( m_bMouseDown && m_bMouseOver ) ? !m_bPopup : m_bPopup ) ? 0x06001275 : 0x06001274, 0, pCanvas );
return S_OK;
}
STDMETHODIMP cChoice::Reformat()
{
if( !m_bPopup || m_options.size() == 0 )
{
// If it's hidden great, hide it well
static RECT rcHidden = { -1, -1, 0, 0 };
m_pPopup->put_Position( &rcHidden );
return S_OK;
}
// Calculate the correct position
RECT rc;
m_pSite->get_ScreenPosition( &rc );
// Two modes, with scroll bar and without
if( m_options.size() > m_nDropLines )
{
// With a scroller
RECT rcPopup = { rc.left, rc.bottom, rc.right - ICON_WIDTH + 16, rc.bottom +
ROW_HEIGHT * m_nDropLines };
m_pPopup->put_Position( &rcPopup );
m_pScroller->put_VerticalEnabled( VARIANT_TRUE );
SIZE szArea = { rc.right - ICON_WIDTH, ROW_HEIGHT * m_options.size() };
m_pScroller->put_Area( &szArea );
}
else
{
RECT rcPopup = { rc.left, rc.bottom, rc.right - ICON_WIDTH, rc.bottom +
ROW_HEIGHT * m_options.size() };
m_pPopup->put_Position( &rcPopup );
POINT ptOffset = { 0, 0 };
m_pScroller->put_Offset( &ptOffset );
m_pScroller->put_VerticalEnabled( VARIANT_FALSE );
SIZE szArea = { rc.right - ICON_WIDTH, ROW_HEIGHT * m_options.size() };
m_pScroller->put_Area( &szArea );
}
return S_OK;
}
STDMETHODIMP cChoice::SchemaLoad(IView *pView, IUnknown *pSchema)
{
// Load the data from the schema
MSXML::IXMLDOMElementPtr pElement = pSchema;
MSXML::IXMLDOMElementPtr pRow;
for( MSXML::IXMLDOMNodeListPtr pRows = pElement->selectNodes( _T( "option" ) );
( pRow = pRows->nextNode() ).GetInterfacePtr() != NULL; )
{
_variant_t vRow = pRow->getAttribute( _T( "text" ) ),
vData = pRow->getAttribute( _T( "data" ) );
_ASSERTE( vRow.vt == VT_BSTR );
cOption o;
o.m_strText = vRow;
o.m_value = vData;
m_options.push_back( o );
}
_variant_t vDropRows = pElement->getAttribute( "droplines" ),
vSelected = pElement->getAttribute( "selected" );
if( vDropRows.vt != VT_NULL )
{
try
{
m_nDropLines = static_cast< long >( vDropRows );
_ASSERTE( m_nDropLines > 0 );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vSelected.vt != VT_NULL )
{
try
{
m_nSelected = static_cast< long >( vSelected );
_ASSERTE( m_nSelected >= 0 );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
return S_OK;
}
STDMETHODIMP cChoice::AddChoice(BSTR strDisplay, VARIANT vData)
{
cOption o;
o.m_strText = strDisplay;
o.m_value = vData;
m_options.push_back( o );
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cChoice::get_ChoiceCount(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_options.size();
return S_OK;
}
STDMETHODIMP cChoice::get_Data(long nIndex, VARIANT *pVal)
{
if( pVal == NULL )
return E_POINTER;
if( nIndex < 0 || nIndex > m_options.size() )
{
pVal->lVal = -1;
pVal->vt = VT_I4;
}
else
::VariantCopy( pVal, &m_options[ nIndex ].m_value );
return S_OK;
}
STDMETHODIMP cChoice::put_Data(long nIndex, VARIANT newVal)
{
_ASSERTE( nIndex >= 0 );
_ASSERTE( nIndex < m_options.size() );
::VariantCopy( &m_options[ nIndex ].m_value, &newVal );
return S_OK;
}
STDMETHODIMP cChoice::get_Text(long nIndex, BSTR *pVal)
{
USES_CONVERSION;
_ASSERTE( nIndex >= 0 );
_ASSERTE( nIndex < m_options.size() );
_ASSERTE( pVal != NULL );
*pVal = OLE2BSTR( m_options[ nIndex ].m_strText );
return S_OK;
}
STDMETHODIMP cChoice::put_Text(long nIndex, BSTR newVal)
{
_ASSERTE( nIndex >= 0 );
_ASSERTE( nIndex < m_options.size() );
_ASSERTE( newVal != NULL );
m_options[ nIndex ].m_strText = newVal;
m_pPopup->Invalidate();
return S_OK;
}
STDMETHODIMP cChoice::RemoveChoice(long nIndex)
{
_ASSERTE( nIndex >= 0 );
_ASSERTE( nIndex < m_options.size() );
m_options.erase( m_options.begin() + nIndex );
if( m_nSelected >= m_options.size() )
m_nSelected = m_options.size() - 1;
long nID;
m_pSite->get_ID( &nID );
Fire_Change( nID, m_nSelected );
// Redraw the concerned
m_pSite->Reformat();
m_pPopup->Invalidate();
return S_OK;
}
STDMETHODIMP cChoice::get_Dropped(VARIANT_BOOL *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = ( m_bPopup ) ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP cChoice::put_Dropped(VARIANT_BOOL newVal)
{
if( !!newVal != m_bPopup )
setPopup( !!newVal );
return S_OK;
}
STDMETHODIMP cChoice::get_Selected(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_nSelected;
return S_OK;
}
STDMETHODIMP cChoice::put_Selected(long newVal)
{
_ASSERTE( newVal >= -1 );
//_ASSERTE( newVal < m_options.size() );
//back out if out of bounds, don't error to prevent breaking vb plugs
//this should fix the crash on display bug
if (newVal >= m_options.size())
return S_OK;
if( newVal == m_nSelected )
return S_OK;
m_nSelected = newVal;
long nID;
m_pSite->get_ID( &nID );
Fire_Change( nID, m_nSelected );
// Redraw the concerned
m_pSite->Invalidate();
m_pPopup->Invalidate();
return S_OK;
}
STDMETHODIMP cChoice::get_DropLines(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_nDropLines;
return S_OK;
}
STDMETHODIMP cChoice::put_DropLines(long newVal)
{
_ASSERTE( newVal > 0 );
m_nDropLines = newVal;
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cChoice::Clear()
{
m_options.clear();
m_nSelected = -1;
long nID;
m_pSite->get_ID( &nID );
Fire_Change( nID, m_nSelected );
m_pSite->Reformat();
return S_OK;
}

View file

@ -0,0 +1,128 @@
// Choice.h : Declaration of the cChoice
#ifndef __CHOICE_H_
#define __CHOICE_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "DecalControlsCP.h"
/////////////////////////////////////////////////////////////////////////////
// cChoice
class ATL_NO_VTABLE cChoice :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cChoice, &CLSID_Choice>,
public IConnectionPointContainerImpl<cChoice>,
public ILayerImpl< cChoice >,
public ILayerRenderImpl,
public ILayerMouseImpl,
public ILayerSchema,
public IControlImpl< cChoice, IChoice, &IID_IChoice, &LIBID_DecalControls >,
public IProvideClassInfo2Impl< &CLSID_Choice, &DIID_IChoiceEvents, &LIBID_DecalControls >,
public CProxyIChoiceEvents< cChoice >
{
public:
cChoice();
long m_nSelected;
long m_nHotSelect;
long m_nDropLines;
struct cOption
{
_variant_t m_value;
_bstr_t m_strText;
};
typedef std::deque< cOption > cOptionList;
cOptionList m_options;
CComPtr< IImageCache > m_pInactive;
CComPtr< IFontCache > m_pFont;
CComPtr< ILayerSite > m_pPopup;
CComPtr< IScroller > m_pScroller;
bool m_bMouseDown;
bool m_bMouseOver;
bool m_bPopup;
void setPopup( bool bPopup );
void onCreate();
void onDestroy();
DECLARE_REGISTRY_RESOURCEID(IDR_CHOICE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cChoice)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(IChoice)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cChoice)
CONNECTION_POINT_ENTRY(DIID_IChoiceEvents)
END_CONNECTION_POINT_MAP()
public:
STDMETHOD(Clear)();
// IChoice Methods
STDMETHOD(get_Selected)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_Selected)(/*[in]*/ long newVal);
STDMETHOD(get_Dropped)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Dropped)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(RemoveChoice)(long nIndex);
STDMETHOD(get_Text)(long nIndex, /*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Text)(long nIndex, /*[in]*/ BSTR newVal);
STDMETHOD(get_Data)(long nIndex, /*[out, retval]*/ VARIANT *pVal);
STDMETHOD(put_Data)(long nIndex, /*[in]*/ VARIANT newVal);
STDMETHOD(get_ChoiceCount)(/*[out, retval]*/ long *pVal);
STDMETHOD(AddChoice)(BSTR strDisplay, /*[optional]*/ VARIANT vData);
STDMETHOD(get_DropLines)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_DropLines)(/*[in]*/ long newVal);
// ILayerMouse Methods
STDMETHOD(MouseDown)(MouseState *)
{
m_bMouseDown = true;
m_pSite->Invalidate();
return S_OK;
}
STDMETHOD(MouseEnter)(MouseState *pMS)
{
m_bMouseOver = true;
m_pSite->Invalidate();
return S_OK;
}
STDMETHOD(MouseExit)(MouseState *pMS)
{
m_bMouseOver = false;
m_pSite->Invalidate();
return S_OK;
}
STDMETHOD(MouseUp)(MouseState *pMS);
// ILayerRender Methods
STDMETHOD(Render)(ICanvas *pCanvas);
STDMETHOD(Reformat)();
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
};
#endif //__CHOICE_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.Choice.1 = s 'DecalControls Choice'
{
CLSID = s '{E099DC60-0F19-4690-AB7C-8B5834DA286E}'
}
DecalControls.Choice = s 'DecalControls Choice'
{
CLSID = s '{E099DC60-0F19-4690-AB7C-8B5834DA286E}'
CurVer = s 'DecalControls.Choice.1'
}
NoRemove CLSID
{
ForceRemove {E099DC60-0F19-4690-AB7C-8B5834DA286E} = s 'DecalControls Choice'
{
ProgID = s 'DecalControls.Choice.1'
VersionIndependentProgID = s 'DecalControls.Choice'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,46 @@
// ChoiceDropDown.cpp : Implementation of cChoiceDropDown
#include "stdafx.h"
#include "DecalControls.h"
#include "ChoiceDropDown.h"
#include "Choice.h"
/////////////////////////////////////////////////////////////////////////////
// cChoiceDropDown
STDMETHODIMP cChoiceDropDown::Reformat()
{
RECT rcLayer;
m_pSite->get_Position( &rcLayer );
// Move our only child to cover the entire client
CComPtr< ILayerSite > pChild;
m_pSite->get_Child( 0, ePositionByIndex, &pChild );
if( ( rcLayer.right - rcLayer.left ) < 16 || ( rcLayer.bottom - rcLayer.top ) < 16 )
{
RECT rcClient = { 0, 0, 0, 0 };
pChild->put_Position( &rcClient );
}
else
{
RECT rcClient = { 0, 0, rcLayer.right - rcLayer.left, rcLayer.bottom - rcLayer.top };
pChild->put_Position( &rcClient );
}
return S_OK;
}
STDMETHODIMP cChoiceDropDown::PopupCancel(MouseState *pMS, VARIANT_BOOL *pbContinue)
{
// Allow clicks in the parent object
*pbContinue = ( pMS->over == m_pChoice ) ? VARIANT_TRUE : VARIANT_FALSE;
if( !( *pbContinue ) )
{
m_pChoice->m_nHotSelect = -1;
m_pChoice->setPopup( false );
}
return S_OK;
}

View file

@ -0,0 +1,49 @@
// ChoiceDropDown.h : Declaration of the cChoiceDropDown
#ifndef __CHOICEDROPDOWN_H_
#define __CHOICEDROPDOWN_H_
#include "resource.h" // main symbols
#include <SinkImpl.h>
class cChoice;
/////////////////////////////////////////////////////////////////////////////
// cChoiceDropDown
class ATL_NO_VTABLE cChoiceDropDown :
public CComObjectRootEx<CComMultiThreadModel>,
public ILayerImpl< cChoiceDropDown >,
public ILayerRenderImpl,
public ILayerPopup,
public cNoEventsImpl,
public IChoiceDropDown
{
public:
cChoiceDropDown()
: m_pChoice( NULL )
{
}
cChoice *m_pChoice;
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cChoiceDropDown)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerPopup)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IChoiceDropDown)
END_COM_MAP()
// IChoiceDropDown
public:
// ILayerRender Methods
STDMETHOD(Reformat)();
// ILayerPopup Methods
STDMETHOD(PopupCancel)(MouseState *pMS, VARIANT_BOOL *pbContinue);
};
#endif //__CHOICEDROPDOWN_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.ChoiceDropDown.1 = s 'ChoiceDropDown Class'
{
CLSID = s '{DF7D18FA-A3AE-4AED-BEE3-7936F25EC95A}'
}
DecalControls.ChoiceDropDown = s 'ChoiceDropDown Class'
{
CLSID = s '{DF7D18FA-A3AE-4AED-BEE3-7936F25EC95A}'
CurVer = s 'DecalControls.ChoiceDropDown.1'
}
NoRemove CLSID
{
ForceRemove {DF7D18FA-A3AE-4AED-BEE3-7936F25EC95A} = s 'ChoiceDropDown Class'
{
ProgID = s 'DecalControls.ChoiceDropDown.1'
VersionIndependentProgID = s 'DecalControls.ChoiceDropDown'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,97 @@
// ChoicePopup.cpp : Implementation of cChoicePopup
#include "stdafx.h"
#include "DecalControls.h"
#include "ChoicePopup.h"
#include "Choice.h"
/////////////////////////////////////////////////////////////////////////////
// cChoicePopup
#define ROW_HEIGHT 18
void cChoicePopup::hotSelect( MouseState *pMS )
{
if( pMS->over != this )
m_pChoice->m_nHotSelect = -1;
else
{
m_pChoice->m_nHotSelect = pMS->client.y / ROW_HEIGHT;
if( m_pChoice->m_nHotSelect >= m_pChoice->m_options.size() )
// If we went over the edge, kill the selection
m_pChoice->m_nHotSelect = -1;
}
m_pSite->Invalidate();
}
void cChoicePopup::onCreate()
{
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
pPlugin->LoadBitmapPortal( 0x0600127A, &m_pActive );
m_pSite->put_Transparent( VARIANT_FALSE );
}
void cChoicePopup::onDestroy()
{
m_pActive.Release();
}
#define RENDER_LEFTSTRETCH 10
#define RENDER_RIGHTSTRETCH 7
STDMETHODIMP cChoicePopup::Render(ICanvas *pCanvas)
{
int nHighlight = ( m_pChoice->m_nHotSelect == -1 ) ? m_pChoice->m_nSelected : m_pChoice->m_nHotSelect;
RECT rc;
m_pSite->get_Position( &rc );
long nWidth = rc.right - rc.left;
SIZE szImage;
m_pActive->get_Size( &szImage );
long nRightStretch = szImage.cx - RENDER_RIGHTSTRETCH;
for( cChoice::cOptionList::iterator i = m_pChoice->m_options.begin(); i != m_pChoice->m_options.end(); ++ i )
{
int nRow = i - m_pChoice->m_options.begin();
bool bHighlight = ( nRow == nHighlight );
POINT ptDest = { 0, nRow * ROW_HEIGHT };
// Draw the background image
( ( bHighlight ) ? m_pActive : m_pChoice->m_pInactive )->StretchBlt( pCanvas, &ptDest, nWidth, RENDER_LEFTSTRETCH, nRightStretch );
// Draw the text
POINT ptText = { 12, nRow * ROW_HEIGHT + 2 };
m_pChoice->m_pFont->DrawTextEx( &ptText, i->m_strText, 0, 0, eAA, pCanvas );
}
return S_OK;
}
STDMETHODIMP cChoicePopup::MouseUp(MouseState *pMS)
{
// Set the selection
m_bMouseDown = false;
hotSelect( pMS );
if( m_pChoice->m_nHotSelect != -1 )
m_pChoice->put_Selected( m_pChoice->m_nHotSelect );
m_pChoice->m_pSite->Invalidate();
// Hide the popup
m_pChoice->setPopup( false );
m_pChoice->m_pPopup->put_Popup( VARIANT_FALSE );
// Clear the selection
m_pSite->Invalidate();
return S_OK;
}

View file

@ -0,0 +1,87 @@
// ChoicePopup.h : Declaration of the cChoicePopup
#ifndef __CHOICEPOPUP_H_
#define __CHOICEPOPUP_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
class cChoice;
/////////////////////////////////////////////////////////////////////////////
// cChoicePopup
class ATL_NO_VTABLE cChoicePopup :
public CComObjectRootEx<CComMultiThreadModel>,
public ILayerImpl< cChoicePopup >,
public ILayerRenderImpl,
public ILayerMouseImpl,
public cNoEventsImpl,
public IChoicePopup
{
public:
cChoicePopup()
: m_pChoice( NULL ),
m_bMouseDown( false )
{
}
cChoice *m_pChoice;
CComPtr< IImageCache > m_pActive;
bool m_bMouseDown;
void onCreate();
void onDestroy();
BEGIN_COM_MAP(cChoicePopup)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IChoicePopup)
END_COM_MAP()
void hotSelect( MouseState *pMS );
public:
// IChoicePopup Methods
// ILayerRender Methods
STDMETHOD(Render)(ICanvas *pCanvas);
// ILayerMouse Methods
STDMETHOD(MouseDown)(MouseState *pMS)
{
m_bMouseDown = true;
hotSelect( pMS );
return S_OK;
}
STDMETHOD(MouseEnter)(MouseState *pMS)
{
if( m_bMouseDown )
hotSelect( pMS );
return S_OK;
}
STDMETHOD(MouseExit)(MouseState *pMS)
{
if( m_bMouseDown )
hotSelect( pMS );
return S_OK;
}
STDMETHOD(MouseMove)(MouseState *pMS)
{
if( m_bMouseDown )
hotSelect( pMS );
return S_OK;
}
STDMETHOD(MouseUp)(MouseState *pMS);
};
#endif //__CHOICEPOPUP_H_

View file

@ -0,0 +1,37 @@
// Client.cpp : Implementation of cClient
#include "stdafx.h"
#include "DecalControls.h"
#include "Client.h"
/////////////////////////////////////////////////////////////////////////////
// cClient
STDMETHODIMP cClient::LayerCreate( ILayerSite *pSite )
{
m_pSite = pSite;
return S_OK;
}
STDMETHODIMP cClient::LayerDestroy()
{
m_pSite.Release();
return S_OK;
}
STDMETHODIMP cClient::SchemaLoad(IView *pView, IUnknown *pXMLSchema)
{
MSXML::IXMLDOMElementPtr pElement = pXMLSchema;
long nID = 1000;
// Create all child controls from schema and let them be
// placed wherever they like
MSXML::IXMLDOMElementPtr pChild;
for( MSXML::IXMLDOMNodeListPtr pChildren = pElement->selectNodes( _T( "control" ) );
( pChild = pChildren->nextNode() ).GetInterfacePtr() != NULL; )
pView->LoadControl( m_pSite, nID ++, pChild );
return S_OK;
}

View file

@ -0,0 +1,50 @@
// Client.h : Declaration of the cClient
#ifndef __CLIENT_H_
#define __CLIENT_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
/////////////////////////////////////////////////////////////////////////////
// cClient
class ATL_NO_VTABLE cClient :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cClient, &CLSID_Client>,
public ILayerImpl,
public ILayerSchema,
public IClient
{
public:
cClient()
{
}
CComPtr< ILayerSite > m_pSite;
// TODO: Add support for background image and possibly
// scrolling
DECLARE_REGISTRY_RESOURCEID(IDR_CLIENT)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cClient)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IClient)
END_COM_MAP()
public:
// IClient Methods
// ILayer Methods
STDMETHOD(LayerCreate)(ILayerSite *pSite);
STDMETHOD(LayerDestroy)();
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pXMLSchema);
};
#endif //__CLIENT_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.Client.1 = s 'DecalControls Client'
{
CLSID = s '{CD6556CD-F8D9-4CB0-AB7C-7C33058294E4}'
}
DecalControls.Client = s 'DecalControls Client'
{
CLSID = s '{CD6556CD-F8D9-4CB0-AB7C-7C33058294E4}'
CurVer = s 'DecalControls.Client.1'
}
NoRemove CLSID
{
ForceRemove {CD6556CD-F8D9-4CB0-AB7C-7C33058294E4} = s 'DecalControls Client'
{
ProgID = s 'DecalControls.Client.1'
VersionIndependentProgID = s 'DecalControls.Client'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,155 @@
// ControlImpl.h
// Default interface Implementations for controls
#ifndef __CONTROLIMPL_H
#define __CONTROLIMPL_H
#include "..\Inject\SinkImpl.h"
template< class cImpl, class ILayoutItf, const IID *pDispIID, const GUID *pLib >
class ATL_NO_VTABLE ILayoutImpl
: public IControlImpl< cImpl, ILayoutItf, pDispIID, pLib >,
public ILayerRenderImpl,
public ILayerSchema
{
public:
ILayoutImpl()
// Initialize in the static range
: m_nNextControlID( 1000 )
{
}
long m_nNextControlID;
// Override this function for custom schema fun
void onSchemaLoad( IView *, MSXML::IXMLDOMElementPtr & )
{
}
long loadChildControl( IView *pView, const MSXML::IXMLDOMElementPtr &pChild )
{
_ASSERTE( pView != NULL );
_ASSERTE( pChild.GetInterfacePtr() != NULL );
long nAssigned;
pView->LoadControl( static_cast< cImpl * >( this )->m_pSite, ++ m_nNextControlID, pChild, &nAssigned );
return nAssigned;
}
long dispenseID()
{
return ++ m_nNextControlID;
}
CComPtr< IImageCache > m_pBackground;
// ILayout Methods
STDMETHOD(get_Background)( IImageCacheDisp **ppVal )
{
_ASSERTE( ppVal != NULL );
if( m_pBackground.p == NULL )
*ppVal = NULL;
else
m_pBackground->QueryInterface( ppVal );
return S_OK;
}
STDMETHOD(putref_Background)( IImageCacheDisp *pCache )
{
if( m_pBackground.p )
m_pBackground.Release();
if( pCache != NULL )
pCache->QueryInterface( &m_pBackground );
static_cast< cImpl * >( this )->m_pSite->Invalidate();
return S_OK;
}
// ILayerRender Methods
STDMETHOD(Render)( ICanvas *pCanvas )
{
if( m_pBackground.p == NULL )
// No background means no drawing
return S_OK;
// Tile the background into the clipping area
ClipParams cp;
pCanvas->GetClipParams( &cp );
RECT rc = { cp.org.x, cp.org.y, cp.org.x + ( cp.window.right - cp.window.left ),
cp.org.y + ( cp.window.bottom - cp.window.top ) };
m_pBackground->PatBlt( pCanvas, &rc, &cp.org );
return S_OK;
}
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pXMLSchema )
{
MSXML::IXMLDOMElementPtr pElement = pXMLSchema;
CComPtr< IPluginSite > pPluginSite;
static_cast< cImpl * >( this )->m_pSite->get_PluginSite( &pPluginSite );
HRESULT hRes = pPluginSite->LoadImageSchema( pXMLSchema, &m_pBackground );
_ASSERTE( SUCCEEDED( hRes ) );
static_cast< cImpl * >( this )->onSchemaLoad( pView, pElement );
return S_OK;
}
};
template< UINT nID, class cImpl >
class IScrollerEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_IScrollerEvents, &LIBID_DecalControls >
{
};
template< UINT nID, class cImpl >
class IListEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_IListEvents, &LIBID_DecalControls >
{
};
template< UINT nID, class cImpl >
class INotebookEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_INotebookEvents, &LIBID_DecalControls >
{
};
#define DISPID_BEGIN 10
#define DISPID_END 11
template< UINT nID, class cImpl >
class IEditEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_IEditEvents, &LIBID_DecalControls >
{
};
#define DISPID_DROPDOWN 12
template< UINT nID, class cImpl >
class IChoiceEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_IChoiceEvents, &LIBID_DecalControls >
{
};
template< UINT nID, class cImpl >
class ICheckboxEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_ICheckboxEvents, &LIBID_DecalControls >
{
};
template< UINT nID, class cImpl >
class ISliderEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_ISliderEvents, &LIBID_DecalControls >
{
};
#endif

View file

@ -0,0 +1,14 @@
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "decalcontrols.h"
LastPage=0
ClassCount=0
ResourceCount=0

View file

@ -0,0 +1,105 @@
// DecalControls.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f DecalControlsps.mk in the project directory.
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "DecalControls.h"
#include "Scroller.h"
#include "List.h"
#include "TextColumn.h"
#include "IconColumn.h"
#include "CheckColumn.h"
#include "Notebook.h"
#include "DecalControls_i.c"
#include "Edit.h"
#include "Choice.h"
#include "FixedLayout.h"
#include "BorderLayout.h"
#include "PageLayout.h"
#include "PushButton.h"
#include "Static.h"
#include "Checkbox.h"
#include "DerethMap.h"
#include "Slider.h"
#include "Progress.h"
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Scroller, cScroller)
OBJECT_ENTRY(CLSID_List, cList)
OBJECT_ENTRY(CLSID_TextColumn, cTextColumn)
OBJECT_ENTRY(CLSID_IconColumn, cIconColumn)
OBJECT_ENTRY(CLSID_CheckColumn, cCheckColumn)
OBJECT_ENTRY(CLSID_Notebook, cNotebook)
OBJECT_ENTRY(CLSID_Edit, cEdit)
OBJECT_ENTRY(CLSID_Choice, cChoice)
OBJECT_ENTRY(CLSID_FixedLayout, cFixedLayout)
OBJECT_ENTRY(CLSID_BorderLayout, cBorderLayout)
OBJECT_ENTRY(CLSID_PageLayout, cPageLayout)
OBJECT_ENTRY(CLSID_PushButton, cPushButton)
OBJECT_ENTRY(CLSID_StaticText, cStatic)
OBJECT_ENTRY(CLSID_Checkbox, cCheckbox)
OBJECT_ENTRY(CLSID_DerethMap, cDerethMap)
OBJECT_ENTRY(CLSID_Slider, cSlider)
OBJECT_ENTRY(CLSID_Progress, cProgress)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_DecalControls);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();
return TRUE; // ok
}
/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return _Module.GetClassObject(rclsid, riid, ppv);
}
/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
return _Module.UnregisterServer(TRUE);
}

View file

@ -0,0 +1,9 @@
; DecalControls.def : Declares the module parameters.
LIBRARY "DecalControls.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

View file

@ -0,0 +1,402 @@
# Microsoft Developer Studio Project File - Name="DecalControls" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=DecalControls - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "DecalControls.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "DecalControls.mak" CFG="DecalControls - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DecalControls - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "DecalControls - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "DecalControls - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\Inject" /I "..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD MTL /nologo /I "..\Include" /Oicf
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\..\Debug
TargetPath=\Decal\source\Debug\DecalControls.dll
InputPath=\Decal\source\Debug\DecalControls.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "DecalControls - Win32 Release MinDependency"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseMinDependency"
# PROP BASE Intermediate_Dir "ReleaseMinDependency"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release"
# PROP Intermediate_Dir "ReleaseMinDependency"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /Oa /Og /Oi /Os /Oy /Ob1 /Gf /Gy /I "..\Inject" /I "..\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /c
# ADD MTL /nologo /I "..\Include" /Oicf
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\Release"
# Begin Custom Build - Performing registration
OutDir=.\..\Release
TargetPath=\Decal\source\Release\DecalControls.dll
InputPath=\Decal\source\Release\DecalControls.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ENDIF
# Begin Target
# Name "DecalControls - Win32 Debug"
# Name "DecalControls - Win32 Release MinDependency"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\BorderLayout.cpp
# End Source File
# Begin Source File
SOURCE=.\Checkbox.cpp
# End Source File
# Begin Source File
SOURCE=.\CheckColumn.cpp
# End Source File
# Begin Source File
SOURCE=.\Choice.cpp
# End Source File
# Begin Source File
SOURCE=.\ChoiceDropDown.cpp
# End Source File
# Begin Source File
SOURCE=.\ChoicePopup.cpp
# End Source File
# Begin Source File
SOURCE=.\DecalControls.cpp
# End Source File
# Begin Source File
SOURCE=.\DecalControls.def
# End Source File
# Begin Source File
SOURCE=.\DecalControls.idl
# ADD MTL /tlb ".\DecalControls.tlb" /h "DecalControls.h" /iid "DecalControls_i.c" /Oicf
# End Source File
# Begin Source File
SOURCE=.\DecalControls.rc
# End Source File
# Begin Source File
SOURCE=.\DerethMap.cpp
# End Source File
# Begin Source File
SOURCE=.\Edit.cpp
# End Source File
# Begin Source File
SOURCE=.\FixedLayout.cpp
# End Source File
# Begin Source File
SOURCE=.\IconColumn.cpp
# End Source File
# Begin Source File
SOURCE=..\Inject\Inject_i.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=.\List.cpp
# End Source File
# Begin Source File
SOURCE=.\ListView.cpp
# End Source File
# Begin Source File
SOURCE=.\Notebook.cpp
# End Source File
# Begin Source File
SOURCE=.\PageLayout.cpp
# End Source File
# Begin Source File
SOURCE=.\Progress.cpp
# End Source File
# Begin Source File
SOURCE=.\PushButton.cpp
# End Source File
# Begin Source File
SOURCE=.\Scroller.cpp
# End Source File
# Begin Source File
SOURCE=.\Slider.cpp
# End Source File
# Begin Source File
SOURCE=.\Static.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\TextColumn.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\BorderLayout.h
# End Source File
# Begin Source File
SOURCE=.\Checkbox.h
# End Source File
# Begin Source File
SOURCE=.\CheckColumn.h
# End Source File
# Begin Source File
SOURCE=.\Choice.h
# End Source File
# Begin Source File
SOURCE=.\ChoiceDropDown.h
# End Source File
# Begin Source File
SOURCE=.\ChoicePopup.h
# End Source File
# Begin Source File
SOURCE=.\ControlImpl.h
# End Source File
# Begin Source File
SOURCE=.\DecalControlsCP.h
# End Source File
# Begin Source File
SOURCE=.\DerethMap.h
# End Source File
# Begin Source File
SOURCE=.\Edit.h
# End Source File
# Begin Source File
SOURCE=.\FixedLayout.h
# End Source File
# Begin Source File
SOURCE=.\IconColumn.h
# End Source File
# Begin Source File
SOURCE=.\List.h
# End Source File
# Begin Source File
SOURCE=.\ListView.h
# End Source File
# Begin Source File
SOURCE=.\Notebook.h
# End Source File
# Begin Source File
SOURCE=.\PageLayout.h
# End Source File
# Begin Source File
SOURCE=.\Progress.h
# End Source File
# Begin Source File
SOURCE=.\PushButton.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\Scroller.h
# End Source File
# Begin Source File
SOURCE=.\Slider.h
# End Source File
# Begin Source File
SOURCE=.\Static.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\TextColumn.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\BorderLayout.rgs
# End Source File
# Begin Source File
SOURCE=.\Checkbox.rgs
# End Source File
# Begin Source File
SOURCE=.\CheckColumn.rgs
# End Source File
# Begin Source File
SOURCE=.\Choice.rgs
# End Source File
# Begin Source File
SOURCE=.\ChoiceDropDown.rgs
# End Source File
# Begin Source File
SOURCE=.\Client.rgs
# End Source File
# Begin Source File
SOURCE=.\DerethMap.rgs
# End Source File
# Begin Source File
SOURCE=.\Edit.rgs
# End Source File
# Begin Source File
SOURCE=.\FixedLayout.rgs
# End Source File
# Begin Source File
SOURCE=.\IconColumn.rgs
# End Source File
# Begin Source File
SOURCE=.\List.rgs
# End Source File
# Begin Source File
SOURCE=.\Notebook.rgs
# End Source File
# Begin Source File
SOURCE=.\PageLayout.rgs
# End Source File
# Begin Source File
SOURCE=.\Progress.rgs
# End Source File
# Begin Source File
SOURCE=.\PushButton.rgs
# End Source File
# Begin Source File
SOURCE=.\Scroller.rgs
# End Source File
# Begin Source File
SOURCE=.\Slider.rgs
# End Source File
# Begin Source File
SOURCE=.\Static.rgs
# End Source File
# Begin Source File
SOURCE=.\TextColumn.rgs
# End Source File
# End Group
# End Target
# End Project

View file

@ -0,0 +1,663 @@
// DecalControls.idl : IDL source for DecalControls.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (DecalControls.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
import "..\Inject\Inject.idl";
interface IListColumn;
enum eBorderEdge
{
eEdgeLeft,
eEdgeTop,
eEdgeRight,
eEdgeBottom
};
[
object,
uuid(24CFCE12-88A0-437A-89E6-31982EA92899),
helpstring("IScroller Interface"),
pointer_default(unique)
]
interface IScroller : IControl
{
[propget, helpstring("property Viewport")] HRESULT Viewport([out, retval] LPSIZE pVal);
[propget, helpstring("property Area")] HRESULT Area([out, retval] LPSIZE pVal);
[propput, helpstring("property Area")] HRESULT Area([in] LPSIZE newVal);
[propget, helpstring("property HorizontalEnabled")] HRESULT HorizontalEnabled([out, retval] VARIANT_BOOL *pVal);
[propput, helpstring("property HorizontalEnabled")] HRESULT HorizontalEnabled([in] VARIANT_BOOL newVal);
[propget, helpstring("property VerticalEnabled")] HRESULT VerticalEnabled([out, retval] VARIANT_BOOL *pVal);
[propput, helpstring("property VerticalEnabled")] HRESULT VerticalEnabled([in] VARIANT_BOOL newVal);
[helpstring("method CreateClient")] HRESULT CreateClient(ILayer *pChild);
[propget, helpstring("property Offset")] HRESULT Offset([out, retval] LPPOINT pVal);
[propput, helpstring("property Offset")] HRESULT Offset([in] LPPOINT newVal);
[helpstring("method ScrollTo")] HRESULT ScrollTo(LPPOINT ptOffset);
[propget, helpstring("property Increments")] HRESULT Increments([out, retval] LPSIZE pVal);
[propput, helpstring("property Increments")] HRESULT Increments([in] LPSIZE newVal);
[helpstring("method ResetScroller")] HRESULT ResetScroller();
};
[
uuid(DEE67370-16C9-4f81-80CC-1F1B61112299),
helpstring("IScrollerEvents Interface")
]
dispinterface IScrollerEvents
{
properties:
methods:
[id(1), helpstring("This control is about to be destroyed, release any references to this object.")] void Destroy(long nID);
[id(6), helpstring("method ScrollChange")] HRESULT Change(long nID, long nX, long nY);
};
[
object,
uuid(A54D70F6-8CFE-4259-9F16-AF0111541278),
dual,
helpstring("IList Interface"),
pointer_default(unique)
]
interface IListDisp : IControl
{
[id(101), helpstring("method AddRow")] HRESULT AddRow([out, retval] long *pnNewIndex);
[id(102), helpstring("method DeleteRow")] HRESULT DeleteRow(long nIndex);
[id(103), propget, helpstring("property Data")] HRESULT Data(long nX, long nY, [defaultvalue(0)] long nSubValue, [out, retval] VARIANT* pVal);
[id(103), propput, helpstring("property Data")] HRESULT Data(long nX, long nY, [defaultvalue(0)] long nSubValue, [in] VARIANT* newVal);
[id(104), propput, helpstring("property RowEstimate")] HRESULT RowEstimate([in] long newVal);
[propget, id(105), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
[id(106), helpstring("method Clear")] HRESULT Clear();
[id(107), helpstring("method InsertRow")] HRESULT InsertRow(long lIndex);
[id(108), propget, helpstring("method GetColumnWidth")] HRESULT ColumnWidth(long nColumn, [out, retval] long *nWidth);
[id(108), propput, helpstring("method SetColumnWidth")] HRESULT ColumnWidth(long nColumn, long nWidth);
[propget, id(109), helpstring("property Color")] HRESULT Color(long nX, long nY, [out, retval] long *pVal);
[propput, id(109), helpstring("property Color")] HRESULT Color(long nX, long nY, [in] long newVal);
[propget, id(110), helpstring("property AutoScroll")] HRESULT AutoScroll([out, retval] VARIANT_BOOL *pVal);
[propput, id(110), helpstring("property AutoScroll")] HRESULT AutoScroll([in] VARIANT_BOOL newVal);
[propget, id(111), helpstring("property ScrollPosition")] HRESULT ScrollPosition([out, retval] long *pVal);
[propput, id(111), helpstring("property ScrollPosition")] HRESULT ScrollPosition([in] long newVal);
[id(112), helpstring("method JumpToPosition")] HRESULT JumpToPosition(long newVal);
[propget, id(113), helpstring("property CountCols")] HRESULT CountCols([out, retval] long *pVal);
};
[
object,
uuid(D648F00A-FE27-4E88-895B-72F58AF50C0C),
helpstring("IList Interface"),
pointer_default(unique)
]
interface IList : IListDisp
{
[helpstring("method AddColumn")] HRESULT AddColumn(IListColumn *pNewColumn, [out, retval] long *nIndex);
[propget, helpstring("property CellRect")] HRESULT CellRect(LPPOINT pt, [out, retval] LPRECT pVal);
};
[
uuid(88456660-8132-433b-A4CD-E252BDF147C5),
helpstring("IListEvents Interface")
]
dispinterface IListEvents
{
properties:
methods:
[id(1), helpstring("This control is about to be destroyed, release any references to this object.")] void Destroy(long nID);
[id(6), helpstring("method ListDataChange")] void Change(long nID, long nX, long nY);
};
[
object,
uuid(E28573F0-36FC-4D64-B8E1-60A2D475A2A8),
helpstring("IListColumn Interface"),
pointer_default(unique)
]
interface IListColumn : IUnknown
{
[propget, helpstring("property FixedWidth")] HRESULT FixedWidth([out, retval] VARIANT_BOOL *pVal);
[propget, helpstring("property Width")] HRESULT Width([out, retval] long *pVal);
[helpstring("method Render")] HRESULT Render(ICanvas *, LPPOINT ptCell, long nColor);
[propget, helpstring("property DataColumns")] HRESULT DataColumns([out, retval] long *pVal);
[helpstring("property List")] HRESULT Initialize([in] IList * newVal, [in] IPluginSite *pSite);
[helpstring("method SchemaLoad")] HRESULT SchemaLoad(IUnknown *pSchema);
[propget, helpstring("property Height")] HRESULT Height([out, retval] long *pVal);
[helpstring("method Activate")] HRESULT Activate(LPPOINT ptCell);
[propput, helpstring("property Width")] HRESULT Width(long newVal);
};
[
object,
uuid(1A11BEA0-A0ED-41C1-9057-46084DE9AEDC),
helpstring("IListView Interface"),
pointer_default(unique)
]
interface IListView : IUnknown
{
[propput, helpstring("property Area")] HRESULT Area([in] LPSIZE newVal);
[helpstring("method SetCacheInfo")] HRESULT SetCacheInfo(long nRowHeight, long nRowsToCache);
[helpstring("method InvalidateFrom")] HRESULT InvalidateFrom(long nRow);
[propget, helpstring("property Color")] HRESULT Color(long nCol, long nRow, [out, retval] long *pVal);
[propput, helpstring("property Color")] HRESULT Color(long nCol, long nRow, [in] long newVal);
};
[
object,
uuid(78B62B0F-B3A4-47FF-A9A4-C68CA3FA80B6),
dual,
helpstring("INotebook Interface"),
pointer_default(unique)
]
interface INotebook : IControl
{
[id(101), helpstring("method AddPage")] HRESULT AddPage(BSTR strText, IControl *pClient);
[id(102), propget, helpstring("property ActiveTab")] HRESULT ActiveTab([out, retval] long *pVal);
[id(102), propput, helpstring("property ActiveTab")] HRESULT ActiveTab([in] long newVal);
[id(103), propget, helpstring("property PageText")] HRESULT PageText(long nIndex, [out, retval] BSTR *pVal);
[id(103), propput, helpstring("property PageText")] HRESULT PageText(long nIndex, [in] BSTR newVal);
};
[
uuid(C964E99A-7C1C-46e9-AEA6-09FF5D1BFDD0),
helpstring("INotebookEvents Interface")
]
dispinterface INotebookEvents
{
properties:
methods:
[id(1), helpstring("This control is about to be destroyed, release any references to this object.")] void Destroy(long nID);
[id(6), helpstring("method NotebookPageChange")] HRESULT Change(long nID, long nNewPage);
};
[
object,
uuid(D7EA9129-E36A-4317-BF24-76DA5967DA75),
dual,
helpstring("IEdit Interface"),
pointer_default(unique)
]
interface IEdit : IControl
{
[id(101), propget, helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal);
[id(101), propput, helpstring("property Text")] HRESULT Text([in] BSTR newVal);
[id(102), propget, helpstring("property Caret")] HRESULT Caret([out, retval] long *pVal);
[id(102), propput, helpstring("property Caret")] HRESULT Caret([in] long newVal);
[id(103), helpstring("method Select")] HRESULT Select(long nStart, long nEnd);
[id(104), propget, helpstring("property SelectedText")] HRESULT SelectedText([out, retval] BSTR *pVal);
[id(104), propput, helpstring("property SelectedText")] HRESULT SelectedText([in] BSTR newVal);
[id(105), propget, helpstring("property Background")] HRESULT Background([out, retval] IImageCacheDisp * *pVal);
[id(105), propputref, helpstring("property Background")] HRESULT Background([in] IImageCacheDisp * newVal);
[id(106), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
[id(106), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
[id(107), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
[id(107), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
[id(108), helpstring("property Margins")] HRESULT SetMargins(long nX, long nY);
[id(109), helpstring("method Capture")] HRESULT Capture();
};
[
uuid(4A3E384D-39A5-4bc2-A548-66634C8FACCE),
helpstring("IEditEvents Interface")
]
dispinterface IEditEvents
{
properties:
methods:
[id(1), helpstring("This control is about to be destroyed, release any references to this object")] void Destroy(long nID);
[id(10), helpstring("method EditBegin")] void Begin(long nID);
[id(6), helpstring("method EditChange")] void Change(long nID, BSTR strText);
[id(11), helpstring("method EditEnd")] void End(long nID, VARIANT_BOOL bSuccess);
};
[
object,
uuid(6450E486-03E6-493c-9D3B-9B36A5F50E65),
dual,
helpstring("Base interface for layout classes"),
pointer_default(unique)
]
interface ILayout : IControl
{
[id(101), propget, helpstring("property Background")] HRESULT Background([out, retval] IImageCacheDisp * *pVal);
[id(101), propputref, helpstring("property Background")] HRESULT Background([in] IImageCacheDisp * newVal);
};
[
object,
uuid(58CBF550-DFBE-433C-88EC-3FED4A5E09F1),
helpstring("IClient Interface"),
pointer_default(unique)
]
interface IFixedLayout : ILayout
{
[helpstring("method CreateChild")] HRESULT CreateChild(struct LayerParams *params, ILayer *pSink);
[helpstring("method PositionChild")] HRESULT PositionChild(long nID, LPRECT prcNew);
};
[
object,
uuid(BD2B37B8-80DE-4F50-ACF8-ED2525B27336),
dual,
helpstring("IChoice Interface"),
pointer_default(unique)
]
interface IChoice : IControl
{
[id(101), helpstring("method AddChoice")] HRESULT AddChoice(BSTR strDisplay, [optional] VARIANT vData);
[id(102), propget, helpstring("property ChoiceCount")] HRESULT ChoiceCount([out, retval] long *pVal);
[id(103), propget, helpstring("property Data")] HRESULT Data(long nIndex, [out, retval] VARIANT *pVal);
[id(103), propput, helpstring("property Data")] HRESULT Data(long nIndex, [in] VARIANT newVal);
[id(104), propget, helpstring("property Text")] HRESULT Text(long nIndex, [out, retval] BSTR *pVal);
[id(104), propput, helpstring("property Text")] HRESULT Text(long nIndex, [in] BSTR newVal);
[id(105), helpstring("method RemoveChoice")] HRESULT RemoveChoice(long nIndex);
[id(106), propget, helpstring("property Dropped")] HRESULT Dropped([out, retval] VARIANT_BOOL *pVal);
[id(106), propput, helpstring("property Dropped")] HRESULT Dropped([in] VARIANT_BOOL newVal);
[id(107), propget, helpstring("property Selected")] HRESULT Selected([out, retval] long *pVal);
[id(107), propput, helpstring("property Selected")] HRESULT Selected([in] long newVal);
[id(108), propget, helpstring("property DropLines")] HRESULT DropLines([out, retval] long *pVal);
[id(108), propput, helpstring("property DropLines")] HRESULT DropLines([in] long newVal);
[id(109), helpstring("method Clear")] HRESULT Clear();
};
[
uuid(763E36A3-389C-42eb-A5F3-C208D028F9AB),
helpstring("IChoiceEvents Interface")
]
dispinterface IChoiceEvents
{
properties:
methods:
[id(1), helpstring("This control is about to be destroyed, release any references to this object")] void Destroy(long nID);
[id(6), helpstring("Sent when the user changes the selection")] void Change(long nID, long nIndex);
[id(12), helpstring("Sent before drop down - you can add items at this point")] void DropDown(long nID);
};
[
object,
uuid(B40F3CEA-5DAD-413A-B779-D6FCB0663B7D),
helpstring("IChoicePopup Interface"),
pointer_default(unique)
]
interface IChoicePopup : IUnknown
{
};
[
object,
uuid(CF0438EB-8299-48E8-B766-9E9BDDA50203),
helpstring("IBorderLayout Interface"),
pointer_default(unique)
]
interface IBorderLayout : ILayout
{
[helpstring("method CreateEdge")] HRESULT CreateEdge(enum eBorderEdge eEdge, long nSize, ILayer *pSink);
[helpstring("method CreateCenter")] HRESULT CreateCenter(ILayer *pSink);
};
[
object,
uuid(1E39FB9E-2C07-4287-B2D7-58EE0BFC9BBB),
dual,
helpstring("IPageLayout Interface"),
pointer_default(unique)
]
interface IPageLayoutDisp : ILayout
{
[id(201), propget, helpstring("property Active")] HRESULT Active([out, retval] long *pVal);
[id(201), propput, helpstring("property Active")] HRESULT Active([in] long newVal);
[id(202), propget, helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
};
[
object,
uuid(2DF39739-2EFC-4F67-B3AC-712D774B57A9),
helpstring("IPageLayout Interface"),
pointer_default(unique)
]
interface IPageLayout : IPageLayoutDisp
{
[helpstring("method CreatePage")] HRESULT CreatePage(ILayer *pChild);
};
[
object,
uuid(AAAB9EEA-06E8-4F0A-A926-3A9AB45939FF),
dual,
helpstring("IPushButton Interface"),
pointer_default(unique)
]
interface IPushButton : IControl
{
[id(101), propget, helpstring("property Image")] HRESULT Image([out, retval] IImageCacheDisp * *pVal);
[id(101), propputref, helpstring("property Image")] HRESULT Image([in] IImageCacheDisp * newVal);
[id(102), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
[id(102), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
[id(103), propget, helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal);
[id(103), propput, helpstring("property Text")] HRESULT Text([in] BSTR newVal);
[id(104), propget, helpstring("property FaceColor")] HRESULT FaceColor([out, retval] long *pVal);
[id(104), propput, helpstring("property FaceColor")] HRESULT FaceColor([in] long newVal);
[id(105), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
[id(105), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
};
[
object,
uuid(93C28CFF-DCF4-4B63-AB00-A89453940CFE),
dual,
helpstring("IStatic Interface"),
pointer_default(unique)
]
interface IStatic : IControl
{
[id(101), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
[id(101), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
[id(102), propget, helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal);
[id(102), propput, helpstring("property Text")] HRESULT Text([in] BSTR newVal);
[id(103), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
[id(103), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
};
[
object,
uuid(63D0BB56-1552-4F8C-99CC-52006DD47E9E),
dual,
helpstring("ICheckbox Interface"),
pointer_default(unique)
]
interface ICheckbox : IControl
{
[id(101), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
[id(101), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
[id(102), propget, helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal);
[id(102), propput, helpstring("property Text")] HRESULT Text([in] BSTR newVal);
[id(103), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
[id(103), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
[id(104), propget, helpstring("property Checked")] HRESULT Checked([out, retval] VARIANT_BOOL *pVal);
[id(104), propput, helpstring("property Checked")] HRESULT Checked([in] VARIANT_BOOL newVal);
[id(105), propget, helpstring("property RightToLeft")] HRESULT RightToLeft([out, retval] VARIANT_BOOL *pVal);
[id(105), propput, helpstring("property RightToLeft")] HRESULT RightToLeft([in] VARIANT_BOOL newVal);
};
[
uuid(D56CB28A-9BAD-40b1-A011-70F466DC8F05),
helpstring("ICheckboxEvents Interface")
]
dispinterface ICheckboxEvents
{
properties:
methods:
[id(1), helpstring("This control is about to be destroyed, release any references to this object")] void Destroy(long nID);
[id(6), helpstring("method CheckboxToggle")] void Change(long nID, VARIANT_BOOL bChecked);
};
[
object,
uuid(10D12549-8F59-4f06-83FB-D08FB76337F3),
dual,
helpstring("ISlider Interface"),
pointer_default(unique)
]
interface ISlider : IControl
{
[id(101), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
[id(101), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
[id(103), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
[id(103), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
[id(104), propget, helpstring("property SliderPosition")] HRESULT SliderPosition([out, retval] long *pVal);
[id(104), propput, helpstring("property SliderPosition")] HRESULT SliderPosition([in] long newVal);
[id(105), propget, helpstring("property Minimum")] HRESULT Minimum([out, retval] long *pVal);
[id(105), propput, helpstring("property Minimum")] HRESULT Minimum([in] long newVal);
[id(106), propget, helpstring("property Maximum")] HRESULT Maximum([out, retval] long *pVal);
[id(106), propput, helpstring("property Maximum")] HRESULT Maximum([in] long newVal);
};
[
uuid(F881B44D-67FA-4770-B10A-05DA14409E8F),
helpstring("ISliderEvents Interface")
]
dispinterface ISliderEvents
{
properties:
methods:
[id(1), helpstring("This control is about to be destroyed, release any references to this object")] void Destroy(long nID);
[id(6), helpstring("method Change")] void Change(long nID, long lValue);
};
[
object,
uuid(5BAD2CC0-6F03-4EA9-8D7E-1DFD9D134648),
helpstring("IChoiceDropDown Interface"),
pointer_default(unique)
]
interface IChoiceDropDown : IUnknown
{
};
[
object,
uuid(D4FBCA22-45B4-4775-A181-1D4EEC3BFEA1),
helpstring("IDerethMap Interface"),
pointer_default(unique)
]
interface IDerethMap : IControl
{
};
[
object,
uuid(2EC89916-3E65-422B-977C-9277BA693E82),
dual,
helpstring("IProgress Interface"),
pointer_default(unique)
]
interface IProgress : IControl
{
[propget, id(101), helpstring("property Value")] HRESULT Value([out, retval] long *pVal);
[propput, id(101), helpstring("property Value")] HRESULT Value([in] long newVal);
[propput, id(102), helpstring("property FaceColor")] HRESULT FaceColor([in] long newVal);
[propput, id(103), helpstring("property FillColor")] HRESULT FillColor([in] long newVal);
[propput, id(104), helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
[propput, id(105), helpstring("property MaxValue")] HRESULT MaxValue([in] long newVal);
[propput, id(106), helpstring("property PostText")] HRESULT PostText([in] BSTR newVal);
[propput, id(107), helpstring("property Alignment")] HRESULT Alignment([in] BSTR newVal);
[propput, id(108), helpstring("property DrawText")] HRESULT DrawText([in] VARIANT_BOOL newVal);
[propput, id(109), helpstring("property PreText")] HRESULT PreText([in] BSTR newVal);
[propput, id(110), helpstring("property BorderWidth")] HRESULT BorderWidth([in] long newVal);
[propput, id(111), helpstring("property BorderColor")] HRESULT BorderColor([in] long newVal);
};
[
uuid(1C4B007A-04DD-4DF8-BA29-2CFBD0220B89),
version(1.0),
helpstring("Decal Controls Type Library")
]
library DecalControls
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface ILayout;
interface IListView;
interface IChoicePopup;
dispinterface IListEvents;
dispinterface IChoiceEvents;
dispinterface IScrollerEvents;
dispinterface INotebookEvents;
dispinterface IEditEvents;
dispinterface IChoiceEvents;
dispinterface ICheckboxEvents;
dispinterface ISliderEvents;
interface IListDisp;
interface IPageLayoutDisp;
[
uuid(8FC80D21-1731-4816-9AD3-B0364D5F2C27),
helpstring("Scroller Class")
]
coclass Scroller
{
[default] interface IControl;
[default, source] interface IScrollerEvents;
};
[
uuid(3839008F-AF5B-43FC-9F6A-3376B99E3DAF),
helpstring("List Class")
]
coclass List
{
[default] interface IListDisp;
[default, source] interface IListEvents;
};
[
uuid(864DEABF-D079-4B61-A8CF-081418179239),
helpstring("TextColumn Class")
]
coclass TextColumn
{
[default] interface IListColumn;
};
[
uuid(F12A2C4C-3B78-46EB-8722-68B27A75AE55),
helpstring("IconColumn Class")
]
coclass IconColumn
{
[default] interface IListColumn;
};
[
uuid(48E444F1-8E30-4E4C-B203-4C87FC901586),
helpstring("CheckColumn Class")
]
coclass CheckColumn
{
[default] interface IListColumn;
};
[
uuid(ED14E7C5-11BE-4DFD-9829-873AB6BE3CFC),
helpstring("Notebook Class")
]
coclass Notebook
{
[default] interface INotebook;
[default, source] interface INotebookEvents;
};
[
uuid(8E8F88D2-AA47-474E-9DB7-912D49C8BE9D),
helpstring("Edit Class")
]
coclass Edit
{
[default] interface IEdit;
[default, source] interface IEditEvents;
};
[
uuid(E099DC60-0F19-4690-AB7C-8B5834DA286E),
helpstring("Choice Class")
]
coclass Choice
{
[default] interface IChoice;
[default, source] interface IChoiceEvents;
};
[
uuid(CD6556CD-F8D9-4CB0-AB7C-7C33058294E4),
helpstring("FixedLayout Class")
]
coclass FixedLayout
{
[default] interface ILayout;
[default, source] interface IControlEvents;
};
[
uuid(CA121762-31BB-4073-8597-33BAB4BDCAA3),
helpstring("BorderLayout Class")
]
coclass BorderLayout
{
[default] interface ILayout;
[default, source] interface IControlEvents;
};
[
uuid(5AD04D45-D4BF-4729-8A2E-5D37CF726CAA),
helpstring("PageLayout Class")
]
coclass PageLayout
{
[default] interface IPageLayoutDisp;
[default, source] interface IControlEvents;
};
[
uuid(AE4525BE-81D1-40FB-9170-77172077EB49),
helpstring("PushButton Class")
]
coclass PushButton
{
[default] interface IPushButton;
[default, source] interface ICommandEvents;
};
[
uuid(4887101C-A9F9-495B-921B-EF22822CFB97),
helpstring("Static Class")
]
coclass StaticText
{
[default] interface IStatic;
[default, source] interface IControlEvents;
};
[
uuid(5AE37451-F79C-478A-834E-EDCF95F01B0E),
helpstring("Checkbox Class")
]
coclass Checkbox
{
[default] interface ICheckbox;
[default, source] interface ICheckboxEvents;
};
[
uuid(5D14557A-1268-43c6-A283-3B5B271359AA),
helpstring("Slider Class")
]
coclass Slider
{
[default] interface ISlider;
[default, source] interface ISliderEvents;
};
[
uuid(3035299A-C5FB-4CC7-A63C-66400B80DCA4),
helpstring("DerethMap Class")
]
coclass DerethMap
{
[default] interface IDerethMap;
[default, source] interface ICommandEvents;
};
[
uuid(FE361225-6BB7-4AE0-A10C-8A6420621680),
helpstring("Progress Class")
]
coclass Progress
{
[default] interface IProgress;
[default, source] interface IControlEvents;
};
};

View file

@ -0,0 +1,142 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "..\Include\DecalVersion.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""DecalControls.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
PRODUCTVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "DecalControls is a group of control objects that give plug-in developers a basic group of UI elements to work with"
VALUE "FileDescription", "DecalControls Module"
VALUE "FileVersion", DECAL_VERSION_STRING
VALUE "InternalName", "DecalControls"
VALUE "LegalCopyright", "Copyright 2001"
VALUE "OriginalFilename", "DecalControls.DLL"
VALUE "ProductName", "DecalControls Module"
VALUE "ProductVersion", DECAL_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_TEXTCOLUMN REGISTRY "TextColumn.rgs"
IDR_ICONCOLUMN REGISTRY "IconColumn.rgs"
IDR_LIST REGISTRY "List.rgs"
IDR_NOTEBOOK REGISTRY "Notebook.rgs"
IDR_SCROLLER REGISTRY "Scroller.rgs"
IDR_CHECKCOLUMN REGISTRY "CheckColumn.rgs"
IDR_EDIT REGISTRY "Edit.rgs"
IDR_CHOICE REGISTRY "Choice.rgs"
IDR_FIXEDLAYOUT REGISTRY "FixedLayout.rgs"
IDR_BORDERLAYOUT REGISTRY "BorderLayout.rgs"
IDR_PAGELAYOUT REGISTRY "PageLayout.rgs"
IDR_PUSHBUTTON REGISTRY "PushButton.rgs"
IDR_STATIC REGISTRY "Static.rgs"
IDR_CHECKBOX REGISTRY "Checkbox.rgs"
IDR_DerethMap REGISTRY "DerethMap.rgs"
IDR_SLIDER REGISTRY "Slider.rgs"
IDR_PROGRESS REGISTRY "Progress.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "DecalControls"
END
STRINGTABLE
BEGIN
IDS_DERETHMAP_DESC "DerethMap Class"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "DecalControls.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,788 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="DecalControls"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release MinDependency|Win32"
OutputDirectory=".\..\Release"
IntermediateDirectory=".\ReleaseMinDependency"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\Inject,..\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\ReleaseMinDependency/DecalControls.pch"
AssemblerListingLocation=".\ReleaseMinDependency/"
ObjectFile=".\ReleaseMinDependency/"
ProgramDataBaseFileName=".\ReleaseMinDependency/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
OutputFile=".\..\Release/DecalControls.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Release"
ModuleDefinitionFile=".\DecalControls.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Release/DecalControls.pdb"
SubSystem="2"
ImportLibrary=".\..\Release/DecalControls.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Release/DecalControls.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\..\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Inject,..\Include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/DecalControls.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
OutputFile=".\..\Debug/DecalControls.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\DecalControls.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Debug/DecalControls.pdb"
SubSystem="2"
ImportLibrary=".\..\Debug/DecalControls.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Debug/DecalControls.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="BorderLayout.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="Checkbox.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="CheckColumn.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="Choice.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="ChoiceDropDown.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="ChoicePopup.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalControls.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalControls.def">
</File>
<File
RelativePath="DecalControls.idl">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName=".\DecalControls.tlb"
HeaderFileName="DecalControls.h"
InterfaceIdentifierFileName="DecalControls_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName=".\DecalControls.tlb"
HeaderFileName="DecalControls.h"
InterfaceIdentifierFileName="DecalControls_i.c"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalControls.rc">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
</File>
<File
RelativePath="DerethMap.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="Edit.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="FixedLayout.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="IconColumn.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Inject\Inject_i.c">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
UsePrecompiledHeader="0"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="List.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="ListView.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="Notebook.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="PageLayout.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="Progress.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="PushButton.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="Scroller.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="Slider.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="Static.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
<File
RelativePath="TextColumn.cpp">
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="BorderLayout.h">
</File>
<File
RelativePath="Checkbox.h">
</File>
<File
RelativePath="CheckColumn.h">
</File>
<File
RelativePath="Choice.h">
</File>
<File
RelativePath="ChoiceDropDown.h">
</File>
<File
RelativePath="ChoicePopup.h">
</File>
<File
RelativePath="ControlImpl.h">
</File>
<File
RelativePath="DecalControlsCP.h">
</File>
<File
RelativePath="DerethMap.h">
</File>
<File
RelativePath="Edit.h">
</File>
<File
RelativePath="FixedLayout.h">
</File>
<File
RelativePath="IconColumn.h">
</File>
<File
RelativePath="List.h">
</File>
<File
RelativePath="ListView.h">
</File>
<File
RelativePath="Notebook.h">
</File>
<File
RelativePath="PageLayout.h">
</File>
<File
RelativePath="Progress.h">
</File>
<File
RelativePath="PushButton.h">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="Scroller.h">
</File>
<File
RelativePath="Slider.h">
</File>
<File
RelativePath="Static.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
<File
RelativePath="TextColumn.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="BorderLayout.rgs">
</File>
<File
RelativePath="Checkbox.rgs">
</File>
<File
RelativePath="CheckColumn.rgs">
</File>
<File
RelativePath="Choice.rgs">
</File>
<File
RelativePath="ChoiceDropDown.rgs">
</File>
<File
RelativePath="Client.rgs">
</File>
<File
RelativePath="DerethMap.rgs">
</File>
<File
RelativePath="Edit.rgs">
</File>
<File
RelativePath="FixedLayout.rgs">
</File>
<File
RelativePath="IconColumn.rgs">
</File>
<File
RelativePath="List.rgs">
</File>
<File
RelativePath="Notebook.rgs">
</File>
<File
RelativePath="PageLayout.rgs">
</File>
<File
RelativePath="Progress.rgs">
</File>
<File
RelativePath="PushButton.rgs">
</File>
<File
RelativePath="Scroller.rgs">
</File>
<File
RelativePath="Slider.rgs">
</File>
<File
RelativePath="Static.rgs">
</File>
<File
RelativePath="TextColumn.rgs">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,821 @@
#ifndef _DECALCONTROLSCP_H_
#define _DECALCONTROLSCP_H_
template <class T>
class CProxyISliderEvents : public IConnectionPointImpl<T, &DIID_ISliderEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
HRESULT Fire_Destroy(LONG nID)
{
try
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
// Return failure
return E_FAIL;
}
}
HRESULT Fire_Change(LONG nID, LONG nValue)
{
try
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[1] = nID;
pvars[0] = nValue;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
// Return failure
return E_FAIL;
}
}
};
template <class T>
class CProxyICheckboxEvents : public IConnectionPointImpl<T, &DIID_ICheckboxEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
HRESULT Fire_Destroy(LONG nID)
{
try
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
// Return failure
return E_FAIL;
}
}
HRESULT Fire_Change(LONG nID, VARIANT_BOOL bChecked)
{
try
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[1] = nID;
pvars[0] = bChecked;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
// Return failure
return E_FAIL;
}
}
};
template <class T>
class CProxyIChoiceEvents : public IConnectionPointImpl<T, &DIID_IChoiceEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
VOID Fire_Destroy(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_Change(LONG nID, LONG nIndex)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[1] = nID;
pvars[0] = nIndex;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_DropDown(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0xc, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
};
template <class T>
class CProxyIListEvents : public IConnectionPointImpl<T, &DIID_IListEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
VOID Fire_Destroy(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_Change(LONG nID, LONG nX, LONG nY)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[3];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[2] = nID;
pvars[1] = nX;
pvars[0] = nY;
DISPPARAMS disp = { pvars, NULL, 3, 0 };
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
};
template <class T>
class CProxyINotebookEvents : public IConnectionPointImpl<T, &DIID_INotebookEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
VOID Fire_Destroy(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
HRESULT Fire_Change(LONG nID, LONG nNewPage)
{
try
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[1] = nID;
pvars[0] = nNewPage;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
// Return failure
return E_FAIL;
}
}
};
template <class T>
class CProxyICommandEvents : public IConnectionPointImpl<T, &DIID_ICommandEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
VOID Fire_Destroy(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_Hit(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_Unhit(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_Accepted(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_Canceled(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
};
template <class T>
class CProxyIScrollerEvents : public IConnectionPointImpl<T, &DIID_IScrollerEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
VOID Fire_Destroy(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
HRESULT Fire_Change(LONG nID, LONG nX, LONG nY)
{
try
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[3];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[2] = nID;
pvars[1] = nX;
pvars[0] = nY;
DISPPARAMS disp = { pvars, NULL, 3, 0 };
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
// Return failure
return E_FAIL;
}
}
};
template <class T>
class CProxyIControlEvents : public IConnectionPointImpl<T, &DIID_IControlEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
VOID Fire_Destroy(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
};
template <class T>
class CProxyIEditEvents : public IConnectionPointImpl<T, &DIID_IEditEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
VOID Fire_Destroy(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_Begin(LONG nID)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = nID;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0xa, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_Change(LONG nID, BSTR strText)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[1] = nID;
pvars[0] = strText;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
VOID Fire_End(LONG nID, VARIANT_BOOL bSuccess)
{
try
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[1] = nID;
pvars[0] = bSuccess;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0xb, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
catch (...)
{
// In debug mode warn the user
_ASSERTE( FALSE );
}
}
};
#endif

View file

@ -0,0 +1,11 @@
LIBRARY "DecalControlsPS"
DESCRIPTION 'Proxy/Stub DLL'
EXPORTS
DllGetClassObject @1 PRIVATE
DllCanUnloadNow @2 PRIVATE
GetProxyDllInfo @3 PRIVATE
DllRegisterServer @4 PRIVATE
DllUnregisterServer @5 PRIVATE

View file

@ -0,0 +1,16 @@
DecalControlsps.dll: dlldata.obj DecalControls_p.obj DecalControls_i.obj
link /dll /out:DecalControlsps.dll /def:DecalControlsps.def /entry:DllMain dlldata.obj DecalControls_p.obj DecalControls_i.obj \
kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \
.c.obj:
cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \
$<
clean:
@del DecalControlsps.dll
@del DecalControlsps.lib
@del DecalControlsps.exp
@del dlldata.obj
@del DecalControls_p.obj
@del DecalControls_i.obj

View file

@ -0,0 +1,120 @@
// DerethMap.cpp : Implementation of CDecalControlsApp and DLL registration.
#include "stdafx.h"
#include "DecalControls.h"
#include "DerethMap.h"
/////////////////////////////////////////////////////////////////////////////
//
cDerethMap::cDerethMap()
{
m_rcMapSrc.left = m_rcMapSrc.top = 100;
m_rcMapSrc.right = m_rcMapSrc.bottom = 200;
}
cDerethMap::~cDerethMap()
{
}
void cDerethMap::onCreate()
{
CComPtr< IButton > pRollup;
HRESULT hRes = ::CoCreateInstance( CLSID_Button, NULL, CLSCTX_INPROC_SERVER, IID_IButton, reinterpret_cast< void ** >( &pRollup ) );
_ASSERTE( SUCCEEDED( hRes ) );
CComPtr< ILayer > pBtnLayer;
pRollup->QueryInterface( &pBtnLayer );
LayerParams lp = { 1, { 180 - 22, 0, 180, 31 }, eRenderTransparent };
m_pSite->CreateChild( &lp, pBtnLayer );
pRollup->put_Matte( RGB( 0, 0, 0 ) );
pRollup->SetImages( 0, 0x06001127, 0x06001128 );
}
void cDerethMap::onDestroy()
{
}
STDMETHODIMP cDerethMap::SchemaLoad( IView *pView, IUnknown *pSchema )
{
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
pPlugin->LoadImageSchema( pSchema, &m_pBackground );
pPlugin->LoadBitmapFile( _bstr_t( "MapObject.bmp" ), &m_pObjectImage );
BSTR bstrFontName;
pPlugin->get_FontName(&bstrFontName);
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
return S_OK;
}
void cDerethMap::checkFont()
{
if( m_pFont.p == NULL )
{
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
BSTR bstrFontName;
pPlugin->get_FontName(&bstrFontName);
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
}
}
STDMETHODIMP cDerethMap::MouseEnter(struct MouseState *)
{
return S_OK;
}
STDMETHODIMP cDerethMap::MouseExit(struct MouseState *)
{
return S_OK;
}
STDMETHODIMP cDerethMap::MouseDown(struct MouseState *pms)
{
m_rcMapSrc.left += 5;
m_rcMapSrc.right = 600;
m_pSite->Invalidate( );
return S_OK;
}
STDMETHODIMP cDerethMap::MouseUp(struct MouseState *)
{
m_rcMapSrc.left += 5;
m_rcMapSrc.right = 600;
m_pSite->Invalidate( );
return S_OK;
}
STDMETHODIMP cDerethMap::Reformat()
{
return S_OK;
}
STDMETHODIMP cDerethMap::Render( ICanvas *pCanvas )
{
_ASSERTE( pCanvas != NULL );
_ASSERTE( m_pSite.p != NULL );
static POINT ptOff = { 0, 0 };
RECT rcPos;
m_pSite->get_Position( &rcPos );
RECT rcClient = { 0, 12, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top + 12 };
RECT rcDest = { 0, 12, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top + 12 };
if( m_pBackground.p != NULL )
m_pBackground->StretchBltArea( &m_rcMapSrc, pCanvas, &rcDest );
checkFont( );
return S_OK;
}

View file

@ -0,0 +1,92 @@
// DerethMap.h: Definition of the cDerethMap class
//
//////////////////////////////////////////////////////////////////////
#ifndef __DERETHMAP_H_
#define __DERETHMAP_H_
#if !defined(AFX_DERETHMAP_H__D110354A_8D4A_485A_9379_961C3A6E445D__INCLUDED_)
#define AFX_DERETHMAP_H__D110354A_8D4A_485A_9379_961C3A6E445D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "DecalControlsCP.h"
#define MAPSIZE_X 245
#define MAPSIZE_Y 245
#define MAPBORDER_X 6
#define MAPBORDER_Y 11
/////////////////////////////////////////////////////////////////////////////
// cDerethMap
class ATL_NO_VTABLE cDerethMap :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cDerethMap,&CLSID_DerethMap>,
public IControlImpl< cDerethMap, IDerethMap, &IID_IDerethMap, &LIBID_DecalControls >,
public ILayerImpl< cDerethMap >,
public ILayerRenderImpl,
public ILayerSchema,
public ILayerMouseImpl,
public IProvideClassInfo2Impl< &CLSID_DerethMap, &DIID_ICommandEvents, &LIBID_DecalControls >,
public IConnectionPointContainerImpl<cDerethMap>,
public CProxyICommandEvents< cDerethMap >
{
public:
cDerethMap();
~cDerethMap();
CComPtr< IImageCache > m_pBackground;
CComPtr< IImageCache > m_pObjectImage;
CComPtr< IFontCache > m_pFont;
RECT m_rcMapSrc;
DECLARE_REGISTRY_RESOURCEID(IDR_DerethMap)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cDerethMap)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IDerethMap)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cDerethMap)
CONNECTION_POINT_ENTRY(DIID_ICommandEvents)
END_CONNECTION_POINT_MAP()
void onCreate();
void onDestroy();
void checkFont();
public:
// ILayerMouse Methods
STDMETHOD(MouseEnter)(struct MouseState *);
STDMETHOD(MouseExit)(struct MouseState *);
STDMETHOD(MouseDown)(struct MouseState *);
STDMETHOD(MouseUp)(struct MouseState *);
// ILayerRender Methods
STDMETHOD(Reformat)();
STDMETHOD(Render)(ICanvas *pCanvas);
// ILayerSchema Methods
STDMETHOD(SchemaLoad)( IView *pView, IUnknown *pSchema );
};
#endif // !defined(AFX_DERETHMAP_H__D110354A_8D4A_485A_9379_961C3A6E445D__INCLUDED_)
#endif

View file

@ -0,0 +1,23 @@
HKCR
{
DecalControls.DerethMap.1 = s 'DerethMap Class'
{
CLSID = s '{3035299A-C5FB-4CC7-A63C-66400B80DCA4}'
}
DecalControls.DerethMap = s 'DerethMap Class'
{
CLSID = s '{3035299A-C5FB-4CC7-A63C-66400B80DCA4}'
}
NoRemove CLSID
{
ForceRemove {3035299A-C5FB-4CC7-A63C-66400B80DCA4} = s 'DerethMap Class'
{
ProgID = s 'DecalControls.DerethMap.1'
VersionIndependentProgID = s 'DecalControls.DerethMap'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'both'
}
}
}
}

View file

@ -0,0 +1,990 @@
// Edit.cpp : Implementation of cEdit
#include "stdafx.h"
#include "DecalControls.h"
#include "Edit.h"
/////////////////////////////////////////////////////////////////////////////
// cEdit
#define TIMER_CARET 1
#define TIMER_REPEAT 2
#define END -1
#ifndef MIN
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef MAX
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#endif
cEdit::cEdit()
: m_bAllowCapture( true ), // cyn -- 15/10/2002
m_bCapture( false ),
m_bDrawCaret( false ),
m_bSelecting( false ),
m_nSelStartChar( 0 ),
m_nSelStart( 0 ),
m_nCaretChar( 0 ),
m_nCaret( 0 ),
m_nOffset( 0 ),
m_nTextColor( 0 ),
m_nCaretHeight( 0 )
{
m_szMargin.cx = 3;
m_szMargin.cy = 1;
}
void cEdit::checkFont()
{
if( m_pFont.p == NULL )
{
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
BSTR bstrFontName;
pPlugin->get_FontName(&bstrFontName);
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
}
}
void cEdit::sendTextChange()
{
long nID;
m_pSite->get_ID( &nID );
Fire_Change( nID, _bstr_t( m_strText.c_str() ) );
}
void cEdit::Delete() {
if (m_nCaretChar == m_nSelStartChar) {
return;
}
m_strText.assign( m_strText.substr(0, MIN(m_nCaretChar, m_nSelStartChar)) + m_strText.substr(MAX(m_nCaretChar, m_nSelStartChar), m_strText.length()) );
if (m_bPassword) { /* This is bad, someone fix it */
m_strPass.assign( m_strPass.substr(0, MIN(m_nCaretChar, m_nSelStartChar)) + m_strPass.substr(MAX(m_nCaretChar, m_nSelStartChar), m_strPass.length()) );
}
m_nSelStartChar = MIN(m_nCaretChar, m_nSelStartChar);
put_Caret( m_nSelStartChar );
}
void cEdit::Copy() {
HGLOBAL hMem;
HRESULT hr;
long hWnd;
IPluginSite *Plug;
char *lpMem;
int Start, Length;
if (m_bPassword) {
return;
}
hr = m_pSite->get_PluginSite(&Plug);
if (FAILED(hr)) {
return;
}
hr = Plug->get_HWND(&hWnd);
Plug->Release();
Plug = NULL;
if (FAILED(hr)) {
return;
}
if (m_nCaretChar < m_nSelStartChar) {
Start = m_nCaretChar;
Length = m_nSelStartChar - Start;
} else {
Start = m_nSelStartChar;
Length = m_nCaretChar - Start;
}
hMem = GlobalAlloc(GMEM_MOVEABLE, Length+1);
if (!hMem) {
return;
}
lpMem = (char *)GlobalLock(hMem);
if (!lpMem) {
GlobalFree(hMem);
return;
}
/* This is gauranteed to nul-terminate */
lstrcpyn( lpMem, m_strText.c_str() + Start, Length + 1);
GlobalUnlock(hMem);
if (!OpenClipboard((HWND)hWnd)) {
GlobalFree(hMem);
return;
}
EmptyClipboard();
GetLastError();
SetClipboardData(CF_TEXT, hMem);
GetLastError();
CloseClipboard();
}
void cEdit::Cut() {
if (!m_bPassword) {
Copy();
Delete();
}
}
// OK, this paste code isn't pretty, but it's functional for now. Look for a full rewrite later!
// cyn, 22/10/2002
void cEdit::Paste() {
HANDLE hClipboardData;
char *sData;
int Count, Length;
Delete();
if (!OpenClipboard(NULL)) {
return;
}
hClipboardData = GetClipboardData(CF_TEXT);
if (hClipboardData) {
sData = (char *)GlobalLock(hClipboardData);
if (sData) {
Length = lstrlen(sData);
for (Count=0;Count<Length;Count++) {
if ((sData[Count] == 13) || (sData[Count] == 10)) {
break;
}
}
m_strText.insert(m_strText.begin() + m_nCaretChar, sData, sData + Count);
if (m_bPassword) {
m_strPass.insert(m_strPass.begin(), Count, '*');
}
put_Caret(m_nCaretChar + Count);
GlobalUnlock(hClipboardData);
}
}
CloseClipboard();
}
int cEdit::Normalize(int Offset) {
int Length;
Length = m_strText.length();
if (Offset == END) {
return Length;
} else if (Offset < END) {
return 0;
} else if (Offset > Length) {
return Length;
}
return Offset;
}
STDMETHODIMP cEdit::Reformat()
{
// Just a typical post-resize type of behavior, make sure everythign is still visible as
// the user likes.
if( m_nCaretChar > m_strText.length() )
put_Caret( m_strText.length() );
else
// Force a recalculation for scrolling
put_Caret( m_nCaretChar );
//put_Caret( m_nCaretChar );
return S_OK;
}
STDMETHODIMP cEdit::Render( ICanvas *pCanvas )
{
HDC RenderDC;
HRESULT hr;
checkFont();
// Draw the background
RECT rcPos;
m_pSite->get_Position( &rcPos );
RECT rcClient = { 0, 0, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top };
if( m_pBackground.p != NULL )
{
static POINT ptOff = { 0, 0 };
m_pBackground->PatBlt( pCanvas, &rcClient, &ptOff );
}
RECT rcText = { m_szMargin.cx, m_szMargin.cy, rcClient.right - m_szMargin.cx, rcClient.bottom - m_szMargin.cy };
VARIANT_BOOL bVisible;
pCanvas->SetClipRect( &rcText, &bVisible );
if( !bVisible )
// Nothing to draw huzzah!
return S_OK;
long lFlags = 0;
if( m_bAA )
lFlags |= eAA;
if( m_bOutline )
lFlags |= eOutlined;
// Draw the text
POINT ptText = { -m_nOffset, 0 };
if( m_strText.length() > 0 )
if (m_bPassword) {
m_pFont->DrawTextEx( &ptText, _bstr_t( m_strPass.c_str() ), m_nTextColor, m_nOutlineColor, lFlags, pCanvas );
} else {
m_pFont->DrawTextEx( &ptText, _bstr_t( m_strText.c_str() ), m_nTextColor, m_nOutlineColor, lFlags, pCanvas );
}
if( m_bCapture && m_bDrawCaret )
{
// Draw the caret
RECT rcCaret = { m_nCaret - m_nOffset, m_szMargin.cy, m_nCaret - m_nOffset + 1, m_szMargin.cy + m_nCaretHeight };
pCanvas->Fill( &rcCaret, m_nTextColor );
}
if( m_bCapture ) // - Haz, fix for the annoying multiple edit selection ghosts
{
if (m_nCaretChar != m_nSelStartChar) {
hr = pCanvas->GetDC(&RenderDC);
if (SUCCEEDED(hr)) {
RECT rcSelect;
rcSelect.top = m_szMargin.cy;
rcSelect.bottom = m_szMargin.cy + m_nCaretHeight;
rcSelect.left = m_nSelStart - m_nOffset;
rcSelect.right = m_nCaret - m_nOffset;
if (rcSelect.right < rcSelect.left) {
int t;
t = rcSelect.left;
rcSelect.left = rcSelect.right;
rcSelect.right = t;
}
InvertRect(RenderDC, &rcSelect);
pCanvas->ReleaseDC();
}
}
}
return S_OK;
}
STDMETHODIMP cEdit::MouseDown( MouseState *pMS )
{
if( !m_bCapture )
Capture();
else
{
_ASSERTE(!m_bSelecting);
checkFont();
// Hit test the character and move to that position
long nHitChar;
if(m_bPassword)
m_pFont->HitTest( _bstr_t( m_strPass.c_str() ), pMS->client.x + m_nOffset - m_szMargin.cx, &nHitChar );
else
m_pFont->HitTest( _bstr_t( m_strText.c_str() ), pMS->client.x + m_nOffset - m_szMargin.cx, &nHitChar );
// Reset the timer
put_Caret( nHitChar );
m_bSelecting = true;
}
return S_OK;
}
STDMETHODIMP cEdit::MouseUp(MouseState *pMS) {
/* I assume it's possible to trigger a mouse up without a mousedown */
m_bSelecting = false;
return S_OK;
}
STDMETHODIMP cEdit::MouseMove(MouseState *pMS) {
long nHitChar;
if (!m_bCapture) {
_ASSERTE(!m_bSelecting);
return S_OK;
}
if (!m_bSelecting) {
return S_OK;
}
checkFont();
if (m_bPassword) {
m_pFont->HitTest( _bstr_t( m_strPass.c_str() ), pMS->client.x + m_nOffset - m_szMargin.cx, &nHitChar );
} else {
m_pFont->HitTest( _bstr_t( m_strText.c_str() ), pMS->client.x + m_nOffset - m_szMargin.cx, &nHitChar );
}
put_Caret(nHitChar);
return S_OK;
}
STDMETHODIMP cEdit::KeyboardChar( KeyState *pKS )
{
if (pKS->ctrl && pKS->vkey == 22) {
Paste();
} else if (pKS->ctrl && pKS->vkey == 3) {
Copy();
} else if (pKS->ctrl && pKS->vkey == 24) {
Cut();
} else {
// Look for special characters
switch( pKS->vkey )
{
case VK_BACK:
if (m_nCaretChar != m_nSelStartChar) {
Delete();
} else {
if( m_nCaretChar > 0 )
{
// Decrease the caret position
put_Caret( m_nCaretChar - 1 );
// Remove the character
m_strText.erase( m_strText.begin() + m_nCaretChar, m_strText.begin() + m_nCaretChar + 1 );
if(m_bPassword)
m_strPass.erase( m_strPass.begin() + m_nCaretChar, m_strPass.begin() + m_nCaretChar + 1 );
}
}
break;
default:
// Assume every other character is being added
if (m_nCaretChar != m_nSelStartChar) {
Delete();
}
char wc[ 2 ] = { pKS->vkey, L'\0' };
m_strText.insert( m_strText.begin() + m_nCaretChar, wc, wc + 1 );
if(m_bPassword)
{
wc[0] = L'*';
m_strPass.insert( m_strPass.begin() + m_nCaretChar, wc, wc + 1 );
}
put_Caret( m_nCaretChar + 1 );
}
}
m_pSite->Invalidate();
sendTextChange();
return S_OK;
}
STDMETHODIMP cEdit::KeyboardEndCapture( VARIANT_BOOL bCancel )
{
if (bCancel) { // cyn, 15/10/2002
m_bAllowCapture = false;
}
m_bCapture = false;
m_pSite->EndTimer( TIMER_CARET );
m_pSite->Invalidate();
long nID;
m_pSite->get_ID( &nID );
Fire_End( nID, ( bCancel ) ? VARIANT_FALSE : VARIANT_TRUE );
m_bAllowCapture = true; // cyn, 15/10/2002
return S_OK;
}
STDMETHODIMP cEdit::KeyboardEvent( long nMsg, long wParam, long lParam )
{
const char *Start;
int Search;
bool Shift, OldSelecting;
int Length;
if( nMsg != WM_KEYDOWN )
// Only looking for keydown messages
return S_OK;
Shift = (GetAsyncKeyState(VK_SHIFT) < 0);
OldSelecting = m_bSelecting;
m_bSelecting |= Shift; /* Hrrmm.. */
// Look for special characters
switch( wParam )
{
case VK_DELETE:
if (GetAsyncKeyState( VK_SHIFT ) < 0) {
Cut();
} else {
if (m_nCaretChar != m_nSelStartChar) {
Delete();
} else {
if( m_nCaretChar < m_strText.length() ) {
// Remove the character
m_strText.erase( m_strText.begin() + m_nCaretChar, m_strText.begin() + m_nCaretChar + 1 );
if(m_bPassword)
m_strPass.erase( m_strPass.begin() + m_nCaretChar, m_strPass.begin() + m_nCaretChar + 1 );
}
}
}
break;
case VK_HOME:
put_Caret( 0 );
break;
case VK_END:
put_Caret( END );
break;
case VK_INSERT: // cyn, 22/10/2002
if (Shift) {
m_bSelecting = false;
Paste();
} else if (GetAsyncKeyState( VK_CONTROL) < 0 ) {
Copy();
}
break;
case VK_LEFT:
if( m_nCaretChar > 0 ) {
if (GetAsyncKeyState( VK_CONTROL ) < 0) {
if (m_bPassword) {
Start = m_strPass.c_str();
} else {
Start = m_strText.c_str();
}
/* Loop until we find a non-space */
for (Search=m_nCaretChar-1;Search>0;Search--) {
if (Start[Search] != ' ') {
break;
}
}
/* Loop until we find a space */
for (;Search>0;Search--) {
if (Start[Search] == ' ') {
Search++;
break;
}
}
if (Search < 0) {
_ASSERTE( false );
Search = 0;
}
put_Caret( Search );
} else {
put_Caret( m_nCaretChar - 1 );
}
}
break;
case VK_RIGHT:
Length = m_strText.length();
if( m_nCaretChar < Length ) {
if (GetAsyncKeyState( VK_CONTROL ) < 0) {
/* Possible change this, AC edit box is slightly different */
if (m_bPassword) {
Start = m_strPass.c_str();
} else {
Start = m_strText.c_str();
}
/* Loop until we find a non-space */
for (Search=m_nCaretChar+1;Search<Length;Search++) {
if (Start[Search] != ' ') {
break;
}
}
/* Loop until we find a space */
for (;Search<Length;Search++) {
if (Start[Search] == ' ') {
break;
}
}
/* Loop until we find a non-space again, test it in notepad if you don't believe me */
for (;Search<Length;Search++) {
if (Start[Search] != ' ') {
break;
}
}
/* It's acceptable to go one character over the end (Search == Length) */
if (Search > Length) {
_ASSERTE( false );
Search = END;
}
put_Caret( Search );
} else {
put_Caret( m_nCaretChar + 1 );
}
}
break;
default:
// No processing
m_bSelecting = OldSelecting;
return S_OK;
}
m_bSelecting = OldSelecting;
m_pSite->Invalidate();
sendTextChange();
return S_OK;
}
STDMETHODIMP cEdit::get_Text(BSTR *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = T2BSTR( m_strText.c_str() );
return S_OK;
}
STDMETHODIMP cEdit::put_Text(BSTR newVal)
{
USES_CONVERSION;
m_strText = OLE2T( newVal );
m_strPass.assign("");
if(m_bPassword) {
m_strPass.append(m_strText.length(), '*');
}
m_nSelStartChar = m_nCaretChar = 0;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cEdit::get_Caret(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_nCaretChar;
return S_OK;
}
// Only scroll within 10 pixels of the edge
#define EDIT_HYSTERESIS 18
STDMETHODIMP cEdit::put_Caret(long newVal)
{
std::string strSample;
checkFont();
m_nCaretChar = Normalize(newVal);
if(m_bPassword) {
_ASSERTE( m_strPass.length() == m_strText.length() );
strSample.assign(m_strPass.begin(), m_strPass.begin() + m_nCaretChar);
} else {
strSample.assign(m_strText.begin(), m_strText.begin() + m_nCaretChar);
}
// Calculate the actual character position
SIZE szText;
if (!SUCCEEDED (m_pFont->MeasureText( _bstr_t( strSample.c_str() ), &szText )))
{
return E_FAIL;
}
m_nCaretHeight = szText.cy;
m_nCaret = szText.cx;
RECT rcPosition;
m_pSite->get_Position( &rcPosition );
long nWidth = ( rcPosition.right - rcPosition.left ) - m_szMargin.cx * 2 - 2;
// Check for offset updates
if( m_nCaret < ( m_nOffset + EDIT_HYSTERESIS ) )
{
// The caret has moved in front of the scroll region
m_nOffset = m_nCaret - EDIT_HYSTERESIS;
if( m_nOffset < 0 )
// The offset is less thant the beginning, correct it
m_nOffset = 0;
}
else if( m_nCaret > nWidth + m_nOffset )
// The caret has moved off the end of the visible region
// NOTE: the +1 is to account for the 1 pixel width of the caret
m_nOffset = m_nCaret - nWidth;
if( m_bCapture )
{
// Force the caret on for a half second to make sure the user sees the new position
m_pSite->EndTimer( TIMER_CARET );
m_pSite->StartTimer( TIMER_CARET, 500 );
m_bDrawCaret = true;
}
if (m_bSelecting) {
if(m_bPassword) {
strSample.assign(m_strPass.begin(), m_strPass.begin() + m_nSelStartChar);
} else {
strSample.assign(m_strText.begin(), m_strText.begin() + m_nSelStartChar);
}
if (!SUCCEEDED (m_pFont->MeasureText( _bstr_t( strSample.c_str() ), &szText))) {
return E_FAIL;
}
m_nSelStart = szText.cx;
} else {
m_nSelStartChar = m_nCaretChar;
m_nSelStart = m_nCaret;
}
m_pSite->Invalidate();
return S_OK;
}
/*
nEnd < nStart is a valid condition
*/
STDMETHODIMP cEdit::Select(long nStart, long nEnd)
{
bool OldSelection;
OldSelection = m_bSelecting;
m_bSelecting = false;
put_Caret(Normalize(nStart));
m_bSelecting = true;
put_Caret(Normalize(nEnd));
m_bSelecting = OldSelection;
return S_OK;
}
/* I think this is done */
STDMETHODIMP cEdit::get_SelectedText(BSTR *pVal) {
int Start, Len;
_ASSERTE(pVal);
if (m_bPassword) {
return S_FALSE;
}
if (m_nCaretChar < m_nSelStartChar) {
Start = m_nCaretChar;
Len = m_nSelStartChar - Start;
} else {
Start = m_nSelStartChar;
Len = m_nCaretChar - Start;
}
*pVal = T2BSTR( m_strText.substr(Start, Len).c_str() );
return S_OK;
}
STDMETHODIMP cEdit::put_SelectedText(BSTR newVal) {
USES_CONVERSION;
std::string strInsert;
int Length;
if (m_nCaretChar != m_nSelStartChar) {
Delete();
}
strInsert = OLE2T(newVal);
Length = strInsert.length();
m_strText.insert(m_strText.begin() + m_nCaretChar, strInsert.begin(), strInsert.begin() + Length);
if (m_bPassword) {
m_strPass.insert(m_strPass.begin(), Length, '*');
}
put_Caret( m_nCaretChar + Length );
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cEdit::TimerTimeout(long nID, long, long, VARIANT_BOOL *pbContinue)
{
if( nID == TIMER_CARET )
{
m_bDrawCaret = !m_bDrawCaret;
m_pSite->Invalidate();
*pbContinue = VARIANT_TRUE;
}
return S_OK;
}
STDMETHODIMP cEdit::SchemaLoad(IView *pView, IUnknown *pSchema)
{
USES_CONVERSION;
// Load the font and background image
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
pPlugin->CreateFontSchema( 14, 0, pSchema, &m_pFont );
pPlugin->LoadImageSchema( pSchema, &m_pBackground );
MSXML::IXMLDOMElementPtr pElement = pSchema;
_variant_t vText = pElement->getAttribute( _T( "text" ) ),
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
vMarginX = pElement->getAttribute( _T( "marginx" ) ),
vMarginY = pElement->getAttribute( _T( "marginy" ) ),
vPassword = pElement->getAttribute( _T( "password" ) ),
vOutline = pElement->getAttribute( _T( "outlinecolor" ) ),
vAntialias = pElement->getAttribute( _T( "aa" ) );
if( vText.vt != VT_NULL )
{
_ASSERTE( vText.vt == VT_BSTR );
m_strText = OLE2T( vText.bstrVal );
}
if( vTextColor.vt != VT_NULL )
{
try
{
m_nTextColor = static_cast< long >( vTextColor );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vMarginX.vt != VT_NULL )
{
try
{
m_szMargin.cx = static_cast< long >( vMarginX );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vMarginY.vt != VT_NULL )
{
try
{
m_szMargin.cy = static_cast< long >( vMarginY );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vPassword.vt != VT_NULL)
{
try
{
m_bPassword = static_cast< bool >( vPassword );
}
catch( ... )
{
_ASSERTE( FALSE );
}
}
else
m_bPassword = false;
if( vText.vt != VT_NULL )
{
_ASSERTE( vText.vt == VT_BSTR );
m_strText = OLE2T( vText.bstrVal );
if(m_bPassword)
for(int i=0; i<m_strText.length(); i++)
m_strPass.append("*");
}
m_nOutlineColor = 0;
m_bOutline = false;
if( vOutline.vt != VT_NULL )
{
try
{
m_bOutline = true;
m_nOutlineColor = static_cast< long >( vOutline );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
m_bAA = true;
if( vAntialias.vt != VT_NULL )
{
try
{
m_bAA = static_cast< bool >( vAntialias );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
return S_OK;
}
STDMETHODIMP cEdit::get_Background(IImageCacheDisp **pVal)
{
_ASSERTE( pVal != NULL );
if( m_pBackground.p == NULL )
*pVal = NULL;
else
m_pBackground->QueryInterface( pVal );
return S_OK;
}
STDMETHODIMP cEdit::putref_Background(IImageCacheDisp *newVal)
{
if( m_pBackground.p )
m_pBackground.Release();
if( newVal != NULL )
{
HRESULT hRes = newVal->QueryInterface( &m_pBackground );
_ASSERTE( SUCCEEDED( hRes ) );
}
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cEdit::get_Font(IFontCacheDisp **pVal)
{
_ASSERTE( pVal != NULL );
if( m_pFont.p == NULL )
*pVal = NULL;
else
m_pFont->QueryInterface( pVal );
return S_OK;
}
STDMETHODIMP cEdit::putref_Font(IFontCacheDisp *newVal)
{
_ASSERTE( newVal != NULL );
if( m_pFont.p )
m_pFont.Release();
HRESULT hRes = newVal->QueryInterface( &m_pFont );
_ASSERTE( SUCCEEDED( hRes ) );
// Reformat
put_Caret( m_nCaretChar );
return S_OK;
}
STDMETHODIMP cEdit::get_TextColor(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_nTextColor;
return S_OK;
}
STDMETHODIMP cEdit::put_TextColor(long newVal)
{
_ASSERTE( ( newVal & 0xFF000000 ) == 0 );
m_nTextColor = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cEdit::SetMargins(long nX, long nY)
{
_ASSERTE( nX >= 0 && nY >= 0 );
m_szMargin.cx = nX;
m_szMargin.cy = nY;
put_Caret( m_nCaretChar );
return S_OK;
}
STDMETHODIMP cEdit::Capture()
{
_ASSERTE( !m_bCapture );
if ( m_bAllowCapture ) {
m_pSite->CaptureKeyboard();
/* Until we actually capture the keyboard, other code can still execute */
/* If that other code calls put_Caret (eg, put_SelectedText), the timer is set */
/* If that timer is set, and we then try to set it again, it has an error */
m_bCapture = true;
m_bDrawCaret = true;
m_pSite->Invalidate();
m_pSite->StartTimer( TIMER_CARET, 500 );
if (m_nCaretChar == m_nSelStartChar) {
Select(0, END);
}
long nID;
m_pSite->get_ID( &nID );
Fire_Begin( nID );
return S_OK;
} else {
return S_FALSE;
}
}

122
Native/DecalControls/Edit.h Normal file
View file

@ -0,0 +1,122 @@
// Edit.h : Declaration of the cEdit
#ifndef __EDIT_H_
#define __EDIT_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "DecalControlsCP.h"
/////////////////////////////////////////////////////////////////////////////
// cEdit
class ATL_NO_VTABLE cEdit :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cEdit, &CLSID_Edit>,
public IConnectionPointContainerImpl<cEdit>,
public ILayerImpl< cEdit >,
public ILayerRenderImpl,
public ILayerMouseImpl,
public ILayerKeyboard,
public ILayerTimer,
public ILayerSchema,
public IControlImpl< cEdit, IEdit, &IID_IEdit, &LIBID_DecalControls >,
public IProvideClassInfo2Impl< &CLSID_Edit, &DIID_IEditEvents, &LIBID_DecalControls >,
public CProxyIEditEvents< cEdit >
{
public:
cEdit();
CComPtr< IImageCache > m_pBackground;
CComPtr< IFontCache > m_pFont;
SIZE m_szMargin;
bool m_bAllowCapture; // cyn, 15/10/2002
bool m_bCapture;
bool m_bDrawCaret;
bool m_bPassword;
bool m_bSelecting;
bool m_bOutline;
bool m_bAA;
long m_nCaretChar, m_nCaret, m_nOffset,
m_nCaretHeight,
m_nSelStart, m_nSelStartChar,
m_nTextColor, m_nOutlineColor;
std::string m_strText;
std::string m_strPass;
void checkFont();
void sendTextChange();
void Delete();
void Copy();
void Cut();
void Paste();
int Normalize(int Offset);
DECLARE_REGISTRY_RESOURCEID(IDR_EDIT)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cEdit)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(ILayerKeyboard)
COM_INTERFACE_ENTRY(ILayerTimer)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IEdit)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cEdit)
CONNECTION_POINT_ENTRY(DIID_IEditEvents)
END_CONNECTION_POINT_MAP()
public:
// IEdit Methods
STDMETHOD(get_SelectedText)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_SelectedText)(/*[in]*/ BSTR newVal);
STDMETHOD(Select)(long nStart, long nEnd);
STDMETHOD(get_Caret)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_Caret)(/*[in]*/ long newVal);
STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Text)(/*[in]*/ BSTR newVal);
STDMETHOD(SetMargins)(long nX, long nY);
STDMETHOD(get_TextColor)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
STDMETHOD(get_Font)(/*[out, retval]*/ IFontCacheDisp * *pVal);
STDMETHOD(putref_Font)(/*[in]*/ IFontCacheDisp * newVal);
STDMETHOD(get_Background)(/*[out, retval]*/ IImageCacheDisp * *pVal);
STDMETHOD(putref_Background)(/*[in]*/ IImageCacheDisp * newVal);
STDMETHOD(Capture)();
// ILayerRender Methods
STDMETHOD(Reformat)();
STDMETHOD(Render)(ICanvas *pCanvas);
// ILayerMouse Methods
STDMETHOD(MouseDown)(MouseState *pMS);
STDMETHOD(MouseUp)(MouseState *pMS);
STDMETHOD(MouseMove)(MouseState *pMS);
// ILayerKeyboard Methods
STDMETHOD(KeyboardChar)(KeyState *pKS);
STDMETHOD(KeyboardEndCapture)(VARIANT_BOOL bCancel);
STDMETHOD(KeyboardEvent)( long uMsg, long wParam, long lParam );
// ILayerTimer Methods
STDMETHOD(TimerTimeout)(long nID, long nInterval, long nReps, VARIANT_BOOL *pbContinue);
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
};
#endif //__EDIT_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.Edit.1 = s 'DecalControls Edit'
{
CLSID = s '{8E8F88D2-AA47-474E-9DB7-912D49C8BE9D}'
}
DecalControls.Edit = s 'DecalControls Edit'
{
CLSID = s '{8E8F88D2-AA47-474E-9DB7-912D49C8BE9D}'
CurVer = s 'DecalControls.Edit.1'
}
NoRemove CLSID
{
ForceRemove {8E8F88D2-AA47-474E-9DB7-912D49C8BE9D} = s 'DecalControls Edit'
{
ProgID = s 'DecalControls.Edit.1'
VersionIndependentProgID = s 'DecalControls.Edit'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,36 @@
// Client.cpp : Implementation of cClient
#include "stdafx.h"
#include "DecalControls.h"
#include "FixedLayout.h"
/////////////////////////////////////////////////////////////////////////////
// cClient
void cFixedLayout::onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement )
{
// Create all child controls from schema and let them be
// placed wherever they like
MSXML::IXMLDOMElementPtr pChild;
for( MSXML::IXMLDOMNodeListPtr pChildren = pElement->selectNodes( _T( "control" ) );
( pChild = pChildren->nextNode() ).GetInterfacePtr() != NULL; )
loadChildControl( pView, pChild );
}
STDMETHODIMP cFixedLayout::CreateChild(LayerParams *params, ILayer *pSink)
{
m_pSite->CreateChild( params, pSink );
return S_OK;
}
STDMETHODIMP cFixedLayout::PositionChild(long nID, LPRECT prcNew)
{
CComPtr< ILayerSite > pChildSite;
HRESULT hRes = m_pSite->get_Child( nID, ePositionByID, &pChildSite );
_ASSERTE( SUCCEEDED( hRes ) );
pChildSite->put_Position( prcNew );
return S_OK;
}

View file

@ -0,0 +1,57 @@
// Client.h : Declaration of the cClient
#ifndef __FIXEDLAYOUT_H_
#define __FIXEDLAYOUT_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "ControlImpl.h"
#include "DecalControlsCP.h"
/////////////////////////////////////////////////////////////////////////////
// cClient
class ATL_NO_VTABLE cFixedLayout :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cFixedLayout, &CLSID_FixedLayout>,
public ILayerImpl< cFixedLayout >,
public ILayoutImpl< cFixedLayout, IFixedLayout, &IID_ILayout, &LIBID_DecalControls >,
public IProvideClassInfo2Impl< &CLSID_FixedLayout, &DIID_IControlEvents, &LIBID_DecalControls >,
public IConnectionPointContainerImpl<cFixedLayout>,
public CProxyIControlEvents< cFixedLayout >
{
public:
cFixedLayout()
{
}
void onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement );
DECLARE_REGISTRY_RESOURCEID(IDR_FIXEDLAYOUT)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cFixedLayout)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(ILayout)
COM_INTERFACE_ENTRY(IFixedLayout)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cFixedLayout)
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
END_CONNECTION_POINT_MAP()
public:
// IFixedLayout Methods
STDMETHOD(CreateChild)(struct LayerParams *params, ILayer *pSink);
STDMETHOD(PositionChild)(long nID, LPRECT prcNew);
};
#endif //__CLIENT_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.FixedLayout.1 = s 'DecalControls FixedLayout'
{
CLSID = s '{CD6556CD-F8D9-4CB0-AB7C-7C33058294E4}'
}
DecalControls.FixedLayout = s 'DecalControls FixedLayout'
{
CLSID = s '{CD6556CD-F8D9-4CB0-AB7C-7C33058294E4}'
CurVer = s 'DecalControls.FixedLayout.1'
}
NoRemove CLSID
{
ForceRemove {CD6556CD-F8D9-4CB0-AB7C-7C33058294E4} = s 'DecalControls FixedLayout'
{
ProgID = s 'DecalControls.FixedLayout.1'
VersionIndependentProgID = s 'DecalControls.FixedLayout'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,95 @@
// IconColumn.cpp : Implementation of cIconColumn
#include "stdafx.h"
#include "DecalControls.h"
#include "IconColumn.h"
/////////////////////////////////////////////////////////////////////////////
// cIconColumn
STDMETHODIMP cIconColumn::get_FixedWidth(VARIANT_BOOL *pVal)
{
*pVal = VARIANT_TRUE;
return S_OK;
}
STDMETHODIMP cIconColumn::get_Width(long *pVal)
{
*pVal = 20;
return S_OK;
}
STDMETHODIMP cIconColumn::put_Width(long newVal)
{
//m_Width = newVal;
return S_OK;
}
STDMETHODIMP cIconColumn::Render(ICanvas *pCanvas, LPPOINT ptCell, long nColor)
{
_variant_t vIconLib, vIcon;
m_pList->get_Data( ptCell->x, ptCell->y, 0, &vIconLib );
m_pList->get_Data( ptCell->x, ptCell->y, 1, &vIcon );
// Converted nicely now ...
// Find our checked and unchecked images
CComPtr< IIconCache > pIcons;
SIZE sz = { 16, 16 };
m_pSite->GetIconCache( &sz, &pIcons );
POINT pt = { 2, 2 };
pIcons->DrawIcon( &pt, static_cast< long >( vIcon ), static_cast< long >( vIconLib ), pCanvas );
return S_OK;
}
STDMETHODIMP cIconColumn::get_DataColumns(long *pVal)
{
*pVal = 2;
return S_OK;
}
STDMETHODIMP cIconColumn::Initialize(IList *newVal, IPluginSite *pSite)
{
m_pList = newVal;
m_pSite = pSite;
return S_OK;
}
STDMETHODIMP cIconColumn::SchemaLoad(IUnknown *pSchema)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP cIconColumn::get_Height(long *pVal)
{
*pVal = 20;
return S_OK;
}
STDMETHODIMP cIconColumn::Activate(LPPOINT ptCell)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP cIconColumn::get_Color(long nRow, long *pVal)
{
return S_OK;
}
STDMETHODIMP cIconColumn::put_Color(long nRow, long newVal)
{
return S_OK;
}

View file

@ -0,0 +1,46 @@
// IconColumn.h : Declaration of the cIconColumn
#ifndef __ICONCOLUMN_H_
#define __ICONCOLUMN_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cIconColumn
class ATL_NO_VTABLE cIconColumn :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cIconColumn, &CLSID_IconColumn>,
public IListColumn
{
public:
cIconColumn()
{
}
CComPtr< IList > m_pList;
CComPtr< IPluginSite > m_pSite;
DECLARE_REGISTRY_RESOURCEID(IDR_ICONCOLUMN)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cIconColumn)
COM_INTERFACE_ENTRY(IListColumn)
END_COM_MAP()
// IListColumn
public:
STDMETHOD(get_Color)(long nRow, /*[out, retval]*/ long *pVal);
STDMETHOD(put_Color)(long nRow, /*[in]*/ long newVal);
STDMETHOD(Activate)(LPPOINT ptCell);
STDMETHOD(get_Height)(/*[out, retval]*/ long *pVal);
STDMETHOD(SchemaLoad)(IUnknown *pSchema);
STDMETHOD(Initialize)(/*[in]*/ IList * newVal, IPluginSite *pSite);
STDMETHOD(get_DataColumns)(/*[out, retval]*/ long *pVal);
STDMETHOD(Render)(ICanvas *, LPPOINT ptCell, long nColor);
STDMETHOD(get_Width)(/*[out, retval]*/ long *pVal);
STDMETHOD(get_FixedWidth)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Width)(/*[in]*/ long newVal);
};
#endif //__ICONCOLUMN_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.IconColumn.1 = s 'DecalControls IconColumn'
{
CLSID = s '{F12A2C4C-3B78-46EB-8722-68B27A75AE55}'
}
DecalControls.IconColumn = s 'DecalControls IconColumn'
{
CLSID = s '{F12A2C4C-3B78-46EB-8722-68B27A75AE55}'
CurVer = s 'DecalControls.IconColumn.1'
}
NoRemove CLSID
{
ForceRemove {F12A2C4C-3B78-46EB-8722-68B27A75AE55} = s 'DecalControls IconColumn'
{
ProgID = s 'DecalControls.IconColumn.1'
VersionIndependentProgID = s 'DecalControls.IconColumn'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
}
}
}

View file

@ -0,0 +1,656 @@
// List.cpp : Implementation of cList
#include "stdafx.h"
#include "DecalControls.h"
#include "List.h"
#include "ListView.h"
enum eListChild
{
eListScroller = 1,
eListView = 1000
};
/////////////////////////////////////////////////////////////////////////////
// cList
cList::cRow::cRow( long nDataWidth )
: m_pData( new VARIANT[ nDataWidth ] ),
m_pEndData( m_pData + nDataWidth ),
m_bInvalid( true ),
m_colors( NULL ) /* cyn - 07/08/2002 */
{
for( VARIANT *i_var = m_pData; i_var != m_pEndData; ++ i_var )
::VariantInit( i_var );
}
cList::cRow::cRow( const cRow &row )
: m_pData( row.m_pData ),
m_pEndData( row.m_pEndData ),
m_bInvalid( row.m_bInvalid ),
m_colors( row.m_colors ) /* cyn - 07/08/2002 -- This is the real fix, the rest of */
/* the changes just make it faster */
{
_ASSERTE( _CrtIsValidHeapPointer( m_pData ) );
row.m_pData = NULL;
row.m_colors = NULL;
}
cList::cRow::~cRow()
{
if( m_pData != NULL )
{
_ASSERTE( _CrtIsValidHeapPointer( m_pData ) );
for( VARIANT *i_var = m_pData; i_var != m_pEndData; ++ i_var )
{
HRESULT hRes = ::VariantClear( i_var );
_ASSERTE( SUCCEEDED( hRes ) );
}
delete[] m_pData;
}
if (m_colors) { /* cyn - 07/08/2002 */
delete[] m_colors;
}
}
cList::cRow &cList::cRow::operator =( const cRow &row )
{
// Clear out our current data - if any
if( m_pData != NULL )
{
_ASSERTE( _CrtIsValidHeapPointer( m_pData ) );
for( VARIANT *i_var = m_pData; i_var != m_pEndData; ++ i_var )
{
HRESULT hRes = ::VariantClear( i_var );
_ASSERTE( SUCCEEDED( hRes ) );
}
delete[] m_pData;
m_pData = NULL;
}
_ASSERTE( _CrtIsValidHeapPointer( row.m_pData ) );
m_pData = row.m_pData;
m_pEndData = row.m_pEndData;
m_bInvalid = row.m_bInvalid;
if (m_colors) { /* cyn - 07/08/2002 */
delete[] m_colors;
}
m_colors = row.m_colors;
row.m_colors = NULL;
row.m_pData = NULL;
_ASSERTMEM( _CrtCheckMemory() );
return *this;
}
STDMETHODIMP cList::AddColumn(IListColumn *pNewColumn, long *nIndex)
{
_ASSERTE( pNewColumn != NULL );
_ASSERTE( nIndex != NULL );
// We can only add columns before there are data rows
_ASSERTE( m_rows.size() == 0 );
// Looking good, make up the record
cColumn c;
c.m_pColumn = pNewColumn;
c.m_nDataLeft = ( m_cols.size() == 0 ) ? 0 : m_cols.back().m_nDataRight;
CComPtr< IPluginSite > pPluginSite;
m_pSite->get_PluginSite( &pPluginSite );
long nDataSize;
pNewColumn->get_DataColumns( &nDataSize );
c.m_nDataRight = c.m_nDataLeft + nDataSize;
pNewColumn->Initialize( this, pPluginSite );
CComPtr< ILayerMouse > pMouse;
c.m_bSupportsMouse = !!SUCCEEDED( pNewColumn->QueryInterface( &pMouse ) );
m_cols.push_back( c );
// Reformat will fill in column lefts and rights
m_pSite->Reformat();
*nIndex = ( m_cols.size() - 1 );
return S_OK;
}
STDMETHODIMP cList::AddRow(long *pnNewIndex)
{
_ASSERTE( pnNewIndex != NULL );
// There must be at least one column defined
_ASSERTE( m_cols.size() > 0 );
m_rows.push_back( cRow( m_cols.back().m_nDataRight ) );
long nSize = m_rows.size();
Reformat();
m_pSite->Reformat();
if( m_bAutoScroll == true )
{
POINT ptCurrent;
m_pScroller->get_Offset( &ptCurrent );
ptCurrent.y = m_rows.size();
m_pScroller->ScrollTo( &ptCurrent );
Reformat();
m_pSite->Reformat();
}
*pnNewIndex = ( nSize - 1 );
return S_OK;
}
STDMETHODIMP cList::DeleteRow(long nIndex)
{
_ASSERTE( nIndex >= 0 );
_ASSERTE( nIndex < m_rows.size() );
m_rows.erase( m_rows.begin() + nIndex );
// Start at that index and invalidate all rows below that point
m_pView->InvalidateFrom( nIndex );
for( cRowList::iterator i_row = m_rows.begin() + nIndex; i_row != m_rows.end(); ++ i_row )
i_row->m_bInvalid = true;
m_pSite->Invalidate();
m_pSite->Reformat();
POINT offset;
::memset (&offset, 0, sizeof (offset));
m_pScroller->get_Offset (&offset);
if (offset.y > nIndex )
{
// TODO: This isn't perfect, if items are removed from the bottom of the list when
// you're scrolled to the middle, this will cause it to scroll up a line. It does
// solve the problem of lists 'losing' items when the thumb goes away though.
// Note by Haz - I changed the above from if( offset.y > 0 ) - seems to fix problem :)
offset.y--;
m_pScroller->ScrollTo (&offset);
}
return S_OK;
}
STDMETHODIMP cList::get_Data(long nX, long nY, long nSubValue, VARIANT *pVal)
{
_ASSERTE( m_cols.size() > 0 );
_ASSERTE( nX >= 0 );
_ASSERTE( nX < m_cols.back().m_nDataRight );
_ASSERTE( nSubValue >= 0 );
_ASSERTE( nSubValue < ( m_cols[ nX ].m_nDataRight - m_cols[ nX ].m_nDataLeft ) );
_ASSERTE( nY >= 0 );
_ASSERTE( nY < m_rows.size() );
_ASSERTE( pVal != NULL );
cRow &rowData = m_rows[ nY ];
HRESULT hRes = ::VariantCopy( pVal, rowData.m_pData + ( m_cols[ nX ].m_nDataLeft + nSubValue ) );
_ASSERTE( SUCCEEDED( hRes ) );
return S_OK;
}
STDMETHODIMP cList::put_Data(long nX, long nY, long nSubValue, VARIANT *newVal)
{
_ASSERTE( m_cols.size() > 0 );
_ASSERTE( nX >= 0 );
_ASSERTE( nX < m_cols.back().m_nDataRight );
_ASSERTE( nSubValue >= 0 );
_ASSERTE( nSubValue < ( m_cols[ nX ].m_nDataRight - m_cols[ nX ].m_nDataLeft ) );
_ASSERTE( nY >= 0 );
_ASSERTE( nY < m_rows.size() );
_ASSERTE( newVal != NULL );
if( nY >= m_rows.size() )
return E_FAIL;
cRow &rowData = m_rows[ nY ];
long lDataColumns = 0;
m_cols[ nX ].m_pColumn->get_DataColumns( &lDataColumns );
if( nSubValue > lDataColumns )
return E_FAIL;
HRESULT hRes = ::VariantCopy( rowData.m_pData + ( m_cols[ nX ].m_nDataLeft + nSubValue ), newVal );
_ASSERTE( SUCCEEDED( hRes ) );
rowData.m_bInvalid = true;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cList::get_CellRect(LPPOINT pt, LPRECT pVal)
{
_ASSERTE( pt != NULL );
_ASSERTE( m_cols.size() > 0 );
_ASSERTE( pt->x >= 0 );
_ASSERTE( pt->x < m_cols.back().m_nDataRight );
_ASSERTE( pt->y >= 0 );
_ASSERTE( pt->y < m_rows.size() );
_ASSERTE( pVal != NULL );
pVal->top = pt->y * m_nRowHeight;
pVal->bottom = ( pt->y + 1 ) * m_nRowHeight;
pVal->left = m_cols[ pt->x ].m_nLeft;
pVal->right = m_cols[ pt->y ].m_nRight;
return S_OK;
}
void cList::onCreate()
{
// Create the scoller and the scroller client object
CComPtr< ILayer > pScrollerLayer;
HRESULT hRes = ::CoCreateInstance( CLSID_Scroller, NULL, CLSCTX_INPROC_SERVER,
__uuidof( ILayer ), reinterpret_cast< void ** >( &pScrollerLayer ) );
_ASSERTE( SUCCEEDED( hRes ) );
// Will reposition on reformat
LayerParams p = { eListScroller, { 0, 0, 0, 0 }, eRenderClipped };
m_pSite->CreateChild( &p, pScrollerLayer );
pScrollerLayer->QueryInterface( &m_pScroller );
CComObject< cListView > *pView;
CComObject< cListView >::CreateInstance( &pView );
m_pScroller->CreateClient( pView );
m_pView = pView;
// Configure the scroller
SIZE szIncrement = { 100, 20 };
m_pScroller->put_Increments( &szIncrement );
m_pScroller->put_HorizontalEnabled( VARIANT_FALSE );
m_pScroller->put_VerticalEnabled( VARIANT_TRUE );
pView->m_pList = this;
m_pSite->put_Transparent( VARIANT_FALSE );
}
void cList::onDestroy()
{
// Release all of our references
m_pView.Release();
m_pScroller.Release();
// Kill the data
m_cols.clear();
m_rows.clear();
}
STDMETHODIMP cList::Reformat()
{
// Recalculate the column widths and reposition the child control
RECT rc;
m_pSite->get_Position( &rc );
RECT rcScroller = { 0, 0, rc.right - rc.left, rc.bottom - rc.top };
CComPtr< ILayerSite > pScrollerSite;
HRESULT hRes = m_pSite->get_Child( eListScroller, ePositionByID, &pScrollerSite );
_ASSERTE( SUCCEEDED( hRes ) );
pScrollerSite->put_Position( &rcScroller );
SIZE szClient;
m_pScroller->get_Viewport( &szClient );
// Ok, setup the list view objects (note there is cache for a partial row at the top and bottom)
m_pView->SetCacheInfo( m_nRowHeight, ( szClient.cy / m_nRowHeight ) + 2 );
szClient.cy = m_nRowHeight * m_rows.size();
m_pScroller->put_Area( &szClient );
// Last, calculate the column widths
long nFixedWidthsTotal = 0,
nVariableCount = 0;
// First pass adds up the fixed widths
{
for( cColumnList::iterator i = m_cols.begin(); i != m_cols.end(); ++ i )
{
VARIANT_BOOL bFixed;
i->m_pColumn->get_FixedWidth( &bFixed );
if( bFixed )
{
long nWidth;
i->m_pColumn->get_Width( &nWidth );
nFixedWidthsTotal += nWidth;
}
else
++ nVariableCount;
}
}
// Next pass sets the widths
//_ASSERTE( nFixedWidthsTotal < szClient.cx );
long nPosition = 0;
for( cColumnList::iterator i = m_cols.begin(); i != m_cols.end(); ++ i )
{
VARIANT_BOOL bFixed;
i->m_pColumn->get_FixedWidth( &bFixed );
i->m_nLeft = nPosition;
if( bFixed )
{
long nWidth;
i->m_pColumn->get_Width( &nWidth );
i->m_nRight = i->m_nLeft + nWidth;
}
else
i->m_nRight = i->m_nLeft + ( szClient.cx - nFixedWidthsTotal ) / nVariableCount;
nPosition = i->m_nRight;
}
_ASSERTMEM( _CrtCheckMemory( ) );
_ASSERT(0==0);
return S_OK;
}
STDMETHODIMP cList::put_RowEstimate(long newVal)
{
m_rows.reserve( newVal );
return S_OK;
}
STDMETHODIMP cList::SchemaLoad(IView *, IUnknown *pSchema)
{
MSXML::IXMLDOMElementPtr pElement = pSchema;
_variant_t vRowHeight = pElement->getAttribute( _T( "rowheight" ) );
if( vRowHeight.vt != VT_NULL )
{
try
{
m_nRowHeight = static_cast< long >( vRowHeight );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
else
m_nRowHeight = 20;
_variant_t vAutoScroll = pElement->getAttribute( _T( "autoscroll" ) );
if( vAutoScroll.vt != VT_NULL )
{
try
{
m_bAutoScroll = static_cast< bool >( vAutoScroll );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
// Walk the list of columns under this element
MSXML::IXMLDOMElementPtr pColumn;
for( MSXML::IXMLDOMNodeListPtr pColumns = pElement->selectNodes( _T( "column" ) ); ( pColumn = pColumns->nextNode() ).GetInterfacePtr() != NULL; )
{
_variant_t vProgID = pColumn->getAttribute( _T( "progid" ) );
_ASSERTE( vProgID.vt == VT_BSTR );
CLSID clsid;
HRESULT hRes = ::CLSIDFromProgID( vProgID.bstrVal, &clsid );
_ASSERTE( SUCCEEDED( hRes ) );
// Looking good, create the column object
CComPtr< IListColumn > pColumnInst;
hRes = ::CoCreateInstance( clsid, NULL, CLSCTX_INPROC_SERVER, IID_IListColumn,
reinterpret_cast< void ** >( &pColumnInst ) );
_ASSERTE( SUCCEEDED( hRes ) );
// Have the column load any special internal values
pColumnInst->SchemaLoad( pColumn );
long nIndex;
AddColumn( pColumnInst, &nIndex );
}
SIZE szIncrement = { 100, m_nRowHeight };
m_pScroller->put_Increments( &szIncrement );
return S_OK;
}
STDMETHODIMP cList::get_Count( long *pnCount )
{
_ASSERTE( pnCount != NULL );
*pnCount = m_rows.size();
return S_OK;
}
STDMETHODIMP cList::get_CountCols( long *pnCount )
{
_ASSERTE( pnCount != NULL );
*pnCount = m_cols.size();
return S_OK;
}
STDMETHODIMP cList::Clear()
{
m_rows.clear();
m_pView->InvalidateFrom( 0 );
m_pScroller->ResetScroller();
m_pSite->Reformat();
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cList::InsertRow(long lIndex)
{
_ASSERTE (lIndex >= 0);
// There must be at least one column defined
_ASSERTE( m_cols.size() > 0 );
cRowList::iterator it = m_rows.begin ();
if (lIndex > 0)
{
it += lIndex;
}
m_rows.insert( it, cRow( m_cols.back().m_nDataRight ) );
// Start at that index and invalidate all rows below that point
m_pView->InvalidateFrom( lIndex );
for( cRowList::iterator i_row = m_rows.begin() + lIndex; i_row != m_rows.end(); ++ i_row )
{
i_row->m_bInvalid = true;
}
m_pSite->Invalidate();
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cList::put_ColumnWidth(long nColumn, long nWidth)
{
m_cols[ nColumn ].m_pColumn->put_Width(nWidth);
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cList::get_ColumnWidth(long nColumn, long *nWidth)
{
m_cols[ nColumn ].m_pColumn->get_Width(nWidth);
return S_OK;
}
STDMETHODIMP cList::get_Color(long nX, long nY, long *pVal)
{
if (!pVal) { /* cyn - 07/08/2002 */
return E_FAIL;
}
*pVal = 0x00FFFFFF;
cRow &rowData = m_rows[nY];
if (nX >= m_cols.size()) {
return E_FAIL;
}
if (rowData.m_colors) {
if (rowData.m_colors[nX]) {
*pVal = rowData.m_colors[nX];
}
}
return S_OK;
}
STDMETHODIMP cList::put_Color(long nX, long nY, long newVal)
{
int i;
if (nX >= m_cols.size()) { /* cyn - 07/08/2002 */
return E_FAIL;
}
cRow &rowData = m_rows[nY];
if (!rowData.m_colors) {
i = m_cols.size();
rowData.m_colors = new long[ i ];
if (!rowData.m_colors) {
return E_OUTOFMEMORY;
}
// Madar 9/8/2002: Initialize colors to white.
for (long loop = 0; loop < m_cols.size(); ++loop) {
rowData.m_colors[loop] = 0x00ffffff;
}
}
rowData.m_colors[nX] = newVal;
m_pSite->Invalidate();
rowData.m_bInvalid = true;
return S_OK;
}
STDMETHODIMP cList::get_AutoScroll(VARIANT_BOOL *pVal)
{
if( m_bAutoScroll == true )
*pVal = VARIANT_TRUE;
else if( m_bAutoScroll == false )
*pVal = VARIANT_FALSE;
else
return E_FAIL;
return S_OK;
}
STDMETHODIMP cList::put_AutoScroll(VARIANT_BOOL newVal)
{
if( newVal == VARIANT_TRUE )
m_bAutoScroll = true;
else if( newVal == VARIANT_FALSE )
m_bAutoScroll = false;
else
return E_FAIL;
return S_OK;
}
STDMETHODIMP cList::get_ScrollPosition(long *pVal)
{
tagPOINT tpOffset;
tagSIZE tsSize;
m_pScroller->get_Offset( &tpOffset );
m_pScroller->get_Increments( &tsSize );
*pVal = tpOffset.y;
return S_OK;
}
STDMETHODIMP cList::put_ScrollPosition(long newVal)
{
tagPOINT tpOffset;
tagSIZE tsSize;
m_pScroller->get_Offset( &tpOffset );
m_pScroller->get_Increments( &tsSize );
tpOffset.y = newVal;
m_pScroller->ScrollTo( &tpOffset );
return S_OK;
}
STDMETHODIMP cList::JumpToPosition(long newVal)
{
_ASSERTE( newVal >= 0 );
_ASSERTE( newVal < m_rows.size() );
tagPOINT tpOffset;
m_pScroller->get_Offset( &tpOffset );
tpOffset.y = newVal;
m_pScroller->put_Offset( &tpOffset );
m_pScroller->ScrollTo( &tpOffset ); // ensures the thumb gets updated
return S_OK;
}

122
Native/DecalControls/List.h Normal file
View file

@ -0,0 +1,122 @@
// List.h : Declaration of the cList
#ifndef __LIST_H_
#define __LIST_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "DecalControlsCP.h"
/////////////////////////////////////////////////////////////////////////////
// cList
class ATL_NO_VTABLE cList :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cList, &CLSID_List>,
public IControlImpl< cList, IList, &IID_IListDisp, &LIBID_DecalControls >,
public ILayerImpl< cList >,
public ILayerRenderImpl,
public ILayerSchema,
public IProvideClassInfo2Impl< &CLSID_List, &DIID_IListEvents, &LIBID_DecalControls >,
public IConnectionPointContainerImpl<cList>,
public CProxyIListEvents< cList >
{
public:
cList()
{
m_bAutoScroll = false;
}
class cColumn
{
public:
CComPtr< IListColumn > m_pColumn;
long m_nLeft, m_nRight;
long m_nDataLeft, m_nDataRight;
bool m_bSupportsMouse;
};
typedef std::deque< cColumn > cColumnList;
class cRow
{
public:
mutable VARIANT *m_pData,
*m_pEndData;
bool m_bInvalid;
mutable long *m_colors; /* cyn - 07/08/2002 */
explicit cRow( long nDataWidth );
cRow( const cRow &row );
~cRow();
cRow &operator=( const cRow & );
};
typedef std::vector< cRow > cRowList;
CComPtr< IScroller > m_pScroller;
CComPtr< IListView > m_pView;
cColumnList m_cols;
cRowList m_rows;
long m_nRowHeight;
bool m_bAutoScroll;
void onCreate();
void onDestroy();
DECLARE_REGISTRY_RESOURCEID(IDR_LIST)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cList)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(IList)
COM_INTERFACE_ENTRY(IListDisp)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cList)
CONNECTION_POINT_ENTRY(DIID_IListEvents)
END_CONNECTION_POINT_MAP()
public:
STDMETHOD(JumpToPosition)(long newVal);
STDMETHOD(get_ScrollPosition)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_ScrollPosition)(/*[in]*/ long newVal);
STDMETHOD(get_AutoScroll)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_AutoScroll)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_Color)(long nX, long nY, /*[out, retval]*/ long *pVal);
STDMETHOD(put_Color)(long nX, long nY, /*[in]*/ long newVal);
STDMETHOD(InsertRow)(long lIndex);
// IList Methods
STDMETHOD(get_CellRect)(LPPOINT pt, /*[out, retval]*/ LPRECT pVal);
STDMETHOD(get_Data)(long nX, long nY, /*[optional, defaultvalue(0)]*/ long nSubValue, /*[out, retval]*/ VARIANT* pVal);
STDMETHOD(put_Data)(long nX, long nY, /*[optional, defaultvalue(0)]*/ long nSubValue, /*[in]*/ VARIANT* newVal);
STDMETHOD(DeleteRow)(long nIndex);
STDMETHOD(AddRow)(/*[out, retval]*/ long *pnNewIndex);
STDMETHOD(AddColumn)(IListColumn *pNewColumn, /*[out, retval]*/ long *nIndex);
STDMETHOD(put_RowEstimate)(/*[in]*/ long newVal);
STDMETHOD(get_Count)(long *pnCount);
STDMETHOD(get_CountCols)(long *pnCount);
STDMETHOD(Clear)();
STDMETHOD(put_ColumnWidth)(long nColumn, long nWidth);
STDMETHOD(get_ColumnWidth)(long nColumn, long *nWidth);
// ILayerRender Methods
STDMETHOD(Reformat)();
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *, IUnknown *pSchema);
};
#endif //__LIST_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.List.1 = s 'DecalControls List'
{
CLSID = s '{3839008F-AF5B-43FC-9F6A-3376B99E3DAF}'
}
DecalControls.List = s 'DecalControls List'
{
CLSID = s '{3839008F-AF5B-43FC-9F6A-3376B99E3DAF}'
CurVer = s 'DecalControls.List.1'
}
NoRemove CLSID
{
ForceRemove {3839008F-AF5B-43FC-9F6A-3376B99E3DAF} = s 'DecalControls List'
{
ProgID = s 'DecalControls.List.1'
VersionIndependentProgID = s 'DecalControls.List'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
}
}
}

View file

@ -0,0 +1,220 @@
// ListView.cpp : Implementation of cListView
#include "stdafx.h"
#include "DecalControls.h"
#include "ListView.h"
#include "List.h"
/////////////////////////////////////////////////////////////////////////////
// cListView
cListView::cListView()
: m_nRowHeight( 20 ),
m_nRowCache( 0 ),
m_nValidFrom( 0 ),
m_nValidTo( 0 )
{
}
STDMETHODIMP cListView::put_Area(LPSIZE newVal)
{
RECT rc = { 0, 0, newVal->cx, newVal->cy };
m_pSite->put_Position( &rc );
return S_OK;
}
STDMETHODIMP cListView::SetCacheInfo(long nRowHeight, long nRowsToCache)
{
m_nRowHeight = nRowHeight;
m_nRowCache = nRowsToCache;
m_pSite->Reformat();
return S_OK;
}
void cListView::onCreate()
{
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
pPlugin->LoadBitmapPortal( 0x0600128A, &m_pBackground );
m_pSite->put_Transparent( VARIANT_FALSE );
}
void cListView::onDestroy()
{
m_pBackground.Release();
if( m_pCache.p != NULL )
m_pCache.Release();
}
STDMETHODIMP cListView::Reformat()
{
RECT rcPos;
m_pSite->get_Position( &rcPos );
SIZE szCache = { rcPos.right - rcPos.left, m_nRowHeight * m_nRowCache };
if( m_pCache.p != NULL )
m_pCache->put_Size( &szCache );
else
{
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
pPlugin->CreateCanvas( &szCache, &m_pCache );
}
_ASSERTMEM( _CrtCheckMemory( ) );
return S_OK;
}
STDMETHODIMP cListView::Render(ICanvas *pCanvas)
{
_ASSERTMEM( _CrtCheckMemory( ) );
// First, draw the Background pattern
VARIANT_BOOL bLost;
m_pCache->get_WasLost( &bLost );
if( bLost )
// There is no valid range - we must redraw
// the entire rowset
m_nValidFrom = m_nValidTo;
ClipParams cp;
pCanvas->GetClipParams( &cp );
SIZE szCache;
m_pCache->get_Size( &szCache );
// We have the clipping rectangle now - calculate the range
// of rows we want to draw
long nDrawFrom = cp.org.y / m_nRowHeight,
nDrawTo = nDrawFrom + m_nRowCache,
nRowCount = m_pList->m_rows.size();
// Ok, now draw all of the rows either out of range
// or invalid
for( long nDraw = nDrawFrom; nDraw < nDrawTo; ++ nDraw )
{
// Determine how much we need to draw
bool bHasData = ( nDraw >= 0 && nDraw < nRowCount );
if( nDraw < m_nValidFrom || nDraw >= m_nValidTo || ( bHasData && m_pList->m_rows[ nDraw ].m_bInvalid ) )
{
// Redraw this row
long nRowPos = nDraw % m_nRowCache;
RECT rcRow = { 0, nRowPos * m_nRowHeight, szCache.cx, ( nRowPos + 1 ) * m_nRowHeight };
// Fill the background with the background image
POINT ptBackgroundOrg = { 0, nDraw * m_nRowHeight };
m_pBackground->PatBlt( m_pCache, &rcRow, &ptBackgroundOrg );
if( bHasData )
{
// This row is visible and there's data - so use the
// column objects to render the data
for( cList::cColumnList::iterator i_col = m_pList->m_cols.begin(); i_col != m_pList->m_cols.end(); ++ i_col )
{
RECT rcCell = { i_col->m_nLeft, rcRow.top, i_col->m_nRight, rcRow.bottom };
VARIANT_BOOL bVisible;
m_pCache->PushClipRect( &rcCell, &bVisible );
// All our clippings should be completely visible
_ASSERTE( bVisible );
long nColor;
POINT ptCell = { i_col - m_pList->m_cols.begin(), nDraw };
get_Color(ptCell.x, ptCell.y, &nColor);
i_col->m_pColumn->Render( m_pCache, &ptCell, nColor);
m_pCache->PopClipRect();
_ASSERTMEM( _CrtCheckMemory( ) );
}
m_pList->m_rows[ nDraw ].m_bInvalid = false;
}
}
}
// Now that our cache is updated, we can tranfer it to the surface
m_nValidFrom = nDrawFrom;
m_nValidTo = nDrawTo;
long nBltFrom = nDrawFrom % m_nRowCache;
RECT rcTop = { 0, nBltFrom * m_nRowHeight, szCache.cx, m_nRowHeight * m_nRowCache };
POINT ptDest = { 0, nDrawFrom * m_nRowHeight };
pCanvas->Blt( &rcTop, m_pCache, &ptDest );
if( nBltFrom != 0 )
{
// Transfer the bottom part
RECT rcBottom = { 0, 0, szCache.cx, nBltFrom * m_nRowHeight };
POINT ptDestBottom = { 0, ( nDrawFrom + m_nRowCache - nBltFrom ) * m_nRowHeight };
pCanvas->Blt( &rcBottom, m_pCache, &ptDestBottom );
}
_ASSERTMEM( _CrtCheckMemory( ) );
return S_OK;
}
STDMETHODIMP cListView::MouseDown( MouseState *pMS )
{
// Hit test to find what cell
POINT ptHit = { 0, pMS->client.y / m_nRowHeight };
if( ptHit.y >= m_pList->m_rows.size() )
// We did not hit any rows
return S_OK;
for( cList::cColumnList::iterator i_col = m_pList->m_cols.begin(); i_col != m_pList->m_cols.end(); ++ i_col )
{
if( pMS->client.x >= i_col->m_nLeft && pMS->client.x < i_col->m_nRight )
{
ptHit.x = ( i_col - m_pList->m_cols.begin() );
i_col->m_pColumn->Activate( &ptHit );
long nID;
m_pList->m_pSite->get_ID( &nID );
m_pList->Fire_Change( nID, ptHit.x, ptHit.y );
break;
}
}
return S_OK;
}
STDMETHODIMP cListView::InvalidateFrom(long nRow)
{
if( nRow < m_nValidTo )
m_nValidTo = nRow;
if( nRow < m_nValidFrom )
m_nValidFrom = nRow;
return S_OK;
}
STDMETHODIMP cListView::get_Color(long nCol, long nRow, long *pVal)
{
m_pList->get_Color(nCol, nRow, pVal);
return S_OK;
}
STDMETHODIMP cListView::put_Color(long nCol, long nRow, long newVal)
{
m_pList->put_Color(nCol, nRow, newVal);
return S_OK;
}

View file

@ -0,0 +1,65 @@
// ListView.h : Declaration of the cListView
#ifndef __LISTVIEW_H_
#define __LISTVIEW_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
class cList;
/////////////////////////////////////////////////////////////////////////////
// cListView
class ATL_NO_VTABLE cListView :
public CComObjectRootEx<CComMultiThreadModel>,
public ILayerImpl< cListView >,
public ILayerRenderImpl,
public ILayerMouseImpl,
public cNoEventsImpl,
public IListView
{
public:
cListView();
CComPtr< ICanvas > m_pCache;
CComPtr< IImageCache > m_pBackground;
typedef std::map< std::pair< long, long >, long > cCellMap;
cCellMap m_cells;
long m_nRowHeight,
m_nRowCache,
m_nValidFrom,
m_nValidTo;
cList *m_pList;
void onCreate();
void onDestroy();
BEGIN_COM_MAP(cListView)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IListView)
END_COM_MAP()
public:
STDMETHOD(get_Color)(long nCol, long nRow, /*[out, retval]*/ long *pVal);
STDMETHOD(put_Color)(long nCol, long nRow, /*[in]*/ long newVal);
// IListView Methods
STDMETHOD(put_Area)(/*[in]*/ LPSIZE newVal);
STDMETHOD(SetCacheInfo)(long nRowHeight, long nRowsToCache);
STDMETHOD(InvalidateFrom)(long nRow);
// ILayerRender Methods
STDMETHOD(Reformat)();
STDMETHOD(Render)(ICanvas *pCanvas);
// ILayerMouse Methods
STDMETHOD(MouseDown)(MouseState *pMS);
};
#endif //__LISTVIEW_H_

View file

@ -0,0 +1,281 @@
// Notebook.cpp : Implementation of cNotebook
#include "stdafx.h"
#include "DecalControls.h"
#include "Notebook.h"
/////////////////////////////////////////////////////////////////////////////
// cNotebook
cNotebook::cNotebook():
m_nNextPageID( 1001 ),
m_nActiveTab( -1 ),
m_nCaptureTab( -1 ),
m_bHitCapture( false )
{
}
long cNotebook::hitTest( MouseState *pMS )
{
if( pMS->over != this )
// Not hitting us, therefore not hitting a tab
return -1;
// Yes for y boundaries
if( pMS->client.y < 0 || pMS->client.y >= 16 )
return -1;
// Walk through the list of tabs
for( cPageList::iterator i = m_pages.begin(); i != m_pages.end(); ++ i )
{
if( pMS->client.x >= i->m_nLeft && pMS->client.x < i->m_nRight )
// Hit a tab!
return ( i - m_pages.begin() );
}
// No tabs hit
return -1;
}
void cNotebook::positionActiveTab()
{
if( m_nActiveTab == -1 )
return;
RECT rcClient;
m_pSite->get_Position( &rcClient );
CComPtr< ILayerSite > pChild;
m_pSite->get_Child( m_pages[ m_nActiveTab ].m_nPageID, ePositionByID, &pChild );
RECT rcChild = { 0, 16, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
pChild->put_Position( &rcChild );
}
STDMETHODIMP cNotebook::AddPage(BSTR strText, IControl *pClient)
{
cPage p;
p.m_strName = strText;
p.m_nPageID = m_nNextPageID ++;
CComPtr< ILayer > pClientLayer;
pClient->QueryInterface( &pClientLayer );
LayerParams lp = { p.m_nPageID, { 0, 0, 0, 0 }, eRenderClipped };
m_pSite->CreateChild( &lp, pClientLayer );
m_pages.push_back( p );
if( m_nActiveTab == -1 )
// Activate the page if it's the first one
m_nActiveTab = 0;
m_pSite->Reformat();
return S_OK;
}
void cNotebook::onCreate()
{
// Load the images
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
pPlugin->LoadBitmapFile( _bstr_t( _T( "Tab-Active.bmp" ) ), &m_pActive );
pPlugin->LoadBitmapFile( _bstr_t( _T( "Tab-Inactive.bmp" ) ), &m_pInactive );
BSTR bstrFontName;
pPlugin->get_FontName(&bstrFontName);
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
}
void cNotebook::onDestroy()
{
m_pActive.Release();
m_pInactive.Release();
}
#define TEXT_LR_MARGIN 5
STDMETHODIMP cNotebook::Reformat()
{
// Walk through the tabs and position the graphics
long nTabPos = 0;
for( cPageList::iterator i = m_pages.begin(); i != m_pages.end(); ++ i )
{
// Calculate the text length
SIZE sz;
m_pFont->MeasureText( i->m_strName, &sz );
long nWidth = sz.cx + TEXT_LR_MARGIN * 2;
i->m_nLeft = nTabPos;
i->m_nRight = nTabPos + nWidth;
nTabPos += nWidth;
}
if( m_nActiveTab != -1 )
positionActiveTab();
_ASSERTMEM( _CrtCheckMemory( ) );
return S_OK;
}
STDMETHODIMP cNotebook::Render( ICanvas *pCanvas )
{
for( cPageList::iterator i = m_pages.begin(); i != m_pages.end(); ++ i )
{
POINT ptTab = { i->m_nLeft, 0 };
long nWidth = i->m_nRight - i->m_nLeft;
long nIndex = i - m_pages.begin();
bool bActive = ( ( nIndex == m_nActiveTab ) || ( m_nCaptureTab != -1 && m_bHitCapture && nIndex == m_nCaptureTab ) );
if( bActive )
m_pActive->StretchBlt( pCanvas, &ptTab, nWidth, 7, 90 );
else
m_pInactive->StretchBlt( pCanvas, &ptTab, nWidth, 7, 90 );
// Draw the text
POINT ptText = { i->m_nLeft + TEXT_LR_MARGIN, 2 };
m_pFont->DrawText( &ptText, i->m_strName, ( bActive ) ? RGB( 0, 0, 0 ) : RGB( 192, 192, 192 ), pCanvas );
}
_ASSERTMEM( _CrtCheckMemory( ) );
return S_OK;
}
STDMETHODIMP cNotebook::MouseDown( MouseState *pMS )
{
m_nCaptureTab = hitTest( pMS );
if( m_nCaptureTab != -1 )
{
m_bHitCapture = true;
m_pSite->Invalidate();
}
return S_OK;
}
STDMETHODIMP cNotebook::MouseUp( MouseState *pMS )
{
_ASSERTMEM( _CrtCheckMemory( ) );
if( m_nCaptureTab == -1 )
return S_OK;
if( hitTest( pMS ) == m_nCaptureTab )
put_ActiveTab( m_nCaptureTab );
_ASSERTMEM( _CrtCheckMemory( ) );
m_nCaptureTab = -1;
return S_OK;
}
STDMETHODIMP cNotebook::MouseMove( MouseState *pMS )
{
if( m_nCaptureTab == -1 )
// We are hitting in progress
return S_OK;
// Check for a hit
bool bHitCapture = ( hitTest( pMS ) == m_nCaptureTab );
if( bHitCapture != m_bHitCapture )
{
m_bHitCapture = bHitCapture;
m_pSite->Invalidate();
}
return S_OK;
}
STDMETHODIMP cNotebook::get_ActiveTab(long *pVal)
{
*pVal = m_nActiveTab;
return S_OK;
}
STDMETHODIMP cNotebook::put_ActiveTab(long newVal)
{
if( m_nActiveTab != -1 )
{
// Hide the current active view
static RECT rcHide = { 0, 0, 0, 0 };
CComPtr< ILayerSite > pChild;
m_pSite->get_Child( m_pages[ m_nActiveTab ].m_nPageID, ePositionByID, &pChild );
pChild->put_Position( &rcHide );
}
m_nActiveTab = newVal;
if( m_nActiveTab != -1 )
positionActiveTab();
long nID;
m_pSite->get_ID( &nID );
Fire_Change( nID, m_nActiveTab );
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cNotebook::SchemaLoad(IView *pView, IUnknown *pSchema)
{
MSXML::IXMLDOMElementPtr pElement = pSchema;
MSXML::IXMLDOMElementPtr pPage;
for( MSXML::IXMLDOMNodeListPtr pPages = pElement->selectNodes( _T( "page" ) ); ( pPage = pPages->nextNode() ).GetInterfacePtr() != NULL; )
{
// We have the page, get the text, then recurse and generate the control
_variant_t vText = pPage->getAttribute( _T( "label" ) );
_ASSERTE( vText.vt == VT_BSTR );
cPage p;
p.m_strName = vText.bstrVal;
p.m_nPageID = m_nNextPageID ++;
m_pages.push_back( p );
MSXML::IXMLDOMElementPtr pControl = pPage->selectSingleNode( _T( "control" ) );
_ASSERTE( pControl.GetInterfacePtr() != NULL );
long nAssigned;
pView->LoadControl( m_pSite, p.m_nPageID, pControl, &nAssigned );
}
if( m_nActiveTab == -1 && m_pages.size() > 0 )
// Activate the page if it's the first one
m_nActiveTab = 0;
return S_OK;
}
STDMETHODIMP cNotebook::get_PageText(long nIndex, BSTR *pVal)
{
_ASSERTE( pVal != NULL );
_ASSERTE( nIndex >= 0 );
_ASSERTE( nIndex < m_pages.size() );
*pVal = OLE2BSTR( m_pages[ nIndex ].m_strName );
return S_OK;
}
STDMETHODIMP cNotebook::put_PageText(long nIndex, BSTR newVal)
{
_ASSERTE( newVal != NULL );
_ASSERTE( nIndex >= 0 );
_ASSERTE( nIndex < m_pages.size() );
m_pages[ nIndex ].m_strName = newVal;
m_pSite->Reformat();
return S_OK;
}

View file

@ -0,0 +1,97 @@
// Notebook.h : Declaration of the cNotebook
#ifndef __NOTEBOOK_H_
#define __NOTEBOOK_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "DecalControlsCP.h"
/////////////////////////////////////////////////////////////////////////////
// cNotebook
class ATL_NO_VTABLE cNotebook :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cNotebook, &CLSID_Notebook>,
public IConnectionPointContainerImpl<cNotebook>,
public ILayerImpl< cNotebook >,
public ILayerRenderImpl,
public ILayerMouseImpl,
public ILayerSchema,
public IProvideClassInfo2Impl< &CLSID_Notebook, &DIID_INotebookEvents, &LIBID_DecalControls >,
public IControlImpl< cNotebook, INotebook, &IID_INotebook, &LIBID_DecalControls >,
public CProxyINotebookEvents< cNotebook >
{
public:
cNotebook();
class cPage
{
public:
_bstr_t m_strName;
long m_nPageID;
long m_nLeft, m_nRight;
};
typedef std::vector< cPage > cPageList;
cPageList m_pages;
CComPtr< IImageCache > m_pActive;
CComPtr< IImageCache > m_pInactive;
CComPtr< IFontCache > m_pFont;
long m_nNextPageID,
m_nActiveTab,
m_nCaptureTab;
bool m_bHitCapture;
long hitTest( MouseState *pMS );
void positionActiveTab();
void onCreate();
void onDestroy();
DECLARE_REGISTRY_RESOURCEID(IDR_NOTEBOOK)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cNotebook)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(INotebook)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cNotebook)
CONNECTION_POINT_ENTRY(DIID_INotebookEvents)
END_CONNECTION_POINT_MAP()
public:
// INotebook Methods
STDMETHOD(AddPage)(BSTR strText, IControl *pClient);
STDMETHOD(get_ActiveTab)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_ActiveTab)(/*[in]*/ long newVal);
STDMETHOD(get_PageText)(long nIndex, /*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_PageText)(long nIndex, /*[in]*/ BSTR newVal);
// ILayerRender Methods
STDMETHOD(Reformat)();
STDMETHOD(Render)( ICanvas *pCanvas );
// ILayerMouse Methods
STDMETHOD(MouseDown)( MouseState *pMS );
STDMETHOD(MouseUp)( MouseState *pMS );
STDMETHOD(MouseMove)( MouseState *pMS );
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *, IUnknown *pSchema);
};
#endif //__NOTEBOOK_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.Notebook.1 = s 'DecalControls Notebook'
{
CLSID = s '{ED14E7C5-11BE-4DFD-9829-873AB6BE3CFC}'
}
DecalControls.Notebook = s 'DecalControls Notebook'
{
CLSID = s '{ED14E7C5-11BE-4DFD-9829-873AB6BE3CFC}'
CurVer = s 'DecalControls.Notebook.1'
}
NoRemove CLSID
{
ForceRemove {ED14E7C5-11BE-4DFD-9829-873AB6BE3CFC} = s 'DecalControls Notebook'
{
ProgID = s 'DecalControls.Notebook.1'
VersionIndependentProgID = s 'DecalControls.Notebook'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
}
}
}

View file

@ -0,0 +1,110 @@
// PageLayout.cpp : Implementation of cPageLayout
#include "stdafx.h"
#include "DecalControls.h"
#include "PageLayout.h"
/////////////////////////////////////////////////////////////////////////////
// cPageLayout
void cPageLayout::onChildDestroy( long nID )
{
if( m_nActive != -1 )
{
if( nID == m_pages[ m_nActive ] )
// The active page is being deleted, now we show no pages
m_nActive = -1;
}
// Walk through the list of pages and remove he who does
// not exist
for( cChildIDList::iterator i = m_pages.begin(); i != m_pages.end(); ++ i )
{
if( *i == nID )
{
m_pages.erase( i );
break;
}
}
}
void cPageLayout::onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement )
{
// Each control child is a page
MSXML::IXMLDOMElementPtr pChild;
for( MSXML::IXMLDOMNodeListPtr pChildren = pElement->selectNodes( _T( "control" ) );
( pChild = pChildren->nextNode() ).GetInterfacePtr() != NULL; )
m_pages.push_back( loadChildControl( pView, pChild ) );
}
STDMETHODIMP cPageLayout::get_Active(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_nActive;
return S_OK;
}
STDMETHODIMP cPageLayout::put_Active(long newVal)
{
_ASSERTE( newVal >= 0 );
_ASSERTE( newVal < m_pages.size() );
if( m_nActive != -1 )
{
// Hide the active page
CComPtr< ILayerSite > pChildSite;
HRESULT hRes = m_pSite->get_Child( m_pages[ m_nActive ], ePositionByID, &pChildSite );
_ASSERTE( SUCCEEDED( hRes ) );
static RECT rcHide = { 0, 0, 0, 0 };
pChildSite->put_Position( &rcHide );
}
m_nActive = newVal;
// The reformat next cycle will reposition the child
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cPageLayout::CreatePage(ILayer *pChild)
{
_ASSERTE( pChild != NULL );
LayerParams lp = { dispenseID(), { 0, 0, 0, 0 }, eRenderClipped };
m_pSite->CreateChild( &lp, pChild );
m_pages.push_back( lp.ID );
return S_OK;
}
STDMETHODIMP cPageLayout::get_Count(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_pages.size();
return S_OK;
}
STDMETHODIMP cPageLayout::Reformat()
{
if( m_nActive == -1 )
return S_OK;
// Get the active page and set it to fill our entire client area
RECT rcThis;
m_pSite->get_Position( &rcThis );
RECT rcClient = { 0, 0, rcThis.right - rcThis.left, rcThis.bottom - rcThis.top };
CComPtr< ILayerSite > pChild;
HRESULT hRes = m_pSite->get_Child( m_pages[ m_nActive ], ePositionByID, &pChild );
_ASSERTE( SUCCEEDED( hRes ) );
pChild->put_Position( &rcClient );
return S_OK;
}

View file

@ -0,0 +1,70 @@
// PageLayout.h : Declaration of the cPageLayout
#ifndef __PAGELAYOUT_H_
#define __PAGELAYOUT_H_
#include "resource.h" // main symbols
#include "ControlImpl.h"
#include "DecalControlsCP.h"
/////////////////////////////////////////////////////////////////////////////
// cPageLayout
class ATL_NO_VTABLE cPageLayout :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cPageLayout, &CLSID_PageLayout>,
public ILayoutImpl< cPageLayout, IPageLayout, &IID_IPageLayoutDisp, &LIBID_DecalControls >,
public ILayerImpl< cPageLayout >,
public IProvideClassInfo2Impl< &CLSID_PageLayout, &DIID_IControlEvents, &LIBID_DecalControls >,
public IConnectionPointContainerImpl<cPageLayout>,
public CProxyIControlEvents< cPageLayout >
{
public:
cPageLayout()
: m_nActive( -1 )
{
}
// Override functions
void onChildDestroy( long nID );
void onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement );
typedef std::deque< long > cChildIDList;
cChildIDList m_pages;
long m_nActive;
DECLARE_REGISTRY_RESOURCEID(IDR_PAGELAYOUT)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cPageLayout)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IPageLayout)
COM_INTERFACE_ENTRY(IPageLayoutDisp)
COM_INTERFACE_ENTRY(ILayout)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cPageLayout)
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
END_CONNECTION_POINT_MAP()
public:
// IPageLayout Methods
STDMETHOD(get_Count)(/*[out, retval]*/ long *pVal);
STDMETHOD(CreatePage)(ILayer *pChild);
STDMETHOD(get_Active)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_Active)(/*[in]*/ long newVal);
// ILayerRender Methods
STDMETHOD(Reformat)();
};
#endif //__PAGELAYOUT_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.PageLayout.1 = s 'PageLayout Class'
{
CLSID = s '{5AD04D45-D4BF-4729-8A2E-5D37CF726CAA}'
}
DecalControls.PageLayout = s 'PageLayout Class'
{
CLSID = s '{5AD04D45-D4BF-4729-8A2E-5D37CF726CAA}'
CurVer = s 'DecalControls.PageLayout.1'
}
NoRemove CLSID
{
ForceRemove {5AD04D45-D4BF-4729-8A2E-5D37CF726CAA} = s 'PageLayout Class'
{
ProgID = s 'DecalControls.PageLayout.1'
VersionIndependentProgID = s 'DecalControls.PageLayout'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,323 @@
// Progress.cpp : Implementation of cProgress
#include "stdafx.h"
#include "DecalControls.h"
#include "Progress.h"
#include <sstream>
/////////////////////////////////////////////////////////////////////////////
// cProgress
STDMETHODIMP cProgress::get_Value(long *pVal)
{
_ASSERTE( pVal );
*pVal = m_nProgress;
return S_OK;
}
STDMETHODIMP cProgress::put_Value(long newVal)
{
_ASSERTE( newVal <= m_nMaxProgress );
m_nProgress = newVal;
m_pSite->Invalidate();
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cProgress::SchemaLoad(IView *pView, IUnknown *pSchema)
{
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite(&pPlugin);
pPlugin->CreateFontSchema(14, 0, pSchema, &m_pFont);
MSXML::IXMLDOMElementPtr pElement = pSchema;
_variant_t vValue = pElement->getAttribute(_T("value"));
_variant_t vMaxValue = pElement->getAttribute(_T("max"));
_variant_t vFaceColor = pElement->getAttribute(_T("facecolor"));
_variant_t vFillColor = pElement->getAttribute(_T("fillcolor"));
_variant_t vTextColor = pElement->getAttribute(_T("textcolor"));
_variant_t vBorderColor = pElement->getAttribute(_T("bordercolor"));
_variant_t vPreText = pElement->getAttribute(_T("pretext"));
_variant_t vPostText = pElement->getAttribute(_T("posttext"));
_variant_t vAlignment = pElement->getAttribute(_T("align"));
_variant_t vDrawText = pElement->getAttribute(_T("drawtext"));
_variant_t vBorderWidth = pElement->getAttribute(_T("border"));
// This is a required element
_ASSERTE( vValue.vt == VT_I4 || vValue.vt == VT_I2 );
m_nProgress = vValue;
if( vMaxValue.vt != VT_NULL )
{
try
{
m_nMaxProgress = static_cast< long >(vMaxValue);
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vFaceColor.vt != VT_NULL )
{
try
{
m_nFaceColor = static_cast< long >(vFaceColor);
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vFillColor.vt != VT_NULL )
{
try
{
m_nFillColor = static_cast< long >(vFillColor);
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vTextColor.vt != VT_NULL )
{
try
{
m_nTextColor = static_cast< long >(vTextColor);
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vBorderColor.vt != VT_NULL )
{
try
{
m_nBorderColor = static_cast< long >(vBorderColor);
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if (vPreText.vt == VT_BSTR)
put_PreText(vPreText.bstrVal);
if (vPostText.vt == VT_BSTR)
put_PostText(vPostText.bstrVal);
if (vAlignment.vt == VT_BSTR)
put_Alignment(vAlignment.bstrVal);
if( vDrawText.vt != VT_NULL )
{
try
{
m_nDrawText = static_cast< long >(vDrawText);
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vBorderWidth.vt != VT_NULL )
{
try
{
m_nBorderWidth = static_cast< long >(vBorderWidth);
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
return S_OK;
}
STDMETHODIMP cProgress::Reformat()
{
if (!m_pFont.p)
{
// No font was specified, create the default font
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite(&pPlugin);
BSTR bstrFontName;
pPlugin->get_FontName(&bstrFontName);
pPlugin->CreateFont(bstrFontName /*_bstr_t(_T( "Times New Roman" ))*/, 14, 0, &m_pFont);
}
// build string
std::stringstream strText;
strText << m_strPre << m_nProgress << m_strPost;
m_bstrText = strText.str().c_str();
RECT rc;
m_pSite->get_Position(&rc);
SIZE szText;
m_pFont->MeasureText(m_bstrText, &szText);
// align vertically center
m_ptText.y = ((rc.bottom - rc.top) - szText.cy) / 2;
// align left
if (m_nAlignment == 0)
m_ptText.x = m_nBorderWidth + 1;
// align center
if (m_nAlignment == 1)
m_ptText.x = ((rc.right - rc.left) - szText.cx) / 2;
// align right
if (m_nAlignment == 2)
m_ptText.x = ((rc.right - szText.cx) - m_nBorderWidth) - 6;
return S_OK;
}
STDMETHODIMP cProgress::Render(ICanvas *pCanvas)
{
_ASSERTE( pCanvas != NULL );
_ASSERTE( m_pSite.p != NULL );
RECT rcPos;
m_pSite->get_Position(&rcPos);
RECT rcClient = { 0, 0, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top };
RECT rcCenter = { m_nBorderWidth, m_nBorderWidth,
(rcPos.right - rcPos.left) - m_nBorderWidth,
(rcPos.bottom - rcPos.top) - m_nBorderWidth };
pCanvas->Fill(&rcClient, m_nBorderColor); // draw border
pCanvas->Fill(&rcCenter, m_nFaceColor); // fill background
// calculate fill width
long nPixelWidth = ((float)rcCenter.right / (float)m_nMaxProgress) * (float)m_nProgress;
RECT rcProgress = { m_nBorderWidth, m_nBorderWidth,
nPixelWidth - m_nBorderWidth,
rcCenter.bottom };
pCanvas->Fill(&rcProgress, m_nFillColor); // fill progress
// draw text
if (m_nDrawText)
m_pFont->DrawText(&m_ptText, m_bstrText, m_nTextColor, pCanvas);
return S_OK;
}
STDMETHODIMP cProgress::put_FaceColor(long newVal)
{
m_nFaceColor = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_FillColor(long newVal)
{
m_nFillColor = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_TextColor(long newVal)
{
m_nTextColor = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_MaxValue(long newVal)
{
m_nMaxProgress = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_PreText(BSTR newVal)
{
USES_CONVERSION;
m_strPre = OLE2A(newVal);
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_PostText(BSTR newVal)
{
USES_CONVERSION;
m_strPost = OLE2A(newVal);
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_Alignment(BSTR newVal)
{
USES_CONVERSION;
std::string val = OLE2A(newVal);
if (!val.compare("left"))
m_nAlignment = 0;
if (!val.compare("center"))
m_nAlignment = 1;
if (!val.compare("right"))
m_nAlignment = 2;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_DrawText(VARIANT_BOOL newVal)
{
if (newVal == VARIANT_TRUE)
m_nDrawText = true;
else
m_nDrawText = false;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_BorderWidth(long newVal)
{
m_nBorderWidth = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cProgress::put_BorderColor(long newVal)
{
m_nBorderColor = newVal;
m_pSite->Invalidate();
return S_OK;
}

View file

@ -0,0 +1,88 @@
// Progress.h : Declaration of the cProgress
#ifndef __PROGRESS_H_
#define __PROGRESS_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "DecalControlsCP.h"
/////////////////////////////////////////////////////////////////////////////
// cProgress
class ATL_NO_VTABLE cProgress :
public CComObjectRootEx< CComSingleThreadModel >,
public CComCoClass< cProgress, &CLSID_Progress >,
public IConnectionPointContainerImpl< cProgress >,
public IControlImpl< cProgress, IProgress, &IID_IProgress, &LIBID_DecalControls >,
public ILayerImpl< cProgress >,
public ILayerRenderImpl,
public ILayerSchema,
public IProvideClassInfo2Impl< &CLSID_Progress, &DIID_IControlEvents, &LIBID_DecalControls >,
public CProxyIControlEvents< cProgress >
{
public:
cProgress()
{
m_nFaceColor = RGB(140, 80, 30);
m_nFillColor = RGB(220, 140, 60);
m_nProgress = 50;
m_nTextColor = RGB(240, 240, 120);
m_nBorderColor = RGB(240, 240, 120);
m_nBorderWidth = 1;
m_nMaxProgress = 100;
m_strPost = "%";
m_nDrawText = true;
m_nAlignment = 1; // center
}
DECLARE_REGISTRY_RESOURCEID(IDR_PROGRESS)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cProgress)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IProgress)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cProgress)
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
END_CONNECTION_POINT_MAP()
public:
STDMETHOD(put_BorderColor)(/*[in]*/ long newVal);
STDMETHOD(put_BorderWidth)(/*[in]*/ long newVal);
STDMETHOD(put_PreText)(/*[in]*/ BSTR newVal);
STDMETHOD(put_DrawText)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(put_Alignment)(/*[in]*/ BSTR newVal);
STDMETHOD(put_PostText)(/*[in]*/ BSTR newVal);
STDMETHOD(put_MaxValue)(/*[in]*/ long newVal);
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
STDMETHOD(put_FillColor)(/*[in]*/ long newVal);
STDMETHOD(put_FaceColor)(/*[in]*/ long newVal);
STDMETHOD(get_Value)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_Value)(/*[in]*/ long newVal);
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
// ILayerRender Methods
STDMETHOD(Reformat)();
STDMETHOD(Render)(ICanvas *pCanvas);
long m_nProgress, m_nFaceColor, m_nTextColor, m_nFillColor,
m_nMaxProgress, m_nBorderColor, m_nBorderWidth, m_nDrawText;
std::string m_strPost, m_strPre;
POINT m_ptText;
_bstr_t m_bstrText;
int m_nAlignment; // 0 = left, 1 = center, 2 = right
CComPtr< IFontCache > m_pFont;
};
#endif //__PROGRESS_H_

View file

@ -0,0 +1,382 @@
// PushButton.cpp : Implementation of cPushButton
#include "stdafx.h"
#include "DecalControls.h"
#include "PushButton.h"
/////////////////////////////////////////////////////////////////////////////
// cPushButton
cPushButton::cPushButton()
: m_bPressed( VARIANT_FALSE ),
m_bMouseIn( VARIANT_FALSE ),
m_nFaceColor( RGB( 140, 80, 30 ) ),
m_nTextColor( RGB( 240, 240, 120 ) ),
m_UseFaceColor(false) // GKusnick: Render 3D outline.
{
}
void cPushButton::onCreate()
{
// This control draws over it's entire area
m_pSite->put_Transparent( VARIANT_FALSE );
}
STDMETHODIMP cPushButton::get_Image(IImageCacheDisp **pVal)
{
_ASSERTE( pVal != NULL );
if( m_pBackground.p == NULL )
*pVal = NULL;
else
m_pBackground->QueryInterface( pVal );
return S_OK;
}
STDMETHODIMP cPushButton::putref_Image(IImageCacheDisp *newVal)
{
if( m_pBackground.p )
m_pBackground.Release();
if( newVal != NULL )
{
HRESULT hRes = newVal->QueryInterface( &m_pBackground );
_ASSERTE( SUCCEEDED( hRes ) );
}
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cPushButton::get_Font(IFontCacheDisp **pVal)
{
_ASSERTE( pVal != NULL );
if( m_pFont.p == NULL )
*pVal = NULL;
else
m_pFont->QueryInterface( pVal );
return S_OK;
}
STDMETHODIMP cPushButton::putref_Font(IFontCacheDisp *newVal)
{
_ASSERTE( newVal != NULL );
if( m_pFont.p )
m_pFont.Release();
HRESULT hRes = newVal->QueryInterface( &m_pFont );
_ASSERTE( SUCCEEDED( hRes ) );
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cPushButton::get_Text(BSTR *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = OLE2BSTR( m_strText );
return S_OK;
}
STDMETHODIMP cPushButton::put_Text(BSTR newVal)
{
_ASSERTE( newVal != NULL );
m_strText = newVal;
m_pSite->Reformat();
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cPushButton::get_FaceColor(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_nFaceColor;
return S_OK;
}
STDMETHODIMP cPushButton::put_FaceColor(long newVal)
{
_ASSERTE( ( newVal & 0xFF000000L ) == 0 );
m_nFaceColor = newVal;
m_UseFaceColor = true; // GKusnick: Render 3D outline.
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cPushButton::get_TextColor(long *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_nTextColor;
return S_OK;
}
STDMETHODIMP cPushButton::put_TextColor(long newVal)
{
_ASSERTE( ( newVal & 0xFF000000L ) == 0 );
m_nTextColor = newVal;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cPushButton::SchemaLoad( IView *pView, IUnknown *pSchema )
{
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
// Load some defaults
pPlugin->CreateFontSchema( 14, 0, pSchema, &m_pFont );
pPlugin->LoadImageSchema( pSchema, &m_pBackground );
MSXML::IXMLDOMElementPtr pElement = pSchema;
_variant_t vFaceColor = pElement->getAttribute( _T( "facecolor" ) ),
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
vText = pElement->getAttribute( _T( "text" ) ),
vAntialias = pElement->getAttribute( _T( "aa" ) );
if( vFaceColor.vt != VT_NULL )
{
try
{
m_nFaceColor = static_cast< long >( vFaceColor );
m_UseFaceColor = true; // GKusnick: Render 3D outline.
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vTextColor.vt != VT_NULL )
{
try
{
m_nTextColor = static_cast< long >( vTextColor );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vText.vt != VT_NULL )
{
_ASSERTE( vText.vt == VT_BSTR );
m_strText = vText.bstrVal;
}
m_bAA = true;
if( vAntialias.vt != VT_NULL )
{
try
{
m_bAA = static_cast< bool >( vAntialias );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
return S_OK;
}
STDMETHODIMP cPushButton::MouseEnter(struct MouseState *)
{
_ASSERTE( !m_bMouseIn );
m_bMouseIn = VARIANT_TRUE;
if( m_bPressed )
{
long nID;
m_pSite->get_ID( &nID );
Fire_Hit( nID );
_ASSERTE( m_pSite.p != NULL );
m_pSite->Invalidate();
}
return S_OK;
}
STDMETHODIMP cPushButton::MouseExit(struct MouseState *)
{
_ASSERTE( m_bMouseIn );
m_bMouseIn = VARIANT_FALSE;
if( m_bPressed )
{
long nID;
m_pSite->get_ID( &nID );
Fire_Unhit( nID );
_ASSERTE( m_pSite.p != NULL );
m_pSite->Invalidate();
}
return S_OK;
}
STDMETHODIMP cPushButton::MouseDown(struct MouseState *)
{
_ASSERTE( m_pSite != NULL );
long nID;
m_pSite->get_ID( &nID );
Fire_Hit( nID );
m_bPressed = VARIANT_TRUE;
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cPushButton::MouseUp(struct MouseState *)
{
m_bPressed = VARIANT_FALSE;
long nID;
m_pSite->get_ID( &nID );
if( m_bMouseIn )
{
_ASSERTE( m_pSite.p != NULL );
m_pSite->Invalidate();
// NOTE: The command may destroy the control synchronously
// so we make a stack copy of the target in case our instance is destroyed
// for the purpose of completing the command
Fire_Accepted( nID );
Fire_Unhit( nID );
}
else
Fire_Canceled( nID );
return S_OK;
}
STDMETHODIMP cPushButton::Reformat()
{
// Everything looks good, calculate the offset of the text
if( m_pFont.p == NULL )
{
// No font was specified, create the default font
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
BSTR bstrFontName;
pPlugin->get_FontName(&bstrFontName);
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
}
RECT rc;
m_pSite->get_Position( &rc );
SIZE szText;
m_pFont->MeasureText( m_strText, &szText );
m_ptText.x = ( ( rc.right - rc.left ) - szText.cx ) / 2;
m_ptText.y = ( ( rc.bottom - rc.top ) - szText.cy ) / 2;
return S_OK;
}
STDMETHODIMP cPushButton::Render( ICanvas *pCanvas )
{
_ASSERTE( pCanvas != NULL );
_ASSERTE( m_pSite.p != NULL );
RECT rcPos;
m_pSite->get_Position( &rcPos );
RECT rcClient = { 0, 0, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top };
bool bPressed = ( m_bPressed && m_bMouseIn );
// First draw the background
if( m_pBackground.p == NULL )
pCanvas->Fill( &rcClient, m_nFaceColor );
else
{
POINT ptOrg = { ( bPressed ) ? 1 : 0, ( bPressed ) ? 1 : 0 };
m_pBackground->PatBlt( pCanvas, &rcClient, &ptOrg );
}
// Next, draw the text
POINT ptText = { ( !bPressed ) ? m_ptText.x : m_ptText.x + 1, ( !bPressed ) ? m_ptText.y : m_ptText.y + 1 };
m_pFont->DrawTextEx( &ptText, m_strText, m_nTextColor, 0, m_bAA ? eAA : 0, pCanvas );
// Nerfgolem 2001.10.11
// Do not render the 3D outline if there's a background image.
// GKusnick: Do render it if there's an explicit face color.
if( m_pBackground.p == NULL || m_UseFaceColor )
{
// Last, draw the '3D' border - colors are generated relative to the face color
// and the design is taken from the windows button
long nBrightest = RGB( ( 255 - GetRValue( m_nFaceColor ) ) / 2 + GetRValue( m_nFaceColor ),
( 255 - GetGValue( m_nFaceColor ) ) / 2 + GetGValue( m_nFaceColor ),
( 255 - GetBValue( m_nFaceColor ) ) / 2 + GetBValue( m_nFaceColor ) ),
nDarkShadow = RGB( GetRValue( m_nFaceColor ) / 4, GetGValue( m_nFaceColor ) / 4, GetBValue( m_nFaceColor ) / 4 ),
nShadow = RGB( GetRValue( m_nFaceColor ) / 2, GetGValue( m_nFaceColor ) / 2, GetBValue( m_nFaceColor ) / 2 );
RECT rcOuterLeft = { 0, 0, 1, rcClient.bottom - 1 },
rcInnerLeft = { 1, 1, 2, rcClient.bottom - 2 },
rcOuterTop = { 0, 0, rcClient.right - 1, 1 },
rcInnerTop = { 1, 1, rcClient.right - 2, 2 },
rcOuterRight = { rcClient.right - 1, 0, rcClient.right, rcClient.bottom },
rcInnerRight = { rcClient.right - 2, 1, rcClient.right - 1, rcClient.bottom - 1 },
rcOuterBottom = { 0, rcClient.bottom - 1, rcClient.right, rcClient.bottom },
rcInnerBottom = { 1, rcClient.bottom - 2, rcClient.right - 1, rcClient.bottom - 1 };
if( bPressed )
{
pCanvas->Fill( &rcOuterLeft, nDarkShadow );
pCanvas->Fill( &rcOuterTop, nDarkShadow );
pCanvas->Fill( &rcOuterRight, nBrightest );
pCanvas->Fill( &rcOuterBottom, nBrightest );
pCanvas->Fill( &rcInnerLeft, nShadow );
pCanvas->Fill( &rcInnerTop, nShadow );
pCanvas->Fill( &rcInnerRight, m_nFaceColor );
pCanvas->Fill( &rcInnerBottom, m_nFaceColor );
}
else
{
pCanvas->Fill( &rcOuterLeft, nBrightest );
pCanvas->Fill( &rcOuterTop, nBrightest );
pCanvas->Fill( &rcOuterRight, nDarkShadow );
pCanvas->Fill( &rcOuterBottom, nDarkShadow );
pCanvas->Fill( &rcInnerLeft, m_nFaceColor );
pCanvas->Fill( &rcInnerTop, m_nFaceColor );
pCanvas->Fill( &rcInnerRight, nShadow );
pCanvas->Fill( &rcInnerBottom, nShadow );
}
}
return S_OK;
}

View file

@ -0,0 +1,91 @@
// PushButton.h : Declaration of the cPushButton
#ifndef __PUSHBUTTON_H_
#define __PUSHBUTTON_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "DecalControlsCP.h"
/////////////////////////////////////////////////////////////////////////////
// cPushButton
class ATL_NO_VTABLE cPushButton :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cPushButton, &CLSID_PushButton>,
public IControlImpl< cPushButton, IPushButton, &IID_IPushButton, &LIBID_DecalControls >,
public ILayerImpl< cPushButton >,
public ILayerRenderImpl,
public ILayerSchema,
public ILayerMouseImpl,
public IProvideClassInfo2Impl< &CLSID_PushButton, &DIID_ICommandEvents, &LIBID_DecalControls >,
public IConnectionPointContainerImpl<cPushButton>,
public CProxyICommandEvents< cPushButton >
{
public:
cPushButton();
VARIANT_BOOL m_bPressed,
m_bMouseIn;
_bstr_t m_strText;
CComPtr< IFontCache > m_pFont;
CComPtr< IImageCache > m_pBackground;
POINT m_ptText;
long m_nFaceColor,
m_nTextColor;
BOOL m_UseFaceColor; // GKusnick: Render 3D outline.
bool m_bAA;
void onCreate();
DECLARE_REGISTRY_RESOURCEID(IDR_PUSHBUTTON)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cPushButton)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IPushButton)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cPushButton)
CONNECTION_POINT_ENTRY(DIID_ICommandEvents)
END_CONNECTION_POINT_MAP()
public:
// IPushButton Methods
STDMETHOD(get_TextColor)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
STDMETHOD(get_FaceColor)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_FaceColor)(/*[in]*/ long newVal);
STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Text)(/*[in]*/ BSTR newVal);
STDMETHOD(get_Font)(/*[out, retval]*/ IFontCacheDisp * *pVal);
STDMETHOD(putref_Font)(/*[in]*/ IFontCacheDisp * newVal);
STDMETHOD(get_Image)(/*[out, retval]*/ IImageCacheDisp * *pVal);
STDMETHOD(putref_Image)(/*[in]*/ IImageCacheDisp * newVal);
// ILayerMouse Methods
STDMETHOD(MouseEnter)(struct MouseState *);
STDMETHOD(MouseExit)(struct MouseState *);
STDMETHOD(MouseDown)(struct MouseState *);
STDMETHOD(MouseUp)(struct MouseState *);
// ILayerRender Methods
STDMETHOD(Reformat)();
STDMETHOD(Render)(ICanvas *pCanvas);
// ILayerSchema Methods
STDMETHOD(SchemaLoad)( IView *pView, IUnknown *pSchema );
};
#endif //__PUSHBUTTON_H_

View file

@ -0,0 +1,25 @@
HKCR
{
DecalControls.PushButton.1 = s 'PushButton Class'
{
CLSID = s '{AE4525BE-81D1-40FB-9170-77172077EB49}'
}
DecalControls.PushButton = s 'PushButton Class'
{
CLSID = s '{AE4525BE-81D1-40FB-9170-77172077EB49}'
CurVer = s 'DecalControls.PushButton.1'
}
NoRemove CLSID
{
ForceRemove {AE4525BE-81D1-40FB-9170-77172077EB49} = s 'PushButton Class'
{
ProgID = s 'DecalControls.PushButton.1'
VersionIndependentProgID = s 'DecalControls.PushButton'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
}
}
}

View file

@ -0,0 +1,863 @@
// Scroller.cpp : Implementation of cScroller
#include "stdafx.h"
#include "DecalControls.h"
#include "Scroller.h"
enum eScrollChildren
{
eScrollerUp = 1,
eScrollerDown = 2,
eScrollerRight = 3,
eScrollerLeft = 4,
eScrollerPager = 5,
eScrollerPageUp = 6,
eScrollerPageDown = 7,
eScrollerPageLeft = 8,
eScrollerPageRight = 9,
eScrollerClient = 10,
eScrollerHThumb = 11,
eScrollerVThumb = 12
};
/////////////////////////////////////////////////////////////////////////////
// cScroller
void cScroller::onCreate()
{
// Initialize our layout options
m_szArea.cx = 0;
m_szArea.cy = 0;
m_szIncrement.cx = 100;
m_szIncrement.cy = 20;
m_ptThumb.x = 0;
m_ptThumb.y = 0;
m_bHScroll = VARIANT_FALSE;
m_bVScroll = VARIANT_FALSE;
CComPtr< ILayer > pLayerPager;
HRESULT hRes = ::CoCreateInstance( __uuidof( Pager ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
reinterpret_cast< void ** >( &pLayerPager ) );
_ASSERTE( SUCCEEDED( hRes ) );
LayerParams p = { eScrollerPager, { 0, 0, 0, 0 }, eRenderClipped };
m_pSite->CreateChild( &p, pLayerPager );
pLayerPager->QueryInterface( &m_pPager );
IPagerEventsImpl< PAGER_CLIENT, cScroller >::advise( m_pPager );
CComPtr< ILayer > pLayerUp;
hRes = ::CoCreateInstance( __uuidof( Button ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
reinterpret_cast< void ** >( &pLayerUp ) );
_ASSERTE( SUCCEEDED( hRes ) );
p.ID = eScrollerUp;
CComPtr< IButton > pUp;
m_pSite->CreateChild( &p, pLayerUp );
pLayerUp->QueryInterface( &pUp);
ICommandEventsImpl< BUTTON_UP, cScroller >::advise( pUp );
pUp->SetImages( 0, 0x06001261, 0x06001262 );
pUp->put_Matte( RGB( 0, 0, 0 ) );
CComPtr< ILayer > pLayerDown;
hRes = ::CoCreateInstance( __uuidof( Button ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
reinterpret_cast< void ** >( &pLayerDown ) );
_ASSERTE( SUCCEEDED( hRes ) );
p.ID = eScrollerDown;
CComPtr< IButton > pDown;
m_pSite->CreateChild( &p, pLayerDown );
pLayerDown->QueryInterface( &pDown );
ICommandEventsImpl< BUTTON_DOWN, cScroller >::advise( pDown );
pDown->SetImages( 0, 0x0600125E, 0x0600125F );
pDown->put_Matte( RGB( 0, 0, 0 ) );
CComPtr< ILayer > pLayerLeft;
hRes = ::CoCreateInstance( __uuidof( Button ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
reinterpret_cast< void ** >( &pLayerLeft ) );
_ASSERTE( SUCCEEDED( hRes ) );
p.ID = eScrollerLeft;
CComPtr< IButton > pLeft;
m_pSite->CreateChild( &p, pLayerLeft );
pLayerLeft->QueryInterface( &pLeft );
ICommandEventsImpl< BUTTON_LEFT, cScroller >::advise( pLeft );
pLeft->SetImages( 0, 0x06001295, 0x06001296 );
pLeft->put_Matte( RGB( 0, 0, 0 ) );
CComPtr< ILayer > pLayerRight;
hRes = ::CoCreateInstance( __uuidof( Button ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
reinterpret_cast< void ** >( &pLayerRight ) );
_ASSERTE( SUCCEEDED( hRes ) );
p.ID = eScrollerRight;
CComPtr< IButton > pRight;
m_pSite->CreateChild( &p, pLayerRight );
pLayerRight->QueryInterface( &pRight );
ICommandEventsImpl< BUTTON_RIGHT, cScroller >::advise( pRight );
pRight->SetImages( 0, 0x06001298, 0x06001299 );
pRight->put_Matte( RGB( 0, 0, 0 ) );
// Positioning will occur during Reformat
// Load the images
CComPtr< IPluginSite > pPlugin;
m_pSite->get_PluginSite( &pPlugin );
pPlugin->LoadBitmapPortal( 0x06001260, &m_pVScrollBack );
pPlugin->LoadBitmapPortal( 0x06001297, &m_pHScrollBack );
}
void cScroller::onDestroy()
{
m_pPager.Release();
}
void cScroller::constrainOffset( LPPOINT ppt )
{
// First check for overflow, furthest scroll should be allowed is less a
// page size
POINT ptMax = { m_szArea.cx, m_szArea.cy };
SIZE szViewport;
get_Viewport( &szViewport );
if((szViewport.cx % m_szIncrement.cx)==0)
ptMax.x -= szViewport.cx;
else
ptMax.x -= ( szViewport.cx / m_szIncrement.cx + 1) * m_szIncrement.cx;
if((szViewport.cy % m_szIncrement.cy)==0)
ptMax.y -= szViewport.cy;
else
ptMax.y -= ( szViewport.cy / m_szIncrement.cy + 1) * m_szIncrement.cy;
// substract the viewport (rounded up a notch) from the max scroll area
// ptMax.x -= ( szViewport.cx / m_szIncrement.cx + 1) * m_szIncrement.cx;
// ptMax.y -= ( szViewport.cy / m_szIncrement.cy + 1) * m_szIncrement.cy;
if( ppt->x > ptMax.x )
ppt->x = ptMax.x;
if( ppt->y > ptMax.y )
ppt->y = ptMax.y;
// Check for underflow (either because it was assigned too low
// or or max is too low)
if( ppt->x < 0 )
ppt->x = 0;
if( ppt->y < 0 )
ppt->y = 0;
}
#define BTN_SIZE 16
long cScroller::hitTest( MouseState *pMS )
{
if( pMS->over != this )
return -1;
SIZE szViewport;
get_Viewport( &szViewport );
RECT rcScroll = { BTN_SIZE, BTN_SIZE, szViewport.cx - BTN_SIZE, szViewport.cy - BTN_SIZE };
// Check if it's on the horizontal bar
if( m_bHScroll )
{
if( pMS->client.x > rcScroll.left && pMS->client.x < rcScroll.right && pMS->client.y > szViewport.cy )
{
if( m_szArea.cx == szViewport.cx )
// Special case, no scrolling if the area is the minimum size
return -1;
// We hit the horizontal bar
if( pMS->client.x < ( m_ptThumb.x + BTN_SIZE ) )
// Hit before the thumb
return eScrollerPageLeft;
else if( pMS->client.x > ( m_ptThumb.x + BTN_SIZE * 2 ) )
// Hit after the thumb
return eScrollerPageRight;
// Hit the thumb
return eScrollerHThumb;
}
}
// Check if it's on the vertical bar
if( m_bVScroll )
{
if( pMS->client.y > rcScroll.top && pMS->client.y < rcScroll.bottom && pMS->client.x > szViewport.cx )
{
if( m_szArea.cy == szViewport.cy )
// Special case, no scrolling if the area is the minimum size
return -1;
// We hit the vertical bar
if( pMS->client.y < ( m_ptThumb.y + BTN_SIZE ) )
// Hit above the thumb
return eScrollerPageUp;
else if( pMS->client.y > ( m_ptThumb.y + BTN_SIZE * 2 ) )
// Hit below thumb
return eScrollerPageDown;
// Hit the v thumb
return eScrollerVThumb;
}
}
return -1;
}
STDMETHODIMP cScroller::Render(ICanvas *pCanvas)
{
SIZE szViewport;
get_Viewport( &szViewport );
// Fill in the scrollbars as neccessary
static POINT ptOff = { 0, 0 };
CComPtr< IPluginSite > pPluginSite;
m_pSite->get_PluginSite( &pPluginSite );
SIZE szIcon = { BTN_SIZE, BTN_SIZE };
CComPtr< IIconCache > pIconCache;
pPluginSite->GetIconCache( &szIcon, &pIconCache );
if( m_bHScroll )
{
RECT rcHScroll = { BTN_SIZE, szViewport.cy, szViewport.cx - BTN_SIZE, szViewport.cy + BTN_SIZE };
m_pHScrollBack->PatBlt( pCanvas, &rcHScroll, &ptOff );
if( m_szArea.cx != szViewport.cx )
{
// Draw the H thumb
POINT ptHThumb = { BTN_SIZE + m_ptThumb.x, szViewport.cy };
RECT rcThumb = { ptHThumb.x, ptHThumb.y, ptHThumb.x + BTN_SIZE, ptHThumb.y + BTN_SIZE };
pCanvas->Fill( &rcThumb, RGB( 0, 0, 0 ) );
pIconCache->DrawIcon( &ptHThumb, ( m_nCurrentCommand == eScrollerHThumb ) ? 0x06001264 : 0x06001263, 0, pCanvas );
}
}
if( m_bVScroll )
{
RECT rcVScroll = { szViewport.cx, BTN_SIZE, szViewport.cx + BTN_SIZE, szViewport.cy - BTN_SIZE };
m_pVScrollBack->PatBlt( pCanvas, &rcVScroll, &ptOff );
if( m_szArea.cy != szViewport.cy )
{
// Draw the V thumb
POINT ptVThumb = { szViewport.cx, BTN_SIZE + m_ptThumb.y };
RECT rcThumb = { ptVThumb.x, ptVThumb.y, ptVThumb.x + BTN_SIZE, ptVThumb.y + BTN_SIZE };
pCanvas->Fill( &rcThumb, RGB( 0, 0, 0 ) );
pIconCache->DrawIcon( &ptVThumb, ( m_nCurrentCommand == eScrollerVThumb ) ? 0x06001264 : 0x06001263, 0, pCanvas );
}
}
if( m_bHScroll && m_bVScroll )
{
// Draw the little corner piece
RECT rcCorner = { szViewport.cx, szViewport.cy, szViewport.cx + BTN_SIZE, szViewport.cy + BTN_SIZE };
pCanvas->Fill( &rcCorner, RGB( 130, 100, 80 ) );
}
return S_OK;
}
STDMETHODIMP cScroller::Reformat()
{
SIZE szViewport;
get_Viewport( &szViewport );
CComPtr< ILayerSite > pPagerSite;
HRESULT hRes = m_pSite->get_Child( eScrollerPager, ePositionByID, &pPagerSite );
RECT rcPager = { 0, 0, szViewport.cx, szViewport.cy };
pPagerSite->put_Position( &rcPager );
CComPtr< ILayerSite > pClientSite;
pPagerSite->get_Child( eScrollerClient, ePositionByID, &pClientSite );
RECT rcClient = { 0, 0, m_szArea.cx, m_szArea.cy };
pClientSite->put_Position( &rcClient );
CComPtr< ILayerSite > pUp, pDown, pLeft, pRight;
m_pSite->get_Child( eScrollerUp, ePositionByID, &pUp );
m_pSite->get_Child( eScrollerDown, ePositionByID, &pDown );
m_pSite->get_Child( eScrollerLeft, ePositionByID, &pLeft );
m_pSite->get_Child( eScrollerRight, ePositionByID, &pRight );
static RECT rcHidden = { 0, 0, 0, 0 };
if( m_bHScroll )
{
RECT rcLeft = { 0, szViewport.cy, BTN_SIZE, szViewport.cy + BTN_SIZE },
rcRight = { szViewport.cx - BTN_SIZE, szViewport.cy, szViewport.cx, szViewport.cy + BTN_SIZE };
pLeft->put_Position( &rcLeft );
pRight->put_Position( &rcRight );
}
else
{
pLeft->put_Position( &rcHidden );
pRight->put_Position( &rcHidden );
}
if( m_bVScroll )
{
RECT rcUp = { szViewport.cx, 0, szViewport.cx + BTN_SIZE, BTN_SIZE },
rcDown = { szViewport.cx, szViewport.cy - BTN_SIZE, szViewport.cx + BTN_SIZE, szViewport.cy };
pUp->put_Position( &rcUp );
pDown->put_Position( &rcDown );
}
else
{
pUp->put_Position( &rcHidden );
pDown->put_Position( &rcHidden );
}
// Calculate the size of the page increments
m_szPage.cx = ( szViewport.cx / m_szIncrement.cx ) * m_szIncrement.cx;
m_szPage.cy = ( szViewport.cy / m_szIncrement.cy ) * m_szIncrement.cy;
return S_OK;
}
void cScroller::onButtonHit(long nID)
{
m_pPager->put_Command( nID );
}
void cScroller::onButtonUnhit(long)
{
m_pPager->FinishCommand();
}
VARIANT_BOOL cScroller::onClientGetNextPosition(long nID, long nCommand, long *pnX, long *pnY)
{
POINT ptDest;
m_pPager->get_Offset( &ptDest );
POINT ptOriginal = ptDest;
switch( nCommand )
{
case eScrollerUp:
ptDest.y -= m_szIncrement.cy;
break;
case eScrollerDown:
ptDest.y += m_szIncrement.cy;
break;
case eScrollerPageUp:
ptDest.y -= m_szPage.cy;
break;
case eScrollerPageDown:
ptDest.y += m_szPage.cy;
break;
case eScrollerLeft:
ptDest.x -= m_szIncrement.cx;
break;
case eScrollerRight:
ptDest.x += m_szIncrement.cx;
break;
case eScrollerPageLeft:
ptDest.x -= m_szPage.cx;
break;
case eScrollerPageRight:
ptDest.x += m_szPage.cx;
break;
default:
// Unknown scrolling command
_ASSERTE( FALSE );
}
constrainOffset( &ptDest );
if( ptDest.x == ptOriginal.x && ptDest.y == ptOriginal.y )
// We didn't move this cycle - do not continue
return VARIANT_FALSE;
*pnX = ptDest.x;
*pnY = ptDest.y;
return VARIANT_TRUE;
}
void cScroller::onClientChange( long nID, long, long nX, long nY )
{
_ASSERTE( nID == eScrollerPager );
// Convert these values to a thumb-like position
SIZE szViewport;
get_Viewport( &szViewport );
SIZE szScroll = szViewport;
szScroll.cx -= BTN_SIZE * 3;
szScroll.cy -= BTN_SIZE * 3;
// The viewport is now the size of the thumb ranges
m_ptThumb.x = static_cast< long >( ( ( m_szArea.cx - szViewport.cx ) != 0 ) ? static_cast< double >( nX * szScroll.cx ) / static_cast< double >( m_szArea.cx - szViewport.cx ) : 0.0 );
m_ptThumb.y = static_cast< long >( ( ( m_szArea.cy - szViewport.cy ) != 0 ) ? static_cast< double >( nY * szScroll.cy ) / static_cast< double >( m_szArea.cy - szViewport.cy ) : 0.0 );
if( m_ptThumb.x > szScroll.cx || nX >= ( m_szArea.cx - szViewport.cx - m_szIncrement.cy ) )
m_ptThumb.x = szScroll.cx;
if( m_ptThumb.y > szScroll.cy || nY >= ( m_szArea.cy - szViewport.cy - m_szIncrement.cy ) )
m_ptThumb.y = szScroll.cy;
if( m_ptThumb.x < 0 )
m_ptThumb.x = 0;
if( m_ptThumb.y < 0 )
m_ptThumb.y = 0;
// Check if the thumb moving has canceled a mouse action
switch( m_nCurrentCommand )
{
case eScrollerPageUp:
case eScrollerPageDown:
case eScrollerPageLeft:
case eScrollerPageRight:
{
MouseState ms = { this, { 0, 0 }, { m_ptMouseLast.x, m_ptMouseLast.y }, VARIANT_FALSE, VARIANT_FALSE };
if( hitTest( &ms ) != m_nCurrentCommand )
m_pPager->FinishCommand();
}
break;
}
// Draw next frame
m_pSite->Invalidate();
long nIDThis;
m_pSite->get_ID( &nIDThis );
Fire_Change( nIDThis, nX, nY );
}
STDMETHODIMP cScroller::get_Viewport(LPSIZE pVal)
{
_ASSERTE( pVal != NULL );
RECT rc;
m_pSite->get_Position( &rc );
pVal->cx = ( rc.right - rc.left ) - ( ( m_bVScroll ) ? BTN_SIZE : 0 );
pVal->cy = ( rc.bottom - rc.top ) - ( ( m_bHScroll ) ? BTN_SIZE : 0 );
return S_OK;
}
STDMETHODIMP cScroller::get_Area(LPSIZE pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_szArea;
return S_OK;
}
STDMETHODIMP cScroller::put_Area(LPSIZE newVal)
{
_ASSERTE( newVal != NULL );
//_ASSERTE( newVal->cx >= 0 && newVal->cy >= 0 );
// Now this area will have to be rounded up to an increment or
// a page size
SIZE szViewport;
get_Viewport( &szViewport );
if( newVal->cx < szViewport.cx )
// This view is thinner than the viewport, set it to the minimum
newVal->cx = szViewport.cx;
else if( m_bHScroll )
if((szViewport.cx % m_szIncrement.cx)!=0)
newVal->cx += m_szIncrement.cx - ( newVal->cx % m_szIncrement.cx ); // Make sure there is an extra line so we don't scroll off the edge
// Repeat for y-scoord
if( newVal->cy < szViewport.cy )
newVal->cy = szViewport.cy;
else if( m_bVScroll )
if((szViewport.cy % m_szIncrement.cy)!=0)
newVal->cy += m_szIncrement.cy - ( newVal->cy % m_szIncrement.cy );
m_szArea = *newVal;
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cScroller::get_HorizontalEnabled(VARIANT_BOOL *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_bHScroll;
return S_OK;
}
STDMETHODIMP cScroller::put_HorizontalEnabled(VARIANT_BOOL newVal)
{
if( newVal != m_bHScroll )
{
m_bHScroll = newVal;
m_pSite->Reformat();
}
return S_OK;
}
STDMETHODIMP cScroller::get_VerticalEnabled(VARIANT_BOOL *pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_bVScroll;
return S_OK;
}
STDMETHODIMP cScroller::put_VerticalEnabled(VARIANT_BOOL newVal)
{
if( newVal != m_bVScroll )
{
m_bVScroll = newVal;
m_pSite->Reformat();
}
return S_OK;
}
STDMETHODIMP cScroller::CreateClient(ILayer *pChild)
{
CComPtr< ILayerSite > pPagerSite;
HRESULT hRes = m_pSite->get_Child( eScrollerPager, ePositionByID, &pPagerSite );
_ASSERTE( SUCCEEDED( hRes ) );
LayerParams lp = { eScrollerClient, { 0, 0, 0, 0 }, eRenderClipped };
return pPagerSite->CreateChild( &lp, pChild );
}
STDMETHODIMP cScroller::get_Offset(LPPOINT pVal)
{
_ASSERTE( pVal != NULL );
POINT ptTrueOff;
m_pPager->get_Offset( &ptTrueOff );
pVal->x = ptTrueOff.x / m_szIncrement.cx;
pVal->y = ptTrueOff.y / m_szIncrement.cy;
return S_OK;
}
STDMETHODIMP cScroller::put_Offset(LPPOINT newVal)
{
_ASSERTE( newVal != NULL );
_ASSERTE( newVal->x >= 0 && newVal->y >= 0 );
POINT ptTrueOff = { newVal->x * m_szIncrement.cx, newVal->y * m_szIncrement.cy };
constrainOffset( &ptTrueOff );
m_pPager->put_Offset( &ptTrueOff );
return S_OK;
}
STDMETHODIMP cScroller::ScrollTo(LPPOINT ptOffset)
{
_ASSERTE( ptOffset != NULL );
_ASSERTE( ptOffset->x >= 0 && ptOffset->y >= 0 );
POINT ptTrueOff = { ptOffset->x * m_szIncrement.cx, ptOffset->y * m_szIncrement.cy };
constrainOffset( &ptTrueOff );
m_pPager->ScrollTo( &ptTrueOff );
return S_OK;
}
STDMETHODIMP cScroller::get_Increments(LPSIZE pVal)
{
_ASSERTE( pVal != NULL );
*pVal = m_szIncrement;
return S_OK;
}
STDMETHODIMP cScroller::put_Increments(LPSIZE newVal)
{
_ASSERTE( newVal != NULL );
_ASSERTE( newVal->cx > 0 && newVal->cy > 0 );
// Assign the new increments
m_szIncrement = *newVal;
// Align the current position to the new position
POINT ptCurrent;
m_pPager->get_Offset( &ptCurrent );
ptCurrent.x = ( ptCurrent.x / newVal->cx ) * newVal->cx;
ptCurrent.y = ( ptCurrent.y / newVal->cy ) * newVal->cy;
constrainOffset( &ptCurrent );
m_pPager->put_Offset( &ptCurrent );
m_pSite->Reformat();
return S_OK;
}
STDMETHODIMP cScroller::MouseDown( MouseState *pMS )
{
m_nCurrentCommand = hitTest( pMS );
if( m_nCurrentCommand == -1 )
return S_OK;
switch( m_nCurrentCommand )
{
case eScrollerHThumb:
m_nScreenStart = pMS->screen.x;
m_nThumbStart = m_ptThumb.x;
break;
case eScrollerVThumb:
m_nScreenStart = pMS->screen.y;
m_nThumbStart = m_ptThumb.y;
break;
case eScrollerPageUp:
case eScrollerPageDown:
case eScrollerPageLeft:
case eScrollerPageRight:
m_ptMouseLast = pMS->client;
m_pPager->put_Command( m_nCurrentCommand );
break;
}
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cScroller::MouseUp( MouseState *pMS )
{
m_nCurrentCommand = -1;
// Make sure there are no more commands in the pager
m_pPager->FinishCommand();
m_pSite->Invalidate();
return S_OK;
}
STDMETHODIMP cScroller::MouseMove( MouseState *pMS )
{
if( m_nCurrentCommand == -1 )
// No command, so nothgin to do
return S_OK;
SIZE szViewport;
get_Viewport( &szViewport );
SIZE szScroller = { szViewport.cx - BTN_SIZE * 3, szViewport.cy - BTN_SIZE * 3 };
POINT ptOffset;
m_pPager->get_Offset( &ptOffset );
switch( m_nCurrentCommand )
{
case eScrollerPageUp:
case eScrollerPageDown:
case eScrollerPageLeft:
case eScrollerPageRight:
{
if( hitTest( pMS ) == m_nCurrentCommand )
m_pPager->put_Command( m_nCurrentCommand );
else
m_pPager->FinishCommand();
m_ptMouseLast = pMS->client;
}
break;
case eScrollerHThumb:
{
long nPos = m_nThumbStart + ( pMS->screen.x - m_nScreenStart );
// Make sure it's bigger than 0
if( nPos < 0 )
nPos = 0;
// Convert this to an actual position
ptOffset.x = nPos * ( m_szArea.cx - szViewport.cx ) / szScroller.cx;
// Align to the nearest line
ptOffset.x -= ptOffset.x % m_szIncrement.cx;
// Set the position, pager callback will set the thumb position
constrainOffset( &ptOffset );
m_pPager->put_Offset( &ptOffset );
}
break;
case eScrollerVThumb:
{
long nPos = m_nThumbStart + ( pMS->screen.y - m_nScreenStart );
// Make sure it's bigger than 0
if( nPos < 0 )
nPos = 0;
// Convert this to an actual position
ptOffset.y = nPos * ( m_szArea.cy - szViewport.cy ) / szScroller.cy;
// Align to the nearest line
ptOffset.y -= ptOffset.y % m_szIncrement.cy;
// Set the position, pager callback will set the thumb position
constrainOffset( &ptOffset );
m_pPager->put_Offset( &ptOffset );
}
break;
}
return S_OK;
}
HRESULT cScroller::SchemaLoad( IView *pView, IUnknown *pXMLElement )
{
MSXML::IXMLDOMElementPtr pElement = pXMLElement;
_variant_t vHScroll = pElement->getAttribute( _T( "hscroll" ) ),
vVScroll = pElement->getAttribute( _T( "vscroll" ) ),
vAreaWidth = pElement->getAttribute( _T( "areawidth" ) ),
vAreaHeight = pElement->getAttribute( _T( "areaheight" ) ),
vIncrementX = pElement->getAttribute( _T( "incrementx" ) ),
vIncrementY = pElement->getAttribute( _T( "incrementy" ) );
// Do the client
MSXML::IXMLDOMElementPtr pClient = pElement->selectSingleNode( _T( "control" ) );
if( pClient.GetInterfacePtr() != NULL )
{
// Recurse and load the client
CComPtr< ILayerSite > pPager;
m_pSite->get_Child( eScrollerPager, ePositionByID, &pPager );
long nAssigned;
pView->LoadControl( pPager, eScrollerClient, pClient, &nAssigned );
}
// First enable the scroll bars
if( vHScroll.vt != VT_NULL )
{
try
{
m_bHScroll = static_cast< bool >( vHScroll ) ? VARIANT_TRUE : VARIANT_FALSE;
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vVScroll.vt != VT_NULL )
{
try
{
m_bVScroll = static_cast< bool >( vVScroll ) ? VARIANT_TRUE : VARIANT_FALSE;
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
// Next set the increment sizes
if( vIncrementX.vt != VT_NULL )
{
try
{
m_szIncrement.cx = static_cast< long >( vIncrementX );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vIncrementY.vt != VT_NULL )
{
try
{
m_szIncrement.cy = static_cast< long >( vIncrementY );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
// Last, set the area
SIZE szArea = m_szArea;
if( vAreaWidth.vt != VT_NULL )
{
try
{
szArea.cx = static_cast< long >( vAreaWidth );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
if( vAreaHeight.vt != VT_NULL )
{
try
{
szArea.cy = static_cast< long >( vAreaHeight );
}
catch( ... )
{
// Type conversion error
_ASSERTE( FALSE );
}
}
put_Area( &szArea );
return S_OK;
}
STDMETHODIMP cScroller::ResetScroller()
{
POINT ptCurrent;
ptCurrent.x = 0;
ptCurrent.y = 0;
constrainOffset( &ptCurrent );
m_pPager->put_Offset( &ptCurrent );
m_ptThumb.x =0;
m_ptThumb.y =0;
return S_OK;
}

View file

@ -0,0 +1,139 @@
// Scroller.h : Declaration of the cScroller
#ifndef __SCROLLER_H_
#define __SCROLLER_H_
#include "resource.h" // main symbols
#include "SinkImpl.h"
#include "DecalControlsCP.h"
#define PAGER_CLIENT 1
#define BUTTON_LEFT 2
#define BUTTON_RIGHT 3
#define BUTTON_UP 4
#define BUTTON_DOWN 5
/////////////////////////////////////////////////////////////////////////////
// cScroller
class ATL_NO_VTABLE cScroller :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cScroller, &CLSID_Scroller>,
public IConnectionPointContainerImpl<cScroller>,
public ILayerImpl< cScroller >,
public ILayerRenderImpl,
public ILayerMouseImpl,
public IProvideClassInfo2Impl< &CLSID_Scroller, &DIID_IScrollerEvents, &LIBID_DecalControls >,
public IControlImpl< cScroller, IScroller, &IID_IControl, &LIBID_DecalPlugins >,
public ICommandEventsImpl< BUTTON_LEFT, cScroller >,
public ICommandEventsImpl< BUTTON_RIGHT, cScroller >,
public ICommandEventsImpl< BUTTON_UP, cScroller >,
public ICommandEventsImpl< BUTTON_DOWN, cScroller >,
public IPagerEventsImpl< PAGER_CLIENT, cScroller >,
public ILayerSchema,
public CProxyIScrollerEvents< cScroller >
{
public:
cScroller()
: m_nCurrentCommand( -1 )
{
}
CComPtr< IPager > m_pPager;
CComPtr< IImageCache > m_pHScrollBack;
CComPtr< IImageCache > m_pVScrollBack;
SIZE m_szArea;
SIZE m_szIncrement;
SIZE m_szPage;
POINT m_ptThumb;
// Members for live dragging of the thumbs
long m_nCurrentCommand,
m_nScreenStart,
m_nThumbStart;
POINT m_ptMouseLast;
VARIANT_BOOL m_bHScroll,
m_bVScroll;
void onCreate();
void onDestroy();
// Helper functions
long hitTest( MouseState *pMS );
void constrainOffset( LPPOINT ppt );
DECLARE_REGISTRY_RESOURCEID(IDR_SCROLLER)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cScroller)
COM_INTERFACE_ENTRY(ILayerRender)
COM_INTERFACE_ENTRY(ILayerMouse)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(IScroller)
COM_INTERFACE_ENTRY(IControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ILayer)
COM_INTERFACE_ENTRY(ILayerSchema)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cScroller)
CONNECTION_POINT_ENTRY(DIID_IScrollerEvents)
END_CONNECTION_POINT_MAP()
BEGIN_SINK_MAP(cScroller)
SINK_ENTRY_EX( PAGER_CLIENT, DIID_IPagerEvents, DISPID_CHANGE, onClientChange )
SINK_ENTRY_EX( PAGER_CLIENT, DIID_IPagerEvents, DISPID_GETNEXTPOSITION, onClientGetNextPosition )
SINK_ENTRY_EX( BUTTON_UP, DIID_ICommandEvents, DISPID_HIT, onButtonHit )
SINK_ENTRY_EX( BUTTON_UP, DIID_ICommandEvents, DISPID_UNHIT, onButtonUnhit )
SINK_ENTRY_EX( BUTTON_DOWN, DIID_ICommandEvents, DISPID_HIT, onButtonHit )
SINK_ENTRY_EX( BUTTON_DOWN, DIID_ICommandEvents, DISPID_UNHIT, onButtonUnhit )
SINK_ENTRY_EX( BUTTON_LEFT, DIID_ICommandEvents, DISPID_HIT, onButtonHit )
SINK_ENTRY_EX( BUTTON_LEFT, DIID_ICommandEvents, DISPID_UNHIT, onButtonUnhit )
SINK_ENTRY_EX( BUTTON_RIGHT, DIID_ICommandEvents, DISPID_HIT, onButtonHit )
SINK_ENTRY_EX( BUTTON_RIGHT, DIID_ICommandEvents, DISPID_UNHIT, onButtonUnhit )
END_SINK_MAP()
public:
STDMETHOD(ResetScroller)();
// IScroller Methods
STDMETHOD(get_Viewport)(/*[out, retval]*/ LPSIZE pVal);
STDMETHOD(get_Area)(/*[out, retval]*/ LPSIZE pVal);
STDMETHOD(put_Area)(/*[in]*/ LPSIZE newVal);
STDMETHOD(get_HorizontalEnabled)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_HorizontalEnabled)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_VerticalEnabled)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_VerticalEnabled)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(CreateClient)(ILayer *pChild);
STDMETHOD(get_Offset)(/*[out, retval]*/ LPPOINT pVal);
STDMETHOD(put_Offset)(/*[in]*/ LPPOINT newVal);
STDMETHOD(ScrollTo)(LPPOINT ptOffset);
STDMETHOD(get_Increments)(/*[out, retval]*/ LPSIZE pVal);
STDMETHOD(put_Increments)(/*[in]*/ LPSIZE newVal);
// ILayerRender Methods
STDMETHOD(Render)(ICanvas *pCanvas);
STDMETHOD(Reformat)();
// ICommandEvents Methods
void __stdcall onButtonHit( long nID );
void __stdcall onButtonUnhit( long nID );
// IPagerEvents Methods
void __stdcall onClientChange( long nID, long nCommand, long nX, long nY );
VARIANT_BOOL __stdcall onClientGetNextPosition( long nID, long nCommand, long *pnX, long *pnY );
// ILayerMouse Methods
STDMETHOD(MouseDown)(MouseState *pMS);
STDMETHOD(MouseUp)(MouseState *pMS);
STDMETHOD(MouseMove)(MouseState *pMS);
// ILayerSchema Methods
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pXMLElement);
};
#endif //__SCROLLER_H_

Some files were not shown because too many files have changed in this diff Show more