From 09bedb49152fe9fe7c0997e9815a5bf542d3ed2e Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 03 一月 2025 14:34:08 +0800
Subject: [PATCH] 1.Cim-pc端框架;
---
SourceCode/Bond/Servo/Servo.vcxproj | 230 +++++++
SourceCode/Bond/Servo/res/Servo.ico | 0
SourceCode/Bond/x64/Debug/Res/Servo.bmp | 0
SourceCode/Bond/Servo/targetver.h | 8
SourceCode/Bond/Servo/resource.h | 0
SourceCode/Bond/Servo/stdafx.cpp | 8
SourceCode/Bond/Servo/Servo.cpp | 119 +++
SourceCode/Bond/Servo/stdafx.h | 54 +
SourceCode/Bond/Servo/ReadMe.txt | 67 ++
SourceCode/Bond/Servo/ServoDlg.cpp | 293 +++++++++
SourceCode/Bond/Servo/Servo.vcxproj.filters | 72 ++
SourceCode/Bond/Servo/res/application.exe.manifest | 20
SourceCode/Bond/x64/Debug/Res/Servo001.bmp | 0
SourceCode/Bond/Servo/ServoGraph.cpp | 629 ++++++++++++++++++++
SourceCode/Bond/Servo/Servo.rc | 0
SourceCode/Bond/Servo/Servo.h | 41 +
SourceCode/Bond/Servo/ServoGraph.h | 183 ++++++
SourceCode/Bond/Servo/res/Servo.rc2 | 0
SourceCode/Bond/Servo/ServoDlg.h | 43 +
19 files changed, 1,767 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/ReadMe.txt b/SourceCode/Bond/Servo/ReadMe.txt
new file mode 100644
index 0000000..09c4873
--- /dev/null
+++ b/SourceCode/Bond/Servo/ReadMe.txt
@@ -0,0 +1,67 @@
+锘�================================================================================
+ MICROSOFT 鍩虹绫诲簱 : Servo 椤圭洰姒傝堪
+===============================================================================
+
+搴旂敤绋嬪簭鍚戝宸蹭负鎮ㄥ垱寤轰簡姝� Servo 搴旂敤绋嬪簭銆傛搴旂敤绋嬪簭涓嶄粎婕旂ず Microsoft 鍩虹绫荤殑鍩烘湰浣跨敤鏂规硶锛岃繕鍙綔涓烘偍缂栧啓搴旂敤绋嬪簭鐨勮捣鐐广��
+
+鏈枃浠舵瑕佷粙缁嶇粍鎴� Servo 搴旂敤绋嬪簭鐨勬瘡涓枃浠剁殑鍐呭銆�
+
+Servo.vcxproj
+ 杩欐槸浣跨敤搴旂敤绋嬪簭鍚戝鐢熸垚鐨� VC++ 椤圭洰鐨勪富椤圭洰鏂囦欢锛屽叾涓寘鍚敓鎴愯鏂囦欢鐨� Visual C++ 鐨勭増鏈俊鎭紝浠ュ強鏈夊叧浣跨敤搴旂敤绋嬪簭鍚戝閫夋嫨鐨勫钩鍙般�侀厤缃拰椤圭洰鍔熻兘鐨勪俊鎭��
+
+Servo.vcxproj.filters
+ 杩欐槸浣跨敤鈥滃簲鐢ㄧ▼搴忓悜瀵尖�濈敓鎴愮殑 VC++ 椤圭洰绛涢�夊櫒鏂囦欢銆傚畠鍖呭惈鏈夊叧椤圭洰鏂囦欢涓庣瓫閫夊櫒涔嬮棿鐨勫叧鑱斾俊鎭�傚湪 IDE 涓紝閫氳繃杩欑鍏宠仈锛屽湪鐗瑰畾鑺傜偣涓嬩互鍒嗙粍褰㈠紡鏄剧ず鍏锋湁鐩镐技鎵╁睍鍚嶇殑鏂囦欢銆備緥濡傦紝鈥�.cpp鈥濇枃浠朵笌鈥滄簮鏂囦欢鈥濈瓫閫夊櫒鍏宠仈銆�
+
+Servo.h
+ 杩欐槸搴旂敤绋嬪簭鐨勪富澶存枃浠躲��
+ 鍏朵腑鍖呮嫭鍏朵粬椤圭洰鐗瑰畾鐨勬爣澶达紙鍖呮嫭 Resource.h锛夛紝骞跺0鏄� CServoApp 搴旂敤绋嬪簭绫汇��
+
+Servo.cpp
+ 杩欐槸鍖呭惈搴旂敤绋嬪簭绫� CServoApp 鐨勪富搴旂敤绋嬪簭婧愭枃浠躲��
+
+Servo.rc
+ 杩欐槸绋嬪簭浣跨敤鐨勬墍鏈� Microsoft Windows 璧勬簮鐨勫垪琛ㄣ�傚畠鍖呮嫭 RES 瀛愮洰褰曚腑瀛樺偍鐨勫浘鏍囥�佷綅鍥惧拰鍏夋爣銆傛鏂囦欢鍙互鐩存帴鍦� Microsoft Visual C++ 涓繘琛岀紪杈戙�傞」鐩祫婧愬寘鍚湪 2052 涓��
+
+res\Servo.ico
+ 杩欐槸鐢ㄤ綔搴旂敤绋嬪簭鍥炬爣鐨勫浘鏍囨枃浠躲�傛鍥炬爣鍖呮嫭鍦ㄤ富璧勬簮鏂囦欢 Servo.rc 涓��
+
+res\Servo.rc2
+ 姝ゆ枃浠跺寘鍚笉鍦� Microsoft Visual C++ 涓繘琛岀紪杈戠殑璧勬簮銆傛偍搴旇灏嗕笉鍙敱璧勬簮缂栬緫鍣ㄧ紪杈戠殑鎵�鏈夎祫婧愭斁鍦ㄦ鏂囦欢涓��
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+搴旂敤绋嬪簭鍚戝鍒涘缓涓�涓璇濇绫伙細
+
+ServoDlg.h銆丼ervoDlg.cpp - 瀵硅瘽妗�
+ 杩欎簺鏂囦欢鍖呭惈 CServoDlg 绫汇�傛绫诲畾涔夊簲鐢ㄧ▼搴忕殑涓诲璇濇鐨勮涓恒�傚璇濇妯℃澘鍖呭惈鍦� Servo.rc 涓紝璇ユ枃浠跺彲浠ュ湪 Microsoft Visual C++ 涓紪杈戙��
+
+/////////////////////////////////////////////////////////////////////////////
+
+鍏朵粬鍔熻兘锛�
+
+ActiveX 鎺т欢
+ 璇ュ簲鐢ㄧ▼搴忓寘鍚浣跨敤 ActiveX 鎺т欢鐨勬敮鎸併��
+
+/////////////////////////////////////////////////////////////////////////////
+
+鍏朵粬鏍囧噯鏂囦欢:
+
+StdAfx.h, StdAfx.cpp
+ 杩欎簺鏂囦欢鐢ㄤ簬鐢熸垚鍚嶄负 Servo.pch 鐨勯缂栬瘧澶� (PCH) 鏂囦欢鍜屽悕涓� StdAfx.obj 鐨勯缂栬瘧绫诲瀷鏂囦欢銆�
+
+Resource.h
+ 杩欐槸鏍囧噯澶存枃浠讹紝鍙敤浜庡畾涔夋柊鐨勮祫婧� ID銆侻icrosoft Visual C++ 灏嗚鍙栧苟鏇存柊姝ゆ枃浠躲��
+
+Servo.manifest
+ Windows XP 浣跨敤搴旂敤绋嬪簭娓呭崟鏂囦欢鏉ユ弿杩扮壒瀹氱増鏈殑骞惰绋嬪簭闆嗙殑搴旂敤绋嬪簭渚濊禆椤广�傚姞杞界▼搴忎娇鐢ㄨ繖浜涗俊鎭潵浠庣▼搴忛泦缂撳瓨涓姞杞界浉搴旂殑绋嬪簭闆嗭紝骞朵繚鎶ゅ叾涓嶈搴旂敤绋嬪簭璁块棶銆傚簲鐢ㄧ▼搴忔竻鍗曞彲鑳戒細鍖呭惈鍦ㄥ唴锛屼互浣滀负涓庡簲鐢ㄧ▼搴忓彲鎵ц鏂囦欢瀹夎鍦ㄥ悓涓�鏂囦欢澶逛腑鐨勫閮� .manifest 鏂囦欢杩涜閲嶆柊鍒嗗彂锛屽畠杩樺彲鑳戒互璧勬簮鐨勫舰寮忓寘鍚湪鍙墽琛屾枃浠朵腑銆�
+/////////////////////////////////////////////////////////////////////////////
+
+鍏朵粬娉ㄩ噴:
+
+搴旂敤绋嬪簭鍚戝浣跨敤鈥淭ODO:鈥濇潵鎸囩ず搴旀坊鍔犳垨鑷畾涔夌殑婧愪唬鐮侀儴鍒嗐��
+
+濡傛灉搴旂敤绋嬪簭浣跨敤鍏变韩 DLL 涓殑 MFC锛屾偍灏嗛渶瑕侀噸鏂板垎鍙� MFC DLL銆傚鏋滃簲鐢ㄧ▼搴忔墍浣跨敤鐨勮瑷�涓庢搷浣滅郴缁熺殑鍖哄煙璁剧疆涓嶅悓锛屽垯杩橀渶瑕侀噸鏂板垎鍙戠浉搴旂殑鏈湴鍖栬祫婧� mfc110XXX.DLL銆�
+鏈夊叧涓婅堪璇濋鐨勬洿澶氫俊鎭紝璇峰弬瑙� MSDN 鏂囨。涓湁鍏抽噸鏂板垎鍙� Visual C++ 搴旂敤绋嬪簭鐨勯儴鍒嗐��
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/SourceCode/Bond/Servo/Servo.cpp b/SourceCode/Bond/Servo/Servo.cpp
new file mode 100644
index 0000000..81b50bc
--- /dev/null
+++ b/SourceCode/Bond/Servo/Servo.cpp
@@ -0,0 +1,119 @@
+
+// Servo.cpp : 定义应用程序的类行为。
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "ServoDlg.h"
+#include "ServoGraph.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CServoApp
+
+BEGIN_MESSAGE_MAP(CServoApp, CWinApp)
+ ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CServoApp 构造
+
+CServoApp::CServoApp()
+{
+ // 支持重新启动管理器
+ m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
+
+ // TODO: 在此处添加构造代码,
+ // 将所有重要的初始化放置在 InitInstance 中
+}
+
+
+// 唯一的一个 CServoApp 对象
+
+CServoApp theApp;
+
+
+// CServoApp 初始化
+
+BOOL CServoApp::InitInstance()
+{
+ // 如果一个运行在 Windows XP 上的应用程序清单指定要
+ // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
+ //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
+ INITCOMMONCONTROLSEX InitCtrls;
+ InitCtrls.dwSize = sizeof(InitCtrls);
+ // 将它设置为包括所有要在应用程序中使用的
+ // 公共控件类。
+ InitCtrls.dwICC = ICC_WIN95_CLASSES;
+ InitCommonControlsEx(&InitCtrls);
+
+ CWinApp::InitInstance();
+
+
+ AfxEnableControlContainer();
+
+ // 创建 shell 管理器,以防对话框包含
+ // 任何 shell 树视图控件或 shell 列表视图控件。
+ CShellManager *pShellManager = new CShellManager;
+
+ // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
+ CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
+
+ // 标准初始化
+ // 如果未使用这些功能并希望减小
+ // 最终可执行文件的大小,则应移除下列
+ // 不需要的特定初始化例程
+ // 更改用于存储设置的注册表项
+ // TODO: 应适当修改该字符串,
+ // 例如修改为公司或组织名
+ SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
+
+
+ // 本程序文件目录
+ TCHAR sDrive[_MAX_DRIVE];
+ TCHAR sDir[_MAX_DIR];
+ TCHAR sFilename[_MAX_FNAME], sAppFilename[_MAX_FNAME];
+ TCHAR sExt[_MAX_EXT];
+ GetModuleFileName(AfxGetInstanceHandle(), sAppFilename, _MAX_FNAME);
+ _tsplitpath_s(sAppFilename, sDrive, sDir, sFilename, sExt);
+ m_strAppDir = CString(sDrive) + CString(sDir);
+ m_strAppFile = CString(sFilename);
+
+
+ // 注册控件
+ CServoGraph::RegisterWndClass();
+
+
+ CServoDlg dlg;
+ m_pMainWnd = &dlg;
+ INT_PTR nResponse = dlg.DoModal();
+ if (nResponse == IDOK)
+ {
+ // TODO: 在此放置处理何时用
+ // “确定”来关闭对话框的代码
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: 在此放置处理何时用
+ // “取消”来关闭对话框的代码
+ }
+ else if (nResponse == -1)
+ {
+ TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
+ TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
+ }
+
+ // 删除上面创建的 shell 管理器。
+ if (pShellManager != NULL)
+ {
+ delete pShellManager;
+ }
+
+ // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
+ // 而不是启动应用程序的消息泵。
+ return FALSE;
+}
+
diff --git a/SourceCode/Bond/Servo/Servo.h b/SourceCode/Bond/Servo/Servo.h
new file mode 100644
index 0000000..54c0bbe
--- /dev/null
+++ b/SourceCode/Bond/Servo/Servo.h
@@ -0,0 +1,41 @@
+
+// Servo.h : PROJECT_NAME 应用程序的主头文件
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
+#endif
+
+#include "resource.h" // 主符号
+
+
+// CServoApp:
+// 有关此类的实现,请参阅 Servo.cpp
+//
+
+class CServoApp : public CWinApp
+{
+public:
+ CServoApp();
+
+
+public:
+ // CModel m_model;
+ HANDLE m_hAppMutex;
+ CString m_strAppDir;
+ CString m_strAppFile;
+ int m_nVersionNumber;
+ CString m_strVersionName;
+
+// 重写
+public:
+ virtual BOOL InitInstance();
+
+// 实现
+
+ DECLARE_MESSAGE_MAP()
+};
+
+extern CServoApp theApp;
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
new file mode 100644
index 0000000..18d9953
--- /dev/null
+++ b/SourceCode/Bond/Servo/Servo.rc
Binary files differ
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
new file mode 100644
index 0000000..02d8a5d
--- /dev/null
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -0,0 +1,230 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{66ADACE5-3166-4D1F-B30B-DE5E01FB01A2}</ProjectGuid>
+ <RootNamespace>Servo</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ <Keyword>MFCProj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>Dynamic</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>Dynamic</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ <UseOfMfc>Dynamic</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>Dynamic</UseOfMfc>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ <Midl>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <ValidateAllParameters>true</ValidateAllParameters>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <Culture>0x0804</Culture>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ <Midl>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <ValidateAllParameters>true</ValidateAllParameters>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <Culture>0x0804</Culture>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ <Midl>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <ValidateAllParameters>true</ValidateAllParameters>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <Culture>0x0804</Culture>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ <Midl>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <ValidateAllParameters>true</ValidateAllParameters>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <Culture>0x0804</Culture>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <Text Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="Resource.h" />
+ <ClInclude Include="Servo.h" />
+ <ClInclude Include="ServoDlg.h" />
+ <ClInclude Include="ServoGraph.h" />
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="targetver.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Servo.cpp" />
+ <ClCompile Include="ServoDlg.cpp" />
+ <ClCompile Include="ServoGraph.cpp" />
+ <ClCompile Include="stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="Servo.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\Servo.rc2" />
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="res\Servo.ico" />
+ </ItemGroup>
+ <ItemGroup>
+ <Manifest Include="res\application.exe.manifest" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+ <ProjectExtensions>
+ <VisualStudio>
+ <UserProperties RESOURCE_FILE="Servo.rc" />
+ </VisualStudio>
+ </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
new file mode 100644
index 0000000..3add087
--- /dev/null
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -0,0 +1,72 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="婧愭枃浠�">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="澶存枃浠�">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="璧勬簮鏂囦欢">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="Servo.h">
+ <Filter>澶存枃浠�</Filter>
+ </ClInclude>
+ <ClInclude Include="ServoDlg.h">
+ <Filter>澶存枃浠�</Filter>
+ </ClInclude>
+ <ClInclude Include="stdafx.h">
+ <Filter>澶存枃浠�</Filter>
+ </ClInclude>
+ <ClInclude Include="targetver.h">
+ <Filter>澶存枃浠�</Filter>
+ </ClInclude>
+ <ClInclude Include="Resource.h">
+ <Filter>澶存枃浠�</Filter>
+ </ClInclude>
+ <ClInclude Include="ServoGraph.h">
+ <Filter>澶存枃浠�</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Servo.cpp">
+ <Filter>婧愭枃浠�</Filter>
+ </ClCompile>
+ <ClCompile Include="ServoDlg.cpp">
+ <Filter>婧愭枃浠�</Filter>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>婧愭枃浠�</Filter>
+ </ClCompile>
+ <ClCompile Include="ServoGraph.cpp">
+ <Filter>婧愭枃浠�</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="Servo.rc">
+ <Filter>璧勬簮鏂囦欢</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\Servo.rc2">
+ <Filter>璧勬簮鏂囦欢</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="res\Servo.ico">
+ <Filter>璧勬簮鏂囦欢</Filter>
+ </Image>
+ </ItemGroup>
+ <ItemGroup>
+ <Manifest Include="res\application.exe.manifest" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
new file mode 100644
index 0000000..b2e5d04
--- /dev/null
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -0,0 +1,293 @@
+
+// ServoDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "ServoDlg.h"
+#include "afxdialogex.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+#define INDICATE_BONDER1 1
+#define INDICATE_BONDER2 2
+#define INDICATE_FLIPER 3
+#define INDICATE_ALIGNER 4
+#define INDICATE_LPORT4 5
+#define INDICATE_LPORT3 6
+#define INDICATE_LPORT2 7
+#define INDICATE_LPORT1 8
+#define INDICATE_ROBOT_ARM1 9
+#define INDICATE_ROBOT_ARM2 10
+#define INDICATE_VACUUM_BAKE 11
+#define INDICATE_BAKE_COOLING 12
+#define INDICATE_MEASUREMENT 13
+
+
+// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
+
+class CAboutDlg : public CDialogEx
+{
+public:
+ CAboutDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_ABOUTBOX };
+#endif
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+// 实现
+protected:
+ DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CServoDlg 对话框
+
+
+
+CServoDlg::CServoDlg(CWnd* pParent /*=NULL*/)
+ : CDialogEx(IDD_SERVO_DIALOG, pParent)
+{
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+ m_crBkgnd = RGB(255, 255, 255);
+ m_hbrBkgnd = nullptr;
+}
+
+void CServoDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CServoDlg, CDialogEx)
+ ON_WM_SYSCOMMAND()
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ ON_BN_CLICKED(IDOK, &CServoDlg::OnBnClickedOk)
+ ON_BN_CLICKED(IDCANCEL, &CServoDlg::OnBnClickedCancel)
+ ON_WM_CTLCOLOR()
+ ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+
+// CServoDlg 消息处理程序
+
+BOOL CServoDlg::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // 将“关于...”菜单项添加到系统菜单中。
+
+ // IDM_ABOUTBOX 必须在系统命令范围内。
+ ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+ ASSERT(IDM_ABOUTBOX < 0xF000);
+
+ CMenu* pSysMenu = GetSystemMenu(FALSE);
+ if (pSysMenu != NULL)
+ {
+ BOOL bNameValid;
+ CString strAboutMenu;
+ bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
+ ASSERT(bNameValid);
+ if (!strAboutMenu.IsEmpty())
+ {
+ pSysMenu->AppendMenu(MF_SEPARATOR);
+ pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+ }
+ }
+
+ // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
+ // 执行此操作
+ SetIcon(m_hIcon, TRUE); // 设置大图标
+ SetIcon(m_hIcon, FALSE); // 设置小图标
+
+
+ // 图示
+ m_pGraph = CServoGraph::Hook(GetDlgItem(IDC_SERVO_GRAPH1)->GetSafeHwnd());
+ CString strPath;
+ strPath.Format(_T("%s\\res\\Servo001.bmp"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
+ m_pGraph->AddImage(1, (LPTSTR)(LPCTSTR)strPath, 0, 0);
+
+
+ // 添加指示器
+ // Bonder
+ m_pGraph->AddIndicateBox(INDICATE_BONDER1, 220, 172, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_BONDER1, "10", "Bonder 1");
+ m_pGraph->AddIndicateBox(INDICATE_BONDER2, 220, 516, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_BONDER2, "11", "Bonder 2");
+
+
+ // 翻转
+ m_pGraph->AddIndicateBox(INDICATE_FLIPER, 338, 172, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_FLIPER, "8", "Fliper");
+
+
+ // 对位
+ m_pGraph->AddIndicateBox(INDICATE_ALIGNER, 428, 172, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_ALIGNER, "7", "Aligner");
+
+
+ // Load port 4
+ m_pGraph->AddIndicateBox(INDICATE_LPORT4, 518, 172, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_LPORT4, "4", "LPort4");
+
+
+ // Load port 3
+ m_pGraph->AddIndicateBox(INDICATE_LPORT3, 606, 172, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_LPORT3, "3", "LPort3");
+
+
+ // Load port 2
+ m_pGraph->AddIndicateBox(INDICATE_LPORT2, 690, 172, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_LPORT2, "2", "LPort2");
+
+
+ // Load port 1
+ m_pGraph->AddIndicateBox(INDICATE_LPORT1, 774, 172, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_LPORT1, "1", "LPort1");
+
+
+ // Robot
+ m_pGraph->AddIndicateBox(INDICATE_ROBOT_ARM1, 620, 294, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_ROBOT_ARM1, "5", "Robot");
+ m_pGraph->AddIndicateBox(INDICATE_ROBOT_ARM2, 673, 294, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_ROBOT_ARM2, "6", "Robot");
+
+
+ // Vacuum bake
+ m_pGraph->AddIndicateBox(INDICATE_VACUUM_BAKE, 396, 516, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_VACUUM_BAKE, "9", "Vacuum bake");
+
+
+ // Bake cooling
+ m_pGraph->AddIndicateBox(INDICATE_BAKE_COOLING, 566, 516, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_BAKE_COOLING, "12", "Bake cooling");
+
+
+ // Bake cooling
+ m_pGraph->AddIndicateBox(INDICATE_MEASUREMENT, 736, 516, 48, RGB(22, 22, 22),
+ RGB(255, 127, 39), RGB(0, 176, 80));
+ m_pGraph->SetBoxText(INDICATE_MEASUREMENT, "13", "Measurement");
+
+
+ return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
+}
+
+void CServoDlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+ if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+ {
+ CAboutDlg dlgAbout;
+ dlgAbout.DoModal();
+ }
+ else
+ {
+ CDialogEx::OnSysCommand(nID, lParam);
+ }
+}
+
+// 如果向对话框添加最小化按钮,则需要下面的代码
+// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
+// 这将由框架自动完成。
+
+void CServoDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // 用于绘制的设备上下文
+
+ SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+ // 使图标在工作区矩形中居中
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // 绘制图标
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CDialogEx::OnPaint();
+ }
+}
+
+//当用户拖动最小化窗口时系统调用此函数取得光标
+//显示。
+HCURSOR CServoDlg::OnQueryDragIcon()
+{
+ return static_cast<HCURSOR>(m_hIcon);
+}
+
+
+
+void CServoDlg::OnBnClickedOk()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ CDialogEx::OnOK();
+}
+
+
+void CServoDlg::OnBnClickedCancel()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ CDialogEx::OnCancel();
+}
+
+HBRUSH CServoDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+ HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
+
+ if (nCtlColor == CTLCOLOR_STATIC) {
+ pDC->SetBkColor(m_crBkgnd);
+ pDC->SetTextColor(RGB(0, 0, 0));
+ }
+
+ if (m_hbrBkgnd == nullptr) {
+ m_hbrBkgnd = CreateSolidBrush(m_crBkgnd);
+ }
+
+ return m_hbrBkgnd;
+}
+
+void CServoDlg::OnDestroy()
+{
+ CDialogEx::OnDestroy();
+
+ if (m_hbrBkgnd != nullptr) {
+ ::DeleteObject(m_hbrBkgnd);
+ }
+}
diff --git a/SourceCode/Bond/Servo/ServoDlg.h b/SourceCode/Bond/Servo/ServoDlg.h
new file mode 100644
index 0000000..1353deb
--- /dev/null
+++ b/SourceCode/Bond/Servo/ServoDlg.h
@@ -0,0 +1,43 @@
+
+// ServoDlg.h : 头文件
+//
+
+#pragma once
+#include "ServoGraph.h"
+
+
+// CServoDlg 对话框
+class CServoDlg : public CDialogEx
+{
+// 构造
+public:
+ CServoDlg(CWnd* pParent = NULL); // 标准构造函数
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_SERVO_DIALOG };
+#endif
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+
+// 实现
+protected:
+ HICON m_hIcon;
+ CServoGraph* m_pGraph;
+ COLORREF m_crBkgnd;
+ HBRUSH m_hbrBkgnd;
+
+ // 生成的消息映射函数
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnBnClickedOk();
+ afx_msg void OnBnClickedCancel();
+ afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+ afx_msg void OnDestroy();
+};
diff --git a/SourceCode/Bond/Servo/ServoGraph.cpp b/SourceCode/Bond/Servo/ServoGraph.cpp
new file mode 100644
index 0000000..718661c
--- /dev/null
+++ b/SourceCode/Bond/Servo/ServoGraph.cpp
@@ -0,0 +1,629 @@
+// ServoGraph.cpp: implementation of the CServoGraph class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ServoGraph.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CServoGraph::CServoGraph()
+{
+ m_hWnd = NULL;
+ m_crBkgnd = RGB(255,255,255);
+ m_pHighItem = nullptr;
+ m_hWndTooltip = nullptr;
+}
+
+CServoGraph::~CServoGraph()
+{
+ for (auto& item : m_images) {
+ if (item.hBitmap != nullptr) {
+ ::DeleteObject(item.hBitmap);
+ }
+ }
+}
+
+BOOL CServoGraph::RegisterWndClass()
+{
+ WNDCLASS wc;
+ wc.lpszClassName = BYSERVOGRAPH_CLASS;
+ wc.hInstance = AfxGetInstanceHandle();
+ wc.lpfnWndProc = WindowProc;
+ wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);
+ wc.hIcon = 0;
+ wc.lpszMenuName = NULL;
+ wc.hbrBackground = NULL;
+ wc.style = CS_GLOBALCLASS|CS_DBLCLKS;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+
+ // 注册自定义类
+ return (::RegisterClass(&wc) != 0);
+}
+
+CServoGraph* CServoGraph::Hook(HWND hWnd)
+{
+ CServoGraph* pServoGraph = (CServoGraph*)GetProp(hWnd, BYSTAG_SERVOGRAPH);
+ if(pServoGraph == NULL)
+ {
+ pServoGraph = new CServoGraph;
+ pServoGraph->m_hWnd = hWnd;
+
+ SetProp(hWnd, BYSTAG_SERVOGRAPH, (HANDLE)pServoGraph);
+ }
+
+ return pServoGraph;
+}
+
+void CServoGraph::Release()
+{
+ if (m_hWndTooltip != NULL) {
+ ::DestroyWindow(m_hWndTooltip);
+ m_hWndTooltip = NULL;
+ }
+
+ // delete
+ delete this;
+}
+
+void CServoGraph::Notify(int nCode, int dwData, int dwData1/* = 0*/, int dwData2/* = 0*/)
+{
+ HWND hParent;
+ hParent = GetParent(m_hWnd);
+ if(hParent != NULL) {
+ BYSERVOGRAPH_NMHDR iii_nmhdr;
+ iii_nmhdr.nmhdr.hwndFrom = m_hWnd;
+ iii_nmhdr.nmhdr.idFrom = GetWindowLong(m_hWnd, GWL_ID);
+ iii_nmhdr.nmhdr.code = nCode;
+ iii_nmhdr.dwData = dwData;
+ iii_nmhdr.dwData1 = dwData1;
+ iii_nmhdr.dwData2 = dwData2;
+ SendMessage(hParent, WM_NOTIFY, (WPARAM)iii_nmhdr.nmhdr.idFrom, (LPARAM)&iii_nmhdr);
+ }
+}
+
+
+////////////////////////////////
+// 拦截窗口消息函数
+LRESULT CALLBACK CServoGraph::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ CServoGraph* pServoGraph = (CServoGraph *)GetProp(hWnd, BYSTAG_SERVOGRAPH);
+ if(pServoGraph == NULL && uMsg != WM_NCCREATE)
+ {
+ return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
+ }
+
+
+ // 如果Hook则响应消息
+ ASSERT(hWnd);
+ switch(uMsg)
+ {
+ case WM_NCCREATE:
+ return OnNcCreate(hWnd, wParam, lParam);
+
+ case WM_DESTROY:
+ return pServoGraph->OnDestroy(wParam, lParam);
+
+ case WM_PAINT:
+ return pServoGraph->OnPaint(wParam, lParam);
+
+ case WM_TIMER:
+ return pServoGraph->OnTimer(wParam, lParam);
+
+ case WM_MOUSEMOVE:
+ return pServoGraph->OnMouseMove(wParam, lParam);
+
+ case WM_LBUTTONDOWN:
+ return pServoGraph->OnLButtonDown(wParam, lParam);
+
+ case WM_GETDLGCODE:
+ return DLGC_WANTALLKEYS;
+
+ default:
+ break;
+ }
+
+ return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
+}
+
+///////////////////////////////
+// WM_NCCREATE
+// 窗口创建前的初始化工作
+LRESULT CServoGraph::OnNcCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
+{
+ CServoGraph* pServoGraph = (CServoGraph *)GetProp(hWnd, BYSTAG_SERVOGRAPH);
+ ASSERT(pServoGraph == NULL);
+
+ Hook(hWnd);
+ return ::DefWindowProc(hWnd, WM_NCCREATE, wParam, lParam);
+}
+
+///////////////////////////////
+// WM_DESTROY
+LRESULT CServoGraph::OnDestroy(WPARAM wParam, LPARAM lParam)
+{
+ Release();
+ return ::DefWindowProc(m_hWnd, WM_DESTROY, wParam, lParam);
+}
+
+///////////////////////////////
+// WM_TIMER
+LRESULT CServoGraph::OnTimer(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam == 1) {
+ POINT pt;
+ GetCursorPos(&pt);
+ ::ScreenToClient(m_hWnd, &pt);
+
+ void* pLastHighItem = m_pHighItem;
+ int nHitCode = HitTest(pt, m_pHighItem);
+ if (m_pHighItem != pLastHighItem) {
+ ::InvalidateRect(m_hWnd, NULL, TRUE);
+ }
+
+ if (m_pHighItem == nullptr) {
+ ::KillTimer(m_hWnd, 1);
+ }
+ }
+
+ return ::DefWindowProc(m_hWnd, WM_TIMER, wParam, lParam);
+}
+
+///////////////////////////////
+// WM_MOUSEMOVE
+LRESULT CServoGraph::OnMouseMove(WPARAM wParam, LPARAM lParam)
+{
+ POINT pt;
+ pt.x = LOWORD(lParam);
+ pt.y = HIWORD(lParam);
+
+ void* pLastHighItem = m_pHighItem;
+ int nHitCode = HitTest(pt, m_pHighItem);
+ if (m_pHighItem != pLastHighItem) {
+ ::InvalidateRect(m_hWnd, NULL, TRUE);
+ }
+ if (m_pHighItem != NULL) {
+ ::KillTimer(m_hWnd, 1);
+ ::SetTimer(m_hWnd, 1, 100, NULL);
+ }
+
+
+ return ::DefWindowProc(m_hWnd, WM_MOUSEMOVE, wParam, lParam);
+}
+
+/*
+ * WM_LBUTTONDOWN
+ * 鼠标左键按下
+ */
+LRESULT CServoGraph::OnLButtonDown(WPARAM wParam, LPARAM lParam)
+{
+ POINT pt, ptNew;
+ pt.x = LOWORD(lParam);
+ pt.y = HIWORD(lParam);
+
+ BOOL bButtonUp = FALSE;
+ int nClickIndex = -1;
+ void* pPressItem = nullptr;
+ void* pTempItem = nullptr;
+ HitTest(pt, pPressItem);
+
+
+ // 捕捉鼠标消息,检测是否拖动
+ if (pPressItem != NULL) {
+ ::KillTimer(m_hWnd, 1);
+ if (::GetCapture() == NULL) {
+ SetCapture(m_hWnd);
+ ASSERT(m_hWnd == GetCapture());
+ AfxLockTempMaps();
+ for (;;)
+ {
+ MSG msg;
+ VERIFY(::GetMessage(&msg, NULL, 0, 0));
+
+ if (GetCapture() != m_hWnd) break;
+
+ switch (msg.message)
+ {
+ case WM_MOUSEMOVE:
+ break;
+
+ case WM_LBUTTONUP:
+ ptNew = msg.pt;
+ ::ScreenToClient(m_hWnd, &ptNew);
+ HitTest(ptNew, pTempItem);
+ if (pPressItem == pTempItem) {
+ bButtonUp = TRUE;
+ }
+ goto ExitLoop;
+
+ case WM_KEYDOWN:
+ if (msg.wParam == VK_ESCAPE) {
+ goto ExitLoop;
+ }
+ break;
+
+ default:
+ DispatchMessage(&msg);
+ break;
+ }
+ }
+
+ ExitLoop:
+ ReleaseCapture();
+ ::InvalidateRect(m_hWnd, NULL, TRUE);
+
+ if (bButtonUp) {
+ Notify((int)BYSERVOGRAPH_ITEM_CLICKED, ((INDICATEBOX*)pPressItem)->id);
+ }
+
+ AfxUnlockTempMaps(FALSE);
+ }
+ }
+
+
+ return ::DefWindowProc(m_hWnd, WM_LBUTTONDOWN, wParam, lParam);
+}
+
+///////////////////////////////
+// WM_PAINT
+LRESULT CServoGraph::OnPaint(WPARAM wParam, LPARAM lParam)
+{
+ HDC hDC, hMemDC;
+ HBITMAP hBitmap;
+ RECT rcClient;
+ CString strText;
+ HFONT hFont;
+ HBRUSH hBrushBK;
+
+
+ // BeginPaint
+ PAINTSTRUCT ps;
+ hDC = BeginPaint(m_hWnd, &ps);
+ GetClientRect(m_hWnd, &rcClient);
+
+ hMemDC = ::CreateCompatibleDC(hDC);
+ hBitmap = ::CreateCompatibleBitmap(hDC, rcClient.right-rcClient.left,
+ rcClient.bottom-rcClient.top);
+ ::SelectObject(hMemDC, hBitmap);
+
+ hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
+ ::SelectObject(hMemDC, hFont);
+
+
+ // 背景颜色
+ hBrushBK = CreateSolidBrush( m_crBkgnd );
+ ::FillRect(hMemDC, &rcClient, hBrushBK);
+ DeleteObject(hBrushBK);
+
+
+ // 画IMAGE
+ HDC hDCTemp = ::CreateCompatibleDC(hMemDC);
+ for (auto& item : m_images) {
+ // 载入BMP
+ if (item.hBitmap == nullptr) {
+ item.hBitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(),
+ item.szPath, IMAGE_BITMAP, 0, 0,
+ LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE);
+ if (item.hBitmap != nullptr) {
+ BITMAP bitmap;
+ ::GetObject(item.hBitmap, sizeof(BITMAP), &bitmap);
+ item.bmWidth = bitmap.bmWidth;
+ item.bmHeight = bitmap.bmHeight;
+ }
+
+ }
+
+ if (item.hBitmap != nullptr) {
+ ::SelectObject(hDCTemp, item.hBitmap);
+ ::BitBlt(hMemDC, item.x, item.y, item.bmWidth, item.bmHeight,
+ hDCTemp, 0, 0, SRCCOPY);
+ }
+ }
+ ::DeleteDC(hDCTemp);
+
+
+ // 画背景指示
+ for (auto& item : m_indicateBkgnds) {
+ HBRUSH hbrBkgnd = CreateSolidBrush(item.backgroundColor);
+ ::FillRect(hMemDC, &item.rect, hbrBkgnd);
+ ::DeleteObject(hbrBkgnd);
+ }
+
+
+ // 画指示框
+ ::SetBkMode(hMemDC, TRANSPARENT);
+ for (auto& item : m_indicateBoxs) {
+ RECT rcItem;
+ rcItem.left = item.x - item.box1Width / 2;
+ rcItem.top = item.y - item.box1Width / 2;
+ rcItem.right = rcItem.left + item.box1Width;
+ rcItem.bottom = rcItem.top + item.box1Width;
+ HBRUSH hbrFrame = CreateSolidBrush(m_pHighItem == &item ? item.box1FrameColor[1] : item.box1FrameColor[0]);
+ HBRUSH hbrBkgnd = CreateSolidBrush(item.box1BackgroundColor);
+ ::FillRect(hMemDC, &rcItem, hbrBkgnd);
+ ::FrameRect(hMemDC, &rcItem, hbrFrame);
+ ::DeleteObject(hbrBkgnd);
+ ::DeleteObject(hbrFrame);
+
+ if (item.bBox2Visible) {
+ rcItem.left = item.x - item.box2Width / 2;
+ rcItem.top = item.y - item.box2Width / 2;
+ rcItem.right = rcItem.left + item.box2Width;
+ rcItem.bottom = rcItem.top + item.box2Width;
+ hbrFrame = CreateSolidBrush(item.box2FrameColor);
+ hbrBkgnd = CreateSolidBrush(item.box2BackgroundColor);
+ ::FillRect(hMemDC, &rcItem, hbrBkgnd);
+ ::FrameRect(hMemDC, &rcItem, hbrFrame);
+ ::DeleteObject(hbrBkgnd);
+ ::DeleteObject(hbrFrame);
+ }
+
+ // text
+ ::DrawText(hMemDC, item.szText, strlen(item.szText),
+ &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+ }
+
+
+ // EndPaint
+ ::BitBlt(hDC, 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top,
+ hMemDC, 0, 0, SRCCOPY);
+ EndPaint(m_hWnd, &ps);
+ ::DeleteObject(hBitmap);
+ ::DeleteDC(hMemDC);
+
+
+ return 1;
+}
+
+void CServoGraph::SetBkgndColor(COLORREF cr)
+{
+ m_crBkgnd = cr;
+}
+
+void CServoGraph::SetResDir(CString strDir)
+{
+ m_strResDir = strDir;
+}
+
+void CServoGraph::AddImage(int id, char* pszPath, int x, int y)
+{
+ if (GetImage(id) != nullptr) return;
+
+ IMAGE image;
+ memset(&image, 0, sizeof(IMAGE));
+ image.id = id;
+ strcpy_s(image.szPath, MAX_PATH, pszPath);
+ image.x = x;
+ image.y = y;
+ m_images.push_back(image);
+}
+
+CServoGraph::IMAGE* CServoGraph::GetImage(int id)
+{
+ for (auto& item : m_images) {
+ if (item.id == id) return &item;
+ }
+
+ return nullptr;
+}
+
+void CServoGraph::AddIndicateBox(int id, int x, int y, int width)
+{
+ INDICATEBOX ib;
+ ib.id = id;
+ ib.x = x;
+ ib.y = y;
+ ib.box1Width = width;
+ ib.box1FrameColor[0] = RGB(22, 22, 22);
+ ib.box1FrameColor[1] = RGB(255, 127, 39);
+ ib.box1BackgroundColor = RGB(245, 245, 245);
+ ib.box2Width = width - 10;
+ m_indicateBoxs.push_back(ib);
+}
+
+void CServoGraph::AddIndicateBox(int id, int x, int y, int width,
+ COLORREF crFrame1, COLORREF crFrame2, COLORREF crBackground)
+{
+ INDICATEBOX ib;
+ ib.id = id;
+ ib.x = x;
+ ib.y = y;
+ ib.box1Width = width;
+ ib.box1FrameColor[0] = crFrame1;
+ ib.box1FrameColor[1] = crFrame2;
+ ib.box1BackgroundColor = crBackground;
+ ib.box2Width = width - 10;
+ m_indicateBoxs.push_back(ib);
+}
+
+void CServoGraph::AddIndicateBoxContext(int id, void* pContext)
+{
+ INDICATEBOX* pib = GetIndicateBox(id);
+ if (pib != nullptr) {
+ pib->m_contexts.push_back(pContext);
+ }
+}
+
+BOOL CServoGraph::RemoveIndicateBoxContext(int id, void* pContext)
+{
+ INDICATEBOX* pib = GetIndicateBox(id);
+ if (pib != nullptr) {
+ for (auto iter = pib->m_contexts.begin(); iter != pib->m_contexts.end(); iter++) {
+ if ((*iter) == pContext) {
+ pib->m_contexts.erase(iter);
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+BOOL CServoGraph::RemoveIndicateBoxAllContext(int id)
+{
+ INDICATEBOX* pib = GetIndicateBox(id);
+ if (pib != nullptr) {
+ pib->m_contexts.clear();
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+const std::vector<void*>& CServoGraph::GetIndicateBoxContexts(int id)
+{
+ static std::vector<void*> empty;
+ INDICATEBOX* pib = GetIndicateBox(id);
+ if (pib == nullptr) return empty;
+ return pib->m_contexts;
+}
+
+bool CServoGraph::IsIndicateBoxContextsEmpty(int id)
+{
+ INDICATEBOX* pib = GetIndicateBox(id);
+ if (pib != nullptr) {
+ return pib->m_contexts.empty();
+ }
+
+ return true;
+}
+
+void CServoGraph::ShowIndicateBoxInterior(int id, COLORREF color)
+{
+ INDICATEBOX* pib = GetIndicateBox(id);
+ if (pib != nullptr) {
+ pib->bBox2Visible = true;
+ pib->box2FrameColor = RGB(128, 128, 128);
+ pib->box2BackgroundColor = color;
+ InvalidateRect(m_hWnd, NULL, TRUE);
+ }
+}
+
+void CServoGraph::HideIndicateBoxInterior(int id)
+{
+ INDICATEBOX* pib = GetIndicateBox(id);
+ if (pib != nullptr) {
+ pib->bBox2Visible = false;
+ InvalidateRect(m_hWnd, NULL, TRUE);
+ }
+}
+
+CServoGraph::INDICATEBOX* CServoGraph::GetIndicateBox(int id)
+{
+ for (auto& item : m_indicateBoxs) {
+ if (item.id == id) return &item;
+ }
+
+ return nullptr;
+}
+
+void CServoGraph::AddIndicateBkgnd(int id, int left, int top, int width, int height, COLORREF color)
+{
+ INDICATEBKGND ibk;
+ ibk.id = id;
+ ibk.rect.left = left;
+ ibk.rect.top = top;
+ ibk.rect.right = ibk.rect.left + width;
+ ibk.rect.bottom = ibk.rect.top + height;;
+ ibk.backgroundColor = color;
+ m_indicateBkgnds.push_back(ibk);
+}
+
+void CServoGraph::SetIndicateBkgndColor(int id, COLORREF color)
+{
+ INDICATEBKGND* pibk = GetIndicateBkgnd(id);
+ if (pibk != nullptr) {
+ pibk->backgroundColor = color;
+ InvalidateRect(m_hWnd, nullptr, TRUE);
+ }
+}
+
+CServoGraph::INDICATEBKGND* CServoGraph::GetIndicateBkgnd(int id)
+{
+ for (auto& item : m_indicateBkgnds) {
+ if (item.id == id) return &item;
+ }
+
+ return nullptr;
+}
+
+/*
+ * 检测坐标点所在的项
+ * 返回, TYGTLITEM
+ */
+int CServoGraph::HitTest(POINT pt, OUT void*& pItem)
+{
+ // 检测是否在某个子项
+ int nRet = HMGRAPH_HT_NOWHERE;
+ pItem = NULL;
+ RECT rcItem;
+ for (int i = 0; i < m_indicateBoxs.size(); i++) {
+ auto& item = m_indicateBoxs.at(i);
+ GetIndicateBoxRect(&item, &rcItem);
+ if (::PtInRect(&rcItem, pt)) {
+ pItem = &item;
+ nRet = HMGRAPH_HT_ITEM;
+ break;
+ }
+ }
+
+
+ return nRet;
+}
+
+void CServoGraph::GetIndicateBoxRect(INDICATEBOX* pBox, LPRECT lprcBox)
+{
+ lprcBox->left = pBox->x - pBox->box1Width / 2;
+ lprcBox->top = pBox->y - pBox->box1Width / 2;
+ lprcBox->right = lprcBox->left + pBox->box1Width;
+ lprcBox->bottom = lprcBox->top + pBox->box1Width;
+}
+
+BOOL CServoGraph::GetIndicateBoxRect(int id, LPRECT lprcBox)
+{
+ INDICATEBOX* pBox = GetIndicateBox(id);
+ if (pBox == nullptr) return FALSE;
+ GetIndicateBoxRect(pBox, lprcBox);
+ return TRUE;
+}
+
+HWND CServoGraph::GetSafeWnd()
+{
+ return m_hWnd;
+}
+
+void CServoGraph::SetBoxText(int id, const char* pszText, const char* pszTooltip)
+{
+ if (m_hWndTooltip == NULL) {
+ m_hWndTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS,
+ NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ m_hWnd, NULL, NULL, NULL);
+ ::SendMessage(m_hWndTooltip, TTM_SETMAXTIPWIDTH, 0, 500);
+ }
+
+ INDICATEBOX* pBox = GetIndicateBox(id);
+ if (pBox != nullptr) {
+ strcpy_s(pBox->szText, sizeof(pBox->szText), pszText);
+
+ // tooltip
+ TOOLINFO tti;
+ memset(&tti, 0, sizeof(TOOLINFO));
+ tti.cbSize = sizeof(TOOLINFO);
+ tti.uFlags = TTF_SUBCLASS;
+ tti.hwnd = m_hWnd;
+ GetIndicateBoxRect(pBox, &tti.rect);
+ tti.uId = id;
+ tti.lpszText = (LPSTR)pszTooltip;
+ SendMessage(m_hWndTooltip, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO)&tti);
+ }
+}
diff --git a/SourceCode/Bond/Servo/ServoGraph.h b/SourceCode/Bond/Servo/ServoGraph.h
new file mode 100644
index 0000000..a5ca74f
--- /dev/null
+++ b/SourceCode/Bond/Servo/ServoGraph.h
@@ -0,0 +1,183 @@
+// ServoGraph.h: interface for the CServoGraph class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_SERVOGRAPH_H__FBB8916A_DE77_4EA3_9C21_E51E6B06194C__INCLUDED_)
+#define AFX_vGRAPH_H__FBB8916A_DE77_4EA3_9C21_E51E6B06194C__INCLUDED_
+
+
+#pragma comment(lib, "Msimg32.lib") // TransparentBlt
+#include <vector>
+
+
+
+//====== ServoGraph =====================================================
+
+#ifndef NOSERVOGRAPH
+
+#ifdef _WIN32
+
+#define BYSERVOGRAPH_CLASSA "BYServoGraph"
+#define BYSERVOGRAPH_CLASSW L"BYServoGraph"
+
+#ifdef UNICODE
+#define BYSERVOGRAPH_CLASS BYSERVOGRAPH_CLASSW
+#else
+#define BYSERVOGRAPH_CLASS BYSERVOGRAPH_CLASSA
+#endif
+
+#else
+#define BYSERVOGRAPH_CLASS "BYSERVOGraph"
+#endif
+
+
+#define BYSTAG_SERVOGRAPH _T("ISSERVOGRAPH")
+
+
+//====== WM_NOTIFY codes (NMHDR.code values) ==================================
+#define BYSERVOGRAPH_FIRST (0U-1390U) //
+#define BYSERVOGRAPH_LAST (0U-1350U)
+#define BYSERVOGRAPH_ITEM_CLICKED (BYSERVOGRAPH_FIRST - 1)
+
+
+typedef struct tagBYSERVOGRAPH_NMHDR
+{
+ NMHDR nmhdr;
+ DWORD dwData;
+ DWORD dwData1;
+ DWORD dwData2;
+} BYSERVOGRAPH_NMHDR;
+
+#endif
+
+
+
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+#define HMGRAPH_HITCODETEST _T("HitCode")
+#define HMGRAPH_HT_NOWHERE 0x1
+#define HMGRAPH_HT_ITEM 0x2
+
+
+class CServoGraph
+{
+private:
+ typedef struct tagIMAGE
+ {
+ int id;
+ char szPath[MAX_PATH];
+ int x;
+ int y;
+ HBITMAP hBitmap;
+ int bmWidth;
+ int bmHeight;
+ } IMAGE;
+
+
+ class INDICATEBOX
+ {
+ public:
+ INDICATEBOX() {
+ this->id = 0;
+ this->x = 0;
+ this->y = 0;
+ this->box1Width = 0;
+ this->box1BackgroundColor = RGB(255, 255, 255);
+ this->box1FrameColor[0] = RGB(22, 22, 22);
+ this->box1FrameColor[1] = RGB(22, 22, 22);
+ this->box2Width = 0;
+ this->box2BackgroundColor = RGB(0, 255, 255);;
+ this->box2FrameColor = RGB(255, 255, 0);;
+ this->bBox2Visible = FALSE;
+ };
+ ~INDICATEBOX() {};
+
+ public:
+ int id;
+ int x;
+ int y;
+ int box1Width;
+ COLORREF box1BackgroundColor;
+ COLORREF box1FrameColor[2];
+ char szText[64];
+ int box2Width;
+ COLORREF box2BackgroundColor;
+ COLORREF box2FrameColor;
+ BOOL bBox2Visible;
+ std::vector<void*> m_contexts;
+ };
+
+ class INDICATEBKGND
+ {
+ public:
+ INDICATEBKGND() {
+ this->id = 0;
+ this->rect = { 0, 0, 10, 10 };
+ this->backgroundColor = RGB(255, 255, 255);;
+ };
+ ~INDICATEBKGND() {};
+
+ public:
+ int id;
+ RECT rect;
+ COLORREF backgroundColor;
+ };
+
+public:
+ CServoGraph();
+ virtual ~CServoGraph();
+ static BOOL RegisterWndClass();
+ static CServoGraph* Hook(HWND hWnd);
+ void Notify(int nCode, int dwData, int dwData1 = 0, int dwData2 = 0);
+ void Release();
+ void SetBkgndColor(COLORREF cr);
+ static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ static LRESULT OnNcCreate(HWND hWnd, WPARAM wParam, LPARAM lParam);
+ LRESULT OnDestroy(WPARAM wParam, LPARAM lParam);
+ LRESULT OnTimer(WPARAM wParam, LPARAM lParam);
+ LRESULT OnPaint(WPARAM wParam, LPARAM lParam);
+ LRESULT OnMouseMove(WPARAM wParam, LPARAM lParam);
+ LRESULT OnLButtonDown(WPARAM wParam, LPARAM lParam);
+
+public:
+ void AddImage(int id, char* pszPath, int x, int y);
+ void AddIndicateBox(int id, int x, int y, int width);
+ void AddIndicateBox(int id, int x, int y, int width,
+ COLORREF crFrame1, COLORREF crFrame2, COLORREF crBackground);
+ void AddIndicateBoxContext(int id, void* pContext);
+ BOOL RemoveIndicateBoxContext(int id, void* pContext);
+ BOOL RemoveIndicateBoxAllContext(int id);
+ const std::vector<void*>& GetIndicateBoxContexts(int id);
+ bool IsIndicateBoxContextsEmpty(int id);
+ void ShowIndicateBoxInterior(int id, COLORREF color);
+ void HideIndicateBoxInterior(int id);
+ CServoGraph::INDICATEBOX* GetIndicateBox(int id);
+ void AddIndicateBkgnd(int id, int left, int top, int width, int height, COLORREF color);
+ void SetIndicateBkgndColor(int id, COLORREF color);
+ CServoGraph::INDICATEBKGND* GetIndicateBkgnd(int id);
+ void SetResDir(CString strDir);
+ CServoGraph::IMAGE* GetImage(int id);
+ int HitTest(POINT pt, OUT void*& pItem);
+ void GetIndicateBoxRect(INDICATEBOX* pBox, LPRECT lprcBox);
+ BOOL GetIndicateBoxRect(int id, LPRECT lprcBox);
+ void SetBoxText(int id, const char* pszText, const char* pszTooltip);
+ HWND GetSafeWnd();
+
+private:
+ HWND m_hWnd;
+ COLORREF m_crBkgnd;
+ CString m_strResDir;
+
+private:
+ std::vector<IMAGE> m_images;
+ std::vector<INDICATEBOX> m_indicateBoxs;
+ std::vector<INDICATEBKGND> m_indicateBkgnds;
+ void* m_pHighItem;
+ HWND m_hWndTooltip;
+};
+
+#endif // !defined(AFX_EQUIPMENTGRAPH_H__FBB8916A_DE77_4EA3_9C21_E51E6B06194C__INCLUDED_)
diff --git a/SourceCode/Bond/Servo/res/Servo.ico b/SourceCode/Bond/Servo/res/Servo.ico
new file mode 100644
index 0000000..d56fbcd
--- /dev/null
+++ b/SourceCode/Bond/Servo/res/Servo.ico
Binary files differ
diff --git a/SourceCode/Bond/Servo/res/Servo.rc2 b/SourceCode/Bond/Servo/res/Servo.rc2
new file mode 100644
index 0000000..cee91ee
--- /dev/null
+++ b/SourceCode/Bond/Servo/res/Servo.rc2
Binary files differ
diff --git a/SourceCode/Bond/Servo/res/application.exe.manifest b/SourceCode/Bond/Servo/res/application.exe.manifest
new file mode 100644
index 0000000..b96c40d
--- /dev/null
+++ b/SourceCode/Bond/Servo/res/application.exe.manifest
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity
+ name="XP style manifest"
+ processorArchitecture="amd64"
+ version="1.0.0.0"
+ type="win32"/>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="amd64"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+ </dependency>
+</assembly>
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/resource.h b/SourceCode/Bond/Servo/resource.h
new file mode 100644
index 0000000..802dfd2
--- /dev/null
+++ b/SourceCode/Bond/Servo/resource.h
Binary files differ
diff --git a/SourceCode/Bond/Servo/stdafx.cpp b/SourceCode/Bond/Servo/stdafx.cpp
new file mode 100644
index 0000000..d3ca348
--- /dev/null
+++ b/SourceCode/Bond/Servo/stdafx.cpp
@@ -0,0 +1,8 @@
+
+// stdafx.cpp : 只包括标准包含文件的源文件
+// Servo.pch 将作为预编译头
+// stdafx.obj 将包含预编译类型信息
+
+#include "stdafx.h"
+
+
diff --git a/SourceCode/Bond/Servo/stdafx.h b/SourceCode/Bond/Servo/stdafx.h
new file mode 100644
index 0000000..7d8a96a
--- /dev/null
+++ b/SourceCode/Bond/Servo/stdafx.h
@@ -0,0 +1,54 @@
+
+// stdafx.h : 标准系统包含文件的包含文件,
+// 或是经常使用但不常更改的
+// 特定于项目的包含文件
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
+
+// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC 核心组件和标准组件
+#include <afxext.h> // MFC 扩展
+
+
+#include <afxdisp.h> // MFC 自动化类
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxcontrolbars.h> // 功能区和控件条的 MFC 支持
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+
diff --git a/SourceCode/Bond/Servo/targetver.h b/SourceCode/Bond/Servo/targetver.h
new file mode 100644
index 0000000..416cebf
--- /dev/null
+++ b/SourceCode/Bond/Servo/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include <SDKDDKVer.h>
diff --git a/SourceCode/Bond/x64/Debug/Res/Servo.bmp b/SourceCode/Bond/x64/Debug/Res/Servo.bmp
new file mode 100644
index 0000000..306d3f7
--- /dev/null
+++ b/SourceCode/Bond/x64/Debug/Res/Servo.bmp
Binary files differ
diff --git a/SourceCode/Bond/x64/Debug/Res/Servo001.bmp b/SourceCode/Bond/x64/Debug/Res/Servo001.bmp
new file mode 100644
index 0000000..024cf3b
--- /dev/null
+++ b/SourceCode/Bond/x64/Debug/Res/Servo001.bmp
Binary files differ
--
Gitblit v1.9.3