Jelajahi Sumber

增加 AutoMakeSelection 函数,空选会自动全选

Hongwenjun 2 bulan lalu
induk
melakukan
8bf502a4bc

+ 2 - 0
08_SmartGroup/ToolsBox.cpp

@@ -202,6 +202,7 @@ intptr_t CALLBACK ToolsBoxPlugin::DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
             switch (LOWORD(wParam)) {
             case IDC_RED :{
                     double exp = GetTextValue(hDlg, EXP_TEXT);
+                    AutoMakeSelection(cdr);
                     Box_AutoGroup(cdr, exp);
 
 // MessageBox(NULL, "方框智能群组:Union-Find 算法\n 分组记录请查看: D:\\group.txt", "CPG代码测试", MB_ICONSTOP);
@@ -226,6 +227,7 @@ intptr_t CALLBACK ToolsBoxPlugin::DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
 
             case IDC_CLEAR_FILL:{
                     double exp = GetTextValue(hDlg, EXP_TEXT);
+                    AutoMakeSelection(cdr);
                     BBox_DrawRectangle(cdr, exp);
                     Active_CorelWindows(hDlg);
                 // Clear_Fill(cdr);

+ 9 - 0
08_SmartGroup/boxAutoGroup.cpp

@@ -82,6 +82,15 @@ bool BBox_DrawRectangle(corel *cdr, double exp) {
   return true;
 }
 
+bool AutoMakeSelection(corel *cdr) {
+  auto sr = cdr->ActiveSelectionRange; 
+  if (0 == sr->Count) {
+    auto all = cdr->ActiveDocument->ActivePage->Shapes->All();
+    all->CreateSelection();
+  }
+  return true;
+}
+
 // 快速分组重叠的区域, 使用算法"Union-Find" 算法。这个算法可以有效地处理这种并集问题。
 // 算法的时间复杂度为 O(n^2),其中 n 是矩形的数量。如果矩形数量较多,可以考虑使用更高效的算法,
 // 例如使用四叉树(Quadtree)或者区间树(Interval Tree)等数据结构来加速计算。

+ 1 - 0
08_SmartGroup/cdrapp.h

@@ -13,6 +13,7 @@ bool Clear_Fill(corel *cdr);
 void CdrCopy_to_AdobeAI(corel *cdr);
 void AdobeAI_Copy_ImportCdr(corel *cdr);
 
+bool AutoMakeSelection(corel *cdr);
 bool Box_AutoGroup(corel *cdr, double exp = 0.0);
 bool BBox_DrawRectangle(corel *cdr, double exp = 0.0);
 

+ 1 - 0
08_SmartGroup/lycpg64.cbp

@@ -44,6 +44,7 @@
 			<Option compilerVar="WINDRES" />
 			<Option target="Release" />
 		</Unit>
+		<Unit filename="boxAutoGroup.cpp" />
 		<Unit filename="cdrPDF2Clip.cpp" />
 		<Unit filename="cdrapi.cpp" />
 		<Unit filename="cdrapi.h" />

+ 42 - 0
08_SmartGroup/lycpg64_build_log.html

@@ -0,0 +1,42 @@
+<html>
+<head>
+<title>lycpg64构建日志</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
+<body>
+<tt>
+开始构建:<u>26-08-2024 at 09:35.14</u><br />
+构建结束于:<u>26-08-2024 at 09:35.18</u><p />
+<b>-------------- 构建: Release 在 lycpg64 中 (编译器: Microsoft Visual C++ 2022)---------------</b><br />
+cl.exe /nologo /W3 /EHsc  /Ox /DNDEBUG  /MT   /I..\TypeLibs /IC:\MSVC2022\include /IC:\soft\Git\srgb\CorelDRAW-CPG\08_SmartGroup /c boxAutoGroup.cpp /Foobj\Release\boxAutoGroup.obj<br />
+cl.exe /nologo /W3 /EHsc  /Ox /DNDEBUG  /MT   /I..\TypeLibs /IC:\MSVC2022\include /IC:\soft\Git\srgb\CorelDRAW-CPG\08_SmartGroup /c cdrapi.cpp /Foobj\Release\cdrapi.obj<br />
+boxAutoGroup.cpp<br />
+cdrapi.cpp<br />
+cl.exe /nologo /W3 /EHsc  /Ox /DNDEBUG  /MT   /I..\TypeLibs /IC:\MSVC2022\include /IC:\soft\Git\srgb\CorelDRAW-CPG\08_SmartGroup /c cdrapp.cpp /Foobj\Release\cdrapp.obj<br />
+cdrapp.cpp<br />
+<font color="#0000ff">cdrapp.cpp(25): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.</font><br />
+<font color="#0000ff">cdrapp.cpp(45): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.</font><br />
+<font color="#0000ff">cdrapp.cpp(59): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.</font><br />
+cl.exe /nologo /W3 /EHsc  /Ox /DNDEBUG  /MT   /I..\TypeLibs /IC:\MSVC2022\include /IC:\soft\Git\srgb\CorelDRAW-CPG\08_SmartGroup /c cdrPDF2Clip.cpp /Foobj\Release\cdrPDF2Clip.obj<br />
+cdrPDF2Clip.cpp<br />
+cl.exe /nologo /W3 /EHsc  /Ox /DNDEBUG  /MT   /I..\TypeLibs /IC:\MSVC2022\include /IC:\soft\Git\srgb\CorelDRAW-CPG\08_SmartGroup /c ToolsBox.cpp /Foobj\Release\ToolsBox.obj<br />
+ToolsBox.cpp<br />
+<font color="#0000ff">cdrPDF2Clip.cpp(23): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.</font><br />
+<font color="#0000ff">cdrPDF2Clip.cpp(103): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.</font><br />
+<font color="#0000ff">cdrPDF2Clip.cpp(154): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.</font><br />
+<font color="#0000ff">cdrPDF2Clip.cpp(172): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.</font><br />
+<font color="#0000ff">ToolsBox.cpp(189): warning C4311: “类型强制转换”: 从“HWND”到“LONG”的指针截断</font><br />
+<font color="#0000ff">C:\soft\Git\srgb\CorelDRAW-CPG\08_SmartGroup\cdrPDF2Clip.cpp(166) : warning C4715: “pdf_ImportCdr”: 不是所有的控件路径都返回值</font><br />
+rc.exe /IC:\MSVC2022\include /IC:\soft\Git\srgb\CorelDRAW-CPG\08_SmartGroup  -foobj\Release\ToolsBox.res ToolsBox.rc<br />
+<font color="#0000ff">ToolsBox.cpp(189): warning C4302: “类型强制转换”: 从“HWND”到“LONG”截断</font><br />
+cl.exe /nologo /W3 /EHsc  /Ox /DNDEBUG  /MT   /I..\TypeLibs /IC:\MSVC2022\include /IC:\soft\Git\srgb\CorelDRAW-CPG\08_SmartGroup /c vbadll.cpp /Foobj\Release\vbadll.obj<br />
+vbadll.cpp<br />
+Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384<br />
+Copyright (C) Microsoft Corporation.  All rights reserved.<br />
+link.exe /dll /nologo /LIBPATH:C:\MSVC2022\lib /out:bin\Release\lycpg64.dll Gdi32.lib user32.lib Kernel32.lib obj\Release\boxAutoGroup.obj obj\Release\cdrapi.obj obj\Release\cdrapp.obj obj\Release\cdrPDF2Clip.obj obj\Release\ToolsBox.obj obj\Release\vbadll.obj  obj\Release\ToolsBox.res<br />
+  正在创建库 bin\Release\lycpg64.lib 和对象 bin\Release\lycpg64.exp<br />
+输出文件为 bin\Release\lycpg64.dll,大小为 314.50 KB<br />
+<font color="#0000ff">程序退出, 返回状态码:0 (0 分, 3 秒)</font><br />
+<font color="#0000ff">0个错误, 10个警告 (0 分, 3 秒)</font><br />
+</tt>
+</body>
+</html>