From 0e9e528e18ff63d46e5b3471d6fa12344b0d28b3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 2 Jul 2015 19:04:50 +0000 Subject: unified project for clist_modern git-svn-id: http://svn.miranda-ng.org/main/trunk@14473 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/clist_modern.vcxproj | 28 + plugins/Clist_modern/clist_modern.vcxproj.filters | 4 + plugins/Clist_modern/clist_modern_10.vcxproj | 281 -- .../Clist_modern/clist_modern_10.vcxproj.filters | 245 -- plugins/Clist_modern/clist_modern_12.vcxproj | 290 -- .../Clist_modern/clist_modern_12.vcxproj.filters | 255 -- plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp | 3500 -------------------- plugins/Clist_modern/src/CLUIFrames/cluiframes.h | 135 - plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp | 504 --- plugins/Clist_modern/src/cluiframes.cpp | 3500 ++++++++++++++++++++ plugins/Clist_modern/src/cluiframes.h | 135 + plugins/Clist_modern/src/groupmenu.cpp | 319 ++ plugins/Clist_modern/src/hdr/modern_awaymsg.h | 37 - plugins/Clist_modern/src/hdr/modern_cache_funcs.h | 47 - plugins/Clist_modern/src/hdr/modern_clc.h | 451 --- plugins/Clist_modern/src/hdr/modern_clcpaint.h | 188 -- plugins/Clist_modern/src/hdr/modern_clist.h | 141 - plugins/Clist_modern/src/hdr/modern_clui.h | 184 - .../Clist_modern/src/hdr/modern_commonheaders.h | 355 -- .../Clist_modern/src/hdr/modern_commonprototypes.h | 323 -- plugins/Clist_modern/src/hdr/modern_defsettings.h | 241 -- plugins/Clist_modern/src/hdr/modern_effectenum.h | 93 - plugins/Clist_modern/src/hdr/modern_gettextasync.h | 6 - .../Clist_modern/src/hdr/modern_global_structure.h | 85 - plugins/Clist_modern/src/hdr/modern_image_array.h | 84 - plugins/Clist_modern/src/hdr/modern_log.h | 19 - plugins/Clist_modern/src/hdr/modern_row.h | 87 - .../Clist_modern/src/hdr/modern_rowheight_funcs.h | 70 - plugins/Clist_modern/src/hdr/modern_skinengine.h | 124 - plugins/Clist_modern/src/hdr/modern_skinselector.h | 87 - plugins/Clist_modern/src/hdr/modern_static_clui.h | 124 - .../src/hdr/modern_static_cluiframes_service.h | 235 -- plugins/Clist_modern/src/hdr/modern_statusbar.h | 44 - plugins/Clist_modern/src/hdr/modern_sync.h | 90 - plugins/Clist_modern/src/init.cpp | 11 +- plugins/Clist_modern/src/modern_aniavatars.cpp | 2 +- plugins/Clist_modern/src/modern_awaymsg.cpp | 6 +- plugins/Clist_modern/src/modern_awaymsg.h | 37 + plugins/Clist_modern/src/modern_cache_funcs.h | 47 + plugins/Clist_modern/src/modern_cachefuncs.cpp | 8 +- plugins/Clist_modern/src/modern_clc.cpp | 10 +- plugins/Clist_modern/src/modern_clc.h | 451 +++ plugins/Clist_modern/src/modern_clcidents.cpp | 6 +- plugins/Clist_modern/src/modern_clcitems.cpp | 10 +- plugins/Clist_modern/src/modern_clcmsgs.cpp | 6 +- plugins/Clist_modern/src/modern_clcopts.cpp | 14 +- plugins/Clist_modern/src/modern_clcpaint.cpp | 12 +- plugins/Clist_modern/src/modern_clcpaint.h | 188 ++ plugins/Clist_modern/src/modern_clcutils.cpp | 8 +- plugins/Clist_modern/src/modern_clist.h | 141 + plugins/Clist_modern/src/modern_clistevents.cpp | 10 +- plugins/Clist_modern/src/modern_clistmenus.cpp | 6 +- plugins/Clist_modern/src/modern_clistmod.cpp | 13 +- plugins/Clist_modern/src/modern_clistopts.cpp | 6 +- plugins/Clist_modern/src/modern_clistsettings.cpp | 10 +- plugins/Clist_modern/src/modern_clisttray.cpp | 8 +- plugins/Clist_modern/src/modern_clui.cpp | 16 +- plugins/Clist_modern/src/modern_clui.h | 184 + plugins/Clist_modern/src/modern_cluiservices.cpp | 4 +- plugins/Clist_modern/src/modern_commonheaders.cpp | 2 - plugins/Clist_modern/src/modern_commonprototypes.h | 322 ++ plugins/Clist_modern/src/modern_contact.cpp | 6 +- plugins/Clist_modern/src/modern_defsettings.h | 241 ++ plugins/Clist_modern/src/modern_docking.cpp | 8 +- plugins/Clist_modern/src/modern_effectenum.h | 93 + plugins/Clist_modern/src/modern_gdiplus.cpp | 7 +- plugins/Clist_modern/src/modern_gettextasync.cpp | 6 +- plugins/Clist_modern/src/modern_gettextasync.h | 6 + plugins/Clist_modern/src/modern_global.cpp | 2 +- plugins/Clist_modern/src/modern_global_structure.h | 83 + plugins/Clist_modern/src/modern_image_array.cpp | 8 +- plugins/Clist_modern/src/modern_image_array.h | 84 + plugins/Clist_modern/src/modern_keyboard.cpp | 2 +- plugins/Clist_modern/src/modern_log.cpp | 2 +- plugins/Clist_modern/src/modern_log.h | 19 + plugins/Clist_modern/src/modern_newrowopts.cpp | 4 +- plugins/Clist_modern/src/modern_row.cpp | 6 +- plugins/Clist_modern/src/modern_row.h | 87 + .../Clist_modern/src/modern_rowheight_funcs.cpp | 10 +- plugins/Clist_modern/src/modern_rowheight_funcs.h | 70 + plugins/Clist_modern/src/modern_rowtemplateopt.cpp | 8 +- plugins/Clist_modern/src/modern_skinbutton.cpp | 6 +- plugins/Clist_modern/src/modern_skinengine.cpp | 14 +- plugins/Clist_modern/src/modern_skinengine.h | 124 + plugins/Clist_modern/src/modern_skinopt.cpp | 8 +- plugins/Clist_modern/src/modern_skinselector.cpp | 8 +- plugins/Clist_modern/src/modern_skinselector.h | 87 + plugins/Clist_modern/src/modern_static_clui.h | 124 + .../src/modern_static_cluiframes_service.h | 235 ++ plugins/Clist_modern/src/modern_statusbar.cpp | 10 +- plugins/Clist_modern/src/modern_statusbar.h | 44 + .../Clist_modern/src/modern_statusbar_options.cpp | 8 +- plugins/Clist_modern/src/modern_sync.cpp | 4 +- plugins/Clist_modern/src/modern_sync.h | 90 + plugins/Clist_modern/src/modern_tbbutton.cpp | 6 +- plugins/Clist_modern/src/modern_toolbar.cpp | 6 +- plugins/Clist_modern/src/modern_utils.cpp | 2 +- plugins/Clist_modern/src/modern_viewmodebar.cpp | 4 +- plugins/Clist_modern/src/modern_xptheme.cpp | 4 +- plugins/Clist_modern/src/stdafx.cxx | 3 + plugins/Clist_modern/src/stdafx.h | 355 ++ 101 files changed, 7259 insertions(+), 8484 deletions(-) create mode 100644 plugins/Clist_modern/clist_modern.vcxproj create mode 100644 plugins/Clist_modern/clist_modern.vcxproj.filters delete mode 100644 plugins/Clist_modern/clist_modern_10.vcxproj delete mode 100644 plugins/Clist_modern/clist_modern_10.vcxproj.filters delete mode 100644 plugins/Clist_modern/clist_modern_12.vcxproj delete mode 100644 plugins/Clist_modern/clist_modern_12.vcxproj.filters delete mode 100644 plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp delete mode 100644 plugins/Clist_modern/src/CLUIFrames/cluiframes.h delete mode 100644 plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp create mode 100644 plugins/Clist_modern/src/cluiframes.cpp create mode 100644 plugins/Clist_modern/src/cluiframes.h create mode 100644 plugins/Clist_modern/src/groupmenu.cpp delete mode 100644 plugins/Clist_modern/src/hdr/modern_awaymsg.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_cache_funcs.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_clc.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_clcpaint.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_clist.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_clui.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_commonheaders.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_commonprototypes.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_defsettings.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_effectenum.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_gettextasync.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_global_structure.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_image_array.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_log.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_row.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_rowheight_funcs.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_skinengine.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_skinselector.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_static_clui.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_static_cluiframes_service.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_statusbar.h delete mode 100644 plugins/Clist_modern/src/hdr/modern_sync.h create mode 100644 plugins/Clist_modern/src/modern_awaymsg.h create mode 100644 plugins/Clist_modern/src/modern_cache_funcs.h create mode 100644 plugins/Clist_modern/src/modern_clc.h create mode 100644 plugins/Clist_modern/src/modern_clcpaint.h create mode 100644 plugins/Clist_modern/src/modern_clist.h create mode 100644 plugins/Clist_modern/src/modern_clui.h delete mode 100644 plugins/Clist_modern/src/modern_commonheaders.cpp create mode 100644 plugins/Clist_modern/src/modern_commonprototypes.h create mode 100644 plugins/Clist_modern/src/modern_defsettings.h create mode 100644 plugins/Clist_modern/src/modern_effectenum.h create mode 100644 plugins/Clist_modern/src/modern_gettextasync.h create mode 100644 plugins/Clist_modern/src/modern_global_structure.h create mode 100644 plugins/Clist_modern/src/modern_image_array.h create mode 100644 plugins/Clist_modern/src/modern_log.h create mode 100644 plugins/Clist_modern/src/modern_row.h create mode 100644 plugins/Clist_modern/src/modern_rowheight_funcs.h create mode 100644 plugins/Clist_modern/src/modern_skinengine.h create mode 100644 plugins/Clist_modern/src/modern_skinselector.h create mode 100644 plugins/Clist_modern/src/modern_static_clui.h create mode 100644 plugins/Clist_modern/src/modern_static_cluiframes_service.h create mode 100644 plugins/Clist_modern/src/modern_statusbar.h create mode 100644 plugins/Clist_modern/src/modern_sync.h create mode 100644 plugins/Clist_modern/src/stdafx.cxx create mode 100644 plugins/Clist_modern/src/stdafx.h (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/clist_modern.vcxproj b/plugins/Clist_modern/clist_modern.vcxproj new file mode 100644 index 0000000000..8c88af5879 --- /dev/null +++ b/plugins/Clist_modern/clist_modern.vcxproj @@ -0,0 +1,28 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + Clist_modern + {D9057E63-AAAA-4FE7-800A-20C02F4761F3} + + + + + \ No newline at end of file diff --git a/plugins/Clist_modern/clist_modern.vcxproj.filters b/plugins/Clist_modern/clist_modern.vcxproj.filters new file mode 100644 index 0000000000..de5ad9f66c --- /dev/null +++ b/plugins/Clist_modern/clist_modern.vcxproj.filters @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/plugins/Clist_modern/clist_modern_10.vcxproj b/plugins/Clist_modern/clist_modern_10.vcxproj deleted file mode 100644 index cf99c372d8..0000000000 --- a/plugins/Clist_modern/clist_modern_10.vcxproj +++ /dev/null @@ -1,281 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - Clist_modern - {D9057E63-AAAA-4FE7-800A-20C02F4761F3} - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Use - hdr/modern_commonheaders.h - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin10\lib - - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Use - hdr/modern_commonheaders.h - Level3 - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin10\lib - - - - - Full - OnlyExplicitInline - Size - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - false - false - true - Fast - Use - hdr/modern_commonheaders.h - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin10\lib - /PDBALTPATH:%_PDB% - - - - - Full - OnlyExplicitInline - Size - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - false - true - Fast - Use - hdr/modern_commonheaders.h - Level3 - false - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin10\lib - /PDBALTPATH:%_PDB% - - - - - ../hdr/modern_commonheaders.h - - - ../hdr/modern_commonheaders.h - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/Clist_modern/clist_modern_10.vcxproj.filters b/plugins/Clist_modern/clist_modern_10.vcxproj.filters deleted file mode 100644 index 7c1674cd34..0000000000 --- a/plugins/Clist_modern/clist_modern_10.vcxproj.filters +++ /dev/null @@ -1,245 +0,0 @@ - - - - - {4ca8c0fe-01e6-45f1-9621-3dd1395c7712} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {6250abc3-0ee9-43c9-a5db-62cefebbc60a} - h;hpp;hxx;hm;inl - - - {160168fd-2f10-425e-bd83-f37565fffc2c} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - {826d2dcb-6f27-428e-a2bf-4825dc88ce32} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\CLUIFrames - - - Source Files\CLUIFrames - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files\CLUIFrames - - - - - Resource Files - - - Resource Files - - - \ No newline at end of file diff --git a/plugins/Clist_modern/clist_modern_12.vcxproj b/plugins/Clist_modern/clist_modern_12.vcxproj deleted file mode 100644 index a9431c3af6..0000000000 --- a/plugins/Clist_modern/clist_modern_12.vcxproj +++ /dev/null @@ -1,290 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - Clist_modern - {D9057E63-AAAA-4FE7-800A-20C02F4761F3} - - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Use - hdr/modern_commonheaders.h - Level4 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin12\lib - false - - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Use - hdr/modern_commonheaders.h - Level4 - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin12\lib - - - - - Full - OnlyExplicitInline - Size - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - false - false - true - Fast - Use - hdr/modern_commonheaders.h - Level4 - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin12\lib - - - - - Full - OnlyExplicitInline - Size - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - false - true - Fast - Use - hdr/modern_commonheaders.h - Level4 - false - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - MSImg32.Lib;comctl32.lib;shlwapi.lib;gdiplus.lib;UxTheme.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin12\lib - - - - - ../hdr/modern_commonheaders.h - - - ../hdr/modern_commonheaders.h - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/Clist_modern/clist_modern_12.vcxproj.filters b/plugins/Clist_modern/clist_modern_12.vcxproj.filters deleted file mode 100644 index 71bd707a2a..0000000000 --- a/plugins/Clist_modern/clist_modern_12.vcxproj.filters +++ /dev/null @@ -1,255 +0,0 @@ - - - - - {4ca8c0fe-01e6-45f1-9621-3dd1395c7712} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {6250abc3-0ee9-43c9-a5db-62cefebbc60a} - h;hpp;hxx;hm;inl - - - {160168fd-2f10-425e-bd83-f37565fffc2c} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - {826d2dcb-6f27-428e-a2bf-4825dc88ce32} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\CLUIFrames - - - Source Files\CLUIFrames - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files\CLUIFrames - - - - - Resource Files - - - Resource Files - - - - - Resource Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp deleted file mode 100644 index 000c96ad02..0000000000 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp +++ /dev/null @@ -1,3500 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "../hdr/modern_commonheaders.h" -#include "m_skin_eng.h" -#include "../hdr/modern_commonprototypes.h" -#include "../hdr/modern_sync.h" - -// ALL THIS MODULE FUNCTION SHOULD BE EXECUTED FROM MAIN THREAD - -#include "../hdr/modern_static_cluiframes_service.h" // contain services initialization and proxiation - -static const int UNCOLLAPSED_FRAME_SIZE = 0; -static const int DEFAULT_TITLEBAR_HEIGHT = 18; - -void _AniAva_OnModulesUnload(); -void InitGroupMenus(void); - -// GLOBALS -FRAMEWND *g_pfwFrames = NULL; -int g_nFramesCount = 0; -int g_nTitleBarHeight = DEFAULT_TITLEBAR_HEIGHT; - -// STATIC - -enum { - frame_menu_lock = 1, - frame_menu_visible, - frame_menu_showtitlebar, - frame_menu_floating -}; //legacy menu support - -enum { eUnknownId = -1 }; - -static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam); -static int CLUIFrameResizeFloatingFrame(int framepos); -static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int height); -static BOOL CLUIFramesFitInSize(); -static int RemoveItemFromList(int pos, FRAMEWND **lpFrames, int *FrameItemCount); -static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam); - -static mir_cs _cluiFramesModuleCS; -static BOOL _cluiFramesModuleCSInitialized = FALSE; -static BOOL _fCluiFramesModuleNotStarted = TRUE; -static XPTHANDLE _hFrameTitleTheme = NULL; -static int _nClientFrameId = eUnknownId; //for fast access to frame with alclient properties -static int _iNextFrameId = 100; -static HFONT _hTitleBarFont = NULL; - -// menus -static FrameMenuHandles cont = { NULL }; - -// others -static int _nContactListHeight = 0; -static DWORD _dwLastStoreTick = 0; - -HWND hWndExplorerToolBar; -static int GapBetweenFrames = 1; - -BOOLEAN bMoveTogether; -int recurs_prevent = 0; -static BOOL PreventSizeCalling = FALSE; - -static HBITMAP hBmpBackground; -static int backgroundBmpUse; -static COLORREF bkColour; -static COLORREF SelBkColour; -static BOOL bkUseWinColours; -BYTE AlignCOLLIconToLeft; //will hide frame icon -COLORREF sttGetColor(char * module, char * color, COLORREF defColor); -//for old multiwindow -#define MPCF_CONTEXTFRAMEMENU 3 -POINT ptOld; -short nLeft = 0; -short nTop = 0; - -static int sortfunc(const void *a, const void *b) -{ - SortData *sd1, *sd2; - sd1 = (SortData *)a; - sd2 = (SortData *)b; - if (sd1->order > sd2->order) { return(1); }; - if (sd1->order < sd2->order) return -1;; - return (0); -}; -int CLUIFrames_OnMoving(HWND hwnd, RECT *r) -{ - g_CluiData.mutexPreventDockMoving = 0; - - for (int i = 0; i < g_nFramesCount; i++) { - if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2) { - POINT pt = { 0 }; - RECT wr; - FRAMEWND *Frame = &g_pfwFrames[i]; - - GetWindowRect(hwnd, &wr); - ClientToScreen(hwnd, &pt); - int dx = (r->left - wr.left) + pt.x; - int dy = (r->top - wr.top) + pt.y; - int x = Frame->wndSize.left; - int y = Frame->wndSize.top; - SetWindowPos(Frame->OwnerWindow, NULL, x + dx, y + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS | SWP_DEFERERASE | SWP_NOOWNERZORDER); - }; - - } - g_CluiData.mutexPreventDockMoving = 1; - AniAva_RedrawAllAvatars(FALSE); - return 0; -} - -int SetAlpha(BYTE Alpha) -{ - for (int i = 0; i < g_nFramesCount; i++) { - if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide) { - HWND hwnd = g_pfwFrames[i].OwnerWindow; - long l = GetWindowLongPtr(hwnd, GWL_EXSTYLE); - if (!(l & WS_EX_LAYERED)) { - HWND parent = NULL; - if (g_CluiData.fOnDesktop) { - HWND hProgMan = FindWindow(_T("Progman"), NULL); - if (IsWindow(hProgMan)) - parent = hProgMan; - } - - CLUI_ShowWindowMod(hwnd, SW_HIDE); - SetParent(hwnd, NULL); - SetWindowLongPtr(hwnd, GWL_EXSTYLE, l | WS_EX_LAYERED); - SetParent(hwnd, parent); - if (l&WS_VISIBLE) CLUI_ShowWindowMod(hwnd, SW_SHOW); - } - SetLayeredWindowAttributes(hwnd, g_CluiData.dwKeyColor, Alpha, LWA_ALPHA | LWA_COLORKEY); - } - } - AniAva_RedrawAllAvatars(FALSE); - return 0; -} - - -int CLUIFrames_RepaintSubContainers() -{ - for (int i = 0; i < g_nFramesCount; i++) - if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide) - RedrawWindow(g_pfwFrames[i].hWnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME); - - return 0; -} - -int CLUIFrames_ActivateSubContainers(BOOL active) -{ - for (int i = 0; i < g_nFramesCount; i++) { - if (active && !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide) { - if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { - SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - } - else SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE); - } - } - return 0; -} - -int CLUIFrames_SetParentForContainers(HWND parent) -{ - g_CluiData.fOnDesktop = (parent && parent != pcli->hwndContactList); - - for (int i = 0; i < g_nFramesCount; i++) { - if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide) { - HWND hwnd = g_pfwFrames[i].OwnerWindow; - SetParent(hwnd, parent); - } - } - return 0; -} - -int CLUIFrames_OnShowHide(int mode) -{ - int prevFrameCount; - for (int i = 0; i < g_nFramesCount; i++) { - if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2) { - // Try to avoid crash on exit due to unlock. - HWND owner = g_pfwFrames[i].OwnerWindow; - HWND Frmhwnd = g_pfwFrames[i].hWnd; - BOOL visible = g_pfwFrames[i].visible; - BOOL needhide = g_pfwFrames[i].needhide; - needhide |= (!g_pfwFrames[i].collapsed || g_pfwFrames[i].height == 0); - prevFrameCount = g_nFramesCount; - ShowWindow(owner, (mode == SW_HIDE || !visible || needhide) ? SW_HIDE : mode); - ShowWindow(Frmhwnd, (mode == SW_HIDE || !visible || needhide) ? SW_HIDE : mode); - } - - if (mode != SW_HIDE) { - SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { - SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - } - else SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE); - } - } - - if (mode != SW_HIDE) - SetForegroundWindow(pcli->hwndContactList); - AniAva_RedrawAllAvatars(TRUE); - return 0; -} - -static int RemoveItemFromList(int pos, FRAMEWND **lpFrames, int *FrameItemCount) -{ - memmove(&((*lpFrames)[pos]), &((*lpFrames)[pos + 1]), sizeof(FRAMEWND)*(*FrameItemCount - pos - 1)); - (*FrameItemCount)--; - (*lpFrames) = (FRAMEWND*)realloc((*lpFrames), sizeof(FRAMEWND)*(*FrameItemCount)); - return 0; -} - -static int id2pos(int id) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - for (int i = 0; i < g_nFramesCount; i++) - if (g_pfwFrames[i].id == id) - return i; - - return -1; -}; - -static int btoint(BOOLEAN b) -{ - if (b) return 1; - return 0; -} - - -static FRAMEWND* FindFrameByWnd(HWND hwnd) -{ - int i; - - if (hwnd == NULL) return(NULL); - - for (i = 0; i < g_nFramesCount; i++) - if ((g_pfwFrames[i].floating) && (g_pfwFrames[i].ContainerWnd == hwnd)) - return(&g_pfwFrames[i]); - - return(NULL); -} - - -int QueueAllFramesUpdating(bool queue) -{ - for (int i = 0; i < g_nFramesCount; i++) { - if (!g_CluiData.fLayered) { - if (queue) - InvalidateRect(g_pfwFrames[i].hWnd, NULL, FALSE); - else - ValidateRect(g_pfwFrames[i].hWnd, NULL); - } - if (g_pfwFrames[i].PaintCallbackProc) { - g_pfwFrames[i].bQueued = queue; - if (g_pfwFrames[i].UpdateRgn) { - DeleteObject(g_pfwFrames[i].UpdateRgn); - } - g_pfwFrames[i].UpdateRgn = 0; - } - } - return queue; -} - -int FindFrameID(HWND FrameHwnd) -{ - if (FrameHwnd == NULL) - return 0; - - FRAMEWND *frm = FindFrameByItsHWND(FrameHwnd); - return (frm) ? frm->id : 0; -} - -FRAMEWND* FindFrameByItsHWND(HWND FrameHwnd) -{ - if (FrameHwnd == NULL) return(NULL); - for (int i = 0; i < g_nFramesCount; i++) - if (g_pfwFrames[i].hWnd == FrameHwnd) - return &g_pfwFrames[i]; - - return NULL; -} - -static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight) -{ - if ((pThumbRight->dockOpt.hwndLeft == NULL) && (pThumbLeft->dockOpt.hwndRight == NULL)) { - pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; - pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; - } -} - - -static void UndockThumbs(FRAMEWND *pThumb1, FRAMEWND *pThumb2) -{ - if ((pThumb1 == NULL) || (pThumb2 == NULL)) - return; - - if (pThumb1->dockOpt.hwndRight == pThumb2->ContainerWnd) - pThumb1->dockOpt.hwndRight = NULL; - - if (pThumb1->dockOpt.hwndLeft == pThumb2->ContainerWnd) - pThumb1->dockOpt.hwndLeft = NULL; - - if (pThumb2->dockOpt.hwndRight == pThumb1->ContainerWnd) - pThumb2->dockOpt.hwndRight = NULL; - - if (pThumb2->dockOpt.hwndLeft == pThumb1->ContainerWnd) - pThumb2->dockOpt.hwndLeft = NULL; -} - -static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) -{ - FRAMEWND *pCurThumb = &g_pfwFrames[0]; - FRAMEWND *pDockThumb = pThumb; - FRAMEWND fakeMainWindow; - FRAMEWND fakeTaskBarWindow; - RECT rc; - RECT rcThumb; - RECT rcOld; - int nNewX; - int nNewY; - int nOffs = 10; - int nWidth; - int nHeight; - POINT pt; - RECT rcLeft; - RECT rcTop; - RECT rcRight; - RECT rcBottom; - BOOL bDocked; - BOOL bDockedLeft; - BOOL bDockedRight; - BOOL bLeading; - int frmidx = 0; - - if (pThumb == NULL) return; - - SIZE sizeScreen; - sizeScreen.cx = GetSystemMetrics(SM_CXSCREEN); - sizeScreen.cy = GetSystemMetrics(SM_CYSCREEN); - - // Get thumb dimnsions - GetWindowRect(pThumb->ContainerWnd, &rcThumb); - nWidth = rcThumb.right - rcThumb.left; - nHeight = rcThumb.bottom - rcThumb.top; - - // Docking to the edges of the screen - nNewX = nX < nOffs ? 0 : nX; - nNewX = nNewX > (sizeScreen.cx - nWidth - nOffs) ? (sizeScreen.cx - nWidth) : nNewX; - nNewY = nY < nOffs ? 0 : nY; - nNewY = nNewY > (sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; - - bLeading = pThumb->dockOpt.hwndRight != NULL; - - if (bMoveTogether) { - UndockThumbs(pThumb, FindFrameByWnd(pThumb->dockOpt.hwndLeft)); - GetWindowRect(pThumb->ContainerWnd, &rcOld); - } - - memset(&fakeMainWindow, 0, sizeof(fakeMainWindow)); - fakeMainWindow.ContainerWnd = pcli->hwndContactList; - fakeMainWindow.floating = TRUE; - - memset(&fakeTaskBarWindow, 0, sizeof(fakeTaskBarWindow)); - fakeTaskBarWindow.ContainerWnd = hWndExplorerToolBar; - fakeTaskBarWindow.floating = TRUE; - - - while (pCurThumb != NULL) { - if (pCurThumb->floating) { - - if (pCurThumb != pThumb) { - GetWindowRect(pThumb->ContainerWnd, &rcThumb); - OffsetRect(&rcThumb, nX - rcThumb.left, nY - rcThumb.top); - - GetWindowRect(pCurThumb->ContainerWnd, &rc); - - // These are rects we will dock into - - rcLeft.left = rc.left - nOffs; - rcLeft.top = rc.top - nOffs; - rcLeft.right = rc.left + nOffs; - rcLeft.bottom = rc.bottom + nOffs; - - rcTop.left = rc.left - nOffs; - rcTop.top = rc.top - nOffs; - rcTop.right = rc.right + nOffs; - rcTop.bottom = rc.top + nOffs; - - rcRight.left = rc.right - nOffs; - rcRight.top = rc.top - nOffs; - rcRight.right = rc.right + nOffs; - rcRight.bottom = rc.bottom + nOffs; - - rcBottom.left = rc.left - nOffs; - rcBottom.top = rc.bottom - nOffs; - rcBottom.right = rc.right + nOffs; - rcBottom.bottom = rc.bottom + nOffs; - - - bDockedLeft = FALSE; - bDockedRight = FALSE; - - // Upper-left - pt.x = rcThumb.left; - pt.y = rcThumb.top; - bDocked = FALSE; - - if (PtInRect(&rcRight, pt)) { - nNewX = rc.right; - bDocked = TRUE; - } - - if (PtInRect(&rcBottom, pt)) { - nNewY = rc.bottom; - - if (PtInRect(&rcLeft, pt)) { - nNewX = rc.left; - } - } - - if (PtInRect(&rcTop, pt)) { - nNewY = rc.top; - bDockedLeft = bDocked; - } - - // Upper-right - pt.x = rcThumb.right; - pt.y = rcThumb.top; - bDocked = FALSE; - - if (!bLeading && PtInRect(&rcLeft, pt)) { - if (!bDockedLeft) { - nNewX = rc.left - nWidth; - bDocked = TRUE; - } - else if (rc.right == rcThumb.left) { - bDocked = TRUE; - } - } - - - if (PtInRect(&rcBottom, pt)) { - nNewY = rc.bottom; - - if (PtInRect(&rcRight, pt)) { - nNewX = rc.right - nWidth; - } - } - - if (!bLeading && PtInRect(&rcTop, pt)) { - nNewY = rc.top; - bDockedRight = bDocked; - } - - if (bMoveTogether) { - if (bDockedRight) { - DockThumbs(pThumb, pCurThumb); - } - - if (bDockedLeft) { - DockThumbs(pCurThumb, pThumb); - } - } - - // Lower-left - pt.x = rcThumb.left; - pt.y = rcThumb.bottom; - - if (PtInRect(&rcRight, pt)) { - nNewX = rc.right; - } - - if (PtInRect(&rcTop, pt)) { - nNewY = rc.top - nHeight; - - if (PtInRect(&rcLeft, pt)) { - nNewX = rc.left; - } - } - - - // Lower-right - pt.x = rcThumb.right; - pt.y = rcThumb.bottom; - - if (!bLeading && PtInRect(&rcLeft, pt)) { - nNewX = rc.left - nWidth; - } - - if (!bLeading && PtInRect(&rcTop, pt)) { - nNewY = rc.top - nHeight; - - if (PtInRect(&rcRight, pt)) { - nNewX = rc.right - nWidth; - } - } - } - - }; - frmidx++; - if (pCurThumb->ContainerWnd == fakeTaskBarWindow.ContainerWnd) { break; }; - if (pCurThumb->ContainerWnd == fakeMainWindow.ContainerWnd) { - pCurThumb = &fakeTaskBarWindow; continue; - }; - if (frmidx == g_nFramesCount) { - pCurThumb = &fakeMainWindow; continue; - } - - pCurThumb = &g_pfwFrames[frmidx]; - - - - } - - // Adjust coords once again - nNewX = nNewX < nOffs ? 0 : nNewX; - nNewX = nNewX > (sizeScreen.cx - nWidth - nOffs) ? (sizeScreen.cx - nWidth) : nNewX; - nNewY = nNewY < nOffs ? 0 : nNewY; - nNewY = nNewY > (sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; - - - SetWindowPos(pThumb->ContainerWnd, - HWND_TOPMOST, - nNewX, - nNewY, - 0, - 0, - SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); - - - // OK, move all g_CluiData.fDocked thumbs - if (bMoveTogether) { - pDockThumb = FindFrameByWnd(pDockThumb->dockOpt.hwndRight); - - PositionThumb(pDockThumb, (short)(nNewX + nWidth), (short)nNewY); - } -} - - - -static void GetBorderSize(HWND hwnd, RECT *rect) -{ - RECT wr, cr; - POINT pt1, pt2; - // RECT r = {0}; - // *rect = r; - // return; - GetWindowRect(hwnd, &wr); - GetClientRect(hwnd, &cr); - pt1.y = cr.top; pt1.x = cr.left; - pt2.y = cr.bottom; pt2.x = cr.right; - - ClientToScreen(hwnd, &pt1); - ClientToScreen(hwnd, &pt2); - - cr.top = pt1.y; cr.left = pt1.x; - cr.bottom = pt2.y; cr.right = pt2.x; - - rect->top = cr.top - wr.top; - rect->left = cr.left - wr.left; - rect->right = wr.right - cr.right; - rect->bottom = wr.bottom - cr.bottom; - //if (rect->top+rect->bottom>10){rect->top = rect->bottom = 2;}; - //if (rect->left+rect->right>10){rect->top = rect->bottom = 2;}; - -}; - -static char __inline *AS(char *str, const char *setting, char *addstr) -{ - if (str != NULL) { - mir_strcpy(str, setting); - mir_strcat(str, addstr); - } - return str; -} - -static int DBLoadFrameSettingsAtPos(int pos, int Frameid) -{ - char sadd[15]; - char buf[255]; - // char *oldtb; - - _itoa(pos, sadd, 10); - - //db_set_s(0, CLUIFrameModule,mir_strcat("Name",sadd),Frames[Frameid].name); - //bool - g_pfwFrames[Frameid].collapsed = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Collapse", sadd), g_pfwFrames[Frameid].collapsed); - - g_pfwFrames[Frameid].Locked = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Locked", sadd), g_pfwFrames[Frameid].Locked); - g_pfwFrames[Frameid].visible = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Visible", sadd), g_pfwFrames[Frameid].visible); - g_pfwFrames[Frameid].TitleBar.ShowTitleBar = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "TBVisile", sadd), g_pfwFrames[Frameid].TitleBar.ShowTitleBar); - - g_pfwFrames[Frameid].height = db_get_w(0, CLUIFrameModule, AS(buf, "Height", sadd), g_pfwFrames[Frameid].height); - g_pfwFrames[Frameid].HeightWhenCollapsed = db_get_w(0, CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), 0); - g_pfwFrames[Frameid].align = db_get_w(0, CLUIFrameModule, AS(buf, "Align", sadd), g_pfwFrames[Frameid].align); - - g_pfwFrames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatX", sadd), 100, 0, 2048); - g_pfwFrames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatY", sadd), 100, 0, 2048); - g_pfwFrames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatW", sadd), 100, 0, 2048); - g_pfwFrames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), 100, 0, 2048); - - g_pfwFrames[Frameid].floating = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Floating", sadd), 0); - g_pfwFrames[Frameid].order = db_get_w(0, CLUIFrameModule, AS(buf, "Order", sadd), 0); - - g_pfwFrames[Frameid].UseBorder = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "UseBorder", sadd), g_pfwFrames[Frameid].UseBorder); - - return 0; -} - -static int DBStoreFrameSettingsAtPos(int pos, int Frameid) -{ - char sadd[16]; - char buf[255]; - - _itoa(pos, sadd, 10); - - db_set_ws(0, CLUIFrameModule, AS(buf, "Name", sadd), g_pfwFrames[Frameid].name); - //bool - db_set_b(0, CLUIFrameModule, AS(buf, "Collapse", sadd), (BYTE)btoint(g_pfwFrames[Frameid].collapsed)); - db_set_b(0, CLUIFrameModule, AS(buf, "Locked", sadd), (BYTE)btoint(g_pfwFrames[Frameid].Locked)); - db_set_b(0, CLUIFrameModule, AS(buf, "Visible", sadd), (BYTE)btoint(g_pfwFrames[Frameid].visible)); - db_set_b(0, CLUIFrameModule, AS(buf, "TBVisile", sadd), (BYTE)btoint(g_pfwFrames[Frameid].TitleBar.ShowTitleBar)); - - db_set_w(0, CLUIFrameModule, AS(buf, "Height", sadd), (WORD)g_pfwFrames[Frameid].height); - db_set_w(0, CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), (WORD)g_pfwFrames[Frameid].HeightWhenCollapsed); - db_set_w(0, CLUIFrameModule, AS(buf, "Align", sadd), (WORD)g_pfwFrames[Frameid].align); - //FloatingPos - db_set_w(0, CLUIFrameModule, AS(buf, "FloatX", sadd), (WORD)g_pfwFrames[Frameid].FloatingPos.x); - db_set_w(0, CLUIFrameModule, AS(buf, "FloatY", sadd), (WORD)g_pfwFrames[Frameid].FloatingPos.y); - db_set_w(0, CLUIFrameModule, AS(buf, "FloatW", sadd), (WORD)g_pfwFrames[Frameid].FloatingSize.x); - db_set_w(0, CLUIFrameModule, AS(buf, "FloatH", sadd), (WORD)g_pfwFrames[Frameid].FloatingSize.y); - - db_set_b(0, CLUIFrameModule, AS(buf, "Floating", sadd), (BYTE)btoint(g_pfwFrames[Frameid].floating)); - db_set_b(0, CLUIFrameModule, AS(buf, "UseBorder", sadd), (BYTE)btoint(g_pfwFrames[Frameid].UseBorder)); - db_set_w(0, CLUIFrameModule, AS(buf, "Order", sadd), (WORD)g_pfwFrames[Frameid].order); - return 0; -} - -static int LocateStorePosition(int Frameid, int maxstored) -{ - if (g_pfwFrames[Frameid].name == NULL) - return -1; - - char settingname[255]; - for (int i = 0; i < maxstored; i++) { - mir_snprintf(settingname, _countof(settingname), "Name%d", i); - DBVARIANT dbv = { 0 }; - if (db_get_ts(NULL, CLUIFrameModule, settingname, &dbv)) - continue; - - if (mir_tstrcmpi(dbv.ptszVal, g_pfwFrames[Frameid].name) == 0) { - db_free(&dbv); - return i; - } - db_free(&dbv); - } - return -1; -} - -static int CLUIFramesLoadFrameSettings(int Frameid) -{ - int storpos, maxstored; - - if (_fCluiFramesModuleNotStarted) return -1; - - if (Frameid < 0 || Frameid >= g_nFramesCount) return -1; - - maxstored = db_get_w(0, CLUIFrameModule, "StoredFrames", -1); - if (maxstored == -1) return 0; - - storpos = LocateStorePosition(Frameid, maxstored); - if (storpos == -1) return 0; - - DBLoadFrameSettingsAtPos(storpos, Frameid); - return 0; -} - -static int CLUIFramesStoreFrameSettings(int Frameid) -{ - int maxstored, storpos; - - if (_fCluiFramesModuleNotStarted) return -1; - - if (Frameid < 0 || Frameid >= g_nFramesCount) return -1; - - maxstored = db_get_w(0, CLUIFrameModule, "StoredFrames", -1); - if (maxstored == -1) maxstored = 0; - - storpos = LocateStorePosition(Frameid, maxstored); - if (storpos == -1) { storpos = maxstored; maxstored++; } - - DBStoreFrameSettingsAtPos(storpos, Frameid); - db_set_w(0, CLUIFrameModule, "StoredFrames", (WORD)maxstored); - - return 0; -} - -static int CLUIFramesStoreAllFrames() -{ - if (_fCluiFramesModuleNotStarted) return -1; - for (int i = 0; i < g_nFramesCount; i++) - CLUIFramesStoreFrameSettings(i); - return 0; -} - -static int CLUIFramesGetalClientFrame(void) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - if (_nClientFrameId != eUnknownId) { - /* this value could become invalid if RemoveItemFromList was called, - * so we double-check */ - if (_nClientFrameId < g_nFramesCount) { - if (g_pfwFrames[_nClientFrameId].align == alClient) { - return _nClientFrameId; - } - } - } - - for (int i = 0; i < g_nFramesCount; i++) - if (g_pfwFrames[i].align == alClient) { - _nClientFrameId = i; - return i; - } - return -1; -} - -///////////////////////////////////////////////////////////////////////////////////////// - -static HGENMENU addFrameMenuItem(TMO_MenuItem *pmi, int frameid, bool bMain) -{ - HGENMENU res = (bMain) ? Menu_AddMainMenuItem(pmi) : Menu_AddContextFrameMenuItem(pmi); - if (pmi->pszService != NULL) - Menu_ConfigureItem(res, MCI_OPT_EXECPARAM, frameid); - return res; -} - -static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, bool bMain) -{ - if (_fCluiFramesModuleNotStarted) - return NULL; - - int framepos = id2pos(frameid); - FrameMenuHandles &fmh = (frameid == -1) ? cont : g_pfwFrames[framepos].MenuHandles; - - CMenuItem mi; - mi.root = root; - mi.position = popuppos++; - mi.name.a = LPGEN("&Visible"); - mi.flags = CMIF_SYSTEM | CMIF_CHECKED; - mi.pszService = MS_CLIST_FRAMES_SHFRAME; - fmh.MIVisible = addFrameMenuItem(&mi, frameid, bMain); - - popuppos += 100000; - - mi.position = popuppos++; - mi.name.a = LPGEN("&Show title"); - mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR; - fmh.MITBVisible = addFrameMenuItem(&mi, frameid, bMain); - - mi.position = popuppos++; - mi.name.a = LPGEN("&Locked"); - mi.pszService = MS_CLIST_FRAMES_ULFRAME; - fmh.MILock = addFrameMenuItem(&mi, frameid, bMain); - - mi.position = popuppos++; - mi.name.a = LPGEN("&Expanded"); - mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME; - fmh.MIColl = addFrameMenuItem(&mi, frameid, bMain); - - // floating - mi.position = popuppos++; - mi.name.a = LPGEN("&Floating mode"); - mi.flags = CMIF_SYSTEM; - mi.pszService = "Set_Floating"; - fmh.MIFloating = addFrameMenuItem(&mi, frameid, bMain); - - mi.position = popuppos++; - mi.name.a = LPGEN("&Border"); - mi.flags = CMIF_SYSTEM | CMIF_CHECKED; - mi.pszService = MS_CLIST_FRAMES_SETUNBORDER; - fmh.MIBorder = addFrameMenuItem(&mi, frameid, bMain); - - popuppos += 100000; - - // alignment root - mi.position = popuppos++; - mi.name.a = LPGEN("&Align"); - mi.flags = CMIF_SYSTEM; - mi.pszService = NULL; - fmh.MIAlignRoot = addFrameMenuItem(&mi, frameid, bMain); - - // align top - mi.root = fmh.MIAlignRoot; - mi.position = popuppos++; - mi.name.a = LPGEN("&Top"); - mi.pszService = CLUIFRAMESSETALIGNALTOP; - fmh.MIAlignTop = addFrameMenuItem(&mi, frameid, bMain); - - // align client - mi.position = popuppos++; - mi.name.a = LPGEN("&Client"); - mi.pszService = CLUIFRAMESSETALIGNALCLIENT; - fmh.MIAlignClient = addFrameMenuItem(&mi, frameid, bMain); - - // align bottom - mi.position = popuppos++; - mi.name.a = LPGEN("&Bottom"); - mi.pszService = CLUIFRAMESSETALIGNALBOTTOM; - fmh.MIAlignBottom = addFrameMenuItem(&mi, frameid, bMain); - - // position root - mi.root = root; - mi.position = popuppos++; - mi.name.a = LPGEN("&Position"); - mi.pszService = NULL; - mi.root = addFrameMenuItem(&mi, frameid, bMain); - - mi.position = popuppos++; - mi.name.a = LPGEN("&Up"); - mi.pszService = CLUIFRAMESMOVEUP; - addFrameMenuItem(&mi, frameid, bMain); - - mi.position = popuppos++; - mi.name.a = LPGEN("&Down"); - mi.pszService = CLUIFRAMESMOVEDOWN; - addFrameMenuItem(&mi, frameid, bMain); - return 0; -} - -static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) -{ - /* HOOK */ - if (MirandaExiting()) return 0; - if (_fCluiFramesModuleNotStarted) return -1; - int pos = id2pos(wParam); - if (pos >= 0 && pos < g_nFramesCount) { - FRAMEWND &p = g_pfwFrames[pos]; - - Menu_ModifyItem(cont.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name); - Menu_SetChecked(cont.MIVisible, p.visible); - Menu_SetChecked(cont.MILock, p.Locked); - Menu_SetChecked(cont.MITBVisible, p.TitleBar.ShowTitleBar); - Menu_SetChecked(cont.MIFloating, p.floating); - - if (g_CluiData.fLayered) - Menu_EnableItem(cont.MIBorder, false); - else - Menu_SetChecked(cont.MIBorder, p.UseBorder); - - Menu_SetChecked(cont.MIAlignTop, (p.align & alTop) != 0); - Menu_SetChecked(cont.MIAlignClient, (p.align & alClient) != 0); - Menu_SetChecked(cont.MIAlignBottom, (p.align & alBottom) != 0); - - Menu_SetChecked(cont.MIColl, p.collapsed); - Menu_EnableItem(cont.MIColl, p.visible && !p.Locked && pos != CLUIFramesGetalClientFrame()); - } - return 0; -} - -static int CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM) -{ - // hiword(wParam) = frameid,loword(wParam) = flag - if (_fCluiFramesModuleNotStarted) - return -1; - - int pos = id2pos(wParam); - if (pos >= 0 && pos < g_nFramesCount) { - FRAMEWND &p = g_pfwFrames[pos]; - - Menu_ModifyItem(p.MenuHandles.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name); - Menu_SetChecked(p.MenuHandles.MIVisible, p.visible); - Menu_SetChecked(p.MenuHandles.MILock, p.Locked); - Menu_SetChecked(p.MenuHandles.MITBVisible, p.TitleBar.ShowTitleBar); - Menu_SetChecked(p.MenuHandles.MIFloating, p.floating); - - if (g_CluiData.fLayered) - Menu_EnableItem(p.MenuHandles.MIBorder, false); - else - Menu_SetChecked(p.MenuHandles.MIBorder, p.UseBorder); - - Menu_EnableItem(p.MenuHandles.MIAlignTop, (p.align & alClient) == 0); - Menu_SetChecked(p.MenuHandles.MIAlignTop, (p.align & alTop) != 0); - Menu_EnableItem(p.MenuHandles.MIAlignBottom, (p.align & alClient) == 0); - Menu_SetChecked(p.MenuHandles.MIAlignBottom, (p.align & alBottom) != 0); - Menu_SetChecked(p.MenuHandles.MIAlignClient, (p.align & alClient) != 0); - - Menu_SetChecked(p.MenuHandles.MIColl, p.collapsed); - Menu_EnableItem(p.MenuHandles.MIColl, p.visible && !p.Locked && pos != CLUIFramesGetalClientFrame()); - } - - return 0; -} - - -static INT_PTR _us_DoGetFrameOptions(WPARAM wParam, LPARAM) -{ - if (_fCluiFramesModuleNotStarted) - return -1; - - int pos = id2pos(HIWORD(wParam)); - if (pos < 0 || pos >= g_nFramesCount) - return -1; - - switch (LOWORD(wParam) & ~FO_UNICODETEXT) { - case FO_NAME: - return (INT_PTR)g_pfwFrames[pos].name; - - case FO_TBNAME: - return (INT_PTR)g_pfwFrames[pos].TitleBar.tbname; - - case FO_TBTIPNAME: - return (INT_PTR)g_pfwFrames[pos].TitleBar.tooltip; - - case FO_TBSTYLE: - return GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE); - - case FO_TBEXSTYLE: - return GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_EXSTYLE); - - case FO_ICON: - return (INT_PTR)g_pfwFrames[pos].TitleBar.hicon; - - case FO_HEIGHT: - return (INT_PTR)g_pfwFrames[pos].height; - - case FO_ALIGN: - return (INT_PTR)g_pfwFrames[pos].align; - - case FO_FLOATING: - return (INT_PTR)g_pfwFrames[pos].floating; - - case FO_FLAGS: - INT_PTR retval = 0; - if (g_pfwFrames[pos].visible) retval |= F_VISIBLE; - if (!g_pfwFrames[pos].collapsed) retval |= F_UNCOLLAPSED; - if (g_pfwFrames[pos].Locked) retval |= F_LOCKED; - if (g_pfwFrames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; - if (g_pfwFrames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; - if (!g_CluiData.fLayered) { - if (!(GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE)&WS_BORDER)) - retval |= F_NOBORDER; - } - else if (!g_pfwFrames[pos].UseBorder) - retval |= F_NOBORDER; - return retval; - } - - return -1; -} - -static int UpdateTBToolTip(int framepos) -{ - TOOLINFO ti = { sizeof(ti) }; - ti.lpszText = g_pfwFrames[framepos].TitleBar.tooltip; - ti.hinst = g_hInst; - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; - ti.uId = (UINT_PTR)g_pfwFrames[framepos].TitleBar.hwnd; - return SendMessage(g_pfwFrames[framepos].TitleBar.hwndTip, TTM_UPDATETIPTEXT, 0, (LPARAM)&ti); -} - -//hiword(wParam) = frameid,loword(wParam) = flag -static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) -{ - int retval; // value to be returned - BOOL bUnicodeText = (LOWORD(wParam) & FO_UNICODETEXT) != 0; - wParam = MAKEWPARAM((LOWORD(wParam))& ~FO_UNICODETEXT, HIWORD(wParam)); - if (_fCluiFramesModuleNotStarted) - return -1; - - int pos = id2pos(HIWORD(wParam)); - if (pos < 0 || pos >= g_nFramesCount) - return -1; - - FRAMEWND &fw = g_pfwFrames[pos]; - - switch (LOWORD(wParam)) { - case FO_FLAGS: - fw.dwFlags = lParam; - fw.visible = FALSE; - if (lParam & F_VISIBLE) fw.visible = TRUE; - - fw.collapsed = TRUE; - if (lParam & F_UNCOLLAPSED) fw.collapsed = FALSE; - - fw.Locked = FALSE; - if (lParam & F_LOCKED) fw.Locked = TRUE; - - fw.UseBorder = TRUE; - if (lParam & F_NOBORDER) fw.UseBorder = FALSE; - - fw.TitleBar.ShowTitleBar = FALSE; - if (lParam & F_SHOWTB) fw.TitleBar.ShowTitleBar = TRUE; - - fw.TitleBar.ShowTitleBarTip = FALSE; - if (lParam & F_SHOWTBTIP) fw.TitleBar.ShowTitleBarTip = TRUE; - - SendMessageA(fw.TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)fw.TitleBar.ShowTitleBarTip, 0); - { - LONG_PTR style = GetWindowLongPtr(fw.hWnd, GWL_STYLE); - style &= (~WS_BORDER); - if (!(lParam & F_NOBORDER) && !g_CluiData.fLayered) - style |= WS_BORDER; - - SetWindowLongPtr(fw.hWnd, GWL_STYLE, style); - SetWindowLongPtr(fw.TitleBar.hwnd, GWL_STYLE, style& ~(WS_VSCROLL | WS_HSCROLL)); - } - - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - SetWindowPos(fw.TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); - return 0; - - case FO_NAME: - if (lParam == 0) - return -1; - - mir_free(fw.name); - if (bUnicodeText) - fw.name = mir_tstrdup((LPTSTR)lParam); - else - fw.name = mir_a2t((char *)lParam); - return 0; - - case FO_TBNAME: - if (lParam == 0) - return -1; - - mir_free(fw.TitleBar.tbname); - if (bUnicodeText) - fw.TitleBar.tbname = mir_tstrdup((LPTSTR)lParam); - else - fw.TitleBar.tbname = mir_a2t((char*)lParam); - - if (fw.floating && (fw.TitleBar.tbname != NULL)) - SetWindowText(fw.ContainerWnd, fw.TitleBar.tbname); - return 0; - - case FO_TBTIPNAME: - if (lParam == 0) - return -1; - - if (fw.TitleBar.tooltip != NULL) - mir_free_and_nil(fw.TitleBar.tooltip); - if (bUnicodeText) - fw.TitleBar.tooltip = mir_tstrdup((LPTSTR)lParam); - else - fw.TitleBar.tooltip = mir_a2t((char*)lParam); - - UpdateTBToolTip(pos); - return 0; - - case FO_TBSTYLE: - SetWindowLongPtr(fw.TitleBar.hwnd, GWL_STYLE, lParam& ~(WS_VSCROLL | WS_HSCROLL)); - return 0; - - case FO_TBEXSTYLE: - SetWindowLongPtr(fw.TitleBar.hwnd, GWL_EXSTYLE, lParam); - return 0; - - case FO_ICON: - fw.TitleBar.hicon = (HICON)lParam; - return 0; - - case FO_HEIGHT: - if (lParam < 0) { return -1; } - - if (fw.collapsed) { - int oldHeight = fw.height; - retval = fw.height; - fw.height = lParam; - if (!CLUIFramesFitInSize()) fw.height = retval; - retval = fw.height; - if (fw.height != oldHeight && !fw.floating) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - } - else { - retval = fw.HeightWhenCollapsed; - fw.HeightWhenCollapsed = lParam; - if (!CLUIFramesFitInSize()) fw.HeightWhenCollapsed = retval; - retval = fw.HeightWhenCollapsed; - - } - return retval; - - case FO_FLOATING: - if (lParam < 0) { return -1; } - - { - int id = fw.id; - fw.floating = !(lParam); - - - CLUIFrames_SetFrameFloat(id, 1);//lparam = 1 use stored width and height - return(wParam); - } - - case FO_ALIGN: - if (!(lParam&alTop || lParam&alBottom || lParam&alClient)) { - TRACE("Wrong align option \r\n"); - return (-1); - }; - - if ((lParam&alClient) && (CLUIFramesGetalClientFrame() >= 0)) { //only one alClient frame possible - _nClientFrameId = eUnknownId;//recalc it - - return -1; - } - fw.align = lParam; - return 0; - } - - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - return -1; -} - -//wparam = lparam = 0 -static int _us_DoShowAllFrames(WPARAM, LPARAM) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - for (int i = 0; i < g_nFramesCount; i++) - g_pfwFrames[i].visible = TRUE; - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - return 0; -} - -//wparam = lparam = 0 -static int _us_DoShowTitles(WPARAM, LPARAM) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - for (int i = 0; i < g_nFramesCount; i++) - g_pfwFrames[i].TitleBar.ShowTitleBar = TRUE; - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - return 0; -} - -//wparam = lparam = 0 -static int _us_DoHideTitles(WPARAM, LPARAM) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - for (int i = 0; i < g_nFramesCount; i++) - g_pfwFrames[i].TitleBar.ShowTitleBar = FALSE; - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - return 0; -} - -//wparam = frameid -static int _us_DoShowHideFrame(WPARAM wParam, LPARAM lParam) -{ - if (_fCluiFramesModuleNotStarted) - return -1; - - int pos = (wParam == 0) ? lParam : id2pos(wParam); - if (pos >= 0 && pos < g_nFramesCount) { - g_pfwFrames[pos].visible = !g_pfwFrames[pos].visible; - CLUIFramesStoreFrameSettings(pos); - - if (g_pfwFrames[pos].OwnerWindow != (HWND)-2) { - if (g_pfwFrames[pos].OwnerWindow) - CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); - else if (g_pfwFrames[pos].visible) { - g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10); - SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].OwnerWindow); - CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); - } - } - - if (g_pfwFrames[pos].floating) - CLUIFrameResizeFloatingFrame(pos); - - if (!g_pfwFrames[pos].floating) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - } - return 0; -} - -//wparam = frameid -static int _us_DoShowHideFrameTitle(WPARAM wParam, LPARAM lParam) -{ - if (_fCluiFramesModuleNotStarted) - return -1; - - int pos = (wParam == 0) ? lParam : id2pos(wParam); - if (pos >= 0 && (int)pos < g_nFramesCount) - g_pfwFrames[pos].TitleBar.ShowTitleBar = !g_pfwFrames[pos].TitleBar.ShowTitleBar; - - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - return 0; -} - -//wparam = frameid -//lparam = -1 up ,1 down -static int _us_DoMoveFrame(WPARAM wParam, LPARAM lParam) -{ - int i, curpos, curalign, v, tmpval; - - if (_fCluiFramesModuleNotStarted) - return -1; - - int pos = id2pos(wParam); - if (pos >= 0 && (int)pos < g_nFramesCount) { - curpos = g_pfwFrames[pos].order; - curalign = g_pfwFrames[pos].align; - v = 0; - SortData *sd = (SortData*)malloc(sizeof(SortData)*g_nFramesCount); - memset(sd, 0, sizeof(SortData)*g_nFramesCount); - for (i = 0; i < g_nFramesCount; i++) { - if (g_pfwFrames[i].floating || (!g_pfwFrames[i].visible) || (g_pfwFrames[i].align != curalign)) { continue; }; - - sd[v].order = g_pfwFrames[i].order; - sd[v++].realpos = i; - } - if (v == 0) { - free(sd); - return 0; - } - qsort(sd, v, sizeof(SortData), sortfunc); - for (i = 0; i < v; i++) - g_pfwFrames[sd[i].realpos].order = i + 1; //to be sure that order is incremental - for (i = 0; i < v; i++) { - if (sd[i].realpos == pos) { - if (lParam == -1) { - if (i >= v - 1) break; - tmpval = g_pfwFrames[sd[i + 1].realpos].order; - g_pfwFrames[sd[i + 1].realpos].order = g_pfwFrames[pos].order; - g_pfwFrames[pos].order = tmpval; - break; - } - - if (lParam == 1) { - if (i < 1) break; - tmpval = g_pfwFrames[sd[i - 1].realpos].order; - g_pfwFrames[sd[i - 1].realpos].order = g_pfwFrames[pos].order; - g_pfwFrames[pos].order = tmpval; - break; - } - } - } - - free(sd); - CLUIFramesStoreFrameSettings(pos); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - } - - return 0; -} - -static int _us_DoMoveFrameUp(WPARAM wParam, LPARAM) -{ - return CLUIFrames_MoveFrame(wParam, (LPARAM)+1); -} - -static int _us_DoMoveFrameDown(WPARAM wParam, LPARAM) -{ - return CLUIFrames_MoveFrame(wParam, (LPARAM)-1); -} - -//wparam = frameid -//lparam = alignment -static int _us_DoSetFrameAlign(WPARAM wParam, LPARAM lParam) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - CLUIFrames_SetFrameOptions(MAKEWPARAM(FO_ALIGN, wParam), lParam); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - return 0; -} - -static int _us_DoAlignFrameTop(WPARAM wParam, LPARAM) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - return CLUIFrames_SetFrameAlign(wParam, alTop); -} - -static int _us_DoAlignFrameBottom(WPARAM wParam, LPARAM) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - return CLUIFrames_SetFrameAlign(wParam, alBottom); -} - -static int _us_DoAlignFrameClient(WPARAM wParam, LPARAM) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - return CLUIFrames_SetFrameAlign(wParam, alClient); -} - -//wparam = frameid -static int _us_DoLockFrame(WPARAM wParam, LPARAM lParam) -{ - if (_fCluiFramesModuleNotStarted) return -1; - - int pos = (wParam == 0) ? lParam : id2pos(wParam); - if (pos >= 0 && (int)pos < g_nFramesCount) { - g_pfwFrames[pos].Locked = !g_pfwFrames[pos].Locked; - CLUIFramesStoreFrameSettings(pos); - } - - return 0; -} - -//wparam = frameid -static int _us_DoSetFrameBorder(WPARAM wParam, LPARAM lParam) -{ - RECT rc; - - if (_fCluiFramesModuleNotStarted) return -1; - - int FrameId = (wParam == 0) ? lParam : id2pos(wParam); - if (FrameId == -1) - return -1; - - int oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), 0); - if (oldflags & F_NOBORDER) - oldflags &= ~F_NOBORDER; - else - oldflags |= F_NOBORDER; - - HWND hw = g_pfwFrames[FrameId].hWnd; - GetWindowRect(hw, &rc); - - CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); - SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME); - return 0; -} - -//wparam = frameid -static int _us_DoCollapseFrame(WPARAM wParam, LPARAM lParam) -{ - int FrameId; - - if (_fCluiFramesModuleNotStarted) return -1; - - if (wParam == 0) { - FrameId = lParam; - } - else { - FrameId = id2pos(wParam); - } - if (FrameId >= 0 && FrameId < g_nFramesCount) { - int oldHeight; - - // do not collapse/uncollapse client/locked/invisible frames - if (g_pfwFrames[FrameId].align == alClient && !(g_pfwFrames[FrameId].Locked || (!g_pfwFrames[FrameId].visible) || g_pfwFrames[FrameId].floating)) { - RECT rc; - if (CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { return 0; }; - if (!g_CluiData.fDocked && g_CluiData.fAutoSize) { return 0; }; - GetWindowRect(pcli->hwndContactList, &rc); - - if (g_pfwFrames[FrameId].collapsed == TRUE) { - rc.bottom -= rc.top; - rc.bottom -= g_pfwFrames[FrameId].height; - g_pfwFrames[FrameId].HeightWhenCollapsed = g_pfwFrames[FrameId].height; - g_pfwFrames[FrameId].collapsed = FALSE; - } - else { - rc.bottom -= rc.top; - rc.bottom += g_pfwFrames[FrameId].HeightWhenCollapsed; - g_pfwFrames[FrameId].collapsed = TRUE; - } - - SetWindowPos(pcli->hwndContactList, NULL, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); - - CLUIFramesStoreAllFrames(); - - - return 0; - - } - if (g_pfwFrames[FrameId].Locked || (!g_pfwFrames[FrameId].visible)) return 0; - - oldHeight = g_pfwFrames[FrameId].height; - - // if collapsed, uncollapse - if (g_pfwFrames[FrameId].collapsed == TRUE) { - g_pfwFrames[FrameId].HeightWhenCollapsed = g_pfwFrames[FrameId].height; - g_pfwFrames[FrameId].height = UNCOLLAPSED_FRAME_SIZE; - g_pfwFrames[FrameId].collapsed = FALSE; - } - // if uncollapsed, collapse - else { - g_pfwFrames[FrameId].height = g_pfwFrames[FrameId].HeightWhenCollapsed; - g_pfwFrames[FrameId].collapsed = TRUE; - } - - if (!g_pfwFrames[FrameId].floating) { - - if (!CLUIFramesFitInSize()) { - //cant collapse,we can resize only for height < alclient frame height - int alfrm = CLUIFramesGetalClientFrame(); - - if (alfrm != -1) { - g_pfwFrames[FrameId].collapsed = FALSE; - if (g_pfwFrames[alfrm].height > 2 * UNCOLLAPSED_FRAME_SIZE) { - oldHeight = g_pfwFrames[alfrm].height - UNCOLLAPSED_FRAME_SIZE; - g_pfwFrames[FrameId].collapsed = TRUE; - } - } - else { - int i, sumheight = 0; - for (i = 0; i < g_nFramesCount; i++) { - if ((g_pfwFrames[i].align != alClient) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { - sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)) + 2; - return FALSE; - } - if (sumheight>_nContactListHeight - 0 - 2) { - g_pfwFrames[FrameId].height = (_nContactListHeight - 0 - 2) - sumheight; - } - - } - } - - g_pfwFrames[FrameId].height = oldHeight; - - if (g_pfwFrames[FrameId].collapsed == FALSE) { - - if (!g_pfwFrames[FrameId].floating) { - } - else { - //SetWindowPos(Frames[FrameId].hWnd,HWND_TOP, 0, 0, Frames[FrameId].wndSize.right-Frames[FrameId].wndSize.left,Frames[FrameId].height,SWP_SHOWWINDOW|SWP_NOMOVE); - SetWindowPos(g_pfwFrames[FrameId].ContainerWnd, HWND_TOP, 0, 0, g_pfwFrames[FrameId].wndSize.right - g_pfwFrames[FrameId].wndSize.left + 6, g_pfwFrames[FrameId].height + DEFAULT_TITLEBAR_HEIGHT + 4, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOMOVE); - }; - - - return -1; - };//redraw not needed - } - };//floating test - - //CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); - if (!g_pfwFrames[FrameId].floating) { - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - } - else { - //SetWindowPos(Frames[FrameId].hWnd,HWND_TOP, 0, 0, Frames[FrameId].wndSize.right-Frames[FrameId].wndSize.left,Frames[FrameId].height,SWP_SHOWWINDOW|SWP_NOMOVE); - RECT contwnd; - GetWindowRect(g_pfwFrames[FrameId].ContainerWnd, &contwnd); - contwnd.top = contwnd.bottom - contwnd.top;//height - contwnd.left = contwnd.right - contwnd.left;//width - - contwnd.top -= (oldHeight - g_pfwFrames[FrameId].height);//newheight - SetWindowPos(g_pfwFrames[FrameId].ContainerWnd, HWND_TOP, 0, 0, contwnd.left, contwnd.top, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOMOVE); - }; - CLUIFramesStoreAllFrames(); - return 0; - } - else - return -1; -} - -static int CLUIFramesLoadMainMenu() -{ - if (_fCluiFramesModuleNotStarted) - return -1; - - if (cont.MainMenuItem != NULL) { - Menu_RemoveItem(cont.MainMenuItem); - cont.MainMenuItem = NULL; - } - - // create root menu - CMenuItem mi; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME); - mi.position = 3000090000; - mi.name.a = LPGEN("Frames"); - cont.MainMenuItem = Menu_AddMainMenuItem(&mi); - - // create frames menu - mi.root = cont.MainMenuItem; - int separator = 3000200000; - for (int i = 0; i < g_nFramesCount; i++) { - mi.hIcolibItem = g_pfwFrames[i].TitleBar.hicon; - mi.flags = CMIF_SYSTEM | CMIF_TCHAR; - mi.position = separator++; - mi.name.t = g_pfwFrames[i].TitleBar.tbname ? g_pfwFrames[i].TitleBar.tbname : g_pfwFrames[i].name; - mi.pszService = 0; - g_pfwFrames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi); - CLUIFramesCreateMenuForFrame(g_pfwFrames[i].id, g_pfwFrames[i].MenuHandles.MainMenuItem, separator, true); - CLUIFramesModifyMainMenuItems(g_pfwFrames[i].id, 0); - CallService(MS_CLIST_FRAMEMENUNOTIFY, (WPARAM)g_pfwFrames[i].id, (LPARAM)g_pfwFrames[i].MenuHandles.MainMenuItem); - } - - separator += 100000; - - // create "show all frames" menu - mi.hIcolibItem = NULL; - mi.flags = CMIF_SYSTEM; - mi.position = separator++; - mi.name.a = LPGEN("Show all frames"); - mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES; - Menu_AddMainMenuItem(&mi); - - // create "show all titlebars" menu - mi.position = separator++; - mi.name.a = LPGEN("Show all title bars"); - mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB; - Menu_AddMainMenuItem(&mi); - - // create "hide all titlebars" menu - mi.position = separator++; - mi.name.a = LPGEN("Hide all title bars"); - mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB; - Menu_AddMainMenuItem(&mi); - return 0; -} - -static HFONT CLUILoadTitleBarFont() -{ - char facename[] = "MS Shell Dlg"; - HFONT hfont; - LOGFONTA logfont; - memset(&logfont, 0, sizeof(logfont)); - memcpy(logfont.lfFaceName, facename, sizeof(facename)); - logfont.lfWeight = FW_NORMAL; - logfont.lfHeight = -10; - logfont.lfCharSet = DEFAULT_CHARSET; - hfont = CreateFontIndirectA(&logfont); - return hfont; -} - - -//wparam = (CLISTFrame*)clfrm -static int _us_DoAddFrame(WPARAM wParam, LPARAM) -{ - int retval; - LONG_PTR style; - //char * CustomName = NULL; - CLISTFrame *clfrm = (CLISTFrame *)wParam; - - if (pcli->hwndContactList == 0) return -1; - if (_fCluiFramesModuleNotStarted) return -1; - if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; - if (!(_hTitleBarFont)) _hTitleBarFont = CLUILoadTitleBarFont(); - - g_pfwFrames = (FRAMEWND*)realloc(g_pfwFrames, sizeof(FRAMEWND)*(g_nFramesCount + 1)); - - memset(&g_pfwFrames[g_nFramesCount], 0, sizeof(FRAMEWND)); - g_pfwFrames[g_nFramesCount].id = _iNextFrameId++; - g_pfwFrames[g_nFramesCount].align = clfrm->align; - g_pfwFrames[g_nFramesCount].hWnd = clfrm->hWnd; - g_pfwFrames[g_nFramesCount].height = clfrm->height; - g_pfwFrames[g_nFramesCount].TitleBar.hicon = clfrm->hIcon; - //Frames[nFramescount].TitleBar.BackColour; - g_pfwFrames[g_nFramesCount].floating = FALSE; - if (clfrm->Flags&F_NO_SUBCONTAINER || !g_CluiData.fLayered) - g_pfwFrames[g_nFramesCount].OwnerWindow = (HWND)-2; - else g_pfwFrames[g_nFramesCount].OwnerWindow = 0; - - //override tbbtip - //clfrm->Flags |= F_SHOWTBTIP; - // - if (db_get_b(0, CLUIFrameModule, "RemoveAllBorders", 0) == 1) { - clfrm->Flags |= F_NOBORDER; - }; - g_pfwFrames[g_nFramesCount].dwFlags = clfrm->Flags; - - if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { - g_pfwFrames[g_nFramesCount].name = (LPTSTR)mir_alloc(255 * sizeof(TCHAR)); - GetClassName(g_pfwFrames[g_nFramesCount].hWnd, g_pfwFrames[g_nFramesCount].name, 255); - } - else g_pfwFrames[g_nFramesCount].name = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name); - - if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL - || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0) - g_pfwFrames[g_nFramesCount].TitleBar.tbname = mir_tstrdup(g_pfwFrames[g_nFramesCount].name); - else - g_pfwFrames[g_nFramesCount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname); - - g_pfwFrames[g_nFramesCount].needhide = FALSE; - g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar = (clfrm->Flags & F_SHOWTB ? TRUE : FALSE); - g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBarTip = (clfrm->Flags & F_SHOWTBTIP ? TRUE : FALSE); - - g_pfwFrames[g_nFramesCount].collapsed = (clfrm->Flags & F_UNCOLLAPSED) ? FALSE : TRUE; - - - g_pfwFrames[g_nFramesCount].Locked = clfrm->Flags & F_LOCKED ? TRUE : FALSE; - g_pfwFrames[g_nFramesCount].visible = clfrm->Flags & F_VISIBLE ? TRUE : FALSE; - - g_pfwFrames[g_nFramesCount].UseBorder = ((clfrm->Flags&F_NOBORDER) || g_CluiData.fLayered) ? FALSE : TRUE; - - //Frames[nFramescount].OwnerWindow = 0; - - g_pfwFrames[g_nFramesCount].TitleBar.hwnd = CreateWindow(CLUIFrameTitleBarClassName, g_pfwFrames[g_nFramesCount].name, - (db_get_b(0, CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER) - | WS_CHILD | WS_CLIPCHILDREN | - (g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) | - WS_CLIPCHILDREN, - 0, 0, 0, 0, pcli->hwndContactList, NULL, g_hInst, NULL); - SetWindowLongPtr(g_pfwFrames[g_nFramesCount].TitleBar.hwnd, GWLP_USERDATA, g_pfwFrames[g_nFramesCount].id); - - g_pfwFrames[g_nFramesCount].TitleBar.hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, - WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - pcli->hwndContactList, NULL, g_hInst, - NULL); - - SetWindowPos(g_pfwFrames[g_nFramesCount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - { - TOOLINFO ti = { sizeof(ti) }; - ti.lpszText = _T(""); - ti.hinst = g_hInst; - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; - ti.uId = (UINT_PTR)g_pfwFrames[g_nFramesCount].TitleBar.hwnd; - SendMessage(g_pfwFrames[g_nFramesCount].TitleBar.hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti); - } - - SendMessageA(g_pfwFrames[g_nFramesCount].TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBarTip, 0); - - g_pfwFrames[g_nFramesCount].oldstyles = GetWindowLongPtr(g_pfwFrames[g_nFramesCount].hWnd, GWL_STYLE); - g_pfwFrames[g_nFramesCount].TitleBar.oldstyles = GetWindowLongPtr(g_pfwFrames[g_nFramesCount].TitleBar.hwnd, GWL_STYLE); - //Frames[nFramescount].FloatingPos.x = - - retval = g_pfwFrames[g_nFramesCount].id; - g_pfwFrames[g_nFramesCount].order = g_nFramesCount + 1; - g_nFramesCount++; - - - CLUIFramesLoadFrameSettings(id2pos(retval)); - if (g_pfwFrames[g_nFramesCount - 1].collapsed == FALSE) - g_pfwFrames[g_nFramesCount - 1].height = 0; - - // create frame - - style = GetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].hWnd, GWL_STYLE); - style &= (~WS_BORDER); - style |= (((g_pfwFrames[g_nFramesCount - 1].UseBorder) && !g_CluiData.fLayered) ? WS_BORDER : 0); - SetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].hWnd, GWL_STYLE, style); - SetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].TitleBar.hwnd, GWL_STYLE, style& ~(WS_VSCROLL | WS_HSCROLL)); - SetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].TitleBar.hwnd, GWL_STYLE, GetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].TitleBar.hwnd, GWL_STYLE)&~(WS_VSCROLL | WS_HSCROLL)); - - if (g_pfwFrames[g_nFramesCount - 1].order == 0) { g_pfwFrames[g_nFramesCount - 1].order = g_nFramesCount; }; - - //need to enlarge parent - { - RECT mainRect; - int mainHeight, minHeight; - GetWindowRect(pcli->hwndContactList, &mainRect); - mainHeight = mainRect.bottom - mainRect.top; - minHeight = CLUIFrames_GetTotalHeight(); - if (mainHeight < minHeight) { - BOOL Upward = FALSE; - Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT); - - if (Upward) - mainRect.top = mainRect.bottom - minHeight; - else - mainRect.bottom = mainRect.top + minHeight; - SetWindowPos(pcli->hwndContactList, NULL, mainRect.left, mainRect.top, mainRect.right - mainRect.left, mainRect.bottom - mainRect.top, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING); - } - GetWindowRect(pcli->hwndContactList, &mainRect); - mainHeight = mainRect.bottom - mainRect.top; - } - _nClientFrameId = eUnknownId;//recalc it - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - - if (g_pfwFrames[g_nFramesCount - 1].floating) { - - g_pfwFrames[g_nFramesCount - 1].floating = FALSE; - //SetWindowPos(Frames[nFramescount-1].hw - CLUIFrames_SetFrameFloat(retval, 1);//lparam = 1 use stored width and height - } - else - CLUIFrames_SetFrameFloat(retval, 2); - - /** Remove */ - //_ExtFramesSrv_AddFrame( wParam, lParam); - - return retval; -} - -static int _us_DoRemoveFrame(WPARAM wParam, LPARAM) -{ - int pos; - if (_fCluiFramesModuleNotStarted) return -1; - - pos = id2pos(wParam); - - if (pos < 0 || pos>g_nFramesCount) return -1;; - - mir_free_and_nil(g_pfwFrames[pos].name); - mir_free_and_nil(g_pfwFrames[pos].TitleBar.tbname); - mir_free_and_nil(g_pfwFrames[pos].TitleBar.tooltip); - DestroyWindow(g_pfwFrames[pos].hWnd); - g_pfwFrames[pos].hWnd = (HWND)-1; - DestroyWindow(g_pfwFrames[pos].TitleBar.hwnd); - if (g_pfwFrames[pos].TitleBar.hwndTip) - DestroyWindow(g_pfwFrames[pos].TitleBar.hwndTip); - g_pfwFrames[pos].TitleBar.hwnd = (HWND)-1; - if (g_pfwFrames[pos].ContainerWnd && g_pfwFrames[pos].ContainerWnd != (HWND)-1) DestroyWindow(g_pfwFrames[pos].ContainerWnd); - g_pfwFrames[pos].ContainerWnd = (HWND)-1; - if (g_pfwFrames[pos].TitleBar.hmenu) DestroyMenu(g_pfwFrames[pos].TitleBar.hmenu); - g_pfwFrames[pos].PaintCallbackProc = NULL; - if (g_pfwFrames[pos].UpdateRgn) DeleteObject(g_pfwFrames[pos].UpdateRgn); - - if (g_pfwFrames[pos].OwnerWindow != (HWND)-1 - && g_pfwFrames[pos].OwnerWindow != (HWND)-2 - && g_pfwFrames[pos].OwnerWindow != (HWND)0) - DestroyWindow(g_pfwFrames[pos].OwnerWindow); - - g_pfwFrames[pos].OwnerWindow = NULL; - RemoveItemFromList(pos, &g_pfwFrames, &g_nFramesCount); - - CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); - - return 0; -}; - - -static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame) -{ - if (Frame->TitleBar.hwnd != 0) - RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); - //UpdateWindow(Frame->TitleBar.hwnd); - return 0; -} - -static int CLUIFramesForceUpdateFrame(const FRAMEWND *Frame) -{ - if (Frame->hWnd != 0) { - RedrawWindow(Frame->hWnd, NULL, NULL, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); - UpdateWindow(Frame->hWnd); - } - - if (Frame->floating && Frame->ContainerWnd != 0) - RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); - return 0; -} - -static int CLUIFrameMoveResize(const FRAMEWND *Frame) -{ - // we need to show or hide the frame? - if (Frame->visible && (!Frame->needhide)) { - if (Frame->OwnerWindow != (HWND)-2 && Frame->OwnerWindow) { - // CLUI_ShowWindowMod(Frame->OwnerWindow,SW_SHOW); - } - CLUI_ShowWindowMod(Frame->hWnd, SW_SHOW/*NOACTIVATE*/); - CLUI_ShowWindowMod(Frame->TitleBar.hwnd, Frame->TitleBar.ShowTitleBar == TRUE ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); - } - else { - if (Frame->OwnerWindow && Frame->OwnerWindow != (HWND)(-1) && Frame->OwnerWindow != (HWND)(-2)) { - CLUI_ShowWindowMod(Frame->OwnerWindow, SW_HIDE); - } - CLUI_ShowWindowMod(Frame->hWnd, SW_HIDE); - CLUI_ShowWindowMod(Frame->TitleBar.hwnd, SW_HIDE); - return 0; - } - - if (Frame->OwnerWindow && Frame->OwnerWindow != (HWND)-2) { - RECT pr; - POINT Off = { 0 }; - - ClientToScreen(pcli->hwndContactList, &Off); - GetWindowRect(pcli->hwndContactList, &pr); - - if (Frame->visible && (!Frame->collapsed || Frame->wndSize.bottom - Frame->wndSize.top == 0)) { - ShowWindowAsync(Frame->OwnerWindow, SW_HIDE); - ShowWindowAsync(Frame->hWnd, SW_HIDE); - } - - { - SetWindowPos(Frame->OwnerWindow, NULL, Frame->wndSize.left + Off.x, Frame->wndSize.top + Off.y, - Frame->wndSize.right - Frame->wndSize.left, - Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); //- -= -= - - SetWindowPos(Frame->hWnd, NULL, 0, 0, - Frame->wndSize.right - Frame->wndSize.left, - Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); - } - // set titlebar position - if (Frame->TitleBar.ShowTitleBar) { - SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left, Frame->wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, - Frame->wndSize.right - Frame->wndSize.left, - g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); - } - if (Frame->visible && IsWindowVisible(pcli->hwndContactList) && Frame->collapsed && Frame->wndSize.bottom - Frame->wndSize.top != 0) { - ShowWindow(Frame->OwnerWindow, SW_SHOW); - ShowWindow(Frame->hWnd, SW_SHOW); - } - - } - else { - // set frame position - SetWindowPos(Frame->hWnd, NULL, Frame->wndSize.left, Frame->wndSize.top, - Frame->wndSize.right - Frame->wndSize.left, - Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); - // set titlebar position - if (Frame->TitleBar.ShowTitleBar) { - SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left, Frame->wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, - Frame->wndSize.right - Frame->wndSize.left, - g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); - - } - } - // Sleep(0); - return 0; -} - -static BOOL CLUIFramesFitInSize(void) -{ - int sumheight = 0; - int tbh = 0; // title bar height - int clientfrm; - clientfrm = CLUIFramesGetalClientFrame(); - if (clientfrm != -1) - tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); - - for (int i = 0; i < g_nFramesCount; i++) { - if ((g_pfwFrames[i].align != alClient) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { - sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)) + 2/*+btoint(Frames[i].UseBorder)*2*/; - if (sumheight>_nContactListHeight - tbh - 2) { - if (!g_CluiData.fDocked && g_CluiData.fAutoSize) - return TRUE; //Can be required to enlarge - - return FALSE; - } - } - } - return TRUE; -} - -int CLUIFrames_GetTotalHeight() -{ - if (pcli->hwndContactList == NULL) return 0; - - int sumheight = 0; - RECT border; - for (int i = 0; i < g_nFramesCount; i++) { - if ((g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (pcli->hwndContactTree) && (g_pfwFrames[i].hWnd != pcli->hwndContactTree)) - sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)); - }; - - GetBorderSize(pcli->hwndContactList, &border); - - //GetWindowRect(pcli->hwndContactList,&winrect); - //GetClientRect(pcli->hwndContactList,&clirect); - // clirect.bottom -= clirect.top; - // clirect.bottom += border.top+border.bottom; - //allbord = (winrect.bottom-winrect.top)-(clirect.bottom-clirect.top); - - //TODO minsize - sumheight += g_CluiData.TopClientMargin; - sumheight += g_CluiData.BottomClientMargin; - return max(db_get_w(NULL, "CLUI", "MinHeight", SETTING_MINHEIGTH_DEFAULT), - (sumheight + border.top + border.bottom)); -} - -int CLUIFramesGetMinHeight() -{ - int tbh = 0, sumheight = 0; - RECT border; - int allbord = 0; - if (pcli->hwndContactList == NULL) return 0; - - - // search for alClient frame and get the titlebar's height - int clientfrm = CLUIFramesGetalClientFrame(); - if (clientfrm != -1) - tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); - - for (int i = 0; i < g_nFramesCount; i++) { - if ((g_pfwFrames[i].align != alClient) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating)) { - RECT wsize; - - GetWindowRect(g_pfwFrames[i].hWnd, &wsize); - sumheight += (wsize.bottom - wsize.top) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)); - } - } - - GetBorderSize(pcli->hwndContactList, &border); - - //GetWindowRect(pcli->hwndContactList,&winrect); - //GetClientRect(pcli->hwndContactList,&clirect); - // clirect.bottom -= clirect.top; - // clirect.bottom += border.top+border.bottom; - //allbord = (winrect.bottom-winrect.top)-(clirect.bottom-clirect.top); - - //TODO minsize - sumheight += g_CluiData.TopClientMargin; - sumheight += g_CluiData.BottomClientMargin; - return max(db_get_w(NULL, "CLUI", "MinHeight", SETTING_MINHEIGTH_DEFAULT), - (sumheight + border.top + border.bottom + allbord + tbh)); -} - - - - -static int CLUIFramesResizeFrames(const RECT newsize) -{ - int sumheight = 9999999, newheight; - int prevframe, prevframebottomline; - int tbh, curfrmtbh; - int drawitems; - int clientfrm; - int i, j; - int sepw = GapBetweenFrames; - int topBorder = newsize.top; - SortData *sdarray; - - - g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); - - if (g_nFramesCount < 1) return 0; - newheight = newsize.bottom - newsize.top; - - // search for alClient frame and get the titlebar's height - tbh = 0; - clientfrm = CLUIFramesGetalClientFrame(); - if (clientfrm != -1) - tbh = (g_nTitleBarHeight + g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); - - for (i = 0; i < g_nFramesCount; i++) { - if (!g_pfwFrames[i].floating) { - g_pfwFrames[i].needhide = FALSE; - g_pfwFrames[i].wndSize.left = newsize.left; - g_pfwFrames[i].wndSize.right = newsize.right; - - }; - }; - { - //sorting stuff - sdarray = (SortData*)malloc(sizeof(SortData)*g_nFramesCount); - if (sdarray == NULL) return -1;; - for (i = 0; i < g_nFramesCount; i++) { - sdarray[i].order = g_pfwFrames[i].order; - sdarray[i].realpos = i; - } - qsort(sdarray, g_nFramesCount, sizeof(SortData), sortfunc); - - } - - drawitems = g_nFramesCount; - - while (sumheight>(newheight - tbh) && drawitems > 0) { - sumheight = 0; - drawitems = 0; - for (i = 0; i < g_nFramesCount; i++) { - if (((g_pfwFrames[i].align != alClient)) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { - drawitems++; - curfrmtbh = (g_nTitleBarHeight + g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); - sumheight += (g_pfwFrames[i].height) + curfrmtbh + (i > 0 ? sepw : 0) + ((g_pfwFrames[i].UseBorder && !g_CluiData.fLayered) ? 2 : 0); - if (sumheight > newheight - tbh) { - sumheight -= (g_pfwFrames[i].height) + curfrmtbh + (i > 0 ? sepw : 0); - g_pfwFrames[i].needhide = !g_CluiData.fDocked && g_CluiData.fAutoSize ? FALSE : TRUE; - drawitems--; - break; - } - } - } - } - - prevframe = -1; - prevframebottomline = topBorder; - for (j = 0; j < g_nFramesCount; j++) { - //move all alTop frames - i = sdarray[j].realpos; - if ((!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (g_pfwFrames[i].align == alTop)) { - curfrmtbh = (g_nTitleBarHeight + g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); - g_pfwFrames[i].wndSize.top = prevframebottomline + (i > 0 ? sepw : 0) + (curfrmtbh); - g_pfwFrames[i].wndSize.bottom = g_pfwFrames[i].height + g_pfwFrames[i].wndSize.top + ((g_pfwFrames[i].UseBorder && !g_CluiData.fLayered) ? 2 : 0); - g_pfwFrames[i].prevvisframe = prevframe; - prevframe = i; - prevframebottomline = g_pfwFrames[i].wndSize.bottom; - if (prevframebottomline > newheight) { - //prevframebottomline -= Frames[i].height+(curfrmtbh+1); - //Frames[i].needhide = TRUE; - } - } - } - - if (sumheight < newheight) { - for (j = 0; j < g_nFramesCount; j++) { - //move alClient frame - i = sdarray[j].realpos; - if ((!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (g_pfwFrames[i].align == alClient)) { - int oldh; - g_pfwFrames[i].wndSize.top = prevframebottomline + (j > 0 ? sepw : 0) + (tbh); - g_pfwFrames[i].wndSize.bottom = g_pfwFrames[i].wndSize.top + newheight - sumheight - tbh - (j > 0 ? sepw : 0); - - oldh = g_pfwFrames[i].height; - g_pfwFrames[i].height = g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top; - g_pfwFrames[i].prevvisframe = prevframe; - prevframe = i; - prevframebottomline = g_pfwFrames[i].wndSize.bottom; - if (prevframebottomline > newheight) { - //prevframebottomline -= Frames[i].height+(tbh+1); - //Frames[i].needhide = TRUE; - } - break; - } - } - } - - //newheight - prevframebottomline = newheight + sepw + topBorder; - //prevframe = -1; - for (j = g_nFramesCount - 1; j >= 0; j--) { - //move all alBottom frames - i = sdarray[j].realpos; - if ((g_pfwFrames[i].visible) && (!g_pfwFrames[i].floating) && (!g_pfwFrames[i].needhide) && (g_pfwFrames[i].align == alBottom)) { - curfrmtbh = (g_nTitleBarHeight + g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); - - g_pfwFrames[i].wndSize.bottom = prevframebottomline - (j > 0 ? sepw : 0); - g_pfwFrames[i].wndSize.top = g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].height - ((g_pfwFrames[i].UseBorder && !g_CluiData.fLayered) ? 2 : 0); - g_pfwFrames[i].prevvisframe = prevframe; - prevframe = i; - prevframebottomline = g_pfwFrames[i].wndSize.top/*-1*/ - curfrmtbh; - if (prevframebottomline > newheight) { - - } - } - } - for (i = 0; i < g_nFramesCount; i++) - if (g_pfwFrames[i].TitleBar.ShowTitleBar) - SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); - if (sdarray != NULL) { free(sdarray); sdarray = NULL; }; - - - - return 0; -} - -static int SizeMoveNewSizes() -{ - int i; - for (i = 0; i < g_nFramesCount; i++) { - - if (g_pfwFrames[i].floating) { - CLUIFrameResizeFloatingFrame(i); - } - else { - CLUIFrameMoveResize(&g_pfwFrames[i]); - }; - } - return 0; -} - - -static int CLUIFramesResize(RECT newsize) -{ - CLUIFramesResizeFrames(newsize); - SizeMoveNewSizes(); - return 0; -} -int CLUIFrames_ApplyNewSizes(int mode) -{ - int i; - g_CluiData.mutexPreventDockMoving = 0; - for (i = 0; i < g_nFramesCount; i++) { - if ((mode == 1 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].OwnerWindow) || - (mode == 2 && g_pfwFrames[i].OwnerWindow == (HWND)-2) || - (mode == 3)) - if (g_pfwFrames[i].floating) { - CLUIFrameResizeFloatingFrame(i); - } - else { - CLUIFrameMoveResize(&g_pfwFrames[i]); - }; - } - if (IsWindowVisible(pcli->hwndContactList)) { - ske_DrawNonFramedObjects(1, 0); - CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, 0, 0); - } - g_CluiData.mutexPreventDockMoving = 1; - return 0; -} - -static int _us_DoUpdateFrame(WPARAM wParam, LPARAM lParam) -{ - if (_fCluiFramesModuleNotStarted) - return -1; - if (wParam == -1) { - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - return 0; - } - if (lParam&FU_FMPOS) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 1); - - int pos = id2pos(wParam); - if (pos < 0 || pos >= g_nFramesCount) - return -1; - if (lParam&FU_TBREDRAW) - CLUIFramesForceUpdateTB(&g_pfwFrames[pos]); - if (lParam&FU_FMREDRAW) - CLUIFramesForceUpdateFrame(&g_pfwFrames[pos]); - return 0; -} - -int CLUIFrames_OnClistResize_mod(WPARAM, LPARAM mode) -{ - int tick; - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); - g_CluiData.nGapBetweenTitlebar = db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); - if (_fCluiFramesModuleNotStarted) return -1; - - RECT nRect; - GetClientRect(pcli->hwndContactList, &nRect); - - nRect.left += g_CluiData.LeftClientMargin; - nRect.right -= g_CluiData.RightClientMargin; - nRect.top += g_CluiData.TopClientMargin; - nRect.bottom -= g_CluiData.BottomClientMargin; - // g_CluiData.mutexPreventDockMoving = 0; - tick = GetTickCount(); - CLUIFramesResize(nRect); - if (mode == 0) CLUIFrames_ApplyNewSizes(3); - - tick = GetTickCount() - tick; - - Sleep(0); - - //dont save to database too many times - if (GetTickCount() - _dwLastStoreTick > 1000) { CLUIFramesStoreAllFrames(); _dwLastStoreTick = GetTickCount(); }; - - return 0; -} - -int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode) -{ - RECT nRect; - if (_fCluiFramesModuleNotStarted) return -1; - - g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); - nRect.left = 0; - nRect.top = 0; - nRect.right = r->right - r->left; - nRect.bottom = r->bottom - r->top; - nRect.left += g_CluiData.LeftClientMargin; - nRect.right -= g_CluiData.RightClientMargin; - nRect.top += g_CluiData.TopClientMargin; - nRect.bottom -= g_CluiData.BottomClientMargin; - CLUIFramesResizeFrames(nRect); - for (int i = 0; i < g_nFramesCount; i++) { - int dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left; - int dy = 0;//_window_rect.top-rcOldWindowRect.top; - if (!g_pfwFrames[i].floating) { - if (g_pfwFrames[i].visible && !g_pfwFrames[i].needhide && !IsWindowVisible(g_pfwFrames[i].hWnd)) { - ShowWindow(g_pfwFrames[i].hWnd, SW_SHOW); - if (g_pfwFrames[i].TitleBar.ShowTitleBar) ShowWindow(g_pfwFrames[i].TitleBar.hwnd, SW_SHOW); - } - if (g_pfwFrames[i].OwnerWindow && (INT_PTR)(g_pfwFrames[i].OwnerWindow) != -2) { - if (!(mode & 2)) { - if (NULL != g_pfwFrames[i].OwnerWindow) { /* Wine fix. */ - *PosBatch = DeferWindowPos(*PosBatch, g_pfwFrames[i].OwnerWindow, NULL, g_pfwFrames[i].wndSize.left + r->left, g_pfwFrames[i].wndSize.top + r->top, - g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); - SetWindowPos(g_pfwFrames[i].hWnd, NULL, 0, 0, - g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE/*|SWP_NOSENDCHANGING*/); - } - } - //Frame - if (g_pfwFrames[i].TitleBar.ShowTitleBar) { - SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, - g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); - SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); - UpdateWindow(g_pfwFrames[i].TitleBar.hwnd); - } - } - else { - if (1) { - int res = 0; - // set frame position - res = SetWindowPos(g_pfwFrames[i].hWnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top + dy, - g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, - g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); - } - if (1) { - // set titlebar position - if (g_pfwFrames[i].TitleBar.ShowTitleBar) { - SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, - g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); - SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); - - } - } - UpdateWindow(g_pfwFrames[i].hWnd); - if (g_pfwFrames[i].TitleBar.ShowTitleBar) UpdateWindow(g_pfwFrames[i].TitleBar.hwnd); - }; - } - - } - if (GetTickCount() - _dwLastStoreTick > 1000) { - CLUIFramesStoreAllFrames(); - _dwLastStoreTick = GetTickCount(); - } - return 0; -} - -int CheckFramesPos(RECT *wr) -{ - //CALLED only FROM MainWindow procedure at CLUI.c - if (_fCluiFramesModuleNotStarted) - return -1; - g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); - - for (int i = 0; i < g_nFramesCount; i++) { - int dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left; - int dy = 0;//_window_rect.top-rcOldWindowRect.top; - if (!g_pfwFrames[i].floating && g_pfwFrames[i].visible) { - if (!(g_pfwFrames[i].OwnerWindow && (INT_PTR)(g_pfwFrames[i].OwnerWindow) != -2)) { - RECT r; - GetWindowRect(g_pfwFrames[i].hWnd, &r); - if (r.top - wr->top != g_pfwFrames[i].wndSize.top || r.left - wr->left != g_pfwFrames[i].wndSize.left) - SetWindowPos(g_pfwFrames[i].hWnd, NULL, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); - } - if (g_pfwFrames[i].TitleBar.ShowTitleBar) { - RECT r; - GetWindowRect(g_pfwFrames[i].TitleBar.hwnd, &r); - if (r.top - wr->top != g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar || r.left - wr->left != g_pfwFrames[i].wndSize.left) { - SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, - g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); - SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); - } - } - } - } - - return 0; -} - -int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) -{ - RECT nRect; - int tick; - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); - g_CluiData.nGapBetweenTitlebar = db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); - - if (_fCluiFramesModuleNotStarted) return -1; - - //need to enlarge parent - { - RECT mainRect; - int mainHeight, minHeight; - GetWindowRect(pcli->hwndContactList, &mainRect); - mainHeight = mainRect.bottom - mainRect.top; - minHeight = CLUIFrames_GetTotalHeight(); - if (mainHeight < minHeight) { - BOOL Upward = FALSE; - Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT); - - if (Upward) - mainRect.top = mainRect.bottom - minHeight; - else - mainRect.bottom = mainRect.top + minHeight; - SetWindowPos(pcli->hwndContactList, NULL, mainRect.left, mainRect.top, mainRect.right - mainRect.left, mainRect.bottom - mainRect.top, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING); - } - GetWindowRect(pcli->hwndContactList, &mainRect); - mainHeight = mainRect.bottom - mainRect.top; - } - GetClientRect(pcli->hwndContactList, &nRect); - //$$$ Fixed borders - if (lParam && lParam != 1 && lParam != 2) { - RECT oldRect; - POINT pt; - RECT *newRect = (RECT *)lParam; - int dl, dt, dr, db; - GetWindowRect((HWND)wParam, &oldRect); - pt.x = nRect.left; - pt.y = nRect.top; - ClientToScreen(pcli->hwndContactList, &pt); - dl = pt.x - oldRect.left; - dt = pt.y - oldRect.top; - dr = (oldRect.right - oldRect.left) - (nRect.right - nRect.left) - dl; - db = (oldRect.bottom - oldRect.top) - (nRect.bottom - nRect.top) - dt; - nRect.left = newRect->left + dl; - nRect.top = newRect->top + dt; - nRect.bottom = newRect->bottom - db; - nRect.right = newRect->right - dr; - } - - - //if (db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT))GetWindowRect(pcli->hwndStatus,&rcStatus); - //else rcStatus.top = rcStatus.bottom = 0; - // nRect.top--; - /* $$$ rcStatus.top = rcStatus.bottom = 0; - - - nRect.bottom -= nRect.top; - nRect.bottom -= (rcStatus.bottom-rcStatus.top); - nRect.right -= nRect.left; - nRect.left = 0; - nRect.top = 0; - ContactListHeight = nRect.bottom; $$$*/ - - nRect.left += g_CluiData.LeftClientMargin; - nRect.right -= g_CluiData.RightClientMargin; - nRect.top += g_CluiData.TopClientMargin; - nRect.bottom -= g_CluiData.BottomClientMargin; - - if (nRect.bottom < nRect.top) - nRect.bottom = nRect.top; - _nContactListHeight = nRect.bottom - nRect.top; //$$ - - tick = GetTickCount(); - - - CLUIFramesResize(nRect); - - CLUIFrames_ApplyNewSizes(2); - CLUIFrames_ApplyNewSizes(1); - - //resizing = FALSE; - - tick = GetTickCount() - tick; - - if (pcli->hwndContactList != 0) CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); - if (pcli->hwndContactList != 0) UpdateWindow(pcli->hwndContactList); - - if (lParam == 2) RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); - - - Sleep(0); - - //dont save to database too many times - if (GetTickCount() - _dwLastStoreTick > 1000) { CLUIFramesStoreAllFrames(); _dwLastStoreTick = GetTickCount(); }; - - return 0; -} - -int OnFrameTitleBarBackgroundChange(WPARAM, LPARAM) -{ - if (MirandaExiting()) return 0; - { - AlignCOLLIconToLeft = db_get_b(NULL, "FrameTitleBar", "AlignCOLLIconToLeft", CLCDEFAULT_COLLICONTOLEFT); - - bkColour = sttGetColor("FrameTitleBar", "BkColour", CLCDEFAULT_BKCOLOUR); - bkUseWinColours = db_get_b(NULL, "FrameTitleBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); - SelBkColour = sttGetColor("FrameTitleBar", "TextColour", CLCDEFAULT_TEXTCOLOUR); - - if (hBmpBackground) { - DeleteObject(hBmpBackground); - hBmpBackground = NULL; - } - if (g_CluiData.fDisableSkinEngine) { - if (db_get_b(NULL, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrT tszBitmapName(db_get_tsa(NULL, "FrameTitleBar", "BkBitmap")); - if (tszBitmapName) - hBmpBackground = Bitmap_Load(tszBitmapName); - } - backgroundBmpUse = db_get_w(NULL, "FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); - } - } - - CLUI__cliInvalidateRect(pcli->hwndContactList, 0, 0); - - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); - return 0; -} - -void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColour, DWORD backgroundBmpUse) -{ - HDC hdc; - RECT clRect, *rcPaint; - - int yScroll = 0; - PAINTSTRUCT paintst = { 0 }; - - //InvalidateRect(hwnd, 0, FALSE); - - HFONT hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); - - if (mhdc) { - hdc = mhdc; - rcPaint = NULL; - } - else { - hdc = BeginPaint(hwnd, &paintst); - rcPaint = &(paintst.rcPaint); - } - - GetClientRect(hwnd, &clRect); - if (rcPaint == NULL) rcPaint = &clRect; - if (rcPaint->right - rcPaint->left == 0 || rcPaint->top - rcPaint->bottom == 0) rcPaint = &clRect; - HDC hdcMem = CreateCompatibleDC(hdc); - HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL); - HBITMAP hOldBmp = (HBITMAP)SelectObject(hdcMem, hBmpOsb); - HFONT oFont = (HFONT)SelectObject(hdcMem, hFont); - SetBkMode(hdcMem, TRANSPARENT); - SetStretchBltMode(hdcMem, HALFTONE); - HBRUSH hBrush = CreateSolidBrush(bkColour); - FillRect(hdcMem, rcPaint, hBrush); - DeleteObject(hBrush); - if (hBmpBackground) { - BITMAP bmp; - int destw, desth; - - GetObject(hBmpBackground, sizeof(bmp), &bmp); - HDC hdcBmp = CreateCompatibleDC(hdcMem); - SelectObject(hdcBmp, hBmpBackground); - int y = backgroundBmpUse & CLBF_SCROLL ? -yScroll : 0; - int maxx = backgroundBmpUse & CLBF_TILEH ? clRect.right : 1; - int maxy = backgroundBmpUse & CLBF_TILEV ? rcPaint->bottom : y + 1; - switch (backgroundBmpUse & CLBM_TYPE) { - case CLB_STRETCH: - if (backgroundBmpUse & CLBF_PROPORTIONAL) { - if (clRect.right*bmp.bmHeight < clRect.bottom*bmp.bmWidth) { - desth = clRect.bottom; - destw = desth*bmp.bmWidth / bmp.bmHeight; - } - else { - destw = clRect.right; - //desth = destw*bmp.bmHeight / bmp.bmWidth; - } - } - else { - destw = clRect.right; - //desth = clRect.bottom; - } - break; - case CLB_STRETCHH: - if (backgroundBmpUse & CLBF_PROPORTIONAL) { - destw = clRect.right; - //desth = destw*bmp.bmHeight / bmp.bmWidth; - } - else { - destw = clRect.right; - //desth = bmp.bmHeight; - } - break; - case CLB_STRETCHV: - if (backgroundBmpUse & CLBF_PROPORTIONAL) { - desth = clRect.bottom; - destw = desth*bmp.bmWidth / bmp.bmHeight; - } - else { - destw = bmp.bmWidth; - //desth = clRect.bottom; - } - break; - default: //clb_topleft - destw = bmp.bmWidth; - //desth = bmp.bmHeight; - break; - } - desth = clRect.bottom - clRect.top; - for (; y < maxy; y += desth) { - if (y < rcPaint->top - desth) continue; - for (int x = 0; x < maxx; x += destw) - StretchBlt(hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); - } - DeleteDC(hdcBmp); - } - - { - - BitBlt(hdc, rcPaint->left, rcPaint->top, rcPaint->right - rcPaint->left, rcPaint->bottom - rcPaint->top, hdcMem, rcPaint->left, rcPaint->top, SRCCOPY); - - SelectObject(hdcMem, hOldBmp); - SelectObject(hdcMem, oFont); - DeleteObject(hBmpOsb); - DeleteDC(hdcMem); - paintst.fErase = FALSE; - //DeleteObject(hFont); - if (!mhdc) { - EndPaint(hwnd, &paintst); - } - } -} - - -int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid) -{ - BOOL bThemed = FALSE; - HDC hdcMem; - RECT rc = *rect; - HBITMAP b1 = NULL, b2 = NULL; - hdcMem = CreateCompatibleDC(hdcMem2); - - SetBkMode(hdcMem, TRANSPARENT); - HFONT hoTTBFont = (HFONT)SelectObject(hdcMem, _hTitleBarFont); - ske_ResetTextEffect(hdcMem); - ske_ResetTextEffect(hdcMem2); - HBRUSH hBack = GetSysColorBrush(COLOR_3DFACE); - HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBack); - - int pos = id2pos(Frameid); - - if (pos >= 0 && pos < g_nFramesCount) { - GetClientRect(g_pfwFrames[pos].TitleBar.hwnd, &rc); - if (g_pfwFrames[pos].floating) { - - rc.bottom = rc.top + g_nTitleBarHeight; - g_pfwFrames[pos].TitleBar.wndSize = rc; - } - else { - g_pfwFrames[pos].TitleBar.wndSize = rc; - } - b1 = ske_CreateDIB32(rc.right - rc.left, rc.bottom - rc.top); - b2 = (HBITMAP)SelectObject(hdcMem, b1); - if (g_pfwFrames[pos].floating && !g_CluiData.fDisableSkinEngine) { - FillRect(hdcMem, &rc, hBack); - //SelectObject(hdcMem,hoBrush); - SkinDrawGlyph(hdcMem, &rc, &rc, "Main,ID=FrameCaption"); - } - else { - if (g_CluiData.fDisableSkinEngine) { - if (!hBmpBackground && bkUseWinColours && xpt_IsThemed(_hFrameTitleTheme)) { - int state = CS_ACTIVE; - // if (GetForegroundWindow() != pcli->hwndContactList) state = CS_INACTIVE; - xpt_DrawThemeBackground(_hFrameTitleTheme, hdcMem, WP_SMALLCAPTION, state, &rc, &rc); - bThemed = TRUE; - } - else - DrawBackGround(g_pfwFrames[pos].TitleBar.hwnd, hdcMem, hBmpBackground, bkColour, backgroundBmpUse); - } - else if (!g_CluiData.fLayered) { - ske_BltBackImage(g_pfwFrames[pos].TitleBar.hwnd, hdcMem, &rc); - } - else BitBlt(hdcMem, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hdcMem2, rect->left, rect->top, SRCCOPY); - SkinDrawGlyph(hdcMem, &rc, &rc, "Main,ID=FrameCaption"); - } - if (bThemed) - SetTextColor(hdcMem, GetSysColor(COLOR_CAPTIONTEXT)); - else - SetTextColor(hdcMem, SelBkColour); - - RECT textrc = rc; - if (!AlignCOLLIconToLeft) { - - if (g_pfwFrames[pos].TitleBar.hicon != NULL) { - ske_DrawIconEx(hdcMem, rc.left + 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CYSMICON) >> 1)), g_pfwFrames[pos].TitleBar.hicon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); - textrc.left += GetSystemMetrics(SM_CXSMICON) + 4; - textrc.top += 2; - } - else { - textrc.left += 2; - textrc.top += 2; - } - } - else { - textrc.left += GetSystemMetrics(SM_CXSMICON) + 2; - textrc.top += 2; - } - ske_TextOut(hdcMem, textrc.left, textrc.top, g_pfwFrames[pos].TitleBar.tbname, (int)mir_tstrlen(g_pfwFrames[pos].TitleBar.tbname)); - - if (!AlignCOLLIconToLeft) - ske_DrawIconEx(hdcMem, g_pfwFrames[pos].TitleBar.wndSize.right - GetSystemMetrics(SM_CXSMICON) - 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); - else - ske_DrawIconEx(hdcMem, rc.left, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); - } - - if (g_pfwFrames[pos].floating || (!g_CluiData.fLayered)) { - HRGN rgn = CreateRectRgn(rect->left, rect->top, rect->right, rect->bottom); - SelectClipRgn(hdcMem2, rgn); - BitBlt(hdcMem2, rect->left, rect->top, rc.right - rc.left, rc.bottom - rc.top, hdcMem, 0, 0, SRCCOPY); - DeleteObject(rgn); - } - else BitBlt(hdcMem2, rect->left, rect->top, rc.right - rc.left, rc.bottom - rc.top, hdcMem, 0, 0, SRCCOPY); - - SelectObject(hdcMem, b2); - DeleteObject(b1); - SelectObject(hdcMem, hoTTBFont); - SelectObject(hdcMem, hoBrush); - DeleteDC(hdcMem); - return 0; -} - -static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - static int s_nLastByPos = -1; - static int s_nOldFrameHeight = -1; - static int s_nCurDragBar = -1; - - RECT rect; - int Frameid, Framemod, direction; - int xpos, ypos; - - Frameid = (GetWindowLongPtr(hwnd, GWLP_USERDATA)); - memset(&rect, 0, sizeof(rect)); - - switch (msg) { - case WM_CREATE: - if (!_hFrameTitleTheme) - _hFrameTitleTheme = xpt_AddThemeHandle(hwnd, L"WINDOW"); - SendMessage(hwnd, WM_SETFONT, (WPARAM)_hTitleBarFont, 0); - return FALSE; - - case WM_MEASUREITEM: - return Menu_MeasureItem((LPMEASUREITEMSTRUCT)lParam); - - case WM_DRAWITEM: - return Menu_DrawItem((LPDRAWITEMSTRUCT)lParam); - - case WM_USER + 100: - return 1; - - case WM_ENABLE: - if (hwnd != 0) CLUI__cliInvalidateRect(hwnd, NULL, FALSE); - return 0; - - case WM_ERASEBKGND: - return 1; - - case WM_COMMAND: - if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), 0), Frameid)) - break; - - if (HIWORD(wParam) == 0) {//mouse events for self created menu - int framepos = id2pos(Frameid); - if (framepos == -1) { break; }; - - switch (LOWORD(wParam)) { - case frame_menu_lock: - g_pfwFrames[framepos].Locked = !g_pfwFrames[framepos].Locked; - break; - case frame_menu_visible: - g_pfwFrames[framepos].visible = !g_pfwFrames[framepos].visible; - break; - case frame_menu_showtitlebar: - g_pfwFrames[framepos].TitleBar.ShowTitleBar = !g_pfwFrames[framepos].TitleBar.ShowTitleBar; - break; - case frame_menu_floating: - CLUIFrames_SetFrameFloat(Frameid, 0); - break; - } - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - } - break; - - case WM_RBUTTONDOWN: - { - HMENU hmenu; - POINT pt; - GetCursorPos(&pt); - - if (ServiceExists(MS_CLIST_MENUBUILDFRAMECONTEXT)) - hmenu = (HMENU)CallService(MS_CLIST_MENUBUILDFRAMECONTEXT, Frameid, 0); - else { - //legacy menu support - int framepos = id2pos(Frameid); - - if (framepos == -1) { break; }; - hmenu = CreatePopupMenu(); - // Frames[Frameid].TitleBar.hmenu = hmenu; - AppendMenu(hmenu, MF_STRING | MF_DISABLED | MF_GRAYED, 15, g_pfwFrames[framepos].name); - AppendMenu(hmenu, MF_SEPARATOR, 16, _T("")); - AppendMenu(hmenu, g_pfwFrames[framepos].Locked ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_lock, TranslateT("Lock frame")); - AppendMenu(hmenu, g_pfwFrames[framepos].visible ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_visible, TranslateT("Visible")); - AppendMenu(hmenu, g_pfwFrames[framepos].TitleBar.ShowTitleBar ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_showtitlebar, TranslateT("Show title bar")); - AppendMenu(hmenu, g_pfwFrames[framepos].floating ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_floating, TranslateT("Floating")); - } - - TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); - DestroyMenu(hmenu); - } - break; - - case WM_LBUTTONDBLCLK: - Framemod = -1; - s_nLastByPos = -1; s_nOldFrameHeight = -1; ReleaseCapture(); - CallService(MS_CLIST_FRAMES_UCOLLFRAME, Frameid, 0); - s_nLastByPos = -1; s_nOldFrameHeight = -1; ReleaseCapture(); - break; - - case WM_LBUTTONUP: - { - if (GetCapture() != hwnd) { break; }; - s_nCurDragBar = -1; s_nLastByPos = -1; s_nOldFrameHeight = -1; ReleaseCapture(); - break; - }; - case WM_LBUTTONDOWN: - { - - int framepos = id2pos(Frameid); - - if (framepos == -1) { break; }; - { - if (g_pfwFrames[framepos].floating) { - - POINT pt; - GetCursorPos(&pt); - g_pfwFrames[framepos].TitleBar.oldpos = pt; - } - } - - //ScreenToClient(Frames[framepos].ContainerWnd,&Frames[framepos].TitleBar.oldpos); - - if ((!(wParam&MK_CONTROL)) && g_pfwFrames[framepos].Locked && (!(g_pfwFrames[framepos].floating))) { - if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { - POINT pt; - int res; - //pt = nm->pt; - GetCursorPos(&pt); - res = SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); - return res; - } - }; - - if (g_pfwFrames[framepos].floating) { - RECT rc; - GetCursorPos(&ptOld); - //ClientToScreen(hwnd,&ptOld); - GetWindowRect(hwnd, &rc); - - nLeft = (short)rc.left; - nTop = (short)rc.top; - }; - - SetCapture(hwnd); - - - break; - }; - case WM_MOUSEMOVE: - { - POINT pt, pt2; - RECT wndr; - int pos; - //tbinfo - { - TCHAR TBcapt[255]; - pos = id2pos(Frameid); - if (pos != -1) { - int oldflags; - - mir_sntprintf(TBcapt, _countof(TBcapt), _T("%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d"), - g_pfwFrames[pos].name, g_pfwFrames[pos].height, g_pfwFrames[pos].visible, g_pfwFrames[pos].floating, - g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, - g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y, - g_pfwFrames[pos].order); - - oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, g_pfwFrames[pos].id), 0); - if (!(oldflags&F_SHOWTBTIP)) { - oldflags |= F_SHOWTBTIP; - //CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,Frames[pos].id),(LPARAM)oldflags); - }; - //CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBTIPNAME,Frames[pos].id),(LPARAM)TBcapt); - }; - - - - } - // - if ((wParam&MK_LBUTTON)/* && (wParam&MK_CONTROL)*/) { - RECT rcMiranda; - RECT rcwnd, rcOverlap; - POINT newpt, ofspt, curpt, newpos; - //if (GetCapture() != hwnd){break;}; - //curdragbar = -1;lbypos = -1;oldframeheight = -1;ReleaseCapture(); - - pos = id2pos(Frameid); - if (g_pfwFrames[pos].floating) { - - GetCursorPos(&curpt); - rcwnd.bottom = curpt.y + 5; - rcwnd.top = curpt.y; - rcwnd.left = curpt.x; - rcwnd.right = curpt.x + 5; - - GetWindowRect(pcli->hwndContactList, &rcMiranda); - //GetWindowRect( Frames[pos].ContainerWnd, &rcwnd ); - //IntersectRect( &rcOverlap, &rcwnd, &rcMiranda ) - if (IsWindowVisible(pcli->hwndContactList) && IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { - int id = g_pfwFrames[pos].id; - - - - - ofspt.x = 0; ofspt.y = 0; - ClientToScreen(g_pfwFrames[pos].TitleBar.hwnd, &ofspt); - ofspt.x = curpt.x - ofspt.x; ofspt.y = curpt.y - ofspt.y; - - CLUIFrames_SetFrameFloat(id, 0); - newpt.x = 0; newpt.y = 0; - ClientToScreen(g_pfwFrames[pos].TitleBar.hwnd, &newpt); - SetCursorPos(newpt.x + ofspt.x, newpt.y + ofspt.y); - GetCursorPos(&curpt); - - g_pfwFrames[pos].TitleBar.oldpos = curpt; - - return 0; - }; - - } - else { - int id = g_pfwFrames[pos].id; - - GetCursorPos(&curpt); - rcwnd.bottom = curpt.y + 5; - rcwnd.top = curpt.y; - rcwnd.left = curpt.x; - rcwnd.right = curpt.x + 5; - - GetWindowRect(pcli->hwndContactList, &rcMiranda); - //GetWindowRect( Frames[pos].ContainerWnd, &rcwnd ); - //IntersectRect( &rcOverlap, &rcwnd, &rcMiranda ) - - - if (!IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { - GetCursorPos(&curpt); - GetWindowRect(g_pfwFrames[pos].hWnd, &rcwnd); - rcwnd.left = rcwnd.right - rcwnd.left; - rcwnd.top = rcwnd.bottom - rcwnd.top; - newpos.x = curpt.x; newpos.y = curpt.y; - if (curpt.x >= (rcMiranda.right - 1)) { newpos.x = curpt.x + 5; }; - if (curpt.x <= (rcMiranda.left + 1)) { newpos.x = curpt.x - (rcwnd.left) - 5; }; - if (curpt.y >= (rcMiranda.bottom - 1)) { newpos.y = curpt.y + 5; }; - if (curpt.y <= (rcMiranda.top + 1)) { newpos.y = curpt.y - (rcwnd.top) - 5; }; - ofspt.x = 0; ofspt.y = 0; - //ClientToScreen(Frames[pos].TitleBar.hwnd,&ofspt); - GetWindowRect(g_pfwFrames[pos].TitleBar.hwnd, &rcwnd); - ofspt.x = curpt.x - ofspt.x; ofspt.y = curpt.y - ofspt.y; - - g_pfwFrames[pos].FloatingPos.x = newpos.x; - g_pfwFrames[pos].FloatingPos.y = newpos.y; - CLUIFrames_SetFrameFloat(id, 0); - //SetWindowPos(Frames[pos].ContainerWnd, 0, newpos.x,newpos.y, 0, 0, SWP_NOSIZE); - - - newpt.x = 0; newpt.y = 0; - ClientToScreen(g_pfwFrames[pos].TitleBar.hwnd, &newpt); - - GetWindowRect(g_pfwFrames[pos].hWnd, &rcwnd); - SetCursorPos(newpt.x + (rcwnd.right - rcwnd.left) / 2, newpt.y + (rcwnd.bottom - rcwnd.top) / 2); - GetCursorPos(&curpt); - - g_pfwFrames[pos].TitleBar.oldpos = curpt; - return 0; - } - } - } - - if (wParam & MK_LBUTTON) { - int newh = -1, prevold; - - if (GetCapture() != hwnd) { break; }; - - - pos = id2pos(Frameid); - - if (g_pfwFrames[pos].floating) { - GetCursorPos(&pt); - if ((g_pfwFrames[pos].TitleBar.oldpos.x != pt.x) || (g_pfwFrames[pos].TitleBar.oldpos.y != pt.y)) { - - pt2 = pt; - ScreenToClient(hwnd, &pt2); - GetWindowRect(g_pfwFrames[pos].ContainerWnd, &wndr); - { - int dX, dY; - POINT ptNew; - - ptNew.x = pt.x; - ptNew.y = pt.y; - //ClientToScreen( hwnd, &ptNew ); - - dX = ptNew.x - ptOld.x; - dY = ptNew.y - ptOld.y; - - nLeft += (short)dX; - nTop += (short)dY; - - if (!(wParam&MK_CONTROL)) - PositionThumb(&g_pfwFrames[pos], nLeft, nTop); - else - SetWindowPos(g_pfwFrames[pos].ContainerWnd, - HWND_TOPMOST, - nLeft, - nTop, - 0, - 0, - SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); - - ptOld = ptNew; - } - - pt.x = nLeft; - pt.y = nTop; - g_pfwFrames[pos].TitleBar.oldpos = pt; - }; - - //break; - return 0; - } - - if (g_pfwFrames[pos].prevvisframe != -1) { - GetCursorPos(&pt); - - if ((g_pfwFrames[pos].TitleBar.oldpos.x == pt.x) && (g_pfwFrames[pos].TitleBar.oldpos.y == pt.y)) - break; - - ypos = rect.top + pt.y; xpos = rect.left + pt.x; - Framemod = -1; - - if (g_pfwFrames[pos].align == alBottom) { - direction = -1; - Framemod = pos; - } - else { - direction = 1; - Framemod = g_pfwFrames[pos].prevvisframe; - } - if (g_pfwFrames[Framemod].Locked) break; - if (s_nCurDragBar != -1 && s_nCurDragBar != pos) break; - - if (s_nLastByPos == -1) { - s_nCurDragBar = pos; - s_nLastByPos = ypos; - s_nOldFrameHeight = g_pfwFrames[Framemod].height; - SetCapture(hwnd); - break; - } - - newh = s_nOldFrameHeight + direction*(ypos - s_nLastByPos); - if (newh > 0) { - prevold = g_pfwFrames[Framemod].height; - g_pfwFrames[Framemod].height = newh; - if (!CLUIFramesFitInSize()) { g_pfwFrames[Framemod].height = prevold; return TRUE; } - g_pfwFrames[Framemod].height = newh; - if (newh > 3) g_pfwFrames[Framemod].collapsed = TRUE; - - } - g_pfwFrames[pos].TitleBar.oldpos = pt; - } - - if (newh > 0) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - break; - } - s_nCurDragBar = -1; s_nLastByPos = -1; s_nOldFrameHeight = -1; ReleaseCapture(); - } - break; - - case WM_PRINT: - case WM_PRINTCLIENT: - GetClientRect(hwnd, &rect); - if (!g_CluiData.fLayered) - ske_BltBackImage(hwnd, (HDC)wParam, &rect); - - DrawTitleBar((HDC)wParam, &rect, Frameid); - break; - - case WM_SIZE: - InvalidateRect(hwnd, NULL, FALSE); - return DefWindowProc(hwnd, msg, wParam, lParam); - - case WM_PAINT: - if (g_pfwFrames[id2pos(Frameid)].floating || !g_CluiData.fLayered) { - GetClientRect(hwnd, &rect); - HDC paintDC = GetDC(hwnd); - DrawTitleBar(paintDC, &rect, Frameid); - ReleaseDC(hwnd, paintDC); - ValidateRect(hwnd, NULL); - } - return DefWindowProc(hwnd, msg, wParam, lParam); - - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - } - return TRUE; -} -static int CLUIFrameResizeFloatingFrame(int framepos) -{ - RECT rect; - - if (!g_pfwFrames[framepos].floating) { return 0; }; - if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; }; - GetClientRect(g_pfwFrames[framepos].ContainerWnd, &rect); - - int width = rect.right - rect.left; - int height = rect.bottom - rect.top; - - g_pfwFrames[framepos].visible ? CLUI_ShowWindowMod(g_pfwFrames[framepos].ContainerWnd, SW_SHOW/*NOACTIVATE*/) : CLUI_ShowWindowMod(g_pfwFrames[framepos].ContainerWnd, SW_HIDE); - - - - if (g_pfwFrames[framepos].TitleBar.ShowTitleBar) { - CLUI_ShowWindowMod(g_pfwFrames[framepos].TitleBar.hwnd, SW_SHOW/*NOACTIVATE*/); - g_pfwFrames[framepos].height = height - DEFAULT_TITLEBAR_HEIGHT; - - SetWindowPos(g_pfwFrames[framepos].TitleBar.hwnd, HWND_TOP, 0, 0, width, DEFAULT_TITLEBAR_HEIGHT, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_DRAWFRAME); - SetWindowPos(g_pfwFrames[framepos].hWnd, HWND_TOP, 0, DEFAULT_TITLEBAR_HEIGHT, width, height - DEFAULT_TITLEBAR_HEIGHT, SWP_SHOWWINDOW); - - } - else { - g_pfwFrames[framepos].height = height; - CLUI_ShowWindowMod(g_pfwFrames[framepos].TitleBar.hwnd, SW_HIDE); - SetWindowPos(g_pfwFrames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); - - }; - if (g_pfwFrames[framepos].ContainerWnd != 0) UpdateWindow(g_pfwFrames[framepos].ContainerWnd); - GetWindowRect(g_pfwFrames[framepos].hWnd, &g_pfwFrames[framepos].wndSize); - return 0; -}; - -static int CLUIFrameOnMainMenuBuild(WPARAM, LPARAM) -{ - if (MirandaExiting()) return 0; - CLUIFramesLoadMainMenu(); - - return 0; -} - -static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_ACTIVATE: - if (g_bTransparentFlag) { - BYTE alpha; - if ((wParam != WA_INACTIVE || ((HWND)lParam == hwnd) || GetParent((HWND)lParam) == hwnd)) { - HWND hw = lParam ? GetParent((HWND)lParam) : 0; - alpha = db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT); - if (hw) SetWindowPos(hw, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); - CLUI_SmoothAlphaTransition(hwnd, alpha, 1); - } - } - - return DefWindowProc(hwnd, msg, wParam, lParam); - - case WM_NOTIFY: - case WM_PARENTNOTIFY: - case WM_SYSCOMMAND: - return SendMessage(pcli->hwndContactList, msg, wParam, lParam); - - case WM_MOVE: - if (g_CluiData.fDocked) - return 1; - break; - - case WM_WINDOWPOSCHANGING: - if (g_CluiData.mutexPreventDockMoving) { - WINDOWPOS *wp; - wp = (WINDOWPOS*)lParam; - wp->flags |= SWP_NOMOVE/*|SWP_NOSIZE*/; - wp->flags &= (wp->flags&~SWP_NOACTIVATE); - return DefWindowProc(hwnd, msg, wParam, lParam); - } - break; - - case WM_WINDOWPOSCHANGED: - if (g_CluiData.fDocked && g_CluiData.mutexPreventDockMoving) - return 0; - break; - - case WM_NCPAINT: - case WM_PAINT: - return DefWindowProc(hwnd, msg, wParam, lParam); - - case WM_ERASEBKGND: - return 1; - } - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int height) -{ - HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, _T("SubContainerWindow"), WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, 0, g_hInst, 0); - SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_BORDER)); - if (g_CluiData.fOnDesktop) { - HWND hProgMan = FindWindow(_T("Progman"), NULL); - if (IsWindow(hProgMan)) - SetParent(hwnd, hProgMan); - } - - return hwnd; -} - -static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - int framepos, Frameid = GetWindowLongPtr(hwnd, GWLP_USERDATA); - - RECT rect; - memset(&rect, 0, sizeof(rect)); - - switch (msg) { - case WM_CREATE: - framepos = id2pos(Frameid); - return 0; - - case WM_GETMINMAXINFO: - MINMAXINFO minmax; - framepos = id2pos(Frameid); - if (framepos < 0 || framepos >= g_nFramesCount) { break; }; - if (!g_pfwFrames[framepos].minmaxenabled) { break; }; - if (g_pfwFrames[framepos].ContainerWnd == 0) { break; }; - - if (g_pfwFrames[framepos].Locked) { - RECT rct; - - GetWindowRect(hwnd, &rct); - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = rct.right - rct.left; - ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = rct.bottom - rct.top; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = rct.right - rct.left; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom - rct.top; - // - //return 0; - } - - memset(&minmax, 0, sizeof(minmax)); - if (SendMessage(g_pfwFrames[framepos].hWnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax) == 0) { - RECT border; - int tbh = g_nTitleBarHeight*btoint(g_pfwFrames[framepos].TitleBar.ShowTitleBar); - GetBorderSize(hwnd, &border); - if (minmax.ptMaxTrackSize.x != 0 && minmax.ptMaxTrackSize.y != 0) { - - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = minmax.ptMinTrackSize.x; - ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = minmax.ptMinTrackSize.y; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = minmax.ptMaxTrackSize.x + border.left + border.right; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = minmax.ptMaxTrackSize.y + tbh + border.top + border.bottom; - } - } - else return(DefWindowProc(hwnd, msg, wParam, lParam)); - - case WM_MOVE: - framepos = id2pos(Frameid); - if (framepos < 0 || framepos >= g_nFramesCount) - break; - if (g_pfwFrames[framepos].ContainerWnd == 0) - return 0; - - GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect); - g_pfwFrames[framepos].FloatingPos.x = rect.left; - g_pfwFrames[framepos].FloatingPos.y = rect.top; - g_pfwFrames[framepos].FloatingSize.x = rect.right - rect.left; - g_pfwFrames[framepos].FloatingSize.y = rect.bottom - rect.top; - - CLUIFramesStoreFrameSettings(framepos); - - if (g_pfwFrames[framepos].floating) { - POINT curpt, ofspt, newpt, newpos; - RECT rcwnd, rcOverlap, rcMiranda; - - GetCursorPos(&curpt); - rcwnd.bottom = curpt.y + 5; - rcwnd.top = curpt.y; - rcwnd.left = curpt.x; - rcwnd.right = curpt.x + 5; - - GetWindowRect(pcli->hwndContactList, &rcMiranda); - if (IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { - GetCursorPos(&curpt); - GetWindowRect(g_pfwFrames[framepos].hWnd, &rcwnd); - rcwnd.left = rcwnd.right - rcwnd.left; - rcwnd.top = rcwnd.bottom - rcwnd.top; - newpos.x = curpt.x; newpos.y = curpt.y; - if (curpt.x >= (rcMiranda.right - 1)) { newpos.x = curpt.x + 5; }; - if (curpt.x <= (rcMiranda.left + 1)) { newpos.x = curpt.x - (rcwnd.left) - 5; }; - if (curpt.y >= (rcMiranda.bottom - 1)) { newpos.y = curpt.y + 5; }; - if (curpt.y <= (rcMiranda.top + 1)) { newpos.y = curpt.y - (rcwnd.top) - 5; }; - ofspt.x = 0; ofspt.y = 0; - GetWindowRect(g_pfwFrames[framepos].TitleBar.hwnd, &rcwnd); - ofspt.x = curpt.x - ofspt.x; ofspt.y = curpt.y - ofspt.y; - - g_pfwFrames[framepos].FloatingPos.x = newpos.x; - g_pfwFrames[framepos].FloatingPos.y = newpos.y; - CLUIFrames_SetFrameFloat(Frameid, 0); - - newpt.x = 0; newpt.y = 0; - ClientToScreen(g_pfwFrames[framepos].TitleBar.hwnd, &newpt); - - GetWindowRect(g_pfwFrames[framepos].hWnd, &rcwnd); - SetCursorPos(newpt.x + (rcwnd.right - rcwnd.left) / 2, newpt.y + (rcwnd.bottom - rcwnd.top) / 2); - GetCursorPos(&curpt); - - g_pfwFrames[framepos].TitleBar.oldpos = curpt; - return 0; - } - } - - return 0; - - case WM_SIZE: - CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); - - framepos = id2pos(Frameid); - - if (framepos < 0 || framepos >= g_nFramesCount) { break; }; - if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; }; - CLUIFrameResizeFloatingFrame(framepos); - - GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect); - g_pfwFrames[framepos].FloatingPos.x = rect.left; - g_pfwFrames[framepos].FloatingPos.y = rect.top; - g_pfwFrames[framepos].FloatingSize.x = rect.right - rect.left; - g_pfwFrames[framepos].FloatingSize.y = rect.bottom - rect.top; - - CLUIFramesStoreFrameSettings(framepos); - return 0; - - case WM_LBUTTONDOWN: - if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { - POINT pt; - GetCursorPos(&pt); - return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); - } - break; - - case WM_CLOSE: - DestroyWindow(hwnd); - break; - - case WM_DESTROY: - return 0; - } - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height) -{ - return CreateWindow(_T("FramesContainer"), _T("FramesContainer"), WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0); -} - -static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) -{ - HWND hwndtmp, hwndtooltiptmp; - - int pos = id2pos(wParam); - if (pos < 0 || pos >= g_nFramesCount) - return 0; - - if (g_pfwFrames[pos].floating || (lParam & 2)) { - if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].visible) { - if (g_pfwFrames[pos].OwnerWindow == 0) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10); - CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); - SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].OwnerWindow); - SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList); - SetWindowLongPtr(g_pfwFrames[pos].OwnerWindow, GWLP_USERDATA, g_pfwFrames[pos].id); - g_pfwFrames[pos].floating = FALSE; - if (!(lParam & 2)) { - DestroyWindow(g_pfwFrames[pos].ContainerWnd); - g_pfwFrames[pos].ContainerWnd = 0; - } - } - else { - SetParent(g_pfwFrames[pos].hWnd, pcli->hwndContactList); - SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList); - g_pfwFrames[pos].floating = FALSE; - if (g_pfwFrames[pos].ContainerWnd) DestroyWindow(g_pfwFrames[pos].ContainerWnd); - g_pfwFrames[pos].ContainerWnd = 0; - } - } - else { - RECT recttb, rectw, border; - LONG_PTR temp; - int neww, newh; - - g_pfwFrames[pos].oldstyles = GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE); - g_pfwFrames[pos].TitleBar.oldstyles = GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE); - bool locked = g_pfwFrames[pos].Locked; - g_pfwFrames[pos].Locked = FALSE; - g_pfwFrames[pos].minmaxenabled = FALSE; - - GetWindowRect(g_pfwFrames[pos].hWnd, &rectw); - GetWindowRect(g_pfwFrames[pos].TitleBar.hwnd, &recttb); - if (!g_pfwFrames[pos].TitleBar.ShowTitleBar) - recttb.top = recttb.bottom = recttb.left = recttb.right = 0; - - g_pfwFrames[pos].ContainerWnd = CreateContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10); - - SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].ContainerWnd); - SetParent(g_pfwFrames[pos].TitleBar.hwnd, g_pfwFrames[pos].ContainerWnd); - if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].OwnerWindow != 0) { - DestroyWindow(g_pfwFrames[pos].OwnerWindow); - g_pfwFrames[pos].OwnerWindow = 0; - } - - GetBorderSize(g_pfwFrames[pos].ContainerWnd, &border); - - SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWLP_USERDATA, g_pfwFrames[pos].id); - if ((lParam == 1)) { - if (g_pfwFrames[pos].FloatingPos.x < 0) { g_pfwFrames[pos].FloatingPos.x = 0; }; - if (g_pfwFrames[pos].FloatingPos.y < 0) { g_pfwFrames[pos].FloatingPos.y = 0; }; - - SetWindowPos(g_pfwFrames[pos].ContainerWnd, HWND_TOPMOST, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y, SWP_HIDEWINDOW | SWP_NOACTIVATE); - } - else if (lParam == 0) { - neww = rectw.right - rectw.left + border.left + border.right; - newh = (rectw.bottom - rectw.top) + (recttb.bottom - recttb.top) + border.top + border.bottom; - if (neww < 20) { neww = 40; }; - if (newh < 20) { newh = 40; }; - if (g_pfwFrames[pos].FloatingPos.x < 20) { g_pfwFrames[pos].FloatingPos.x = 40; }; - if (g_pfwFrames[pos].FloatingPos.y < 20) { g_pfwFrames[pos].FloatingPos.y = 40; }; - - SetWindowPos(g_pfwFrames[pos].ContainerWnd, HWND_TOPMOST, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, neww, newh, SWP_HIDEWINDOW | SWP_NOACTIVATE); - } - - SetWindowText(g_pfwFrames[pos].ContainerWnd, g_pfwFrames[pos].TitleBar.tbname); - - temp = GetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWL_EXSTYLE); - temp |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST; - SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWL_EXSTYLE, temp); - - g_pfwFrames[pos].floating = TRUE; - g_pfwFrames[pos].Locked = locked; - } - - CLUIFramesStoreFrameSettings(pos); - g_pfwFrames[pos].minmaxenabled = TRUE; - hwndtooltiptmp = g_pfwFrames[pos].TitleBar.hwndTip; - - hwndtmp = g_pfwFrames[pos].ContainerWnd; - - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - if (hwndtmp) - SendMessage(hwndtmp, WM_SIZE, 0, 0); - - SetWindowPos(hwndtooltiptmp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - return 0; -} - -int CLUIFrameOnModulesLoad(WPARAM, LPARAM) -{ - /* HOOK */ - CLUIFramesLoadMainMenu(); - CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, false); - return 0; -} - -int CLUIFrameOnModulesUnload(WPARAM, LPARAM) -{ - g_CluiData.bSTATE = STATE_PREPARETOEXIT; - - if (cont.MIVisible) { - cont.MIVisible = NULL; - _AniAva_OnModulesUnload(); - } - return 0; -} - -int LoadCLUIFramesModule(void) -{ - _cluiFramesModuleCSInitialized = TRUE; - - WNDCLASS wndclass = { 0 }; - wndclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ; - wndclass.lpfnWndProc = CLUIFrameTitleBarProc; - wndclass.hInstance = g_hInst; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE); - wndclass.lpszClassName = CLUIFrameTitleBarClassName; - RegisterClass(&wndclass); - - WNDCLASS subconclass = { 0 }; - subconclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ; - subconclass.lpfnWndProc = CLUIFrameSubContainerProc; - subconclass.hInstance = g_hInst; - subconclass.hCursor = LoadCursor(NULL, IDC_ARROW); - subconclass.lpszClassName = CLUIFrameSubContainerClassName; - RegisterClass(&subconclass); - - //container helper - WNDCLASS cntclass = { 0 }; - cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/ | CS_DROPSHADOW; - cntclass.lpfnWndProc = CLUIFrameContainerWndProc; - cntclass.hInstance = g_hInst; - cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); - cntclass.lpszClassName = _T("FramesContainer"); - RegisterClass(&cntclass); - //end container helper - - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); - - g_nFramesCount = 0; - InitGroupMenus(); - - HookEvent(ME_SYSTEM_MODULESLOADED, CLUIFrameOnModulesLoad); - HookEvent(ME_CLIST_PREBUILDFRAMEMENU, CLUIFramesModifyContextMenuForFrame); - HookEvent(ME_CLIST_PREBUILDMAINMENU, CLUIFrameOnMainMenuBuild); - HookEvent(ME_SYSTEM_PRESHUTDOWN, CLUIFrameOnModulesUnload); - - CreateCluiFramesServices(); - - hWndExplorerToolBar = FindWindowEx(0, 0, _T("Shell_TrayWnd"), NULL); - OnFrameTitleBarBackgroundChange(0, 0); - _fCluiFramesModuleNotStarted = FALSE; - return 0; -} - -static INT_PTR UnloadMainMenu() -{ - CLUIFrameOnModulesUnload(0, 0); - if (cont.MainMenuItem != NULL) { - Menu_RemoveItem(cont.MainMenuItem); - cont.MainMenuItem = NULL; - } - - return (INT_PTR)cont.MainMenuItem; -} - -int UnLoadCLUIFramesModule(void) -{ - _fCluiFramesModuleNotStarted = TRUE; - if (hBmpBackground) { DeleteObject(hBmpBackground); hBmpBackground = NULL; } - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - CLUIFramesStoreAllFrames(); - - UnloadMainMenu(); - for (int i = 0; i < g_nFramesCount; i++) { - if (g_pfwFrames[i].hWnd != pcli->hwndContactTree) - DestroyWindow(g_pfwFrames[i].hWnd); - - g_pfwFrames[i].hWnd = (HWND)-1; - DestroyWindow(g_pfwFrames[i].TitleBar.hwnd); - g_pfwFrames[i].TitleBar.hwnd = (HWND)-1; - if (g_pfwFrames[i].ContainerWnd && g_pfwFrames[i].ContainerWnd != (HWND)(-2) && g_pfwFrames[i].ContainerWnd != (HWND)(-1)) DestroyWindow(g_pfwFrames[i].ContainerWnd); - g_pfwFrames[i].ContainerWnd = (HWND)-1; - if (g_pfwFrames[i].TitleBar.hmenu) - DestroyMenu(g_pfwFrames[i].TitleBar.hmenu); - if (g_pfwFrames[i].OwnerWindow && g_pfwFrames[i].OwnerWindow != (HWND)(-2) && g_pfwFrames[i].OwnerWindow != (HWND)(-1)) - DestroyWindow(g_pfwFrames[i].OwnerWindow); - g_pfwFrames[i].OwnerWindow = (HWND)-2; - if (g_pfwFrames[i].UpdateRgn) DeleteObject(g_pfwFrames[i].UpdateRgn); - - mir_free_and_nil(g_pfwFrames[i].name); - mir_free_and_nil(g_pfwFrames[i].TitleBar.tbname); - mir_free_and_nil(g_pfwFrames[i].TitleBar.tooltip); - - } - free(g_pfwFrames); - g_pfwFrames = NULL; - g_nFramesCount = 0; - UnregisterClass(CLUIFrameTitleBarClassName, g_hInst); - DeleteObject(_hTitleBarFont); - - _cluiFramesModuleCSInitialized = FALSE; - return 0; -} - -static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam) -{ - if (!wParam) return 0; - - // LOOK REQUIRED OR SYNC CALL NEEDED - FRAMEWND *frm = FindFrameByItsHWND((HWND)wParam); - if (!frm) return 0; - if (lParam) - frm->PaintCallbackProc = (tPaintCallbackProc)lParam; - else - frm->PaintCallbackProc = NULL; - return 1; -} - -int CLUIFrames_SetLayeredMode(BOOL fLayeredMode, HWND hwnd) -{ - for (int i = 0; i < g_nFramesCount; i++) { - if (fLayeredMode) { - if (g_pfwFrames[i].visible && GetParent(g_pfwFrames[i].hWnd) == pcli->hwndContactList && g_pfwFrames[i].PaintCallbackProc == NULL) { - //create owner window - g_pfwFrames[i].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[i].FloatingPos.x, g_pfwFrames[i].FloatingPos.y, 10, 10); - SetParent(g_pfwFrames[i].hWnd, g_pfwFrames[i].OwnerWindow); - } - } - else if (GetParent(g_pfwFrames[i].hWnd) == g_pfwFrames[i].OwnerWindow) { - SetParent(g_pfwFrames[i].hWnd, hwnd); - if ((INT_PTR)g_pfwFrames[i].OwnerWindow > 0) { - DestroyWindow(g_pfwFrames[i].OwnerWindow); - g_pfwFrames[i].OwnerWindow = (HWND)-2; - } - } - } - - CLUIFrames_UpdateFrame((WPARAM)-1, 0); //update all frames - return 0; -} - -int CLUIFrames_UpdateBorders() -{ - for (int i = 0; i < g_nFramesCount; i++) { - if (!g_pfwFrames[i].floating) { - LONG_PTR style = GetWindowLongPtr(g_pfwFrames[i].hWnd, GWL_STYLE) & (~WS_BORDER); - if (!g_CluiData.fLayered && g_pfwFrames[i].UseBorder) style |= WS_BORDER; - SetWindowLongPtr(g_pfwFrames[i].hWnd, GWL_STYLE, style); - CLUIFramesModifyMainMenuItems(g_pfwFrames[i].id, 0); - RedrawWindow(g_pfwFrames[i].hWnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); - } - } - - return 0; -} diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h deleted file mode 100644 index 09af1b44f2..0000000000 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h +++ /dev/null @@ -1,135 +0,0 @@ -/* -Miranda ICQ: the free icq client for MS Windows -Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#pragma once - -#ifndef _CLUIFRAMES_H_ -#define _CLUIFRAMES_H_ - -#include "m_skin_eng.h" - -int LoadCLUIFramesModule(void); -int UnLoadCLUIFramesModule(void); -int CLUIFramesGetMinHeight(); -int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam); -int CLUIFrames_GetTotalHeight(); - -typedef struct tagProtocolData { - char *RealName; - int protopos; - boolean show; -} ProtocolData; - -typedef struct -{ - int order; - int realpos; -}SortData; - - - - -//============ -#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign" - -#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop" -#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient" -#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom" -#define CLUIFRAMESSETFLOATING "Set_Floating" - -#define CLUIFRAMESMOVEUPDOWN "CLUIFramesMoveUpDown" -#define CLUIFRAMESMOVEUP "CLUIFramesMoveUp" -#define CLUIFRAMESMOVEDOWN "CLUIFramesMoveDown" - -struct FrameMenuHandles -{ - HGENMENU MainMenuItem; - HGENMENU MIVisible, MITitle, MITBVisible, MILock, MIColl, MIFloating, MIAlignRoot; - HGENMENU MIAlignTop, MIAlignClient, MIAlignBottom; - HGENMENU MIBorder; -}; - -struct FrameTitleBar -{ - HWND hwnd; - HWND TitleBarbutt; - HWND hwndTip; - - LPTSTR tbname; - LPTSTR tooltip; - - HMENU hmenu; - HICON hicon; - - bool ShowTitleBar; - bool ShowTitleBarTip; - COLORREF BackColour; - COLORREF TextColour; - int oldstyles; - POINT oldpos; - RECT wndSize; -}; - -struct DockOpt -{ - HWND hwndLeft; - HWND hwndRight; -}; - -struct FRAMEWND -{ - int id; - HWND hWnd; - RECT wndSize; - LPTSTR name; - int align; - int height; - int dwFlags; - bool Locked; - bool visible; - bool needhide; - bool collapsed; - bool floating; - bool minmaxenabled; - bool UseBorder; - int prevvisframe; - int HeightWhenCollapsed; - FrameTitleBar TitleBar; - FrameMenuHandles MenuHandles; - int oldstyles; - HWND ContainerWnd; - POINT FloatingPos; - POINT FloatingSize; - int order; - DockOpt dockOpt; - HWND OwnerWindow; - tPaintCallbackProc PaintCallbackProc; - sPaintRequest * PaintData; - bool bQueued; - HRGN UpdateRgn; -}; - -#define OFFSET_PROTOPOS 200 -#define OFFSET_VISIBLE 400 - -#define CLUIFrameSubContainerClassName _T("CLUIFrameSubContainer") -#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar") -#define CLUIFrameModule "CLUIFrames" - -#endif diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp deleted file mode 100644 index 5e6a01de74..0000000000 --- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp +++ /dev/null @@ -1,504 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "../hdr/modern_commonheaders.h" -#include "m_clui.h" -#include "../hdr/modern_clist.h" -#include "../hdr/modern_clc.h" - -//////////////////////////////Group MENU///////////////////////// -int hGroupMenuObject; - -HGENMENU hGroupMainMenuItemProxy; -HGENMENU hHideShowMainMenuItem; -HGENMENU hGroupStatusMenuItemProxy; - -HGENMENU hHideOfflineUsersMenuItem; -HGENMENU hHideOfflineUsersOutHereMenuItem; -HGENMENU hHideEmptyGroupsMenuItem; - -HGENMENU hDisableGroupsMenuItem; -HGENMENU hNewGroupMenuItem; -HGENMENU hNewSubGroupMenuItem; - -void InitSubGroupMenus(void); - -//Groupmenu exec param(ownerdata) -typedef struct -{ - char *szServiceName; - int Param1, Param2; -} -GroupMenuExecParam, *lpGroupMenuExecParam; - -INT_PTR BuildGroupMenu(WPARAM, LPARAM) -{ - NotifyEventHooks(g_CluiData.hEventPreBuildGroupMenu, 0, 0); - - HMENU hMenu = CreatePopupMenu(); - Menu_Build(hMenu, hGroupMenuObject); - return (INT_PTR)hMenu; -} - -static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam) -{ - lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_calloc(sizeof(GroupMenuExecParam)); - if (mmep == NULL) - return 0; - - TMO_MenuItem *pmi = (TMO_MenuItem*)lParam; - - // we need just one parametr. - mmep->szServiceName = mir_strdup(pmi->pszService); - GroupMenuParam *gmp = (GroupMenuParam*)wParam; - if (gmp != NULL) { - mmep->Param1 = gmp->wParam; - mmep->Param2 = gmp->lParam; - } - - HGENMENU hNewItem = Menu_AddItem(hGroupMenuObject, pmi, mmep); - - char buf[1024]; - mir_snprintf(buf, "%s/%s", pmi->pszService, pmi->name.a); - Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf); - return (INT_PTR)hNewItem; -} - -INT_PTR GroupMenuonAddService(WPARAM wParam, LPARAM lParam) -{ - MENUITEMINFO *mii = (MENUITEMINFO*)wParam; - if (mii == NULL) - return 0; - - if (hHideShowMainMenuItem == (HANDLE)lParam) { - mii->fMask |= MIIM_STATE; - mii->fState |= MFS_DEFAULT; - - } - if (hGroupMainMenuItemProxy == (HANDLE)lParam) { - mii->fMask |= MIIM_SUBMENU; - mii->hSubMenu = Menu_GetMainMenu(); - } - - if (hGroupStatusMenuItemProxy == (HANDLE)lParam) { - mii->fMask |= MIIM_SUBMENU; - mii->hSubMenu = (HMENU)Menu_GetStatusMenu(); - } - - return TRUE; -} - -//called with: -//wparam - ownerdata -//lparam - lparam from winproc -INT_PTR GroupMenuExecService(WPARAM wParam, LPARAM lParam) -{ - if (wParam != 0) { - lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)wParam; - if (!mir_strcmp(mmep->szServiceName, "Help/AboutCommand")) { - //bug in help.c,it used wparam as parent window handle without reason. - mmep->Param1 = 0; - CallService(mmep->szServiceName, mmep->Param1, lParam); - } - else CallService(mmep->szServiceName, mmep->Param1, mmep->Param2); - } - return 1; -} - -INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam) -{ - lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)lParam; - if (mmep != NULL) { - mir_free(mmep->szServiceName); - mir_free(mmep); - } - - return 0; -} - -INT_PTR HideGroupsHelper(WPARAM, LPARAM) -{ - int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS); - db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal); - SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0); - return 0; -} - -INT_PTR UseGroupsHelper(WPARAM, LPARAM) -{ - int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS); - db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal); - SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, newVal,0); - return 0; -} - -INT_PTR HideOfflineRootHelper(WPARAM, LPARAM) -{ - SendMessage(pcli->hwndContactTree, CLM_SETHIDEOFFLINEROOT, - !SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0), - 0); - return 0; -} - -INT_PTR CreateGroupHelper(WPARAM, LPARAM) -{ - SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0); - SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, 1, 0); - Clist_CreateGroup(0, 0); - return 0; -}; - -static int OnBuildGroupMenu(WPARAM, LPARAM) -{ - if (MirandaExiting()) return 0; - - int flags = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0; - Menu_ModifyItem(hHideOfflineUsersMenuItem, NULL, INVALID_HANDLE_VALUE, flags); - - flags = SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0; - Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags); - - flags = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0; - Menu_ModifyItem(hHideEmptyGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags); - - flags = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? 0 : CMIF_CHECKED; - Menu_ModifyItem(hDisableGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags); - return 0; -} - -static IconItemT iconItem[] = -{ - { LPGENT("New group"), "NewGroup", IDI_NEWGROUP2 } -}; - -void GroupMenus_Init(void) -{ - Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, _countof(iconItem)); -} - -void InitGroupMenus(void) -{ - CreateServiceFunction("CLISTMENUSGroup/ExecService", GroupMenuExecService); - CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu", FreeOwnerDataGroupMenu); - CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService", GroupMenuonAddService); - CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper", HideGroupsHelper); - CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper", UseGroupsHelper); - CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper", HideOfflineRootHelper); - CreateServiceFunction("CLISTMENUSGroup/CreateGroupHelper", CreateGroupHelper); - - CreateServiceFunction("CList/AddGroupMenuItem", AddGroupMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDGROUP, BuildGroupMenu); - - HookEvent(ME_CLIST_PREBUILDGROUPMENU, OnBuildGroupMenu); - - InitSubGroupMenus(); - - // Group menu - hGroupMenuObject = Menu_AddObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService"); - Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); - Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu"); - Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService"); - - // add exit command to menu - CMenuItem mi; - mi.position = 1900000; - mi.pszService = "CloseAction"; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT); - mi.name.a = LPGEN("E&xit"); - AddGroupMenuItem(0, (LPARAM)&mi); - - mi.position = 500; - mi.pszService = MS_CLIST_SHOWHIDE; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE); - mi.name.a = LPGEN("&Hide/show"); - hHideShowMainMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - mi.position = 200000; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER); - mi.pszService = "FindAdd/FindAddCommand"; - mi.name.a = LPGEN("&Find/add contacts..."); - AddGroupMenuItem(0, (LPARAM)&mi); - - mi.position = 300000; - mi.pszService = ""; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MAINMENU); - mi.name.a = LPGEN("&Main menu"); - hGroupMainMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - mi.position = 300100; - mi.pszService = ""; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_STATUS); - mi.name.a = LPGEN("&Status"); - hGroupStatusMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - mi.position = 400000; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS); - mi.pszService = "Options/OptionsCommand"; - mi.name.a = LPGEN("&Options..."); - AddGroupMenuItem(0, (LPARAM)&mi); - - mi.position = 500000; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); - mi.pszService = "Help/AboutCommand"; - mi.name.a = LPGEN("&About"); - AddGroupMenuItem(0, (LPARAM)&mi); - - GroupMenuParam gmp = {}; - mi.flags = 0; - mi.position = 100000; - mi.hIcolibItem = iconItem[0].hIcolib; - mi.pszService = "CLISTMENUSGroup/CreateGroupHelper"; - mi.name.a = LPGEN("&New group"); - hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); - DestroyIcon_protect((HICON)mi.hIcolibItem); - - mi.position = 100001; - mi.hIcolibItem = NULL; - mi.hIcolibItem = NULL; - mi.pszService = MS_CLIST_SETHIDEOFFLINE; - mi.name.a = LPGEN("&Hide offline users"); - gmp.lParam = 0; gmp.wParam = -1; - hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); - - mi.position = 100002; - mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper"; - mi.name.a = LPGEN("Hide &offline users out here"); - hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - mi.position = 100003; - mi.pszService = "CLISTMENUSGroup/HideGroupsHelper"; - mi.name.a = LPGEN("Hide &empty groups"); - hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - mi.position = 100004; - mi.pszService = "CLISTMENUSGroup/UseGroupsHelper"; - mi.name.a = LPGEN("Disable &groups"); - hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); -} - -//////////////////////////////END Group MENU///////////////////////// - -//////////////////////////////SubGroup MENU///////////////////////// - -int hSubGroupMenuObject; - -HANDLE hSubGroupMainMenuItemProxy; -HANDLE hSubGroupStatusMenuItemProxy; - -HGENMENU hHideOfflineUsersHereMenuItem, hShowOfflineUsersHereMenuItem; - -//SubGroupmenu exec param(ownerdata) -typedef struct -{ - char *szServiceName; - int Param1, Param2; -} -SubGroupMenuExecParam, *lpSubGroupMenuExecParam; - -static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM) -{ - BOOL gray1 = FALSE; - BOOL gray2 = FALSE; - BOOL showOfflineinGroup = FALSE; - - ClcGroup *group = (ClcGroup *)wParam; - if (wParam == 0) return 0; - - if (MirandaExiting()) return 0; - //contact->group - - showOfflineinGroup = CLCItems_IsShowOfflineGroup(group); - gray1 = (showOfflineinGroup != FALSE); - gray2 = (group->hideOffline != FALSE); - - if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline - - Menu_EnableItem(hHideOfflineUsersHereMenuItem, !gray1); - Menu_SetChecked(hHideOfflineUsersHereMenuItem, group->hideOffline && !gray1); - - Menu_EnableItem(hShowOfflineUsersHereMenuItem, !gray2); - Menu_SetChecked(hShowOfflineUsersHereMenuItem, showOfflineinGroup && !gray2); - return 0; -} - -INT_PTR BuildSubGroupMenu(WPARAM wParam, LPARAM lParam) -{ - NotifyEventHooks(g_CluiData.hEventPreBuildSubGroupMenu, wParam, 0); - - HMENU hMenu = CreatePopupMenu(); - Menu_Build(hMenu, hSubGroupMenuObject, wParam, lParam); - return (INT_PTR)hMenu; -} - -HMENU cliBuildGroupPopupMenu(ClcGroup *group) -{ - return (HMENU)CallService(MS_CLIST_MENUBUILDSUBGROUP, (WPARAM)group, 0); -} - -static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam) -{ - lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_calloc(sizeof(SubGroupMenuExecParam)); - if (mmep == NULL) - return 0; - - TMO_MenuItem *pmi = (TMO_MenuItem*)lParam; - // we need just one parametr. - mmep->szServiceName = mir_strdup(pmi->pszService); - GroupMenuParam *gmp = (GroupMenuParam*)wParam; - if (gmp != NULL) { - mmep->Param1 = gmp->wParam; - mmep->Param2 = gmp->lParam; - } - - HGENMENU hNewItem = Menu_AddItem(hSubGroupMenuObject, pmi, mmep); - - char buf[1024]; - mir_snprintf(buf, "%s/%s", pmi->pszService, pmi->name.a); - Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf); - return (INT_PTR)hNewItem; -} - -INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM) -{ - TCheckProcParam * CParam = (TCheckProcParam*)wParam; - if (CParam) { - lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)(CParam->MenuItemOwnerData); - if (mmep) - mmep->Param2 = CParam->lParam; - } - return 1; -} - -INT_PTR SubGroupMenuonAddService(WPARAM wParam, LPARAM) -{ - MENUITEMINFO *mii = (MENUITEMINFO*)wParam; - if (mii == NULL) - return 0; - - return TRUE; -} - -//called with: -//wparam - ownerdata -//lparam - lparam from winproc -INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam) -{ - if (wParam != 0) { - lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)wParam; - if (!mir_strcmp(mmep->szServiceName, "Help/AboutCommand")) { - //bug in help.c,it used wparam as parent window handle without reason. - mmep->Param1 = 0; - CallService(mmep->szServiceName, mmep->Param1, lParam); - } - else CallService(mmep->szServiceName, mmep->Param1, lParam); - } - return 1; -} - -INT_PTR FreeOwnerDataSubGroupMenu(WPARAM, LPARAM lParam) -{ - lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)lParam; - if (mmep != NULL){ - mir_free(mmep->szServiceName); - mir_free(mmep); - } - - return 0; -} - -//wparam menu handle to pass to clc.c -//lparam WM_COMMAND HWND -INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam) -{ - SendMessage(lParam ? (HWND)lParam : (HWND)pcli->hwndContactTree, WM_COMMAND, wParam, 0); - return 0; -} - -void InitSubGroupMenus(void) -{ - CreateServiceFunction("CLISTMENUSSubGroup/ExecService", SubGroupMenuExecService); - CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu", FreeOwnerDataSubGroupMenu); - CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService", SubGroupMenuonAddService); - CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuCheckService", SubGroupMenuCheckService); - CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy", GroupMenuExecProxy); - - CreateServiceFunction("CList/AddSubGroupMenuItem", AddSubGroupMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP, BuildSubGroupMenu); - - HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu); - - // SubGroup menu - hSubGroupMenuObject = Menu_AddObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService"); - Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); - Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"); - Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService"); - Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService"); - - // add exit command to menu - GroupMenuParam gmp; - - CMenuItem mi; - mi.position = 1000; - mi.hIcolibItem = iconItem[0].hIcolib; - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.name.a = LPGEN("&New subgroup"); - gmp.lParam = 0; - gmp.wParam = POPUP_NEWSUBGROUP; - hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); - - mi.position = 1001; - mi.hIcolibItem = NULL; - mi.hIcolibItem = NULL; - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.name.a = LPGEN("&Hide offline users in here"); - gmp.lParam = 0; - gmp.wParam = POPUP_GROUPHIDEOFFLINE; - hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); - - mi.position = 1002; - mi.hIcolibItem = NULL; - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.name.a = LPGEN("&Show offline users in here"); - gmp.lParam = 0; - gmp.wParam = POPUP_GROUPSHOWOFFLINE; - hShowOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.position = 900001; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_RENAME); - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.name.a = LPGEN("&Rename group"); - gmp.lParam = 0; - gmp.wParam = POPUP_RENAMEGROUP; - AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); - - mi.position = 900002; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE); - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.name.a = LPGEN("&Delete group"); - gmp.lParam = 0; - gmp.wParam = POPUP_DELETEGROUP; - AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); -} - -//////////////////////////////END SubGroup MENU///////////////////////// diff --git a/plugins/Clist_modern/src/cluiframes.cpp b/plugins/Clist_modern/src/cluiframes.cpp new file mode 100644 index 0000000000..ae06306bb0 --- /dev/null +++ b/plugins/Clist_modern/src/cluiframes.cpp @@ -0,0 +1,3500 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "stdafx.h" +#include "m_skin_eng.h" +#include "modern_commonprototypes.h" +#include "modern_sync.h" + +// ALL THIS MODULE FUNCTION SHOULD BE EXECUTED FROM MAIN THREAD + +#include "modern_static_cluiframes_service.h" // contain services initialization and proxiation + +static const int UNCOLLAPSED_FRAME_SIZE = 0; +static const int DEFAULT_TITLEBAR_HEIGHT = 18; + +void _AniAva_OnModulesUnload(); +void InitGroupMenus(void); + +// GLOBALS +FRAMEWND *g_pfwFrames = NULL; +int g_nFramesCount = 0; +int g_nTitleBarHeight = DEFAULT_TITLEBAR_HEIGHT; + +// STATIC + +enum { + frame_menu_lock = 1, + frame_menu_visible, + frame_menu_showtitlebar, + frame_menu_floating +}; //legacy menu support + +enum { eUnknownId = -1 }; + +static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam); +static int CLUIFrameResizeFloatingFrame(int framepos); +static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int height); +static BOOL CLUIFramesFitInSize(); +static int RemoveItemFromList(int pos, FRAMEWND **lpFrames, int *FrameItemCount); +static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam); + +static mir_cs _cluiFramesModuleCS; +static BOOL _cluiFramesModuleCSInitialized = FALSE; +static BOOL _fCluiFramesModuleNotStarted = TRUE; +static XPTHANDLE _hFrameTitleTheme = NULL; +static int _nClientFrameId = eUnknownId; //for fast access to frame with alclient properties +static int _iNextFrameId = 100; +static HFONT _hTitleBarFont = NULL; + +// menus +static FrameMenuHandles cont = { NULL }; + +// others +static int _nContactListHeight = 0; +static DWORD _dwLastStoreTick = 0; + +HWND hWndExplorerToolBar; +static int GapBetweenFrames = 1; + +BOOLEAN bMoveTogether; +int recurs_prevent = 0; +static BOOL PreventSizeCalling = FALSE; + +static HBITMAP hBmpBackground; +static int backgroundBmpUse; +static COLORREF bkColour; +static COLORREF SelBkColour; +static BOOL bkUseWinColours; +BYTE AlignCOLLIconToLeft; //will hide frame icon +COLORREF sttGetColor(char * module, char * color, COLORREF defColor); +//for old multiwindow +#define MPCF_CONTEXTFRAMEMENU 3 +POINT ptOld; +short nLeft = 0; +short nTop = 0; + +static int sortfunc(const void *a, const void *b) +{ + SortData *sd1, *sd2; + sd1 = (SortData *)a; + sd2 = (SortData *)b; + if (sd1->order > sd2->order) { return(1); }; + if (sd1->order < sd2->order) return -1;; + return (0); +}; +int CLUIFrames_OnMoving(HWND hwnd, RECT *r) +{ + g_CluiData.mutexPreventDockMoving = 0; + + for (int i = 0; i < g_nFramesCount; i++) { + if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2) { + POINT pt = { 0 }; + RECT wr; + FRAMEWND *Frame = &g_pfwFrames[i]; + + GetWindowRect(hwnd, &wr); + ClientToScreen(hwnd, &pt); + int dx = (r->left - wr.left) + pt.x; + int dy = (r->top - wr.top) + pt.y; + int x = Frame->wndSize.left; + int y = Frame->wndSize.top; + SetWindowPos(Frame->OwnerWindow, NULL, x + dx, y + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS | SWP_DEFERERASE | SWP_NOOWNERZORDER); + }; + + } + g_CluiData.mutexPreventDockMoving = 1; + AniAva_RedrawAllAvatars(FALSE); + return 0; +} + +int SetAlpha(BYTE Alpha) +{ + for (int i = 0; i < g_nFramesCount; i++) { + if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide) { + HWND hwnd = g_pfwFrames[i].OwnerWindow; + long l = GetWindowLongPtr(hwnd, GWL_EXSTYLE); + if (!(l & WS_EX_LAYERED)) { + HWND parent = NULL; + if (g_CluiData.fOnDesktop) { + HWND hProgMan = FindWindow(_T("Progman"), NULL); + if (IsWindow(hProgMan)) + parent = hProgMan; + } + + CLUI_ShowWindowMod(hwnd, SW_HIDE); + SetParent(hwnd, NULL); + SetWindowLongPtr(hwnd, GWL_EXSTYLE, l | WS_EX_LAYERED); + SetParent(hwnd, parent); + if (l&WS_VISIBLE) CLUI_ShowWindowMod(hwnd, SW_SHOW); + } + SetLayeredWindowAttributes(hwnd, g_CluiData.dwKeyColor, Alpha, LWA_ALPHA | LWA_COLORKEY); + } + } + AniAva_RedrawAllAvatars(FALSE); + return 0; +} + + +int CLUIFrames_RepaintSubContainers() +{ + for (int i = 0; i < g_nFramesCount; i++) + if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide) + RedrawWindow(g_pfwFrames[i].hWnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME); + + return 0; +} + +int CLUIFrames_ActivateSubContainers(BOOL active) +{ + for (int i = 0; i < g_nFramesCount; i++) { + if (active && !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide) { + if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { + SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + else SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE); + } + } + return 0; +} + +int CLUIFrames_SetParentForContainers(HWND parent) +{ + g_CluiData.fOnDesktop = (parent && parent != pcli->hwndContactList); + + for (int i = 0; i < g_nFramesCount; i++) { + if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide) { + HWND hwnd = g_pfwFrames[i].OwnerWindow; + SetParent(hwnd, parent); + } + } + return 0; +} + +int CLUIFrames_OnShowHide(int mode) +{ + int prevFrameCount; + for (int i = 0; i < g_nFramesCount; i++) { + if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2) { + // Try to avoid crash on exit due to unlock. + HWND owner = g_pfwFrames[i].OwnerWindow; + HWND Frmhwnd = g_pfwFrames[i].hWnd; + BOOL visible = g_pfwFrames[i].visible; + BOOL needhide = g_pfwFrames[i].needhide; + needhide |= (!g_pfwFrames[i].collapsed || g_pfwFrames[i].height == 0); + prevFrameCount = g_nFramesCount; + ShowWindow(owner, (mode == SW_HIDE || !visible || needhide) ? SW_HIDE : mode); + ShowWindow(Frmhwnd, (mode == SW_HIDE || !visible || needhide) ? SW_HIDE : mode); + } + + if (mode != SW_HIDE) { + SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { + SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + else SetWindowPos(g_pfwFrames[i].OwnerWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE); + } + } + + if (mode != SW_HIDE) + SetForegroundWindow(pcli->hwndContactList); + AniAva_RedrawAllAvatars(TRUE); + return 0; +} + +static int RemoveItemFromList(int pos, FRAMEWND **lpFrames, int *FrameItemCount) +{ + memmove(&((*lpFrames)[pos]), &((*lpFrames)[pos + 1]), sizeof(FRAMEWND)*(*FrameItemCount - pos - 1)); + (*FrameItemCount)--; + (*lpFrames) = (FRAMEWND*)realloc((*lpFrames), sizeof(FRAMEWND)*(*FrameItemCount)); + return 0; +} + +static int id2pos(int id) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + for (int i = 0; i < g_nFramesCount; i++) + if (g_pfwFrames[i].id == id) + return i; + + return -1; +}; + +static int btoint(BOOLEAN b) +{ + if (b) return 1; + return 0; +} + + +static FRAMEWND* FindFrameByWnd(HWND hwnd) +{ + int i; + + if (hwnd == NULL) return(NULL); + + for (i = 0; i < g_nFramesCount; i++) + if ((g_pfwFrames[i].floating) && (g_pfwFrames[i].ContainerWnd == hwnd)) + return(&g_pfwFrames[i]); + + return(NULL); +} + + +int QueueAllFramesUpdating(bool queue) +{ + for (int i = 0; i < g_nFramesCount; i++) { + if (!g_CluiData.fLayered) { + if (queue) + InvalidateRect(g_pfwFrames[i].hWnd, NULL, FALSE); + else + ValidateRect(g_pfwFrames[i].hWnd, NULL); + } + if (g_pfwFrames[i].PaintCallbackProc) { + g_pfwFrames[i].bQueued = queue; + if (g_pfwFrames[i].UpdateRgn) { + DeleteObject(g_pfwFrames[i].UpdateRgn); + } + g_pfwFrames[i].UpdateRgn = 0; + } + } + return queue; +} + +int FindFrameID(HWND FrameHwnd) +{ + if (FrameHwnd == NULL) + return 0; + + FRAMEWND *frm = FindFrameByItsHWND(FrameHwnd); + return (frm) ? frm->id : 0; +} + +FRAMEWND* FindFrameByItsHWND(HWND FrameHwnd) +{ + if (FrameHwnd == NULL) return(NULL); + for (int i = 0; i < g_nFramesCount; i++) + if (g_pfwFrames[i].hWnd == FrameHwnd) + return &g_pfwFrames[i]; + + return NULL; +} + +static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight) +{ + if ((pThumbRight->dockOpt.hwndLeft == NULL) && (pThumbLeft->dockOpt.hwndRight == NULL)) { + pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; + pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; + } +} + + +static void UndockThumbs(FRAMEWND *pThumb1, FRAMEWND *pThumb2) +{ + if ((pThumb1 == NULL) || (pThumb2 == NULL)) + return; + + if (pThumb1->dockOpt.hwndRight == pThumb2->ContainerWnd) + pThumb1->dockOpt.hwndRight = NULL; + + if (pThumb1->dockOpt.hwndLeft == pThumb2->ContainerWnd) + pThumb1->dockOpt.hwndLeft = NULL; + + if (pThumb2->dockOpt.hwndRight == pThumb1->ContainerWnd) + pThumb2->dockOpt.hwndRight = NULL; + + if (pThumb2->dockOpt.hwndLeft == pThumb1->ContainerWnd) + pThumb2->dockOpt.hwndLeft = NULL; +} + +static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) +{ + FRAMEWND *pCurThumb = &g_pfwFrames[0]; + FRAMEWND *pDockThumb = pThumb; + FRAMEWND fakeMainWindow; + FRAMEWND fakeTaskBarWindow; + RECT rc; + RECT rcThumb; + RECT rcOld; + int nNewX; + int nNewY; + int nOffs = 10; + int nWidth; + int nHeight; + POINT pt; + RECT rcLeft; + RECT rcTop; + RECT rcRight; + RECT rcBottom; + BOOL bDocked; + BOOL bDockedLeft; + BOOL bDockedRight; + BOOL bLeading; + int frmidx = 0; + + if (pThumb == NULL) return; + + SIZE sizeScreen; + sizeScreen.cx = GetSystemMetrics(SM_CXSCREEN); + sizeScreen.cy = GetSystemMetrics(SM_CYSCREEN); + + // Get thumb dimnsions + GetWindowRect(pThumb->ContainerWnd, &rcThumb); + nWidth = rcThumb.right - rcThumb.left; + nHeight = rcThumb.bottom - rcThumb.top; + + // Docking to the edges of the screen + nNewX = nX < nOffs ? 0 : nX; + nNewX = nNewX > (sizeScreen.cx - nWidth - nOffs) ? (sizeScreen.cx - nWidth) : nNewX; + nNewY = nY < nOffs ? 0 : nY; + nNewY = nNewY > (sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; + + bLeading = pThumb->dockOpt.hwndRight != NULL; + + if (bMoveTogether) { + UndockThumbs(pThumb, FindFrameByWnd(pThumb->dockOpt.hwndLeft)); + GetWindowRect(pThumb->ContainerWnd, &rcOld); + } + + memset(&fakeMainWindow, 0, sizeof(fakeMainWindow)); + fakeMainWindow.ContainerWnd = pcli->hwndContactList; + fakeMainWindow.floating = TRUE; + + memset(&fakeTaskBarWindow, 0, sizeof(fakeTaskBarWindow)); + fakeTaskBarWindow.ContainerWnd = hWndExplorerToolBar; + fakeTaskBarWindow.floating = TRUE; + + + while (pCurThumb != NULL) { + if (pCurThumb->floating) { + + if (pCurThumb != pThumb) { + GetWindowRect(pThumb->ContainerWnd, &rcThumb); + OffsetRect(&rcThumb, nX - rcThumb.left, nY - rcThumb.top); + + GetWindowRect(pCurThumb->ContainerWnd, &rc); + + // These are rects we will dock into + + rcLeft.left = rc.left - nOffs; + rcLeft.top = rc.top - nOffs; + rcLeft.right = rc.left + nOffs; + rcLeft.bottom = rc.bottom + nOffs; + + rcTop.left = rc.left - nOffs; + rcTop.top = rc.top - nOffs; + rcTop.right = rc.right + nOffs; + rcTop.bottom = rc.top + nOffs; + + rcRight.left = rc.right - nOffs; + rcRight.top = rc.top - nOffs; + rcRight.right = rc.right + nOffs; + rcRight.bottom = rc.bottom + nOffs; + + rcBottom.left = rc.left - nOffs; + rcBottom.top = rc.bottom - nOffs; + rcBottom.right = rc.right + nOffs; + rcBottom.bottom = rc.bottom + nOffs; + + + bDockedLeft = FALSE; + bDockedRight = FALSE; + + // Upper-left + pt.x = rcThumb.left; + pt.y = rcThumb.top; + bDocked = FALSE; + + if (PtInRect(&rcRight, pt)) { + nNewX = rc.right; + bDocked = TRUE; + } + + if (PtInRect(&rcBottom, pt)) { + nNewY = rc.bottom; + + if (PtInRect(&rcLeft, pt)) { + nNewX = rc.left; + } + } + + if (PtInRect(&rcTop, pt)) { + nNewY = rc.top; + bDockedLeft = bDocked; + } + + // Upper-right + pt.x = rcThumb.right; + pt.y = rcThumb.top; + bDocked = FALSE; + + if (!bLeading && PtInRect(&rcLeft, pt)) { + if (!bDockedLeft) { + nNewX = rc.left - nWidth; + bDocked = TRUE; + } + else if (rc.right == rcThumb.left) { + bDocked = TRUE; + } + } + + + if (PtInRect(&rcBottom, pt)) { + nNewY = rc.bottom; + + if (PtInRect(&rcRight, pt)) { + nNewX = rc.right - nWidth; + } + } + + if (!bLeading && PtInRect(&rcTop, pt)) { + nNewY = rc.top; + bDockedRight = bDocked; + } + + if (bMoveTogether) { + if (bDockedRight) { + DockThumbs(pThumb, pCurThumb); + } + + if (bDockedLeft) { + DockThumbs(pCurThumb, pThumb); + } + } + + // Lower-left + pt.x = rcThumb.left; + pt.y = rcThumb.bottom; + + if (PtInRect(&rcRight, pt)) { + nNewX = rc.right; + } + + if (PtInRect(&rcTop, pt)) { + nNewY = rc.top - nHeight; + + if (PtInRect(&rcLeft, pt)) { + nNewX = rc.left; + } + } + + + // Lower-right + pt.x = rcThumb.right; + pt.y = rcThumb.bottom; + + if (!bLeading && PtInRect(&rcLeft, pt)) { + nNewX = rc.left - nWidth; + } + + if (!bLeading && PtInRect(&rcTop, pt)) { + nNewY = rc.top - nHeight; + + if (PtInRect(&rcRight, pt)) { + nNewX = rc.right - nWidth; + } + } + } + + }; + frmidx++; + if (pCurThumb->ContainerWnd == fakeTaskBarWindow.ContainerWnd) { break; }; + if (pCurThumb->ContainerWnd == fakeMainWindow.ContainerWnd) { + pCurThumb = &fakeTaskBarWindow; continue; + }; + if (frmidx == g_nFramesCount) { + pCurThumb = &fakeMainWindow; continue; + } + + pCurThumb = &g_pfwFrames[frmidx]; + + + + } + + // Adjust coords once again + nNewX = nNewX < nOffs ? 0 : nNewX; + nNewX = nNewX > (sizeScreen.cx - nWidth - nOffs) ? (sizeScreen.cx - nWidth) : nNewX; + nNewY = nNewY < nOffs ? 0 : nNewY; + nNewY = nNewY > (sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; + + + SetWindowPos(pThumb->ContainerWnd, + HWND_TOPMOST, + nNewX, + nNewY, + 0, + 0, + SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + + + // OK, move all g_CluiData.fDocked thumbs + if (bMoveTogether) { + pDockThumb = FindFrameByWnd(pDockThumb->dockOpt.hwndRight); + + PositionThumb(pDockThumb, (short)(nNewX + nWidth), (short)nNewY); + } +} + + + +static void GetBorderSize(HWND hwnd, RECT *rect) +{ + RECT wr, cr; + POINT pt1, pt2; + // RECT r = {0}; + // *rect = r; + // return; + GetWindowRect(hwnd, &wr); + GetClientRect(hwnd, &cr); + pt1.y = cr.top; pt1.x = cr.left; + pt2.y = cr.bottom; pt2.x = cr.right; + + ClientToScreen(hwnd, &pt1); + ClientToScreen(hwnd, &pt2); + + cr.top = pt1.y; cr.left = pt1.x; + cr.bottom = pt2.y; cr.right = pt2.x; + + rect->top = cr.top - wr.top; + rect->left = cr.left - wr.left; + rect->right = wr.right - cr.right; + rect->bottom = wr.bottom - cr.bottom; + //if (rect->top+rect->bottom>10){rect->top = rect->bottom = 2;}; + //if (rect->left+rect->right>10){rect->top = rect->bottom = 2;}; + +}; + +static char __inline *AS(char *str, const char *setting, char *addstr) +{ + if (str != NULL) { + mir_strcpy(str, setting); + mir_strcat(str, addstr); + } + return str; +} + +static int DBLoadFrameSettingsAtPos(int pos, int Frameid) +{ + char sadd[15]; + char buf[255]; + // char *oldtb; + + _itoa(pos, sadd, 10); + + //db_set_s(0, CLUIFrameModule,mir_strcat("Name",sadd),Frames[Frameid].name); + //bool + g_pfwFrames[Frameid].collapsed = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Collapse", sadd), g_pfwFrames[Frameid].collapsed); + + g_pfwFrames[Frameid].Locked = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Locked", sadd), g_pfwFrames[Frameid].Locked); + g_pfwFrames[Frameid].visible = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Visible", sadd), g_pfwFrames[Frameid].visible); + g_pfwFrames[Frameid].TitleBar.ShowTitleBar = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "TBVisile", sadd), g_pfwFrames[Frameid].TitleBar.ShowTitleBar); + + g_pfwFrames[Frameid].height = db_get_w(0, CLUIFrameModule, AS(buf, "Height", sadd), g_pfwFrames[Frameid].height); + g_pfwFrames[Frameid].HeightWhenCollapsed = db_get_w(0, CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), 0); + g_pfwFrames[Frameid].align = db_get_w(0, CLUIFrameModule, AS(buf, "Align", sadd), g_pfwFrames[Frameid].align); + + g_pfwFrames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatX", sadd), 100, 0, 2048); + g_pfwFrames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatY", sadd), 100, 0, 2048); + g_pfwFrames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatW", sadd), 100, 0, 2048); + g_pfwFrames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), 100, 0, 2048); + + g_pfwFrames[Frameid].floating = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Floating", sadd), 0); + g_pfwFrames[Frameid].order = db_get_w(0, CLUIFrameModule, AS(buf, "Order", sadd), 0); + + g_pfwFrames[Frameid].UseBorder = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "UseBorder", sadd), g_pfwFrames[Frameid].UseBorder); + + return 0; +} + +static int DBStoreFrameSettingsAtPos(int pos, int Frameid) +{ + char sadd[16]; + char buf[255]; + + _itoa(pos, sadd, 10); + + db_set_ws(0, CLUIFrameModule, AS(buf, "Name", sadd), g_pfwFrames[Frameid].name); + //bool + db_set_b(0, CLUIFrameModule, AS(buf, "Collapse", sadd), (BYTE)btoint(g_pfwFrames[Frameid].collapsed)); + db_set_b(0, CLUIFrameModule, AS(buf, "Locked", sadd), (BYTE)btoint(g_pfwFrames[Frameid].Locked)); + db_set_b(0, CLUIFrameModule, AS(buf, "Visible", sadd), (BYTE)btoint(g_pfwFrames[Frameid].visible)); + db_set_b(0, CLUIFrameModule, AS(buf, "TBVisile", sadd), (BYTE)btoint(g_pfwFrames[Frameid].TitleBar.ShowTitleBar)); + + db_set_w(0, CLUIFrameModule, AS(buf, "Height", sadd), (WORD)g_pfwFrames[Frameid].height); + db_set_w(0, CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), (WORD)g_pfwFrames[Frameid].HeightWhenCollapsed); + db_set_w(0, CLUIFrameModule, AS(buf, "Align", sadd), (WORD)g_pfwFrames[Frameid].align); + //FloatingPos + db_set_w(0, CLUIFrameModule, AS(buf, "FloatX", sadd), (WORD)g_pfwFrames[Frameid].FloatingPos.x); + db_set_w(0, CLUIFrameModule, AS(buf, "FloatY", sadd), (WORD)g_pfwFrames[Frameid].FloatingPos.y); + db_set_w(0, CLUIFrameModule, AS(buf, "FloatW", sadd), (WORD)g_pfwFrames[Frameid].FloatingSize.x); + db_set_w(0, CLUIFrameModule, AS(buf, "FloatH", sadd), (WORD)g_pfwFrames[Frameid].FloatingSize.y); + + db_set_b(0, CLUIFrameModule, AS(buf, "Floating", sadd), (BYTE)btoint(g_pfwFrames[Frameid].floating)); + db_set_b(0, CLUIFrameModule, AS(buf, "UseBorder", sadd), (BYTE)btoint(g_pfwFrames[Frameid].UseBorder)); + db_set_w(0, CLUIFrameModule, AS(buf, "Order", sadd), (WORD)g_pfwFrames[Frameid].order); + return 0; +} + +static int LocateStorePosition(int Frameid, int maxstored) +{ + if (g_pfwFrames[Frameid].name == NULL) + return -1; + + char settingname[255]; + for (int i = 0; i < maxstored; i++) { + mir_snprintf(settingname, _countof(settingname), "Name%d", i); + DBVARIANT dbv = { 0 }; + if (db_get_ts(NULL, CLUIFrameModule, settingname, &dbv)) + continue; + + if (mir_tstrcmpi(dbv.ptszVal, g_pfwFrames[Frameid].name) == 0) { + db_free(&dbv); + return i; + } + db_free(&dbv); + } + return -1; +} + +static int CLUIFramesLoadFrameSettings(int Frameid) +{ + int storpos, maxstored; + + if (_fCluiFramesModuleNotStarted) return -1; + + if (Frameid < 0 || Frameid >= g_nFramesCount) return -1; + + maxstored = db_get_w(0, CLUIFrameModule, "StoredFrames", -1); + if (maxstored == -1) return 0; + + storpos = LocateStorePosition(Frameid, maxstored); + if (storpos == -1) return 0; + + DBLoadFrameSettingsAtPos(storpos, Frameid); + return 0; +} + +static int CLUIFramesStoreFrameSettings(int Frameid) +{ + int maxstored, storpos; + + if (_fCluiFramesModuleNotStarted) return -1; + + if (Frameid < 0 || Frameid >= g_nFramesCount) return -1; + + maxstored = db_get_w(0, CLUIFrameModule, "StoredFrames", -1); + if (maxstored == -1) maxstored = 0; + + storpos = LocateStorePosition(Frameid, maxstored); + if (storpos == -1) { storpos = maxstored; maxstored++; } + + DBStoreFrameSettingsAtPos(storpos, Frameid); + db_set_w(0, CLUIFrameModule, "StoredFrames", (WORD)maxstored); + + return 0; +} + +static int CLUIFramesStoreAllFrames() +{ + if (_fCluiFramesModuleNotStarted) return -1; + for (int i = 0; i < g_nFramesCount; i++) + CLUIFramesStoreFrameSettings(i); + return 0; +} + +static int CLUIFramesGetalClientFrame(void) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + if (_nClientFrameId != eUnknownId) { + /* this value could become invalid if RemoveItemFromList was called, + * so we double-check */ + if (_nClientFrameId < g_nFramesCount) { + if (g_pfwFrames[_nClientFrameId].align == alClient) { + return _nClientFrameId; + } + } + } + + for (int i = 0; i < g_nFramesCount; i++) + if (g_pfwFrames[i].align == alClient) { + _nClientFrameId = i; + return i; + } + return -1; +} + +///////////////////////////////////////////////////////////////////////////////////////// + +static HGENMENU addFrameMenuItem(TMO_MenuItem *pmi, int frameid, bool bMain) +{ + HGENMENU res = (bMain) ? Menu_AddMainMenuItem(pmi) : Menu_AddContextFrameMenuItem(pmi); + if (pmi->pszService != NULL) + Menu_ConfigureItem(res, MCI_OPT_EXECPARAM, frameid); + return res; +} + +static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, bool bMain) +{ + if (_fCluiFramesModuleNotStarted) + return NULL; + + int framepos = id2pos(frameid); + FrameMenuHandles &fmh = (frameid == -1) ? cont : g_pfwFrames[framepos].MenuHandles; + + CMenuItem mi; + mi.root = root; + mi.position = popuppos++; + mi.name.a = LPGEN("&Visible"); + mi.flags = CMIF_SYSTEM | CMIF_CHECKED; + mi.pszService = MS_CLIST_FRAMES_SHFRAME; + fmh.MIVisible = addFrameMenuItem(&mi, frameid, bMain); + + popuppos += 100000; + + mi.position = popuppos++; + mi.name.a = LPGEN("&Show title"); + mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR; + fmh.MITBVisible = addFrameMenuItem(&mi, frameid, bMain); + + mi.position = popuppos++; + mi.name.a = LPGEN("&Locked"); + mi.pszService = MS_CLIST_FRAMES_ULFRAME; + fmh.MILock = addFrameMenuItem(&mi, frameid, bMain); + + mi.position = popuppos++; + mi.name.a = LPGEN("&Expanded"); + mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME; + fmh.MIColl = addFrameMenuItem(&mi, frameid, bMain); + + // floating + mi.position = popuppos++; + mi.name.a = LPGEN("&Floating mode"); + mi.flags = CMIF_SYSTEM; + mi.pszService = "Set_Floating"; + fmh.MIFloating = addFrameMenuItem(&mi, frameid, bMain); + + mi.position = popuppos++; + mi.name.a = LPGEN("&Border"); + mi.flags = CMIF_SYSTEM | CMIF_CHECKED; + mi.pszService = MS_CLIST_FRAMES_SETUNBORDER; + fmh.MIBorder = addFrameMenuItem(&mi, frameid, bMain); + + popuppos += 100000; + + // alignment root + mi.position = popuppos++; + mi.name.a = LPGEN("&Align"); + mi.flags = CMIF_SYSTEM; + mi.pszService = NULL; + fmh.MIAlignRoot = addFrameMenuItem(&mi, frameid, bMain); + + // align top + mi.root = fmh.MIAlignRoot; + mi.position = popuppos++; + mi.name.a = LPGEN("&Top"); + mi.pszService = CLUIFRAMESSETALIGNALTOP; + fmh.MIAlignTop = addFrameMenuItem(&mi, frameid, bMain); + + // align client + mi.position = popuppos++; + mi.name.a = LPGEN("&Client"); + mi.pszService = CLUIFRAMESSETALIGNALCLIENT; + fmh.MIAlignClient = addFrameMenuItem(&mi, frameid, bMain); + + // align bottom + mi.position = popuppos++; + mi.name.a = LPGEN("&Bottom"); + mi.pszService = CLUIFRAMESSETALIGNALBOTTOM; + fmh.MIAlignBottom = addFrameMenuItem(&mi, frameid, bMain); + + // position root + mi.root = root; + mi.position = popuppos++; + mi.name.a = LPGEN("&Position"); + mi.pszService = NULL; + mi.root = addFrameMenuItem(&mi, frameid, bMain); + + mi.position = popuppos++; + mi.name.a = LPGEN("&Up"); + mi.pszService = CLUIFRAMESMOVEUP; + addFrameMenuItem(&mi, frameid, bMain); + + mi.position = popuppos++; + mi.name.a = LPGEN("&Down"); + mi.pszService = CLUIFRAMESMOVEDOWN; + addFrameMenuItem(&mi, frameid, bMain); + return 0; +} + +static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) +{ + /* HOOK */ + if (MirandaExiting()) return 0; + if (_fCluiFramesModuleNotStarted) return -1; + int pos = id2pos(wParam); + if (pos >= 0 && pos < g_nFramesCount) { + FRAMEWND &p = g_pfwFrames[pos]; + + Menu_ModifyItem(cont.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name); + Menu_SetChecked(cont.MIVisible, p.visible); + Menu_SetChecked(cont.MILock, p.Locked); + Menu_SetChecked(cont.MITBVisible, p.TitleBar.ShowTitleBar); + Menu_SetChecked(cont.MIFloating, p.floating); + + if (g_CluiData.fLayered) + Menu_EnableItem(cont.MIBorder, false); + else + Menu_SetChecked(cont.MIBorder, p.UseBorder); + + Menu_SetChecked(cont.MIAlignTop, (p.align & alTop) != 0); + Menu_SetChecked(cont.MIAlignClient, (p.align & alClient) != 0); + Menu_SetChecked(cont.MIAlignBottom, (p.align & alBottom) != 0); + + Menu_SetChecked(cont.MIColl, p.collapsed); + Menu_EnableItem(cont.MIColl, p.visible && !p.Locked && pos != CLUIFramesGetalClientFrame()); + } + return 0; +} + +static int CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM) +{ + // hiword(wParam) = frameid,loword(wParam) = flag + if (_fCluiFramesModuleNotStarted) + return -1; + + int pos = id2pos(wParam); + if (pos >= 0 && pos < g_nFramesCount) { + FRAMEWND &p = g_pfwFrames[pos]; + + Menu_ModifyItem(p.MenuHandles.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name); + Menu_SetChecked(p.MenuHandles.MIVisible, p.visible); + Menu_SetChecked(p.MenuHandles.MILock, p.Locked); + Menu_SetChecked(p.MenuHandles.MITBVisible, p.TitleBar.ShowTitleBar); + Menu_SetChecked(p.MenuHandles.MIFloating, p.floating); + + if (g_CluiData.fLayered) + Menu_EnableItem(p.MenuHandles.MIBorder, false); + else + Menu_SetChecked(p.MenuHandles.MIBorder, p.UseBorder); + + Menu_EnableItem(p.MenuHandles.MIAlignTop, (p.align & alClient) == 0); + Menu_SetChecked(p.MenuHandles.MIAlignTop, (p.align & alTop) != 0); + Menu_EnableItem(p.MenuHandles.MIAlignBottom, (p.align & alClient) == 0); + Menu_SetChecked(p.MenuHandles.MIAlignBottom, (p.align & alBottom) != 0); + Menu_SetChecked(p.MenuHandles.MIAlignClient, (p.align & alClient) != 0); + + Menu_SetChecked(p.MenuHandles.MIColl, p.collapsed); + Menu_EnableItem(p.MenuHandles.MIColl, p.visible && !p.Locked && pos != CLUIFramesGetalClientFrame()); + } + + return 0; +} + + +static INT_PTR _us_DoGetFrameOptions(WPARAM wParam, LPARAM) +{ + if (_fCluiFramesModuleNotStarted) + return -1; + + int pos = id2pos(HIWORD(wParam)); + if (pos < 0 || pos >= g_nFramesCount) + return -1; + + switch (LOWORD(wParam) & ~FO_UNICODETEXT) { + case FO_NAME: + return (INT_PTR)g_pfwFrames[pos].name; + + case FO_TBNAME: + return (INT_PTR)g_pfwFrames[pos].TitleBar.tbname; + + case FO_TBTIPNAME: + return (INT_PTR)g_pfwFrames[pos].TitleBar.tooltip; + + case FO_TBSTYLE: + return GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE); + + case FO_TBEXSTYLE: + return GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_EXSTYLE); + + case FO_ICON: + return (INT_PTR)g_pfwFrames[pos].TitleBar.hicon; + + case FO_HEIGHT: + return (INT_PTR)g_pfwFrames[pos].height; + + case FO_ALIGN: + return (INT_PTR)g_pfwFrames[pos].align; + + case FO_FLOATING: + return (INT_PTR)g_pfwFrames[pos].floating; + + case FO_FLAGS: + INT_PTR retval = 0; + if (g_pfwFrames[pos].visible) retval |= F_VISIBLE; + if (!g_pfwFrames[pos].collapsed) retval |= F_UNCOLLAPSED; + if (g_pfwFrames[pos].Locked) retval |= F_LOCKED; + if (g_pfwFrames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; + if (g_pfwFrames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; + if (!g_CluiData.fLayered) { + if (!(GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE)&WS_BORDER)) + retval |= F_NOBORDER; + } + else if (!g_pfwFrames[pos].UseBorder) + retval |= F_NOBORDER; + return retval; + } + + return -1; +} + +static int UpdateTBToolTip(int framepos) +{ + TOOLINFO ti = { sizeof(ti) }; + ti.lpszText = g_pfwFrames[framepos].TitleBar.tooltip; + ti.hinst = g_hInst; + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + ti.uId = (UINT_PTR)g_pfwFrames[framepos].TitleBar.hwnd; + return SendMessage(g_pfwFrames[framepos].TitleBar.hwndTip, TTM_UPDATETIPTEXT, 0, (LPARAM)&ti); +} + +//hiword(wParam) = frameid,loword(wParam) = flag +static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) +{ + int retval; // value to be returned + BOOL bUnicodeText = (LOWORD(wParam) & FO_UNICODETEXT) != 0; + wParam = MAKEWPARAM((LOWORD(wParam))& ~FO_UNICODETEXT, HIWORD(wParam)); + if (_fCluiFramesModuleNotStarted) + return -1; + + int pos = id2pos(HIWORD(wParam)); + if (pos < 0 || pos >= g_nFramesCount) + return -1; + + FRAMEWND &fw = g_pfwFrames[pos]; + + switch (LOWORD(wParam)) { + case FO_FLAGS: + fw.dwFlags = lParam; + fw.visible = FALSE; + if (lParam & F_VISIBLE) fw.visible = TRUE; + + fw.collapsed = TRUE; + if (lParam & F_UNCOLLAPSED) fw.collapsed = FALSE; + + fw.Locked = FALSE; + if (lParam & F_LOCKED) fw.Locked = TRUE; + + fw.UseBorder = TRUE; + if (lParam & F_NOBORDER) fw.UseBorder = FALSE; + + fw.TitleBar.ShowTitleBar = FALSE; + if (lParam & F_SHOWTB) fw.TitleBar.ShowTitleBar = TRUE; + + fw.TitleBar.ShowTitleBarTip = FALSE; + if (lParam & F_SHOWTBTIP) fw.TitleBar.ShowTitleBarTip = TRUE; + + SendMessageA(fw.TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)fw.TitleBar.ShowTitleBarTip, 0); + { + LONG_PTR style = GetWindowLongPtr(fw.hWnd, GWL_STYLE); + style &= (~WS_BORDER); + if (!(lParam & F_NOBORDER) && !g_CluiData.fLayered) + style |= WS_BORDER; + + SetWindowLongPtr(fw.hWnd, GWL_STYLE, style); + SetWindowLongPtr(fw.TitleBar.hwnd, GWL_STYLE, style& ~(WS_VSCROLL | WS_HSCROLL)); + } + + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + SetWindowPos(fw.TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); + return 0; + + case FO_NAME: + if (lParam == 0) + return -1; + + mir_free(fw.name); + if (bUnicodeText) + fw.name = mir_tstrdup((LPTSTR)lParam); + else + fw.name = mir_a2t((char *)lParam); + return 0; + + case FO_TBNAME: + if (lParam == 0) + return -1; + + mir_free(fw.TitleBar.tbname); + if (bUnicodeText) + fw.TitleBar.tbname = mir_tstrdup((LPTSTR)lParam); + else + fw.TitleBar.tbname = mir_a2t((char*)lParam); + + if (fw.floating && (fw.TitleBar.tbname != NULL)) + SetWindowText(fw.ContainerWnd, fw.TitleBar.tbname); + return 0; + + case FO_TBTIPNAME: + if (lParam == 0) + return -1; + + if (fw.TitleBar.tooltip != NULL) + mir_free_and_nil(fw.TitleBar.tooltip); + if (bUnicodeText) + fw.TitleBar.tooltip = mir_tstrdup((LPTSTR)lParam); + else + fw.TitleBar.tooltip = mir_a2t((char*)lParam); + + UpdateTBToolTip(pos); + return 0; + + case FO_TBSTYLE: + SetWindowLongPtr(fw.TitleBar.hwnd, GWL_STYLE, lParam& ~(WS_VSCROLL | WS_HSCROLL)); + return 0; + + case FO_TBEXSTYLE: + SetWindowLongPtr(fw.TitleBar.hwnd, GWL_EXSTYLE, lParam); + return 0; + + case FO_ICON: + fw.TitleBar.hicon = (HICON)lParam; + return 0; + + case FO_HEIGHT: + if (lParam < 0) { return -1; } + + if (fw.collapsed) { + int oldHeight = fw.height; + retval = fw.height; + fw.height = lParam; + if (!CLUIFramesFitInSize()) fw.height = retval; + retval = fw.height; + if (fw.height != oldHeight && !fw.floating) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + } + else { + retval = fw.HeightWhenCollapsed; + fw.HeightWhenCollapsed = lParam; + if (!CLUIFramesFitInSize()) fw.HeightWhenCollapsed = retval; + retval = fw.HeightWhenCollapsed; + + } + return retval; + + case FO_FLOATING: + if (lParam < 0) { return -1; } + + { + int id = fw.id; + fw.floating = !(lParam); + + + CLUIFrames_SetFrameFloat(id, 1);//lparam = 1 use stored width and height + return(wParam); + } + + case FO_ALIGN: + if (!(lParam&alTop || lParam&alBottom || lParam&alClient)) { + TRACE("Wrong align option \r\n"); + return (-1); + }; + + if ((lParam&alClient) && (CLUIFramesGetalClientFrame() >= 0)) { //only one alClient frame possible + _nClientFrameId = eUnknownId;//recalc it + + return -1; + } + fw.align = lParam; + return 0; + } + + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + return -1; +} + +//wparam = lparam = 0 +static int _us_DoShowAllFrames(WPARAM, LPARAM) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + for (int i = 0; i < g_nFramesCount; i++) + g_pfwFrames[i].visible = TRUE; + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + return 0; +} + +//wparam = lparam = 0 +static int _us_DoShowTitles(WPARAM, LPARAM) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + for (int i = 0; i < g_nFramesCount; i++) + g_pfwFrames[i].TitleBar.ShowTitleBar = TRUE; + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + return 0; +} + +//wparam = lparam = 0 +static int _us_DoHideTitles(WPARAM, LPARAM) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + for (int i = 0; i < g_nFramesCount; i++) + g_pfwFrames[i].TitleBar.ShowTitleBar = FALSE; + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + return 0; +} + +//wparam = frameid +static int _us_DoShowHideFrame(WPARAM wParam, LPARAM lParam) +{ + if (_fCluiFramesModuleNotStarted) + return -1; + + int pos = (wParam == 0) ? lParam : id2pos(wParam); + if (pos >= 0 && pos < g_nFramesCount) { + g_pfwFrames[pos].visible = !g_pfwFrames[pos].visible; + CLUIFramesStoreFrameSettings(pos); + + if (g_pfwFrames[pos].OwnerWindow != (HWND)-2) { + if (g_pfwFrames[pos].OwnerWindow) + CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); + else if (g_pfwFrames[pos].visible) { + g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10); + SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].OwnerWindow); + CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); + } + } + + if (g_pfwFrames[pos].floating) + CLUIFrameResizeFloatingFrame(pos); + + if (!g_pfwFrames[pos].floating) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + } + return 0; +} + +//wparam = frameid +static int _us_DoShowHideFrameTitle(WPARAM wParam, LPARAM lParam) +{ + if (_fCluiFramesModuleNotStarted) + return -1; + + int pos = (wParam == 0) ? lParam : id2pos(wParam); + if (pos >= 0 && (int)pos < g_nFramesCount) + g_pfwFrames[pos].TitleBar.ShowTitleBar = !g_pfwFrames[pos].TitleBar.ShowTitleBar; + + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + return 0; +} + +//wparam = frameid +//lparam = -1 up ,1 down +static int _us_DoMoveFrame(WPARAM wParam, LPARAM lParam) +{ + int i, curpos, curalign, v, tmpval; + + if (_fCluiFramesModuleNotStarted) + return -1; + + int pos = id2pos(wParam); + if (pos >= 0 && (int)pos < g_nFramesCount) { + curpos = g_pfwFrames[pos].order; + curalign = g_pfwFrames[pos].align; + v = 0; + SortData *sd = (SortData*)malloc(sizeof(SortData)*g_nFramesCount); + memset(sd, 0, sizeof(SortData)*g_nFramesCount); + for (i = 0; i < g_nFramesCount; i++) { + if (g_pfwFrames[i].floating || (!g_pfwFrames[i].visible) || (g_pfwFrames[i].align != curalign)) { continue; }; + + sd[v].order = g_pfwFrames[i].order; + sd[v++].realpos = i; + } + if (v == 0) { + free(sd); + return 0; + } + qsort(sd, v, sizeof(SortData), sortfunc); + for (i = 0; i < v; i++) + g_pfwFrames[sd[i].realpos].order = i + 1; //to be sure that order is incremental + for (i = 0; i < v; i++) { + if (sd[i].realpos == pos) { + if (lParam == -1) { + if (i >= v - 1) break; + tmpval = g_pfwFrames[sd[i + 1].realpos].order; + g_pfwFrames[sd[i + 1].realpos].order = g_pfwFrames[pos].order; + g_pfwFrames[pos].order = tmpval; + break; + } + + if (lParam == 1) { + if (i < 1) break; + tmpval = g_pfwFrames[sd[i - 1].realpos].order; + g_pfwFrames[sd[i - 1].realpos].order = g_pfwFrames[pos].order; + g_pfwFrames[pos].order = tmpval; + break; + } + } + } + + free(sd); + CLUIFramesStoreFrameSettings(pos); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + } + + return 0; +} + +static int _us_DoMoveFrameUp(WPARAM wParam, LPARAM) +{ + return CLUIFrames_MoveFrame(wParam, (LPARAM)+1); +} + +static int _us_DoMoveFrameDown(WPARAM wParam, LPARAM) +{ + return CLUIFrames_MoveFrame(wParam, (LPARAM)-1); +} + +//wparam = frameid +//lparam = alignment +static int _us_DoSetFrameAlign(WPARAM wParam, LPARAM lParam) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + CLUIFrames_SetFrameOptions(MAKEWPARAM(FO_ALIGN, wParam), lParam); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + return 0; +} + +static int _us_DoAlignFrameTop(WPARAM wParam, LPARAM) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + return CLUIFrames_SetFrameAlign(wParam, alTop); +} + +static int _us_DoAlignFrameBottom(WPARAM wParam, LPARAM) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + return CLUIFrames_SetFrameAlign(wParam, alBottom); +} + +static int _us_DoAlignFrameClient(WPARAM wParam, LPARAM) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + return CLUIFrames_SetFrameAlign(wParam, alClient); +} + +//wparam = frameid +static int _us_DoLockFrame(WPARAM wParam, LPARAM lParam) +{ + if (_fCluiFramesModuleNotStarted) return -1; + + int pos = (wParam == 0) ? lParam : id2pos(wParam); + if (pos >= 0 && (int)pos < g_nFramesCount) { + g_pfwFrames[pos].Locked = !g_pfwFrames[pos].Locked; + CLUIFramesStoreFrameSettings(pos); + } + + return 0; +} + +//wparam = frameid +static int _us_DoSetFrameBorder(WPARAM wParam, LPARAM lParam) +{ + RECT rc; + + if (_fCluiFramesModuleNotStarted) return -1; + + int FrameId = (wParam == 0) ? lParam : id2pos(wParam); + if (FrameId == -1) + return -1; + + int oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), 0); + if (oldflags & F_NOBORDER) + oldflags &= ~F_NOBORDER; + else + oldflags |= F_NOBORDER; + + HWND hw = g_pfwFrames[FrameId].hWnd; + GetWindowRect(hw, &rc); + + CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); + SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME); + return 0; +} + +//wparam = frameid +static int _us_DoCollapseFrame(WPARAM wParam, LPARAM lParam) +{ + int FrameId; + + if (_fCluiFramesModuleNotStarted) return -1; + + if (wParam == 0) { + FrameId = lParam; + } + else { + FrameId = id2pos(wParam); + } + if (FrameId >= 0 && FrameId < g_nFramesCount) { + int oldHeight; + + // do not collapse/uncollapse client/locked/invisible frames + if (g_pfwFrames[FrameId].align == alClient && !(g_pfwFrames[FrameId].Locked || (!g_pfwFrames[FrameId].visible) || g_pfwFrames[FrameId].floating)) { + RECT rc; + if (CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { return 0; }; + if (!g_CluiData.fDocked && g_CluiData.fAutoSize) { return 0; }; + GetWindowRect(pcli->hwndContactList, &rc); + + if (g_pfwFrames[FrameId].collapsed == TRUE) { + rc.bottom -= rc.top; + rc.bottom -= g_pfwFrames[FrameId].height; + g_pfwFrames[FrameId].HeightWhenCollapsed = g_pfwFrames[FrameId].height; + g_pfwFrames[FrameId].collapsed = FALSE; + } + else { + rc.bottom -= rc.top; + rc.bottom += g_pfwFrames[FrameId].HeightWhenCollapsed; + g_pfwFrames[FrameId].collapsed = TRUE; + } + + SetWindowPos(pcli->hwndContactList, NULL, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); + + CLUIFramesStoreAllFrames(); + + + return 0; + + } + if (g_pfwFrames[FrameId].Locked || (!g_pfwFrames[FrameId].visible)) return 0; + + oldHeight = g_pfwFrames[FrameId].height; + + // if collapsed, uncollapse + if (g_pfwFrames[FrameId].collapsed == TRUE) { + g_pfwFrames[FrameId].HeightWhenCollapsed = g_pfwFrames[FrameId].height; + g_pfwFrames[FrameId].height = UNCOLLAPSED_FRAME_SIZE; + g_pfwFrames[FrameId].collapsed = FALSE; + } + // if uncollapsed, collapse + else { + g_pfwFrames[FrameId].height = g_pfwFrames[FrameId].HeightWhenCollapsed; + g_pfwFrames[FrameId].collapsed = TRUE; + } + + if (!g_pfwFrames[FrameId].floating) { + + if (!CLUIFramesFitInSize()) { + //cant collapse,we can resize only for height < alclient frame height + int alfrm = CLUIFramesGetalClientFrame(); + + if (alfrm != -1) { + g_pfwFrames[FrameId].collapsed = FALSE; + if (g_pfwFrames[alfrm].height > 2 * UNCOLLAPSED_FRAME_SIZE) { + oldHeight = g_pfwFrames[alfrm].height - UNCOLLAPSED_FRAME_SIZE; + g_pfwFrames[FrameId].collapsed = TRUE; + } + } + else { + int i, sumheight = 0; + for (i = 0; i < g_nFramesCount; i++) { + if ((g_pfwFrames[i].align != alClient) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { + sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)) + 2; + return FALSE; + } + if (sumheight>_nContactListHeight - 0 - 2) { + g_pfwFrames[FrameId].height = (_nContactListHeight - 0 - 2) - sumheight; + } + + } + } + + g_pfwFrames[FrameId].height = oldHeight; + + if (g_pfwFrames[FrameId].collapsed == FALSE) { + + if (!g_pfwFrames[FrameId].floating) { + } + else { + //SetWindowPos(Frames[FrameId].hWnd,HWND_TOP, 0, 0, Frames[FrameId].wndSize.right-Frames[FrameId].wndSize.left,Frames[FrameId].height,SWP_SHOWWINDOW|SWP_NOMOVE); + SetWindowPos(g_pfwFrames[FrameId].ContainerWnd, HWND_TOP, 0, 0, g_pfwFrames[FrameId].wndSize.right - g_pfwFrames[FrameId].wndSize.left + 6, g_pfwFrames[FrameId].height + DEFAULT_TITLEBAR_HEIGHT + 4, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOMOVE); + }; + + + return -1; + };//redraw not needed + } + };//floating test + + //CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); + if (!g_pfwFrames[FrameId].floating) { + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + } + else { + //SetWindowPos(Frames[FrameId].hWnd,HWND_TOP, 0, 0, Frames[FrameId].wndSize.right-Frames[FrameId].wndSize.left,Frames[FrameId].height,SWP_SHOWWINDOW|SWP_NOMOVE); + RECT contwnd; + GetWindowRect(g_pfwFrames[FrameId].ContainerWnd, &contwnd); + contwnd.top = contwnd.bottom - contwnd.top;//height + contwnd.left = contwnd.right - contwnd.left;//width + + contwnd.top -= (oldHeight - g_pfwFrames[FrameId].height);//newheight + SetWindowPos(g_pfwFrames[FrameId].ContainerWnd, HWND_TOP, 0, 0, contwnd.left, contwnd.top, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOMOVE); + }; + CLUIFramesStoreAllFrames(); + return 0; + } + else + return -1; +} + +static int CLUIFramesLoadMainMenu() +{ + if (_fCluiFramesModuleNotStarted) + return -1; + + if (cont.MainMenuItem != NULL) { + Menu_RemoveItem(cont.MainMenuItem); + cont.MainMenuItem = NULL; + } + + // create root menu + CMenuItem mi; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME); + mi.position = 3000090000; + mi.name.a = LPGEN("Frames"); + cont.MainMenuItem = Menu_AddMainMenuItem(&mi); + + // create frames menu + mi.root = cont.MainMenuItem; + int separator = 3000200000; + for (int i = 0; i < g_nFramesCount; i++) { + mi.hIcolibItem = g_pfwFrames[i].TitleBar.hicon; + mi.flags = CMIF_SYSTEM | CMIF_TCHAR; + mi.position = separator++; + mi.name.t = g_pfwFrames[i].TitleBar.tbname ? g_pfwFrames[i].TitleBar.tbname : g_pfwFrames[i].name; + mi.pszService = 0; + g_pfwFrames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi); + CLUIFramesCreateMenuForFrame(g_pfwFrames[i].id, g_pfwFrames[i].MenuHandles.MainMenuItem, separator, true); + CLUIFramesModifyMainMenuItems(g_pfwFrames[i].id, 0); + CallService(MS_CLIST_FRAMEMENUNOTIFY, (WPARAM)g_pfwFrames[i].id, (LPARAM)g_pfwFrames[i].MenuHandles.MainMenuItem); + } + + separator += 100000; + + // create "show all frames" menu + mi.hIcolibItem = NULL; + mi.flags = CMIF_SYSTEM; + mi.position = separator++; + mi.name.a = LPGEN("Show all frames"); + mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES; + Menu_AddMainMenuItem(&mi); + + // create "show all titlebars" menu + mi.position = separator++; + mi.name.a = LPGEN("Show all title bars"); + mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB; + Menu_AddMainMenuItem(&mi); + + // create "hide all titlebars" menu + mi.position = separator++; + mi.name.a = LPGEN("Hide all title bars"); + mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB; + Menu_AddMainMenuItem(&mi); + return 0; +} + +static HFONT CLUILoadTitleBarFont() +{ + char facename[] = "MS Shell Dlg"; + HFONT hfont; + LOGFONTA logfont; + memset(&logfont, 0, sizeof(logfont)); + memcpy(logfont.lfFaceName, facename, sizeof(facename)); + logfont.lfWeight = FW_NORMAL; + logfont.lfHeight = -10; + logfont.lfCharSet = DEFAULT_CHARSET; + hfont = CreateFontIndirectA(&logfont); + return hfont; +} + + +//wparam = (CLISTFrame*)clfrm +static int _us_DoAddFrame(WPARAM wParam, LPARAM) +{ + int retval; + LONG_PTR style; + //char * CustomName = NULL; + CLISTFrame *clfrm = (CLISTFrame *)wParam; + + if (pcli->hwndContactList == 0) return -1; + if (_fCluiFramesModuleNotStarted) return -1; + if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; + if (!(_hTitleBarFont)) _hTitleBarFont = CLUILoadTitleBarFont(); + + g_pfwFrames = (FRAMEWND*)realloc(g_pfwFrames, sizeof(FRAMEWND)*(g_nFramesCount + 1)); + + memset(&g_pfwFrames[g_nFramesCount], 0, sizeof(FRAMEWND)); + g_pfwFrames[g_nFramesCount].id = _iNextFrameId++; + g_pfwFrames[g_nFramesCount].align = clfrm->align; + g_pfwFrames[g_nFramesCount].hWnd = clfrm->hWnd; + g_pfwFrames[g_nFramesCount].height = clfrm->height; + g_pfwFrames[g_nFramesCount].TitleBar.hicon = clfrm->hIcon; + //Frames[nFramescount].TitleBar.BackColour; + g_pfwFrames[g_nFramesCount].floating = FALSE; + if (clfrm->Flags&F_NO_SUBCONTAINER || !g_CluiData.fLayered) + g_pfwFrames[g_nFramesCount].OwnerWindow = (HWND)-2; + else g_pfwFrames[g_nFramesCount].OwnerWindow = 0; + + //override tbbtip + //clfrm->Flags |= F_SHOWTBTIP; + // + if (db_get_b(0, CLUIFrameModule, "RemoveAllBorders", 0) == 1) { + clfrm->Flags |= F_NOBORDER; + }; + g_pfwFrames[g_nFramesCount].dwFlags = clfrm->Flags; + + if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { + g_pfwFrames[g_nFramesCount].name = (LPTSTR)mir_alloc(255 * sizeof(TCHAR)); + GetClassName(g_pfwFrames[g_nFramesCount].hWnd, g_pfwFrames[g_nFramesCount].name, 255); + } + else g_pfwFrames[g_nFramesCount].name = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name); + + if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL + || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0) + g_pfwFrames[g_nFramesCount].TitleBar.tbname = mir_tstrdup(g_pfwFrames[g_nFramesCount].name); + else + g_pfwFrames[g_nFramesCount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname); + + g_pfwFrames[g_nFramesCount].needhide = FALSE; + g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar = (clfrm->Flags & F_SHOWTB ? TRUE : FALSE); + g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBarTip = (clfrm->Flags & F_SHOWTBTIP ? TRUE : FALSE); + + g_pfwFrames[g_nFramesCount].collapsed = (clfrm->Flags & F_UNCOLLAPSED) ? FALSE : TRUE; + + + g_pfwFrames[g_nFramesCount].Locked = clfrm->Flags & F_LOCKED ? TRUE : FALSE; + g_pfwFrames[g_nFramesCount].visible = clfrm->Flags & F_VISIBLE ? TRUE : FALSE; + + g_pfwFrames[g_nFramesCount].UseBorder = ((clfrm->Flags&F_NOBORDER) || g_CluiData.fLayered) ? FALSE : TRUE; + + //Frames[nFramescount].OwnerWindow = 0; + + g_pfwFrames[g_nFramesCount].TitleBar.hwnd = CreateWindow(CLUIFrameTitleBarClassName, g_pfwFrames[g_nFramesCount].name, + (db_get_b(0, CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER) + | WS_CHILD | WS_CLIPCHILDREN | + (g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) | + WS_CLIPCHILDREN, + 0, 0, 0, 0, pcli->hwndContactList, NULL, g_hInst, NULL); + SetWindowLongPtr(g_pfwFrames[g_nFramesCount].TitleBar.hwnd, GWLP_USERDATA, g_pfwFrames[g_nFramesCount].id); + + g_pfwFrames[g_nFramesCount].TitleBar.hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, + WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + pcli->hwndContactList, NULL, g_hInst, + NULL); + + SetWindowPos(g_pfwFrames[g_nFramesCount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + { + TOOLINFO ti = { sizeof(ti) }; + ti.lpszText = _T(""); + ti.hinst = g_hInst; + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + ti.uId = (UINT_PTR)g_pfwFrames[g_nFramesCount].TitleBar.hwnd; + SendMessage(g_pfwFrames[g_nFramesCount].TitleBar.hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti); + } + + SendMessageA(g_pfwFrames[g_nFramesCount].TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBarTip, 0); + + g_pfwFrames[g_nFramesCount].oldstyles = GetWindowLongPtr(g_pfwFrames[g_nFramesCount].hWnd, GWL_STYLE); + g_pfwFrames[g_nFramesCount].TitleBar.oldstyles = GetWindowLongPtr(g_pfwFrames[g_nFramesCount].TitleBar.hwnd, GWL_STYLE); + //Frames[nFramescount].FloatingPos.x = + + retval = g_pfwFrames[g_nFramesCount].id; + g_pfwFrames[g_nFramesCount].order = g_nFramesCount + 1; + g_nFramesCount++; + + + CLUIFramesLoadFrameSettings(id2pos(retval)); + if (g_pfwFrames[g_nFramesCount - 1].collapsed == FALSE) + g_pfwFrames[g_nFramesCount - 1].height = 0; + + // create frame + + style = GetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].hWnd, GWL_STYLE); + style &= (~WS_BORDER); + style |= (((g_pfwFrames[g_nFramesCount - 1].UseBorder) && !g_CluiData.fLayered) ? WS_BORDER : 0); + SetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].hWnd, GWL_STYLE, style); + SetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].TitleBar.hwnd, GWL_STYLE, style& ~(WS_VSCROLL | WS_HSCROLL)); + SetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].TitleBar.hwnd, GWL_STYLE, GetWindowLongPtr(g_pfwFrames[g_nFramesCount - 1].TitleBar.hwnd, GWL_STYLE)&~(WS_VSCROLL | WS_HSCROLL)); + + if (g_pfwFrames[g_nFramesCount - 1].order == 0) { g_pfwFrames[g_nFramesCount - 1].order = g_nFramesCount; }; + + //need to enlarge parent + { + RECT mainRect; + int mainHeight, minHeight; + GetWindowRect(pcli->hwndContactList, &mainRect); + mainHeight = mainRect.bottom - mainRect.top; + minHeight = CLUIFrames_GetTotalHeight(); + if (mainHeight < minHeight) { + BOOL Upward = FALSE; + Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT); + + if (Upward) + mainRect.top = mainRect.bottom - minHeight; + else + mainRect.bottom = mainRect.top + minHeight; + SetWindowPos(pcli->hwndContactList, NULL, mainRect.left, mainRect.top, mainRect.right - mainRect.left, mainRect.bottom - mainRect.top, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + } + GetWindowRect(pcli->hwndContactList, &mainRect); + mainHeight = mainRect.bottom - mainRect.top; + } + _nClientFrameId = eUnknownId;//recalc it + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + + if (g_pfwFrames[g_nFramesCount - 1].floating) { + + g_pfwFrames[g_nFramesCount - 1].floating = FALSE; + //SetWindowPos(Frames[nFramescount-1].hw + CLUIFrames_SetFrameFloat(retval, 1);//lparam = 1 use stored width and height + } + else + CLUIFrames_SetFrameFloat(retval, 2); + + /** Remove */ + //_ExtFramesSrv_AddFrame( wParam, lParam); + + return retval; +} + +static int _us_DoRemoveFrame(WPARAM wParam, LPARAM) +{ + int pos; + if (_fCluiFramesModuleNotStarted) return -1; + + pos = id2pos(wParam); + + if (pos < 0 || pos>g_nFramesCount) return -1;; + + mir_free_and_nil(g_pfwFrames[pos].name); + mir_free_and_nil(g_pfwFrames[pos].TitleBar.tbname); + mir_free_and_nil(g_pfwFrames[pos].TitleBar.tooltip); + DestroyWindow(g_pfwFrames[pos].hWnd); + g_pfwFrames[pos].hWnd = (HWND)-1; + DestroyWindow(g_pfwFrames[pos].TitleBar.hwnd); + if (g_pfwFrames[pos].TitleBar.hwndTip) + DestroyWindow(g_pfwFrames[pos].TitleBar.hwndTip); + g_pfwFrames[pos].TitleBar.hwnd = (HWND)-1; + if (g_pfwFrames[pos].ContainerWnd && g_pfwFrames[pos].ContainerWnd != (HWND)-1) DestroyWindow(g_pfwFrames[pos].ContainerWnd); + g_pfwFrames[pos].ContainerWnd = (HWND)-1; + if (g_pfwFrames[pos].TitleBar.hmenu) DestroyMenu(g_pfwFrames[pos].TitleBar.hmenu); + g_pfwFrames[pos].PaintCallbackProc = NULL; + if (g_pfwFrames[pos].UpdateRgn) DeleteObject(g_pfwFrames[pos].UpdateRgn); + + if (g_pfwFrames[pos].OwnerWindow != (HWND)-1 + && g_pfwFrames[pos].OwnerWindow != (HWND)-2 + && g_pfwFrames[pos].OwnerWindow != (HWND)0) + DestroyWindow(g_pfwFrames[pos].OwnerWindow); + + g_pfwFrames[pos].OwnerWindow = NULL; + RemoveItemFromList(pos, &g_pfwFrames, &g_nFramesCount); + + CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + + return 0; +}; + + +static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame) +{ + if (Frame->TitleBar.hwnd != 0) + RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + //UpdateWindow(Frame->TitleBar.hwnd); + return 0; +} + +static int CLUIFramesForceUpdateFrame(const FRAMEWND *Frame) +{ + if (Frame->hWnd != 0) { + RedrawWindow(Frame->hWnd, NULL, NULL, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); + UpdateWindow(Frame->hWnd); + } + + if (Frame->floating && Frame->ContainerWnd != 0) + RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + return 0; +} + +static int CLUIFrameMoveResize(const FRAMEWND *Frame) +{ + // we need to show or hide the frame? + if (Frame->visible && (!Frame->needhide)) { + if (Frame->OwnerWindow != (HWND)-2 && Frame->OwnerWindow) { + // CLUI_ShowWindowMod(Frame->OwnerWindow,SW_SHOW); + } + CLUI_ShowWindowMod(Frame->hWnd, SW_SHOW/*NOACTIVATE*/); + CLUI_ShowWindowMod(Frame->TitleBar.hwnd, Frame->TitleBar.ShowTitleBar == TRUE ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); + } + else { + if (Frame->OwnerWindow && Frame->OwnerWindow != (HWND)(-1) && Frame->OwnerWindow != (HWND)(-2)) { + CLUI_ShowWindowMod(Frame->OwnerWindow, SW_HIDE); + } + CLUI_ShowWindowMod(Frame->hWnd, SW_HIDE); + CLUI_ShowWindowMod(Frame->TitleBar.hwnd, SW_HIDE); + return 0; + } + + if (Frame->OwnerWindow && Frame->OwnerWindow != (HWND)-2) { + RECT pr; + POINT Off = { 0 }; + + ClientToScreen(pcli->hwndContactList, &Off); + GetWindowRect(pcli->hwndContactList, &pr); + + if (Frame->visible && (!Frame->collapsed || Frame->wndSize.bottom - Frame->wndSize.top == 0)) { + ShowWindowAsync(Frame->OwnerWindow, SW_HIDE); + ShowWindowAsync(Frame->hWnd, SW_HIDE); + } + + { + SetWindowPos(Frame->OwnerWindow, NULL, Frame->wndSize.left + Off.x, Frame->wndSize.top + Off.y, + Frame->wndSize.right - Frame->wndSize.left, + Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); //- -= -= + + SetWindowPos(Frame->hWnd, NULL, 0, 0, + Frame->wndSize.right - Frame->wndSize.left, + Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); + } + // set titlebar position + if (Frame->TitleBar.ShowTitleBar) { + SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left, Frame->wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, + Frame->wndSize.right - Frame->wndSize.left, + g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); + } + if (Frame->visible && IsWindowVisible(pcli->hwndContactList) && Frame->collapsed && Frame->wndSize.bottom - Frame->wndSize.top != 0) { + ShowWindow(Frame->OwnerWindow, SW_SHOW); + ShowWindow(Frame->hWnd, SW_SHOW); + } + + } + else { + // set frame position + SetWindowPos(Frame->hWnd, NULL, Frame->wndSize.left, Frame->wndSize.top, + Frame->wndSize.right - Frame->wndSize.left, + Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); + // set titlebar position + if (Frame->TitleBar.ShowTitleBar) { + SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left, Frame->wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, + Frame->wndSize.right - Frame->wndSize.left, + g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + } + } + // Sleep(0); + return 0; +} + +static BOOL CLUIFramesFitInSize(void) +{ + int sumheight = 0; + int tbh = 0; // title bar height + int clientfrm; + clientfrm = CLUIFramesGetalClientFrame(); + if (clientfrm != -1) + tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); + + for (int i = 0; i < g_nFramesCount; i++) { + if ((g_pfwFrames[i].align != alClient) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { + sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)) + 2/*+btoint(Frames[i].UseBorder)*2*/; + if (sumheight>_nContactListHeight - tbh - 2) { + if (!g_CluiData.fDocked && g_CluiData.fAutoSize) + return TRUE; //Can be required to enlarge + + return FALSE; + } + } + } + return TRUE; +} + +int CLUIFrames_GetTotalHeight() +{ + if (pcli->hwndContactList == NULL) return 0; + + int sumheight = 0; + RECT border; + for (int i = 0; i < g_nFramesCount; i++) { + if ((g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (pcli->hwndContactTree) && (g_pfwFrames[i].hWnd != pcli->hwndContactTree)) + sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)); + }; + + GetBorderSize(pcli->hwndContactList, &border); + + //GetWindowRect(pcli->hwndContactList,&winrect); + //GetClientRect(pcli->hwndContactList,&clirect); + // clirect.bottom -= clirect.top; + // clirect.bottom += border.top+border.bottom; + //allbord = (winrect.bottom-winrect.top)-(clirect.bottom-clirect.top); + + //TODO minsize + sumheight += g_CluiData.TopClientMargin; + sumheight += g_CluiData.BottomClientMargin; + return max(db_get_w(NULL, "CLUI", "MinHeight", SETTING_MINHEIGTH_DEFAULT), + (sumheight + border.top + border.bottom)); +} + +int CLUIFramesGetMinHeight() +{ + int tbh = 0, sumheight = 0; + RECT border; + int allbord = 0; + if (pcli->hwndContactList == NULL) return 0; + + + // search for alClient frame and get the titlebar's height + int clientfrm = CLUIFramesGetalClientFrame(); + if (clientfrm != -1) + tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); + + for (int i = 0; i < g_nFramesCount; i++) { + if ((g_pfwFrames[i].align != alClient) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating)) { + RECT wsize; + + GetWindowRect(g_pfwFrames[i].hWnd, &wsize); + sumheight += (wsize.bottom - wsize.top) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)); + } + } + + GetBorderSize(pcli->hwndContactList, &border); + + //GetWindowRect(pcli->hwndContactList,&winrect); + //GetClientRect(pcli->hwndContactList,&clirect); + // clirect.bottom -= clirect.top; + // clirect.bottom += border.top+border.bottom; + //allbord = (winrect.bottom-winrect.top)-(clirect.bottom-clirect.top); + + //TODO minsize + sumheight += g_CluiData.TopClientMargin; + sumheight += g_CluiData.BottomClientMargin; + return max(db_get_w(NULL, "CLUI", "MinHeight", SETTING_MINHEIGTH_DEFAULT), + (sumheight + border.top + border.bottom + allbord + tbh)); +} + + + + +static int CLUIFramesResizeFrames(const RECT newsize) +{ + int sumheight = 9999999, newheight; + int prevframe, prevframebottomline; + int tbh, curfrmtbh; + int drawitems; + int clientfrm; + int i, j; + int sepw = GapBetweenFrames; + int topBorder = newsize.top; + SortData *sdarray; + + + g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + + if (g_nFramesCount < 1) return 0; + newheight = newsize.bottom - newsize.top; + + // search for alClient frame and get the titlebar's height + tbh = 0; + clientfrm = CLUIFramesGetalClientFrame(); + if (clientfrm != -1) + tbh = (g_nTitleBarHeight + g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); + + for (i = 0; i < g_nFramesCount; i++) { + if (!g_pfwFrames[i].floating) { + g_pfwFrames[i].needhide = FALSE; + g_pfwFrames[i].wndSize.left = newsize.left; + g_pfwFrames[i].wndSize.right = newsize.right; + + }; + }; + { + //sorting stuff + sdarray = (SortData*)malloc(sizeof(SortData)*g_nFramesCount); + if (sdarray == NULL) return -1;; + for (i = 0; i < g_nFramesCount; i++) { + sdarray[i].order = g_pfwFrames[i].order; + sdarray[i].realpos = i; + } + qsort(sdarray, g_nFramesCount, sizeof(SortData), sortfunc); + + } + + drawitems = g_nFramesCount; + + while (sumheight>(newheight - tbh) && drawitems > 0) { + sumheight = 0; + drawitems = 0; + for (i = 0; i < g_nFramesCount; i++) { + if (((g_pfwFrames[i].align != alClient)) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { + drawitems++; + curfrmtbh = (g_nTitleBarHeight + g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); + sumheight += (g_pfwFrames[i].height) + curfrmtbh + (i > 0 ? sepw : 0) + ((g_pfwFrames[i].UseBorder && !g_CluiData.fLayered) ? 2 : 0); + if (sumheight > newheight - tbh) { + sumheight -= (g_pfwFrames[i].height) + curfrmtbh + (i > 0 ? sepw : 0); + g_pfwFrames[i].needhide = !g_CluiData.fDocked && g_CluiData.fAutoSize ? FALSE : TRUE; + drawitems--; + break; + } + } + } + } + + prevframe = -1; + prevframebottomline = topBorder; + for (j = 0; j < g_nFramesCount; j++) { + //move all alTop frames + i = sdarray[j].realpos; + if ((!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (g_pfwFrames[i].align == alTop)) { + curfrmtbh = (g_nTitleBarHeight + g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); + g_pfwFrames[i].wndSize.top = prevframebottomline + (i > 0 ? sepw : 0) + (curfrmtbh); + g_pfwFrames[i].wndSize.bottom = g_pfwFrames[i].height + g_pfwFrames[i].wndSize.top + ((g_pfwFrames[i].UseBorder && !g_CluiData.fLayered) ? 2 : 0); + g_pfwFrames[i].prevvisframe = prevframe; + prevframe = i; + prevframebottomline = g_pfwFrames[i].wndSize.bottom; + if (prevframebottomline > newheight) { + //prevframebottomline -= Frames[i].height+(curfrmtbh+1); + //Frames[i].needhide = TRUE; + } + } + } + + if (sumheight < newheight) { + for (j = 0; j < g_nFramesCount; j++) { + //move alClient frame + i = sdarray[j].realpos; + if ((!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (g_pfwFrames[i].align == alClient)) { + int oldh; + g_pfwFrames[i].wndSize.top = prevframebottomline + (j > 0 ? sepw : 0) + (tbh); + g_pfwFrames[i].wndSize.bottom = g_pfwFrames[i].wndSize.top + newheight - sumheight - tbh - (j > 0 ? sepw : 0); + + oldh = g_pfwFrames[i].height; + g_pfwFrames[i].height = g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top; + g_pfwFrames[i].prevvisframe = prevframe; + prevframe = i; + prevframebottomline = g_pfwFrames[i].wndSize.bottom; + if (prevframebottomline > newheight) { + //prevframebottomline -= Frames[i].height+(tbh+1); + //Frames[i].needhide = TRUE; + } + break; + } + } + } + + //newheight + prevframebottomline = newheight + sepw + topBorder; + //prevframe = -1; + for (j = g_nFramesCount - 1; j >= 0; j--) { + //move all alBottom frames + i = sdarray[j].realpos; + if ((g_pfwFrames[i].visible) && (!g_pfwFrames[i].floating) && (!g_pfwFrames[i].needhide) && (g_pfwFrames[i].align == alBottom)) { + curfrmtbh = (g_nTitleBarHeight + g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); + + g_pfwFrames[i].wndSize.bottom = prevframebottomline - (j > 0 ? sepw : 0); + g_pfwFrames[i].wndSize.top = g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].height - ((g_pfwFrames[i].UseBorder && !g_CluiData.fLayered) ? 2 : 0); + g_pfwFrames[i].prevvisframe = prevframe; + prevframe = i; + prevframebottomline = g_pfwFrames[i].wndSize.top/*-1*/ - curfrmtbh; + if (prevframebottomline > newheight) { + + } + } + } + for (i = 0; i < g_nFramesCount; i++) + if (g_pfwFrames[i].TitleBar.ShowTitleBar) + SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); + if (sdarray != NULL) { free(sdarray); sdarray = NULL; }; + + + + return 0; +} + +static int SizeMoveNewSizes() +{ + int i; + for (i = 0; i < g_nFramesCount; i++) { + + if (g_pfwFrames[i].floating) { + CLUIFrameResizeFloatingFrame(i); + } + else { + CLUIFrameMoveResize(&g_pfwFrames[i]); + }; + } + return 0; +} + + +static int CLUIFramesResize(RECT newsize) +{ + CLUIFramesResizeFrames(newsize); + SizeMoveNewSizes(); + return 0; +} +int CLUIFrames_ApplyNewSizes(int mode) +{ + int i; + g_CluiData.mutexPreventDockMoving = 0; + for (i = 0; i < g_nFramesCount; i++) { + if ((mode == 1 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].OwnerWindow) || + (mode == 2 && g_pfwFrames[i].OwnerWindow == (HWND)-2) || + (mode == 3)) + if (g_pfwFrames[i].floating) { + CLUIFrameResizeFloatingFrame(i); + } + else { + CLUIFrameMoveResize(&g_pfwFrames[i]); + }; + } + if (IsWindowVisible(pcli->hwndContactList)) { + ske_DrawNonFramedObjects(1, 0); + CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, 0, 0); + } + g_CluiData.mutexPreventDockMoving = 1; + return 0; +} + +static int _us_DoUpdateFrame(WPARAM wParam, LPARAM lParam) +{ + if (_fCluiFramesModuleNotStarted) + return -1; + if (wParam == -1) { + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + return 0; + } + if (lParam&FU_FMPOS) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 1); + + int pos = id2pos(wParam); + if (pos < 0 || pos >= g_nFramesCount) + return -1; + if (lParam&FU_TBREDRAW) + CLUIFramesForceUpdateTB(&g_pfwFrames[pos]); + if (lParam&FU_FMREDRAW) + CLUIFramesForceUpdateFrame(&g_pfwFrames[pos]); + return 0; +} + +int CLUIFrames_OnClistResize_mod(WPARAM, LPARAM mode) +{ + int tick; + GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + g_CluiData.nGapBetweenTitlebar = db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + if (_fCluiFramesModuleNotStarted) return -1; + + RECT nRect; + GetClientRect(pcli->hwndContactList, &nRect); + + nRect.left += g_CluiData.LeftClientMargin; + nRect.right -= g_CluiData.RightClientMargin; + nRect.top += g_CluiData.TopClientMargin; + nRect.bottom -= g_CluiData.BottomClientMargin; + // g_CluiData.mutexPreventDockMoving = 0; + tick = GetTickCount(); + CLUIFramesResize(nRect); + if (mode == 0) CLUIFrames_ApplyNewSizes(3); + + tick = GetTickCount() - tick; + + Sleep(0); + + //dont save to database too many times + if (GetTickCount() - _dwLastStoreTick > 1000) { CLUIFramesStoreAllFrames(); _dwLastStoreTick = GetTickCount(); }; + + return 0; +} + +int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode) +{ + RECT nRect; + if (_fCluiFramesModuleNotStarted) return -1; + + g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + nRect.left = 0; + nRect.top = 0; + nRect.right = r->right - r->left; + nRect.bottom = r->bottom - r->top; + nRect.left += g_CluiData.LeftClientMargin; + nRect.right -= g_CluiData.RightClientMargin; + nRect.top += g_CluiData.TopClientMargin; + nRect.bottom -= g_CluiData.BottomClientMargin; + CLUIFramesResizeFrames(nRect); + for (int i = 0; i < g_nFramesCount; i++) { + int dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left; + int dy = 0;//_window_rect.top-rcOldWindowRect.top; + if (!g_pfwFrames[i].floating) { + if (g_pfwFrames[i].visible && !g_pfwFrames[i].needhide && !IsWindowVisible(g_pfwFrames[i].hWnd)) { + ShowWindow(g_pfwFrames[i].hWnd, SW_SHOW); + if (g_pfwFrames[i].TitleBar.ShowTitleBar) ShowWindow(g_pfwFrames[i].TitleBar.hwnd, SW_SHOW); + } + if (g_pfwFrames[i].OwnerWindow && (INT_PTR)(g_pfwFrames[i].OwnerWindow) != -2) { + if (!(mode & 2)) { + if (NULL != g_pfwFrames[i].OwnerWindow) { /* Wine fix. */ + *PosBatch = DeferWindowPos(*PosBatch, g_pfwFrames[i].OwnerWindow, NULL, g_pfwFrames[i].wndSize.left + r->left, g_pfwFrames[i].wndSize.top + r->top, + g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(g_pfwFrames[i].hWnd, NULL, 0, 0, + g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE/*|SWP_NOSENDCHANGING*/); + } + } + //Frame + if (g_pfwFrames[i].TitleBar.ShowTitleBar) { + SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, + g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); + SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); + UpdateWindow(g_pfwFrames[i].TitleBar.hwnd); + } + } + else { + if (1) { + int res = 0; + // set frame position + res = SetWindowPos(g_pfwFrames[i].hWnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top + dy, + g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, + g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + } + if (1) { + // set titlebar position + if (g_pfwFrames[i].TitleBar.ShowTitleBar) { + SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, + g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); + + } + } + UpdateWindow(g_pfwFrames[i].hWnd); + if (g_pfwFrames[i].TitleBar.ShowTitleBar) UpdateWindow(g_pfwFrames[i].TitleBar.hwnd); + }; + } + + } + if (GetTickCount() - _dwLastStoreTick > 1000) { + CLUIFramesStoreAllFrames(); + _dwLastStoreTick = GetTickCount(); + } + return 0; +} + +int CheckFramesPos(RECT *wr) +{ + //CALLED only FROM MainWindow procedure at CLUI.c + if (_fCluiFramesModuleNotStarted) + return -1; + g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + + for (int i = 0; i < g_nFramesCount; i++) { + int dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left; + int dy = 0;//_window_rect.top-rcOldWindowRect.top; + if (!g_pfwFrames[i].floating && g_pfwFrames[i].visible) { + if (!(g_pfwFrames[i].OwnerWindow && (INT_PTR)(g_pfwFrames[i].OwnerWindow) != -2)) { + RECT r; + GetWindowRect(g_pfwFrames[i].hWnd, &r); + if (r.top - wr->top != g_pfwFrames[i].wndSize.top || r.left - wr->left != g_pfwFrames[i].wndSize.left) + SetWindowPos(g_pfwFrames[i].hWnd, NULL, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + } + if (g_pfwFrames[i].TitleBar.ShowTitleBar) { + RECT r; + GetWindowRect(g_pfwFrames[i].TitleBar.hwnd, &r); + if (r.top - wr->top != g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar || r.left - wr->left != g_pfwFrames[i].wndSize.left) { + SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, + g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); + SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); + } + } + } + } + + return 0; +} + +int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) +{ + RECT nRect; + int tick; + GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + g_CluiData.nGapBetweenTitlebar = db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + + if (_fCluiFramesModuleNotStarted) return -1; + + //need to enlarge parent + { + RECT mainRect; + int mainHeight, minHeight; + GetWindowRect(pcli->hwndContactList, &mainRect); + mainHeight = mainRect.bottom - mainRect.top; + minHeight = CLUIFrames_GetTotalHeight(); + if (mainHeight < minHeight) { + BOOL Upward = FALSE; + Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT); + + if (Upward) + mainRect.top = mainRect.bottom - minHeight; + else + mainRect.bottom = mainRect.top + minHeight; + SetWindowPos(pcli->hwndContactList, NULL, mainRect.left, mainRect.top, mainRect.right - mainRect.left, mainRect.bottom - mainRect.top, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + } + GetWindowRect(pcli->hwndContactList, &mainRect); + mainHeight = mainRect.bottom - mainRect.top; + } + GetClientRect(pcli->hwndContactList, &nRect); + //$$$ Fixed borders + if (lParam && lParam != 1 && lParam != 2) { + RECT oldRect; + POINT pt; + RECT *newRect = (RECT *)lParam; + int dl, dt, dr, db; + GetWindowRect((HWND)wParam, &oldRect); + pt.x = nRect.left; + pt.y = nRect.top; + ClientToScreen(pcli->hwndContactList, &pt); + dl = pt.x - oldRect.left; + dt = pt.y - oldRect.top; + dr = (oldRect.right - oldRect.left) - (nRect.right - nRect.left) - dl; + db = (oldRect.bottom - oldRect.top) - (nRect.bottom - nRect.top) - dt; + nRect.left = newRect->left + dl; + nRect.top = newRect->top + dt; + nRect.bottom = newRect->bottom - db; + nRect.right = newRect->right - dr; + } + + + //if (db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT))GetWindowRect(pcli->hwndStatus,&rcStatus); + //else rcStatus.top = rcStatus.bottom = 0; + // nRect.top--; + /* $$$ rcStatus.top = rcStatus.bottom = 0; + + + nRect.bottom -= nRect.top; + nRect.bottom -= (rcStatus.bottom-rcStatus.top); + nRect.right -= nRect.left; + nRect.left = 0; + nRect.top = 0; + ContactListHeight = nRect.bottom; $$$*/ + + nRect.left += g_CluiData.LeftClientMargin; + nRect.right -= g_CluiData.RightClientMargin; + nRect.top += g_CluiData.TopClientMargin; + nRect.bottom -= g_CluiData.BottomClientMargin; + + if (nRect.bottom < nRect.top) + nRect.bottom = nRect.top; + _nContactListHeight = nRect.bottom - nRect.top; //$$ + + tick = GetTickCount(); + + + CLUIFramesResize(nRect); + + CLUIFrames_ApplyNewSizes(2); + CLUIFrames_ApplyNewSizes(1); + + //resizing = FALSE; + + tick = GetTickCount() - tick; + + if (pcli->hwndContactList != 0) CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + if (pcli->hwndContactList != 0) UpdateWindow(pcli->hwndContactList); + + if (lParam == 2) RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); + + + Sleep(0); + + //dont save to database too many times + if (GetTickCount() - _dwLastStoreTick > 1000) { CLUIFramesStoreAllFrames(); _dwLastStoreTick = GetTickCount(); }; + + return 0; +} + +int OnFrameTitleBarBackgroundChange(WPARAM, LPARAM) +{ + if (MirandaExiting()) return 0; + { + AlignCOLLIconToLeft = db_get_b(NULL, "FrameTitleBar", "AlignCOLLIconToLeft", CLCDEFAULT_COLLICONTOLEFT); + + bkColour = sttGetColor("FrameTitleBar", "BkColour", CLCDEFAULT_BKCOLOUR); + bkUseWinColours = db_get_b(NULL, "FrameTitleBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + SelBkColour = sttGetColor("FrameTitleBar", "TextColour", CLCDEFAULT_TEXTCOLOUR); + + if (hBmpBackground) { + DeleteObject(hBmpBackground); + hBmpBackground = NULL; + } + if (g_CluiData.fDisableSkinEngine) { + if (db_get_b(NULL, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + ptrT tszBitmapName(db_get_tsa(NULL, "FrameTitleBar", "BkBitmap")); + if (tszBitmapName) + hBmpBackground = Bitmap_Load(tszBitmapName); + } + backgroundBmpUse = db_get_w(NULL, "FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + } + } + + CLUI__cliInvalidateRect(pcli->hwndContactList, 0, 0); + + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); + return 0; +} + +void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColour, DWORD backgroundBmpUse) +{ + HDC hdc; + RECT clRect, *rcPaint; + + int yScroll = 0; + PAINTSTRUCT paintst = { 0 }; + + //InvalidateRect(hwnd, 0, FALSE); + + HFONT hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); + + if (mhdc) { + hdc = mhdc; + rcPaint = NULL; + } + else { + hdc = BeginPaint(hwnd, &paintst); + rcPaint = &(paintst.rcPaint); + } + + GetClientRect(hwnd, &clRect); + if (rcPaint == NULL) rcPaint = &clRect; + if (rcPaint->right - rcPaint->left == 0 || rcPaint->top - rcPaint->bottom == 0) rcPaint = &clRect; + HDC hdcMem = CreateCompatibleDC(hdc); + HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL); + HBITMAP hOldBmp = (HBITMAP)SelectObject(hdcMem, hBmpOsb); + HFONT oFont = (HFONT)SelectObject(hdcMem, hFont); + SetBkMode(hdcMem, TRANSPARENT); + SetStretchBltMode(hdcMem, HALFTONE); + HBRUSH hBrush = CreateSolidBrush(bkColour); + FillRect(hdcMem, rcPaint, hBrush); + DeleteObject(hBrush); + if (hBmpBackground) { + BITMAP bmp; + int destw, desth; + + GetObject(hBmpBackground, sizeof(bmp), &bmp); + HDC hdcBmp = CreateCompatibleDC(hdcMem); + SelectObject(hdcBmp, hBmpBackground); + int y = backgroundBmpUse & CLBF_SCROLL ? -yScroll : 0; + int maxx = backgroundBmpUse & CLBF_TILEH ? clRect.right : 1; + int maxy = backgroundBmpUse & CLBF_TILEV ? rcPaint->bottom : y + 1; + switch (backgroundBmpUse & CLBM_TYPE) { + case CLB_STRETCH: + if (backgroundBmpUse & CLBF_PROPORTIONAL) { + if (clRect.right*bmp.bmHeight < clRect.bottom*bmp.bmWidth) { + desth = clRect.bottom; + destw = desth*bmp.bmWidth / bmp.bmHeight; + } + else { + destw = clRect.right; + //desth = destw*bmp.bmHeight / bmp.bmWidth; + } + } + else { + destw = clRect.right; + //desth = clRect.bottom; + } + break; + case CLB_STRETCHH: + if (backgroundBmpUse & CLBF_PROPORTIONAL) { + destw = clRect.right; + //desth = destw*bmp.bmHeight / bmp.bmWidth; + } + else { + destw = clRect.right; + //desth = bmp.bmHeight; + } + break; + case CLB_STRETCHV: + if (backgroundBmpUse & CLBF_PROPORTIONAL) { + desth = clRect.bottom; + destw = desth*bmp.bmWidth / bmp.bmHeight; + } + else { + destw = bmp.bmWidth; + //desth = clRect.bottom; + } + break; + default: //clb_topleft + destw = bmp.bmWidth; + //desth = bmp.bmHeight; + break; + } + desth = clRect.bottom - clRect.top; + for (; y < maxy; y += desth) { + if (y < rcPaint->top - desth) continue; + for (int x = 0; x < maxx; x += destw) + StretchBlt(hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); + } + DeleteDC(hdcBmp); + } + + { + + BitBlt(hdc, rcPaint->left, rcPaint->top, rcPaint->right - rcPaint->left, rcPaint->bottom - rcPaint->top, hdcMem, rcPaint->left, rcPaint->top, SRCCOPY); + + SelectObject(hdcMem, hOldBmp); + SelectObject(hdcMem, oFont); + DeleteObject(hBmpOsb); + DeleteDC(hdcMem); + paintst.fErase = FALSE; + //DeleteObject(hFont); + if (!mhdc) { + EndPaint(hwnd, &paintst); + } + } +} + + +int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid) +{ + BOOL bThemed = FALSE; + HDC hdcMem; + RECT rc = *rect; + HBITMAP b1 = NULL, b2 = NULL; + hdcMem = CreateCompatibleDC(hdcMem2); + + SetBkMode(hdcMem, TRANSPARENT); + HFONT hoTTBFont = (HFONT)SelectObject(hdcMem, _hTitleBarFont); + ske_ResetTextEffect(hdcMem); + ske_ResetTextEffect(hdcMem2); + HBRUSH hBack = GetSysColorBrush(COLOR_3DFACE); + HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBack); + + int pos = id2pos(Frameid); + + if (pos >= 0 && pos < g_nFramesCount) { + GetClientRect(g_pfwFrames[pos].TitleBar.hwnd, &rc); + if (g_pfwFrames[pos].floating) { + + rc.bottom = rc.top + g_nTitleBarHeight; + g_pfwFrames[pos].TitleBar.wndSize = rc; + } + else { + g_pfwFrames[pos].TitleBar.wndSize = rc; + } + b1 = ske_CreateDIB32(rc.right - rc.left, rc.bottom - rc.top); + b2 = (HBITMAP)SelectObject(hdcMem, b1); + if (g_pfwFrames[pos].floating && !g_CluiData.fDisableSkinEngine) { + FillRect(hdcMem, &rc, hBack); + //SelectObject(hdcMem,hoBrush); + SkinDrawGlyph(hdcMem, &rc, &rc, "Main,ID=FrameCaption"); + } + else { + if (g_CluiData.fDisableSkinEngine) { + if (!hBmpBackground && bkUseWinColours && xpt_IsThemed(_hFrameTitleTheme)) { + int state = CS_ACTIVE; + // if (GetForegroundWindow() != pcli->hwndContactList) state = CS_INACTIVE; + xpt_DrawThemeBackground(_hFrameTitleTheme, hdcMem, WP_SMALLCAPTION, state, &rc, &rc); + bThemed = TRUE; + } + else + DrawBackGround(g_pfwFrames[pos].TitleBar.hwnd, hdcMem, hBmpBackground, bkColour, backgroundBmpUse); + } + else if (!g_CluiData.fLayered) { + ske_BltBackImage(g_pfwFrames[pos].TitleBar.hwnd, hdcMem, &rc); + } + else BitBlt(hdcMem, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hdcMem2, rect->left, rect->top, SRCCOPY); + SkinDrawGlyph(hdcMem, &rc, &rc, "Main,ID=FrameCaption"); + } + if (bThemed) + SetTextColor(hdcMem, GetSysColor(COLOR_CAPTIONTEXT)); + else + SetTextColor(hdcMem, SelBkColour); + + RECT textrc = rc; + if (!AlignCOLLIconToLeft) { + + if (g_pfwFrames[pos].TitleBar.hicon != NULL) { + ske_DrawIconEx(hdcMem, rc.left + 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CYSMICON) >> 1)), g_pfwFrames[pos].TitleBar.hicon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + textrc.left += GetSystemMetrics(SM_CXSMICON) + 4; + textrc.top += 2; + } + else { + textrc.left += 2; + textrc.top += 2; + } + } + else { + textrc.left += GetSystemMetrics(SM_CXSMICON) + 2; + textrc.top += 2; + } + ske_TextOut(hdcMem, textrc.left, textrc.top, g_pfwFrames[pos].TitleBar.tbname, (int)mir_tstrlen(g_pfwFrames[pos].TitleBar.tbname)); + + if (!AlignCOLLIconToLeft) + ske_DrawIconEx(hdcMem, g_pfwFrames[pos].TitleBar.wndSize.right - GetSystemMetrics(SM_CXSMICON) - 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + else + ske_DrawIconEx(hdcMem, rc.left, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + } + + if (g_pfwFrames[pos].floating || (!g_CluiData.fLayered)) { + HRGN rgn = CreateRectRgn(rect->left, rect->top, rect->right, rect->bottom); + SelectClipRgn(hdcMem2, rgn); + BitBlt(hdcMem2, rect->left, rect->top, rc.right - rc.left, rc.bottom - rc.top, hdcMem, 0, 0, SRCCOPY); + DeleteObject(rgn); + } + else BitBlt(hdcMem2, rect->left, rect->top, rc.right - rc.left, rc.bottom - rc.top, hdcMem, 0, 0, SRCCOPY); + + SelectObject(hdcMem, b2); + DeleteObject(b1); + SelectObject(hdcMem, hoTTBFont); + SelectObject(hdcMem, hoBrush); + DeleteDC(hdcMem); + return 0; +} + +static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static int s_nLastByPos = -1; + static int s_nOldFrameHeight = -1; + static int s_nCurDragBar = -1; + + RECT rect; + int Frameid, Framemod, direction; + int xpos, ypos; + + Frameid = (GetWindowLongPtr(hwnd, GWLP_USERDATA)); + memset(&rect, 0, sizeof(rect)); + + switch (msg) { + case WM_CREATE: + if (!_hFrameTitleTheme) + _hFrameTitleTheme = xpt_AddThemeHandle(hwnd, L"WINDOW"); + SendMessage(hwnd, WM_SETFONT, (WPARAM)_hTitleBarFont, 0); + return FALSE; + + case WM_MEASUREITEM: + return Menu_MeasureItem((LPMEASUREITEMSTRUCT)lParam); + + case WM_DRAWITEM: + return Menu_DrawItem((LPDRAWITEMSTRUCT)lParam); + + case WM_USER + 100: + return 1; + + case WM_ENABLE: + if (hwnd != 0) CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + return 0; + + case WM_ERASEBKGND: + return 1; + + case WM_COMMAND: + if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), 0), Frameid)) + break; + + if (HIWORD(wParam) == 0) {//mouse events for self created menu + int framepos = id2pos(Frameid); + if (framepos == -1) { break; }; + + switch (LOWORD(wParam)) { + case frame_menu_lock: + g_pfwFrames[framepos].Locked = !g_pfwFrames[framepos].Locked; + break; + case frame_menu_visible: + g_pfwFrames[framepos].visible = !g_pfwFrames[framepos].visible; + break; + case frame_menu_showtitlebar: + g_pfwFrames[framepos].TitleBar.ShowTitleBar = !g_pfwFrames[framepos].TitleBar.ShowTitleBar; + break; + case frame_menu_floating: + CLUIFrames_SetFrameFloat(Frameid, 0); + break; + } + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + } + break; + + case WM_RBUTTONDOWN: + { + HMENU hmenu; + POINT pt; + GetCursorPos(&pt); + + if (ServiceExists(MS_CLIST_MENUBUILDFRAMECONTEXT)) + hmenu = (HMENU)CallService(MS_CLIST_MENUBUILDFRAMECONTEXT, Frameid, 0); + else { + //legacy menu support + int framepos = id2pos(Frameid); + + if (framepos == -1) { break; }; + hmenu = CreatePopupMenu(); + // Frames[Frameid].TitleBar.hmenu = hmenu; + AppendMenu(hmenu, MF_STRING | MF_DISABLED | MF_GRAYED, 15, g_pfwFrames[framepos].name); + AppendMenu(hmenu, MF_SEPARATOR, 16, _T("")); + AppendMenu(hmenu, g_pfwFrames[framepos].Locked ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_lock, TranslateT("Lock frame")); + AppendMenu(hmenu, g_pfwFrames[framepos].visible ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_visible, TranslateT("Visible")); + AppendMenu(hmenu, g_pfwFrames[framepos].TitleBar.ShowTitleBar ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_showtitlebar, TranslateT("Show title bar")); + AppendMenu(hmenu, g_pfwFrames[framepos].floating ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_floating, TranslateT("Floating")); + } + + TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); + DestroyMenu(hmenu); + } + break; + + case WM_LBUTTONDBLCLK: + Framemod = -1; + s_nLastByPos = -1; s_nOldFrameHeight = -1; ReleaseCapture(); + CallService(MS_CLIST_FRAMES_UCOLLFRAME, Frameid, 0); + s_nLastByPos = -1; s_nOldFrameHeight = -1; ReleaseCapture(); + break; + + case WM_LBUTTONUP: + { + if (GetCapture() != hwnd) { break; }; + s_nCurDragBar = -1; s_nLastByPos = -1; s_nOldFrameHeight = -1; ReleaseCapture(); + break; + }; + case WM_LBUTTONDOWN: + { + + int framepos = id2pos(Frameid); + + if (framepos == -1) { break; }; + { + if (g_pfwFrames[framepos].floating) { + + POINT pt; + GetCursorPos(&pt); + g_pfwFrames[framepos].TitleBar.oldpos = pt; + } + } + + //ScreenToClient(Frames[framepos].ContainerWnd,&Frames[framepos].TitleBar.oldpos); + + if ((!(wParam&MK_CONTROL)) && g_pfwFrames[framepos].Locked && (!(g_pfwFrames[framepos].floating))) { + if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { + POINT pt; + int res; + //pt = nm->pt; + GetCursorPos(&pt); + res = SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); + return res; + } + }; + + if (g_pfwFrames[framepos].floating) { + RECT rc; + GetCursorPos(&ptOld); + //ClientToScreen(hwnd,&ptOld); + GetWindowRect(hwnd, &rc); + + nLeft = (short)rc.left; + nTop = (short)rc.top; + }; + + SetCapture(hwnd); + + + break; + }; + case WM_MOUSEMOVE: + { + POINT pt, pt2; + RECT wndr; + int pos; + //tbinfo + { + TCHAR TBcapt[255]; + pos = id2pos(Frameid); + if (pos != -1) { + int oldflags; + + mir_sntprintf(TBcapt, _countof(TBcapt), _T("%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d"), + g_pfwFrames[pos].name, g_pfwFrames[pos].height, g_pfwFrames[pos].visible, g_pfwFrames[pos].floating, + g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, + g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y, + g_pfwFrames[pos].order); + + oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, g_pfwFrames[pos].id), 0); + if (!(oldflags&F_SHOWTBTIP)) { + oldflags |= F_SHOWTBTIP; + //CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,Frames[pos].id),(LPARAM)oldflags); + }; + //CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBTIPNAME,Frames[pos].id),(LPARAM)TBcapt); + }; + + + + } + // + if ((wParam&MK_LBUTTON)/* && (wParam&MK_CONTROL)*/) { + RECT rcMiranda; + RECT rcwnd, rcOverlap; + POINT newpt, ofspt, curpt, newpos; + //if (GetCapture() != hwnd){break;}; + //curdragbar = -1;lbypos = -1;oldframeheight = -1;ReleaseCapture(); + + pos = id2pos(Frameid); + if (g_pfwFrames[pos].floating) { + + GetCursorPos(&curpt); + rcwnd.bottom = curpt.y + 5; + rcwnd.top = curpt.y; + rcwnd.left = curpt.x; + rcwnd.right = curpt.x + 5; + + GetWindowRect(pcli->hwndContactList, &rcMiranda); + //GetWindowRect( Frames[pos].ContainerWnd, &rcwnd ); + //IntersectRect( &rcOverlap, &rcwnd, &rcMiranda ) + if (IsWindowVisible(pcli->hwndContactList) && IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { + int id = g_pfwFrames[pos].id; + + + + + ofspt.x = 0; ofspt.y = 0; + ClientToScreen(g_pfwFrames[pos].TitleBar.hwnd, &ofspt); + ofspt.x = curpt.x - ofspt.x; ofspt.y = curpt.y - ofspt.y; + + CLUIFrames_SetFrameFloat(id, 0); + newpt.x = 0; newpt.y = 0; + ClientToScreen(g_pfwFrames[pos].TitleBar.hwnd, &newpt); + SetCursorPos(newpt.x + ofspt.x, newpt.y + ofspt.y); + GetCursorPos(&curpt); + + g_pfwFrames[pos].TitleBar.oldpos = curpt; + + return 0; + }; + + } + else { + int id = g_pfwFrames[pos].id; + + GetCursorPos(&curpt); + rcwnd.bottom = curpt.y + 5; + rcwnd.top = curpt.y; + rcwnd.left = curpt.x; + rcwnd.right = curpt.x + 5; + + GetWindowRect(pcli->hwndContactList, &rcMiranda); + //GetWindowRect( Frames[pos].ContainerWnd, &rcwnd ); + //IntersectRect( &rcOverlap, &rcwnd, &rcMiranda ) + + + if (!IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { + GetCursorPos(&curpt); + GetWindowRect(g_pfwFrames[pos].hWnd, &rcwnd); + rcwnd.left = rcwnd.right - rcwnd.left; + rcwnd.top = rcwnd.bottom - rcwnd.top; + newpos.x = curpt.x; newpos.y = curpt.y; + if (curpt.x >= (rcMiranda.right - 1)) { newpos.x = curpt.x + 5; }; + if (curpt.x <= (rcMiranda.left + 1)) { newpos.x = curpt.x - (rcwnd.left) - 5; }; + if (curpt.y >= (rcMiranda.bottom - 1)) { newpos.y = curpt.y + 5; }; + if (curpt.y <= (rcMiranda.top + 1)) { newpos.y = curpt.y - (rcwnd.top) - 5; }; + ofspt.x = 0; ofspt.y = 0; + //ClientToScreen(Frames[pos].TitleBar.hwnd,&ofspt); + GetWindowRect(g_pfwFrames[pos].TitleBar.hwnd, &rcwnd); + ofspt.x = curpt.x - ofspt.x; ofspt.y = curpt.y - ofspt.y; + + g_pfwFrames[pos].FloatingPos.x = newpos.x; + g_pfwFrames[pos].FloatingPos.y = newpos.y; + CLUIFrames_SetFrameFloat(id, 0); + //SetWindowPos(Frames[pos].ContainerWnd, 0, newpos.x,newpos.y, 0, 0, SWP_NOSIZE); + + + newpt.x = 0; newpt.y = 0; + ClientToScreen(g_pfwFrames[pos].TitleBar.hwnd, &newpt); + + GetWindowRect(g_pfwFrames[pos].hWnd, &rcwnd); + SetCursorPos(newpt.x + (rcwnd.right - rcwnd.left) / 2, newpt.y + (rcwnd.bottom - rcwnd.top) / 2); + GetCursorPos(&curpt); + + g_pfwFrames[pos].TitleBar.oldpos = curpt; + return 0; + } + } + } + + if (wParam & MK_LBUTTON) { + int newh = -1, prevold; + + if (GetCapture() != hwnd) { break; }; + + + pos = id2pos(Frameid); + + if (g_pfwFrames[pos].floating) { + GetCursorPos(&pt); + if ((g_pfwFrames[pos].TitleBar.oldpos.x != pt.x) || (g_pfwFrames[pos].TitleBar.oldpos.y != pt.y)) { + + pt2 = pt; + ScreenToClient(hwnd, &pt2); + GetWindowRect(g_pfwFrames[pos].ContainerWnd, &wndr); + { + int dX, dY; + POINT ptNew; + + ptNew.x = pt.x; + ptNew.y = pt.y; + //ClientToScreen( hwnd, &ptNew ); + + dX = ptNew.x - ptOld.x; + dY = ptNew.y - ptOld.y; + + nLeft += (short)dX; + nTop += (short)dY; + + if (!(wParam&MK_CONTROL)) + PositionThumb(&g_pfwFrames[pos], nLeft, nTop); + else + SetWindowPos(g_pfwFrames[pos].ContainerWnd, + HWND_TOPMOST, + nLeft, + nTop, + 0, + 0, + SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); + + ptOld = ptNew; + } + + pt.x = nLeft; + pt.y = nTop; + g_pfwFrames[pos].TitleBar.oldpos = pt; + }; + + //break; + return 0; + } + + if (g_pfwFrames[pos].prevvisframe != -1) { + GetCursorPos(&pt); + + if ((g_pfwFrames[pos].TitleBar.oldpos.x == pt.x) && (g_pfwFrames[pos].TitleBar.oldpos.y == pt.y)) + break; + + ypos = rect.top + pt.y; xpos = rect.left + pt.x; + Framemod = -1; + + if (g_pfwFrames[pos].align == alBottom) { + direction = -1; + Framemod = pos; + } + else { + direction = 1; + Framemod = g_pfwFrames[pos].prevvisframe; + } + if (g_pfwFrames[Framemod].Locked) break; + if (s_nCurDragBar != -1 && s_nCurDragBar != pos) break; + + if (s_nLastByPos == -1) { + s_nCurDragBar = pos; + s_nLastByPos = ypos; + s_nOldFrameHeight = g_pfwFrames[Framemod].height; + SetCapture(hwnd); + break; + } + + newh = s_nOldFrameHeight + direction*(ypos - s_nLastByPos); + if (newh > 0) { + prevold = g_pfwFrames[Framemod].height; + g_pfwFrames[Framemod].height = newh; + if (!CLUIFramesFitInSize()) { g_pfwFrames[Framemod].height = prevold; return TRUE; } + g_pfwFrames[Framemod].height = newh; + if (newh > 3) g_pfwFrames[Framemod].collapsed = TRUE; + + } + g_pfwFrames[pos].TitleBar.oldpos = pt; + } + + if (newh > 0) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + break; + } + s_nCurDragBar = -1; s_nLastByPos = -1; s_nOldFrameHeight = -1; ReleaseCapture(); + } + break; + + case WM_PRINT: + case WM_PRINTCLIENT: + GetClientRect(hwnd, &rect); + if (!g_CluiData.fLayered) + ske_BltBackImage(hwnd, (HDC)wParam, &rect); + + DrawTitleBar((HDC)wParam, &rect, Frameid); + break; + + case WM_SIZE: + InvalidateRect(hwnd, NULL, FALSE); + return DefWindowProc(hwnd, msg, wParam, lParam); + + case WM_PAINT: + if (g_pfwFrames[id2pos(Frameid)].floating || !g_CluiData.fLayered) { + GetClientRect(hwnd, &rect); + HDC paintDC = GetDC(hwnd); + DrawTitleBar(paintDC, &rect, Frameid); + ReleaseDC(hwnd, paintDC); + ValidateRect(hwnd, NULL); + } + return DefWindowProc(hwnd, msg, wParam, lParam); + + default: + return DefWindowProc(hwnd, msg, wParam, lParam); + } + return TRUE; +} +static int CLUIFrameResizeFloatingFrame(int framepos) +{ + RECT rect; + + if (!g_pfwFrames[framepos].floating) { return 0; }; + if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; }; + GetClientRect(g_pfwFrames[framepos].ContainerWnd, &rect); + + int width = rect.right - rect.left; + int height = rect.bottom - rect.top; + + g_pfwFrames[framepos].visible ? CLUI_ShowWindowMod(g_pfwFrames[framepos].ContainerWnd, SW_SHOW/*NOACTIVATE*/) : CLUI_ShowWindowMod(g_pfwFrames[framepos].ContainerWnd, SW_HIDE); + + + + if (g_pfwFrames[framepos].TitleBar.ShowTitleBar) { + CLUI_ShowWindowMod(g_pfwFrames[framepos].TitleBar.hwnd, SW_SHOW/*NOACTIVATE*/); + g_pfwFrames[framepos].height = height - DEFAULT_TITLEBAR_HEIGHT; + + SetWindowPos(g_pfwFrames[framepos].TitleBar.hwnd, HWND_TOP, 0, 0, width, DEFAULT_TITLEBAR_HEIGHT, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_DRAWFRAME); + SetWindowPos(g_pfwFrames[framepos].hWnd, HWND_TOP, 0, DEFAULT_TITLEBAR_HEIGHT, width, height - DEFAULT_TITLEBAR_HEIGHT, SWP_SHOWWINDOW); + + } + else { + g_pfwFrames[framepos].height = height; + CLUI_ShowWindowMod(g_pfwFrames[framepos].TitleBar.hwnd, SW_HIDE); + SetWindowPos(g_pfwFrames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); + + }; + if (g_pfwFrames[framepos].ContainerWnd != 0) UpdateWindow(g_pfwFrames[framepos].ContainerWnd); + GetWindowRect(g_pfwFrames[framepos].hWnd, &g_pfwFrames[framepos].wndSize); + return 0; +}; + +static int CLUIFrameOnMainMenuBuild(WPARAM, LPARAM) +{ + if (MirandaExiting()) return 0; + CLUIFramesLoadMainMenu(); + + return 0; +} + +static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_ACTIVATE: + if (g_bTransparentFlag) { + BYTE alpha; + if ((wParam != WA_INACTIVE || ((HWND)lParam == hwnd) || GetParent((HWND)lParam) == hwnd)) { + HWND hw = lParam ? GetParent((HWND)lParam) : 0; + alpha = db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT); + if (hw) SetWindowPos(hw, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); + CLUI_SmoothAlphaTransition(hwnd, alpha, 1); + } + } + + return DefWindowProc(hwnd, msg, wParam, lParam); + + case WM_NOTIFY: + case WM_PARENTNOTIFY: + case WM_SYSCOMMAND: + return SendMessage(pcli->hwndContactList, msg, wParam, lParam); + + case WM_MOVE: + if (g_CluiData.fDocked) + return 1; + break; + + case WM_WINDOWPOSCHANGING: + if (g_CluiData.mutexPreventDockMoving) { + WINDOWPOS *wp; + wp = (WINDOWPOS*)lParam; + wp->flags |= SWP_NOMOVE/*|SWP_NOSIZE*/; + wp->flags &= (wp->flags&~SWP_NOACTIVATE); + return DefWindowProc(hwnd, msg, wParam, lParam); + } + break; + + case WM_WINDOWPOSCHANGED: + if (g_CluiData.fDocked && g_CluiData.mutexPreventDockMoving) + return 0; + break; + + case WM_NCPAINT: + case WM_PAINT: + return DefWindowProc(hwnd, msg, wParam, lParam); + + case WM_ERASEBKGND: + return 1; + } + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int height) +{ + HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, _T("SubContainerWindow"), WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, 0, g_hInst, 0); + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_BORDER)); + if (g_CluiData.fOnDesktop) { + HWND hProgMan = FindWindow(_T("Progman"), NULL); + if (IsWindow(hProgMan)) + SetParent(hwnd, hProgMan); + } + + return hwnd; +} + +static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + int framepos, Frameid = GetWindowLongPtr(hwnd, GWLP_USERDATA); + + RECT rect; + memset(&rect, 0, sizeof(rect)); + + switch (msg) { + case WM_CREATE: + framepos = id2pos(Frameid); + return 0; + + case WM_GETMINMAXINFO: + MINMAXINFO minmax; + framepos = id2pos(Frameid); + if (framepos < 0 || framepos >= g_nFramesCount) { break; }; + if (!g_pfwFrames[framepos].minmaxenabled) { break; }; + if (g_pfwFrames[framepos].ContainerWnd == 0) { break; }; + + if (g_pfwFrames[framepos].Locked) { + RECT rct; + + GetWindowRect(hwnd, &rct); + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = rct.right - rct.left; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = rct.bottom - rct.top; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = rct.right - rct.left; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom - rct.top; + // + //return 0; + } + + memset(&minmax, 0, sizeof(minmax)); + if (SendMessage(g_pfwFrames[framepos].hWnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax) == 0) { + RECT border; + int tbh = g_nTitleBarHeight*btoint(g_pfwFrames[framepos].TitleBar.ShowTitleBar); + GetBorderSize(hwnd, &border); + if (minmax.ptMaxTrackSize.x != 0 && minmax.ptMaxTrackSize.y != 0) { + + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = minmax.ptMinTrackSize.x; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = minmax.ptMinTrackSize.y; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = minmax.ptMaxTrackSize.x + border.left + border.right; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = minmax.ptMaxTrackSize.y + tbh + border.top + border.bottom; + } + } + else return(DefWindowProc(hwnd, msg, wParam, lParam)); + + case WM_MOVE: + framepos = id2pos(Frameid); + if (framepos < 0 || framepos >= g_nFramesCount) + break; + if (g_pfwFrames[framepos].ContainerWnd == 0) + return 0; + + GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect); + g_pfwFrames[framepos].FloatingPos.x = rect.left; + g_pfwFrames[framepos].FloatingPos.y = rect.top; + g_pfwFrames[framepos].FloatingSize.x = rect.right - rect.left; + g_pfwFrames[framepos].FloatingSize.y = rect.bottom - rect.top; + + CLUIFramesStoreFrameSettings(framepos); + + if (g_pfwFrames[framepos].floating) { + POINT curpt, ofspt, newpt, newpos; + RECT rcwnd, rcOverlap, rcMiranda; + + GetCursorPos(&curpt); + rcwnd.bottom = curpt.y + 5; + rcwnd.top = curpt.y; + rcwnd.left = curpt.x; + rcwnd.right = curpt.x + 5; + + GetWindowRect(pcli->hwndContactList, &rcMiranda); + if (IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { + GetCursorPos(&curpt); + GetWindowRect(g_pfwFrames[framepos].hWnd, &rcwnd); + rcwnd.left = rcwnd.right - rcwnd.left; + rcwnd.top = rcwnd.bottom - rcwnd.top; + newpos.x = curpt.x; newpos.y = curpt.y; + if (curpt.x >= (rcMiranda.right - 1)) { newpos.x = curpt.x + 5; }; + if (curpt.x <= (rcMiranda.left + 1)) { newpos.x = curpt.x - (rcwnd.left) - 5; }; + if (curpt.y >= (rcMiranda.bottom - 1)) { newpos.y = curpt.y + 5; }; + if (curpt.y <= (rcMiranda.top + 1)) { newpos.y = curpt.y - (rcwnd.top) - 5; }; + ofspt.x = 0; ofspt.y = 0; + GetWindowRect(g_pfwFrames[framepos].TitleBar.hwnd, &rcwnd); + ofspt.x = curpt.x - ofspt.x; ofspt.y = curpt.y - ofspt.y; + + g_pfwFrames[framepos].FloatingPos.x = newpos.x; + g_pfwFrames[framepos].FloatingPos.y = newpos.y; + CLUIFrames_SetFrameFloat(Frameid, 0); + + newpt.x = 0; newpt.y = 0; + ClientToScreen(g_pfwFrames[framepos].TitleBar.hwnd, &newpt); + + GetWindowRect(g_pfwFrames[framepos].hWnd, &rcwnd); + SetCursorPos(newpt.x + (rcwnd.right - rcwnd.left) / 2, newpt.y + (rcwnd.bottom - rcwnd.top) / 2); + GetCursorPos(&curpt); + + g_pfwFrames[framepos].TitleBar.oldpos = curpt; + return 0; + } + } + + return 0; + + case WM_SIZE: + CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); + + framepos = id2pos(Frameid); + + if (framepos < 0 || framepos >= g_nFramesCount) { break; }; + if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; }; + CLUIFrameResizeFloatingFrame(framepos); + + GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect); + g_pfwFrames[framepos].FloatingPos.x = rect.left; + g_pfwFrames[framepos].FloatingPos.y = rect.top; + g_pfwFrames[framepos].FloatingSize.x = rect.right - rect.left; + g_pfwFrames[framepos].FloatingSize.y = rect.bottom - rect.top; + + CLUIFramesStoreFrameSettings(framepos); + return 0; + + case WM_LBUTTONDOWN: + if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { + POINT pt; + GetCursorPos(&pt); + return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); + } + break; + + case WM_CLOSE: + DestroyWindow(hwnd); + break; + + case WM_DESTROY: + return 0; + } + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height) +{ + return CreateWindow(_T("FramesContainer"), _T("FramesContainer"), WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0); +} + +static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) +{ + HWND hwndtmp, hwndtooltiptmp; + + int pos = id2pos(wParam); + if (pos < 0 || pos >= g_nFramesCount) + return 0; + + if (g_pfwFrames[pos].floating || (lParam & 2)) { + if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].visible) { + if (g_pfwFrames[pos].OwnerWindow == 0) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10); + CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); + SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].OwnerWindow); + SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList); + SetWindowLongPtr(g_pfwFrames[pos].OwnerWindow, GWLP_USERDATA, g_pfwFrames[pos].id); + g_pfwFrames[pos].floating = FALSE; + if (!(lParam & 2)) { + DestroyWindow(g_pfwFrames[pos].ContainerWnd); + g_pfwFrames[pos].ContainerWnd = 0; + } + } + else { + SetParent(g_pfwFrames[pos].hWnd, pcli->hwndContactList); + SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList); + g_pfwFrames[pos].floating = FALSE; + if (g_pfwFrames[pos].ContainerWnd) DestroyWindow(g_pfwFrames[pos].ContainerWnd); + g_pfwFrames[pos].ContainerWnd = 0; + } + } + else { + RECT recttb, rectw, border; + LONG_PTR temp; + int neww, newh; + + g_pfwFrames[pos].oldstyles = GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE); + g_pfwFrames[pos].TitleBar.oldstyles = GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE); + bool locked = g_pfwFrames[pos].Locked; + g_pfwFrames[pos].Locked = FALSE; + g_pfwFrames[pos].minmaxenabled = FALSE; + + GetWindowRect(g_pfwFrames[pos].hWnd, &rectw); + GetWindowRect(g_pfwFrames[pos].TitleBar.hwnd, &recttb); + if (!g_pfwFrames[pos].TitleBar.ShowTitleBar) + recttb.top = recttb.bottom = recttb.left = recttb.right = 0; + + g_pfwFrames[pos].ContainerWnd = CreateContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10); + + SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].ContainerWnd); + SetParent(g_pfwFrames[pos].TitleBar.hwnd, g_pfwFrames[pos].ContainerWnd); + if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].OwnerWindow != 0) { + DestroyWindow(g_pfwFrames[pos].OwnerWindow); + g_pfwFrames[pos].OwnerWindow = 0; + } + + GetBorderSize(g_pfwFrames[pos].ContainerWnd, &border); + + SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWLP_USERDATA, g_pfwFrames[pos].id); + if ((lParam == 1)) { + if (g_pfwFrames[pos].FloatingPos.x < 0) { g_pfwFrames[pos].FloatingPos.x = 0; }; + if (g_pfwFrames[pos].FloatingPos.y < 0) { g_pfwFrames[pos].FloatingPos.y = 0; }; + + SetWindowPos(g_pfwFrames[pos].ContainerWnd, HWND_TOPMOST, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y, SWP_HIDEWINDOW | SWP_NOACTIVATE); + } + else if (lParam == 0) { + neww = rectw.right - rectw.left + border.left + border.right; + newh = (rectw.bottom - rectw.top) + (recttb.bottom - recttb.top) + border.top + border.bottom; + if (neww < 20) { neww = 40; }; + if (newh < 20) { newh = 40; }; + if (g_pfwFrames[pos].FloatingPos.x < 20) { g_pfwFrames[pos].FloatingPos.x = 40; }; + if (g_pfwFrames[pos].FloatingPos.y < 20) { g_pfwFrames[pos].FloatingPos.y = 40; }; + + SetWindowPos(g_pfwFrames[pos].ContainerWnd, HWND_TOPMOST, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, neww, newh, SWP_HIDEWINDOW | SWP_NOACTIVATE); + } + + SetWindowText(g_pfwFrames[pos].ContainerWnd, g_pfwFrames[pos].TitleBar.tbname); + + temp = GetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWL_EXSTYLE); + temp |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST; + SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWL_EXSTYLE, temp); + + g_pfwFrames[pos].floating = TRUE; + g_pfwFrames[pos].Locked = locked; + } + + CLUIFramesStoreFrameSettings(pos); + g_pfwFrames[pos].minmaxenabled = TRUE; + hwndtooltiptmp = g_pfwFrames[pos].TitleBar.hwndTip; + + hwndtmp = g_pfwFrames[pos].ContainerWnd; + + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + if (hwndtmp) + SendMessage(hwndtmp, WM_SIZE, 0, 0); + + SetWindowPos(hwndtooltiptmp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + return 0; +} + +int CLUIFrameOnModulesLoad(WPARAM, LPARAM) +{ + /* HOOK */ + CLUIFramesLoadMainMenu(); + CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, false); + return 0; +} + +int CLUIFrameOnModulesUnload(WPARAM, LPARAM) +{ + g_CluiData.bSTATE = STATE_PREPARETOEXIT; + + if (cont.MIVisible) { + cont.MIVisible = NULL; + _AniAva_OnModulesUnload(); + } + return 0; +} + +int LoadCLUIFramesModule(void) +{ + _cluiFramesModuleCSInitialized = TRUE; + + WNDCLASS wndclass = { 0 }; + wndclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ; + wndclass.lpfnWndProc = CLUIFrameTitleBarProc; + wndclass.hInstance = g_hInst; + wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE); + wndclass.lpszClassName = CLUIFrameTitleBarClassName; + RegisterClass(&wndclass); + + WNDCLASS subconclass = { 0 }; + subconclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ; + subconclass.lpfnWndProc = CLUIFrameSubContainerProc; + subconclass.hInstance = g_hInst; + subconclass.hCursor = LoadCursor(NULL, IDC_ARROW); + subconclass.lpszClassName = CLUIFrameSubContainerClassName; + RegisterClass(&subconclass); + + //container helper + WNDCLASS cntclass = { 0 }; + cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/ | CS_DROPSHADOW; + cntclass.lpfnWndProc = CLUIFrameContainerWndProc; + cntclass.hInstance = g_hInst; + cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); + cntclass.lpszClassName = _T("FramesContainer"); + RegisterClass(&cntclass); + //end container helper + + GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + + g_nFramesCount = 0; + InitGroupMenus(); + + HookEvent(ME_SYSTEM_MODULESLOADED, CLUIFrameOnModulesLoad); + HookEvent(ME_CLIST_PREBUILDFRAMEMENU, CLUIFramesModifyContextMenuForFrame); + HookEvent(ME_CLIST_PREBUILDMAINMENU, CLUIFrameOnMainMenuBuild); + HookEvent(ME_SYSTEM_PRESHUTDOWN, CLUIFrameOnModulesUnload); + + CreateCluiFramesServices(); + + hWndExplorerToolBar = FindWindowEx(0, 0, _T("Shell_TrayWnd"), NULL); + OnFrameTitleBarBackgroundChange(0, 0); + _fCluiFramesModuleNotStarted = FALSE; + return 0; +} + +static INT_PTR UnloadMainMenu() +{ + CLUIFrameOnModulesUnload(0, 0); + if (cont.MainMenuItem != NULL) { + Menu_RemoveItem(cont.MainMenuItem); + cont.MainMenuItem = NULL; + } + + return (INT_PTR)cont.MainMenuItem; +} + +int UnLoadCLUIFramesModule(void) +{ + _fCluiFramesModuleNotStarted = TRUE; + if (hBmpBackground) { DeleteObject(hBmpBackground); hBmpBackground = NULL; } + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + CLUIFramesStoreAllFrames(); + + UnloadMainMenu(); + for (int i = 0; i < g_nFramesCount; i++) { + if (g_pfwFrames[i].hWnd != pcli->hwndContactTree) + DestroyWindow(g_pfwFrames[i].hWnd); + + g_pfwFrames[i].hWnd = (HWND)-1; + DestroyWindow(g_pfwFrames[i].TitleBar.hwnd); + g_pfwFrames[i].TitleBar.hwnd = (HWND)-1; + if (g_pfwFrames[i].ContainerWnd && g_pfwFrames[i].ContainerWnd != (HWND)(-2) && g_pfwFrames[i].ContainerWnd != (HWND)(-1)) DestroyWindow(g_pfwFrames[i].ContainerWnd); + g_pfwFrames[i].ContainerWnd = (HWND)-1; + if (g_pfwFrames[i].TitleBar.hmenu) + DestroyMenu(g_pfwFrames[i].TitleBar.hmenu); + if (g_pfwFrames[i].OwnerWindow && g_pfwFrames[i].OwnerWindow != (HWND)(-2) && g_pfwFrames[i].OwnerWindow != (HWND)(-1)) + DestroyWindow(g_pfwFrames[i].OwnerWindow); + g_pfwFrames[i].OwnerWindow = (HWND)-2; + if (g_pfwFrames[i].UpdateRgn) DeleteObject(g_pfwFrames[i].UpdateRgn); + + mir_free_and_nil(g_pfwFrames[i].name); + mir_free_and_nil(g_pfwFrames[i].TitleBar.tbname); + mir_free_and_nil(g_pfwFrames[i].TitleBar.tooltip); + + } + free(g_pfwFrames); + g_pfwFrames = NULL; + g_nFramesCount = 0; + UnregisterClass(CLUIFrameTitleBarClassName, g_hInst); + DeleteObject(_hTitleBarFont); + + _cluiFramesModuleCSInitialized = FALSE; + return 0; +} + +static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam) +{ + if (!wParam) return 0; + + // LOOK REQUIRED OR SYNC CALL NEEDED + FRAMEWND *frm = FindFrameByItsHWND((HWND)wParam); + if (!frm) return 0; + if (lParam) + frm->PaintCallbackProc = (tPaintCallbackProc)lParam; + else + frm->PaintCallbackProc = NULL; + return 1; +} + +int CLUIFrames_SetLayeredMode(BOOL fLayeredMode, HWND hwnd) +{ + for (int i = 0; i < g_nFramesCount; i++) { + if (fLayeredMode) { + if (g_pfwFrames[i].visible && GetParent(g_pfwFrames[i].hWnd) == pcli->hwndContactList && g_pfwFrames[i].PaintCallbackProc == NULL) { + //create owner window + g_pfwFrames[i].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[i].FloatingPos.x, g_pfwFrames[i].FloatingPos.y, 10, 10); + SetParent(g_pfwFrames[i].hWnd, g_pfwFrames[i].OwnerWindow); + } + } + else if (GetParent(g_pfwFrames[i].hWnd) == g_pfwFrames[i].OwnerWindow) { + SetParent(g_pfwFrames[i].hWnd, hwnd); + if ((INT_PTR)g_pfwFrames[i].OwnerWindow > 0) { + DestroyWindow(g_pfwFrames[i].OwnerWindow); + g_pfwFrames[i].OwnerWindow = (HWND)-2; + } + } + } + + CLUIFrames_UpdateFrame((WPARAM)-1, 0); //update all frames + return 0; +} + +int CLUIFrames_UpdateBorders() +{ + for (int i = 0; i < g_nFramesCount; i++) { + if (!g_pfwFrames[i].floating) { + LONG_PTR style = GetWindowLongPtr(g_pfwFrames[i].hWnd, GWL_STYLE) & (~WS_BORDER); + if (!g_CluiData.fLayered && g_pfwFrames[i].UseBorder) style |= WS_BORDER; + SetWindowLongPtr(g_pfwFrames[i].hWnd, GWL_STYLE, style); + CLUIFramesModifyMainMenuItems(g_pfwFrames[i].id, 0); + RedrawWindow(g_pfwFrames[i].hWnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + } + } + + return 0; +} diff --git a/plugins/Clist_modern/src/cluiframes.h b/plugins/Clist_modern/src/cluiframes.h new file mode 100644 index 0000000000..09af1b44f2 --- /dev/null +++ b/plugins/Clist_modern/src/cluiframes.h @@ -0,0 +1,135 @@ +/* +Miranda ICQ: the free icq client for MS Windows +Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#pragma once + +#ifndef _CLUIFRAMES_H_ +#define _CLUIFRAMES_H_ + +#include "m_skin_eng.h" + +int LoadCLUIFramesModule(void); +int UnLoadCLUIFramesModule(void); +int CLUIFramesGetMinHeight(); +int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam); +int CLUIFrames_GetTotalHeight(); + +typedef struct tagProtocolData { + char *RealName; + int protopos; + boolean show; +} ProtocolData; + +typedef struct +{ + int order; + int realpos; +}SortData; + + + + +//============ +#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign" + +#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop" +#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient" +#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom" +#define CLUIFRAMESSETFLOATING "Set_Floating" + +#define CLUIFRAMESMOVEUPDOWN "CLUIFramesMoveUpDown" +#define CLUIFRAMESMOVEUP "CLUIFramesMoveUp" +#define CLUIFRAMESMOVEDOWN "CLUIFramesMoveDown" + +struct FrameMenuHandles +{ + HGENMENU MainMenuItem; + HGENMENU MIVisible, MITitle, MITBVisible, MILock, MIColl, MIFloating, MIAlignRoot; + HGENMENU MIAlignTop, MIAlignClient, MIAlignBottom; + HGENMENU MIBorder; +}; + +struct FrameTitleBar +{ + HWND hwnd; + HWND TitleBarbutt; + HWND hwndTip; + + LPTSTR tbname; + LPTSTR tooltip; + + HMENU hmenu; + HICON hicon; + + bool ShowTitleBar; + bool ShowTitleBarTip; + COLORREF BackColour; + COLORREF TextColour; + int oldstyles; + POINT oldpos; + RECT wndSize; +}; + +struct DockOpt +{ + HWND hwndLeft; + HWND hwndRight; +}; + +struct FRAMEWND +{ + int id; + HWND hWnd; + RECT wndSize; + LPTSTR name; + int align; + int height; + int dwFlags; + bool Locked; + bool visible; + bool needhide; + bool collapsed; + bool floating; + bool minmaxenabled; + bool UseBorder; + int prevvisframe; + int HeightWhenCollapsed; + FrameTitleBar TitleBar; + FrameMenuHandles MenuHandles; + int oldstyles; + HWND ContainerWnd; + POINT FloatingPos; + POINT FloatingSize; + int order; + DockOpt dockOpt; + HWND OwnerWindow; + tPaintCallbackProc PaintCallbackProc; + sPaintRequest * PaintData; + bool bQueued; + HRGN UpdateRgn; +}; + +#define OFFSET_PROTOPOS 200 +#define OFFSET_VISIBLE 400 + +#define CLUIFrameSubContainerClassName _T("CLUIFrameSubContainer") +#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar") +#define CLUIFrameModule "CLUIFrames" + +#endif diff --git a/plugins/Clist_modern/src/groupmenu.cpp b/plugins/Clist_modern/src/groupmenu.cpp new file mode 100644 index 0000000000..c5b7781bb8 --- /dev/null +++ b/plugins/Clist_modern/src/groupmenu.cpp @@ -0,0 +1,319 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "stdafx.h" +#include "m_clui.h" +#include "modern_clist.h" +#include "modern_clc.h" + +///////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////// Group MENU ////////////////////////////// + +HGENMENU hGroupMainMenuItemProxy; +HGENMENU hHideShowMainMenuItem; +HGENMENU hGroupStatusMenuItemProxy; + +HGENMENU hHideOfflineUsersMenuItem; +HGENMENU hHideOfflineUsersOutHereMenuItem; +HGENMENU hHideEmptyGroupsMenuItem; + +HGENMENU hDisableGroupsMenuItem; +HGENMENU hNewGroupMenuItem; +HGENMENU hNewSubGroupMenuItem; + +void InitSubGroupMenus(void); + +INT_PTR GroupMenuOnAddService(WPARAM wParam, LPARAM lParam) +{ + MENUITEMINFO *mii = (MENUITEMINFO*)wParam; + if (mii == NULL) + return 0; + + if (hHideShowMainMenuItem == (HANDLE)lParam) { + mii->fMask |= MIIM_STATE; + mii->fState |= MFS_DEFAULT; + + } + if (hGroupMainMenuItemProxy == (HANDLE)lParam) { + mii->fMask |= MIIM_SUBMENU; + mii->hSubMenu = Menu_GetMainMenu(); + } + + if (hGroupStatusMenuItemProxy == (HANDLE)lParam) { + mii->fMask |= MIIM_SUBMENU; + mii->hSubMenu = Menu_GetStatusMenu(); + } + + return TRUE; +} + +INT_PTR HideGroupsHelper(WPARAM, LPARAM) +{ + int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS); + db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal); + SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0); + return 0; +} + +INT_PTR UseGroupsHelper(WPARAM, LPARAM) +{ + int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS); + db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal); + SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, newVal,0); + return 0; +} + +INT_PTR HideOfflineRootHelper(WPARAM, LPARAM) +{ + SendMessage(pcli->hwndContactTree, CLM_SETHIDEOFFLINEROOT, + !SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0), + 0); + return 0; +} + +INT_PTR CreateGroupHelper(WPARAM, LPARAM) +{ + SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0); + SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, 1, 0); + Clist_CreateGroup(0, 0); + return 0; +}; + +static int OnBuildGroupMenu(WPARAM, LPARAM) +{ + if (MirandaExiting()) return 0; + + int flags = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0; + Menu_ModifyItem(hHideOfflineUsersMenuItem, NULL, INVALID_HANDLE_VALUE, flags); + + flags = SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0; + Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags); + + flags = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0; + Menu_ModifyItem(hHideEmptyGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags); + + flags = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? 0 : CMIF_CHECKED; + Menu_ModifyItem(hDisableGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags); + return 0; +} + +static IconItemT iconItem[] = +{ + { LPGENT("New group"), "NewGroup", IDI_NEWGROUP2 } +}; + +void GroupMenus_Init(void) +{ + Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, _countof(iconItem)); +} + +void InitGroupMenus(void) +{ + CreateServiceFunction("CLISTMENUSGroup/GroupMenuOnAddService", GroupMenuOnAddService); + CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper", HideGroupsHelper); + CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper", UseGroupsHelper); + CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper", HideOfflineRootHelper); + CreateServiceFunction("CLISTMENUSGroup/CreateGroupHelper", CreateGroupHelper); + + HookEvent(ME_CLIST_PREBUILDGROUPMENU, OnBuildGroupMenu); + + InitSubGroupMenus(); + + // add exit command to menu + CMenuItem mi; + mi.position = 1900000; + mi.pszService = "CloseAction"; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT); + mi.name.a = LPGEN("E&xit"); + Menu_AddGroupMenuItem(&mi); + + mi.position = 500; + mi.pszService = MS_CLIST_SHOWHIDE; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE); + mi.name.a = LPGEN("&Hide/show"); + hHideShowMainMenuItem = Menu_AddGroupMenuItem(&mi); + + mi.position = 200000; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER); + mi.pszService = "FindAdd/FindAddCommand"; + mi.name.a = LPGEN("&Find/add contacts..."); + Menu_AddGroupMenuItem(&mi); + + mi.position = 300000; + mi.pszService = ""; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MAINMENU); + mi.name.a = LPGEN("&Main menu"); + hGroupMainMenuItemProxy = Menu_AddGroupMenuItem(&mi); + + mi.position = 300100; + mi.pszService = ""; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_STATUS); + mi.name.a = LPGEN("&Status"); + hGroupStatusMenuItemProxy = Menu_AddGroupMenuItem(&mi); + + mi.position = 400000; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS); + mi.pszService = "Options/OptionsCommand"; + mi.name.a = LPGEN("&Options..."); + Menu_AddGroupMenuItem(&mi); + + mi.position = 500000; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); + mi.pszService = "Help/AboutCommand"; + mi.name.a = LPGEN("&About"); + Menu_AddGroupMenuItem(&mi); + + GroupMenuParam gmp = {}; + mi.flags = 0; + mi.position = 100000; + mi.hIcolibItem = iconItem[0].hIcolib; + mi.pszService = "CLISTMENUSGroup/CreateGroupHelper"; + mi.name.a = LPGEN("&New group"); + hNewGroupMenuItem = Menu_AddGroupMenuItem(&mi, &gmp); + DestroyIcon_protect((HICON)mi.hIcolibItem); + + mi.position = 100001; + mi.hIcolibItem = NULL; + mi.hIcolibItem = NULL; + mi.pszService = MS_CLIST_SETHIDEOFFLINE; + mi.name.a = LPGEN("&Hide offline users"); + gmp.wParam = -1; + hHideOfflineUsersMenuItem = Menu_AddGroupMenuItem(&mi, &gmp); + + mi.position = 100002; + mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper"; + mi.name.a = LPGEN("Hide &offline users out here"); + hHideOfflineUsersOutHereMenuItem = Menu_AddGroupMenuItem(&mi); + + mi.position = 100003; + mi.pszService = "CLISTMENUSGroup/HideGroupsHelper"; + mi.name.a = LPGEN("Hide &empty groups"); + hHideEmptyGroupsMenuItem = Menu_AddGroupMenuItem(&mi); + + mi.position = 100004; + mi.pszService = "CLISTMENUSGroup/UseGroupsHelper"; + mi.name.a = LPGEN("Disable &groups"); + hDisableGroupsMenuItem = Menu_AddGroupMenuItem(&mi); +} + +///////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////// SubGroup MENU ////////////////////////////// + +HGENMENU hHideOfflineUsersHereMenuItem, hShowOfflineUsersHereMenuItem; + +// wparam menu handle to pass to clc.c +// lparam WM_COMMAND HWND +static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM) +{ + BOOL gray1 = FALSE; + BOOL gray2 = FALSE; + BOOL showOfflineinGroup = FALSE; + + ClcGroup *group = (ClcGroup *)wParam; + if (wParam == 0) return 0; + + if (MirandaExiting()) return 0; + //contact->group + + showOfflineinGroup = CLCItems_IsShowOfflineGroup(group); + gray1 = (showOfflineinGroup != FALSE); + gray2 = (group->hideOffline != FALSE); + + if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline + + Menu_EnableItem(hHideOfflineUsersHereMenuItem, !gray1); + Menu_SetChecked(hHideOfflineUsersHereMenuItem, group->hideOffline && !gray1); + + Menu_EnableItem(hShowOfflineUsersHereMenuItem, !gray2); + Menu_SetChecked(hShowOfflineUsersHereMenuItem, showOfflineinGroup && !gray2); + return 0; +} + +INT_PTR SubGroupMenuonAddService(WPARAM wParam, LPARAM) +{ + MENUITEMINFO *mii = (MENUITEMINFO*)wParam; + if (mii == NULL) + return 0; + + return TRUE; +} + +INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam) +{ + SendMessage(lParam ? (HWND)lParam : (HWND)pcli->hwndContactTree, WM_COMMAND, wParam, 0); + return 0; +} + +void InitSubGroupMenus(void) +{ + CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuOnAddService", SubGroupMenuonAddService); + CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy", GroupMenuExecProxy); + + HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu); + + // add exit command to menu + GroupMenuParam gmp; + + CMenuItem mi; + mi.position = 1000; + mi.hIcolibItem = iconItem[0].hIcolib; + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.name.a = LPGEN("&New subgroup"); + gmp.lParam = 0; + gmp.wParam = POPUP_NEWSUBGROUP; + hNewSubGroupMenuItem = Menu_AddSubGroupMenuItem(&mi, &gmp); + + mi.position = 1001; + mi.hIcolibItem = NULL; + mi.hIcolibItem = NULL; + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.name.a = LPGEN("&Hide offline users in here"); + gmp.lParam = 0; + gmp.wParam = POPUP_GROUPHIDEOFFLINE; + hHideOfflineUsersHereMenuItem = Menu_AddSubGroupMenuItem(&mi, &gmp); + + mi.position = 1002; + mi.hIcolibItem = NULL; + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.name.a = LPGEN("&Show offline users in here"); + gmp.lParam = 0; + gmp.wParam = POPUP_GROUPSHOWOFFLINE; + hShowOfflineUsersHereMenuItem = Menu_AddSubGroupMenuItem(&mi, &gmp); + + memset(&mi, 0, sizeof(mi)); + mi.position = 900001; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_RENAME); + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.name.a = LPGEN("&Rename group"); + gmp.lParam = 0; + gmp.wParam = POPUP_RENAMEGROUP; + Menu_AddSubGroupMenuItem(&mi, &gmp); + + mi.position = 900002; + mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE); + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.name.a = LPGEN("&Delete group"); + gmp.lParam = 0; + gmp.wParam = POPUP_DELETEGROUP; + Menu_AddSubGroupMenuItem(&mi, &gmp); +} diff --git a/plugins/Clist_modern/src/hdr/modern_awaymsg.h b/plugins/Clist_modern/src/hdr/modern_awaymsg.h deleted file mode 100644 index d99be87d2e..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_awaymsg.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/* -* Author Artem Shpynov aka FYR -* Copyright 2000-2008 Artem Shpynov -*/ - -#pragma once -////////////////////////////////////////////////////////////////////////// -// Module to Request Away Messages - -void InitAwayMsgModule(); -void UninitAwayMsgModule(); -void amRequestAwayMsg(MCONTACT hContact); diff --git a/plugins/Clist_modern/src/hdr/modern_cache_funcs.h b/plugins/Clist_modern/src/hdr/modern_cache_funcs.h deleted file mode 100644 index f1b228f215..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_cache_funcs.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Created by Pescuma - -*/ -#pragma once - -#ifndef __CACHE_FUNCS_H__ -# define __CACHE_FUNCS_H__ - -#include "modern_clc.h" -#include "modern_commonprototypes.h" - -void Cache_GetText(ClcData *dat, ClcContact *contact, BOOL forceRenew); -void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact); -void Cache_GetSecondLineText(SHORTDATA *dat, ClcCacheEntry *pdnce); -void Cache_GetThirdLineText(SHORTDATA *dat, ClcCacheEntry *pdnce); -void Cache_GetAvatar(ClcData *dat, ClcContact *contact); -void Cache_GetTimezone(ClcData *dat, MCONTACT hContact); -int Cache_GetLineText(ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size, TCHAR *variable_text, BOOL xstatus_has_priority, - BOOL show_status_if_no_away, BOOL show_listening_if_no_away, BOOL use_name_and_message_for_xstatus, - BOOL pdnce_time_show_only_if_different); - -void amRequestAwayMsg(MCONTACT hContact); - -#endif // __CACHE_FUNCS_H__ diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h deleted file mode 100644 index 7f6c2cb894..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ /dev/null @@ -1,451 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#pragma once - -#ifndef _CLC_H_ -#define _CLC_H_ -#include "modern_image_array.h" -#include "m_xpTheme.h" - -#include "modern_defsettings.h" -#include "modern_clist.h" - -// Íîâûé ôîðìàò íàñòðîåê. -#define TRAY_ICON_MODE_GLOBAL 1 -#define TRAY_ICON_MODE_ACC 2 -#define TRAY_ICON_MODE_CYCLE 4 -#define TRAY_ICON_MODE_ALL 8 - -#define NIIF_INTERN_UNICODE 0x00000100 - -#define SETTING_STATE_HIDDEN 0 -#define SETTING_STATE_MINIMIZED 1 -#define SETTING_STATE_NORMAL 2 - -#define SETTING_BRINGTOFRONT_DEFAULT 0 - -#define SETTING_AVATAR_OVERLAY_TYPE_NORMAL 0 -#define SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL 1 -#define SETTING_AVATAR_OVERLAY_TYPE_CONTACT 2 - -#define HCONTACT_ISGROUP 0x80000000 -#define HCONTACT_ISINFO 0xFFFF0000 - -#define MAXSTATUSMSGLEN 256 - -#define INTM_NAMECHANGED (WM_USER+10) -#define INTM_ICONCHANGED (WM_USER+11) -#define INTM_GROUPCHANGED (WM_USER+12) -#define INTM_GROUPSCHANGED (WM_USER+13) -#define INTM_CONTACTADDED (WM_USER+14) -#define INTM_CONTACTDELETED (WM_USER+15) -#define INTM_HIDDENCHANGED (WM_USER+16) -#define INTM_INVALIDATE (WM_USER+17) -#define INTM_APPARENTMODECHANGED (WM_USER+18) -#define INTM_SETINFOTIPHOVERTIME (WM_USER+19) -#define INTM_NOTONLISTCHANGED (WM_USER+20) -#define INTM_RELOADOPTIONS (WM_USER+21) -#define INTM_NAMEORDERCHANGED (WM_USER+22) -#define INTM_IDLECHANGED (WM_USER+23) -#define INTM_SCROLLBARCHANGED (WM_USER+24) -#define INTM_PROTOCHANGED (WM_USER+25) -#define INTM_STATUSMSGCHANGED (WM_USER+26) -#define INTM_STATUSCHANGED (WM_USER+27) -#define INTM_AVATARCHANGED (WM_USER+28) -#define INTM_TIMEZONECHANGED (WM_USER+29) - -#define CLBF_TILEVTOROWHEIGHT 0x0100 - -#define TIMERID_RENAME 10 -#define TIMERID_DRAGAUTOSCROLL 11 -#define TIMERID_INFOTIP 13 -#define TIMERID_REBUILDAFTER 14 -#define TIMERID_DELAYEDRESORTCLC 15 -#define TIMERID_SUBEXPAND 21 -#define TIMERID_INVALIDATE 22 -#define TIMERID_INVALIDATE_FULL 25 -#define TIMERID_RECALCSCROLLBAR 26 - -#define TIMERID_FIRST TIMERID_RENAME -#define TIMERID_LAST TIMERID_RECALCSCROLLBAR - -void clcSetDelayTimer(UINT_PTR uIDEvent, HWND hwnd, int nDelay = -1); - -#define FONTID_CONTACTS 0 -#define FONTID_INVIS 1 -#define FONTID_OFFLINE 2 -#define FONTID_NOTONLIST 3 -#define FONTID_OPENGROUPS 4 -#define FONTID_OPENGROUPCOUNTS 5 -#define FONTID_DIVIDERS 6 -#define FONTID_OFFINVIS 7 -#define FONTID_SECONDLINE 8 -#define FONTID_THIRDLINE 9 -#define FONTID_AWAY 10 -#define FONTID_DND 11 -#define FONTID_NA 12 -#define FONTID_OCCUPIED 13 -#define FONTID_CHAT 14 -#define FONTID_INVISIBLE 15 -#define FONTID_PHONE 16 -#define FONTID_LUNCH 17 -#define FONTID_CONTACT_TIME 18 -#define FONTID_CLOSEDGROUPS 19 -#define FONTID_CLOSEDGROUPCOUNTS 20 -#define FONTID_STATUSBAR_PROTONAME 21 -#define FONTID_EVENTAREA 22 -#define FONTID_VIEMODES 23 -#define FONTID_MODERN_MAX 23 - -#define DROPTARGET_OUTSIDE 0 -#define DROPTARGET_ONSELF 1 -#define DROPTARGET_ONNOTHING 2 -#define DROPTARGET_ONGROUP 3 -#define DROPTARGET_ONCONTACT 4 -#define DROPTARGET_INSERTION 5 -#define DROPTARGET_ONMETACONTACT 6 -#define DROPTARGET_ONSUBCONTACT 7 - -ClcGroup; - -#define CONTACTF_ONLINE 1 -#define CONTACTF_INVISTO 2 -#define CONTACTF_VISTO 4 -#define CONTACTF_NOTONLIST 8 -#define CONTACTF_CHECKED 16 -#define CONTACTF_IDLE 32 -//#define CONTACTF_STATUSMSG 64 - -#define AVATAR_POS_DONT_HAVE -1 -#define AVATAR_POS_ANIMATED -2 - -#define TEXT_PIECE_TYPE_TEXT 0 -#define TEXT_PIECE_TYPE_SMILEY 1 - -#define DRAGSTAGE_NOTMOVED 0 -#define DRAGSTAGE_ACTIVE 1 -#define DRAGSTAGEM_STAGE 0x00FF -#define DRAGSTAGEF_MAYBERENAME 0x8000 -#define DRAGSTAGEF_OUTSIDE 0x4000 -#define DRAGSTAGEF_SKIPRENAME 0x2000 - -#define ITEM_AVATAR 0 -#define ITEM_ICON 1 -#define ITEM_TEXT 2 -#define ITEM_EXTRA_ICONS 3 -#define ITEM_CONTACT_TIME 4 -#define NUM_ITEM_TYPE 5 - -#define TEXT_EMPTY -1 -#define TEXT_STATUS 0 -#define TEXT_NICKNAME 1 -#define TEXT_STATUS_MESSAGE 2 -#define TEXT_TEXT 3 -#define TEXT_CONTACT_TIME 4 -#define TEXT_LISTENING_TO 5 - -#define TEXT_TEXT_MAX_LENGTH 1024 - -typedef struct tagClcContactTextPiece -{ - int type; - int len; - union - { - struct - { - int start_pos; - }; - struct - { - HICON smiley; - int smiley_width; - int smiley_height; - }; - }; -} ClcContactTextPiece; - -enum { - CIT_PAINT_END = 0, //next items are invalids - CIT_AVATAR, // 1 - CIT_ICON, // 2 - CIT_TEXT, // 3 //the contact name or group name - CIT_SUBTEXT1, // 4 //the second line for contact or group counter for groups - CIT_SUBTEXT2, // 5 - CIT_TIME, // 6 - CIT_CHECKBOX, // 7 - CIT_SELECTION, // 8 - CIT_EXTRA = 64 //use bit compare for extra icon, the mask &0x3F will return number of extra icon -}; - -struct tContactItems -{ - BYTE itemType; //one of above CIT_ definitions - RECT itemRect; -}; - -struct ClcContact : public ClcContactBase -{ - ClcContact *subcontacts; - BYTE SubAllocated; - BYTE SubExpanded; - BYTE isSubcontact; - // int status; - BOOL image_is_special; - int avatar_pos; - avatarCacheEntry *avatar_data; - SIZE avatar_size; - CSmileyString ssText; - - // For hittest - int pos_indent; - RECT pos_check; - RECT pos_avatar; - RECT pos_icon; - RECT pos_label; - RECT pos_rename_rect; - RECT pos_contact_time; - RECT pos_extra[EXTRA_ICON_COUNT]; - DWORD lastPaintCounter; - BYTE bContactRate; - - // For extended layout - BYTE ext_nItemsNum; - BOOL ext_fItemsValid; - tContactItems ext_mpItemsDesc[EXTRA_ICON_COUNT + 10]; //up to 10 items - - __forceinline bool isChat() const - { - return (type == CLCIT_CONTACT) && (db_get_b(hContact, proto, "ChatRoom", 0) != 0); - } -}; - -struct ClcModernFontInfo { - HFONT hFont; - int fontHeight, changed; - COLORREF colour; - BYTE effect; - COLORREF effectColour1; - COLORREF effectColour2; -}; - -struct ClcData : public ClcDataBase -{ - BYTE HiLightMode; - BYTE doubleClickExpand; - int MetaIgnoreEmptyExtra; - BYTE expandMeta; - BYTE IsMetaContactsEnabled; - time_t last_tick_time; - BOOL force_in_dialog; - int subIndent; - int rightMargin; - HBITMAP hMenuBackground; - DWORD MenuBkColor, MenuBkHiColor, MenuTextColor, MenuTextHiColor; - int MenuBmpUse; - - // Row height - int *row_heights; - int row_heights_size; - int row_heights_allocated; - - // Avatar cache - IMAGE_ARRAY_DATA avatar_cache; - - // Row - int row_min_heigh; - int row_border; - int row_before_group_space; - - BOOL row_variable_height; - BOOL row_align_left_items_to_left; - BOOL row_align_right_items_to_right; - int row_items[NUM_ITEM_TYPE]; - BOOL row_hide_group_icon; - BYTE row_align_group_mode; - - // Avatar - BOOL avatars_show; - BOOL avatars_draw_border; - COLORREF avatars_border_color; - BOOL avatars_round_corners; - BOOL avatars_use_custom_corner_size; - int avatars_custom_corner_size; - BOOL avatars_ignore_size_for_row_height; - BOOL avatars_draw_overlay; - int avatars_overlay_type; - - int avatars_maxheight_size; - int avatars_maxwidth_size; - - // Icon - BOOL icon_hide_on_avatar; - BOOL icon_draw_on_avatar_space; - BOOL icon_ignore_size_for_row_height; - - // Contact time - BOOL contact_time_show; - BOOL contact_time_show_only_if_different; - - // Text - BOOL text_rtl; - BOOL text_align_right; - BOOL text_replace_smileys; - BOOL text_resize_smileys; - int text_smiley_height; - BOOL text_use_protocol_smileys; - BOOL text_ignore_size_for_row_height; - - // First line - BOOL first_line_draw_smileys; - BOOL first_line_append_nick; - - // Second line - BOOL second_line_show; - int second_line_top_space; - BOOL second_line_draw_smileys; - int second_line_type; - TCHAR second_line_text[TEXT_TEXT_MAX_LENGTH]; - BOOL second_line_xstatus_has_priority; - BOOL second_line_show_status_if_no_away; - BOOL second_line_show_listening_if_no_away; - BOOL second_line_use_name_and_message_for_xstatus; - - // Third line - BOOL third_line_show; - int third_line_top_space; - BOOL third_line_draw_smileys; - int third_line_type; - TCHAR third_line_text[TEXT_TEXT_MAX_LENGTH]; - BOOL third_line_xstatus_has_priority; - BOOL third_line_show_status_if_no_away; - BOOL third_line_show_listening_if_no_away; - BOOL third_line_use_name_and_message_for_xstatus; - struct ClcModernFontInfo fontModernInfo[FONTID_MODERN_MAX + 1]; - HWND hWnd; - BYTE menuOwnerType; - int menuOwnerID; - DWORD m_paintCouter; //range is enoght to 49 days if painting will occure each one millisecond - BYTE useMetaIcon; - BYTE drawOverlayedStatus; - int nInsertionLevel; - - BYTE dbbMetaHideExtra; - BYTE dbbBlendInActiveState; - BYTE dbbBlend25; - - XPTHANDLE hCheckBoxTheme; - BYTE bCompactMode; -}; - -struct SHORTDATA -{ - HWND hWnd; - BOOL contact_time_show_only_if_different; - int text_smiley_height; - BOOL text_replace_smileys; - BOOL text_use_protocol_smileys; - - // Second line - BOOL second_line_show; - BOOL second_line_draw_smileys; - int second_line_type; - TCHAR second_line_text[TEXT_TEXT_MAX_LENGTH]; - BOOL second_line_xstatus_has_priority; - BOOL second_line_show_status_if_no_away; - BOOL second_line_show_listening_if_no_away; - BOOL second_line_use_name_and_message_for_xstatus; - - // Third line - BOOL third_line_show; - BOOL third_line_draw_smileys; - int third_line_type; - TCHAR third_line_text[TEXT_TEXT_MAX_LENGTH]; - BOOL third_line_xstatus_has_priority; - BOOL third_line_show_status_if_no_away; - BOOL third_line_show_listening_if_no_away; - BOOL third_line_use_name_and_message_for_xstatus; -}; - -typedef struct tagOVERLAYICONINFO -{ - char *name; - char *description; - int id; - int listID; -} OVERLAYICONINFO; - -//clc.c -void ClcOptionsChanged(void); - -//clcidents.c -int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex); -int FindItem(HWND hwnd, ClcData *dat, DWORD hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible, BOOL isIgnoreSubcontacts); -int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup); -HANDLE ContactToHItem(ClcContact *contact); -HANDLE ContactToItemHandle(ClcContact *contact, DWORD *nmFlags); -void ClearRowByIndexCache(); - -//clcitems.c -ClcGroup *cli_AddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); -void cli_FreeGroup(ClcGroup *group); -int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); -void cliRebuildEntireList(HWND hwnd, ClcData *dat); -void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem); -void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline); -void cli_SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort); -int GetNewSelection(ClcGroup *group, int selection, int direction); - -//clcmsgs.c -LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); - -//clcutils.c -void cliRecalcScrollBar(HWND hwnd, ClcData *dat); -void cliBeginRenameSelection(HWND hwnd, ClcData *dat); -int cliHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags); -void cliScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth); -int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt); -void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst); - - -//clcpaint.c -void CLCPaint_cliPaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint); - -//clcopts.c -int ClcOptInit(WPARAM wParam, LPARAM lParam); -DWORD GetDefaultExStyle(void); -void GetFontSetting(int i, LOGFONT *lf, COLORREF *colour, BYTE *effect, COLORREF *eColour1, COLORREF *eColour2); - -//clistsettings.c -TCHAR * GetContactDisplayNameW(MCONTACT hContact, int mode); - -//groups.c -TCHAR* GetGroupNameTS(int idx, DWORD* pdwFlags); -int RenameGroupT(WPARAM groupID, LPARAM newName); - -int GetContactCachedStatus(MCONTACT hContact); -char *GetContactCachedProtocol(MCONTACT hContact); - -#endif /* _CLC_H_ */ diff --git a/plugins/Clist_modern/src/hdr/modern_clcpaint.h b/plugins/Clist_modern/src/hdr/modern_clcpaint.h deleted file mode 100644 index 879452125f..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_clcpaint.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef modern_clcpaint_h__ -#define modern_clcpaint_h__ - -extern class CLCPaint g_clcPainter; -class CLCPaint -{ - -public: - CLCPaint(); - ~CLCPaint() {}; - - CLINTERFACE void cliPaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint); - CLINTERFACE tPaintCallbackProc PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData); - - BOOL IsForegroundWindow(HWND hWnd); - HFONT ChangeToFont(HDC hdc, ClcData *dat, int id, int *fontHeight); - int GetBasicFontID(ClcContact *contact); - void GetTextSize(SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHAR *szText, SortedList *plText, UINT uTextFormat, int smiley_height); - void AddParam(MODERNMASK *mpModernMask, DWORD dwParamHash, const char* szValue, DWORD dwValueHash); - BOOL CheckMiniMode(ClcData *dat, BOOL selected); - -private: - static const int HORIZONTAL_SPACE; - static const int EXTRA_CHECKBOX_SPACE; - static const int EXTRA_SPACE; - static const int SELECTION_BORDER; - static const int MIN_TEXT_WIDTH; - static const int BUF2SIZE; - - static const BYTE GIM_SELECTED_AFFECT; - static const BYTE GIM_HOT_AFFECT; - static const BYTE GIM_TEMP_AFFECT; - static const BYTE GIM_IDLE_AFFECT; - static const BYTE GIM_EXTRAICON_AFFECT; - static const BYTE GIM_STATUSICON_AFFECT; - static const BYTE GIM_AVATAR_AFFECT; - - enum tagenumHASHINDEX - { - hi_Module = 0, - hi_ID, - hi_Type, - hi_Open, - hi_IsEmpty, - hi_SubPos, - hi_Protocol, - hi_RootGroup, - hi_Status, - hi_HasAvatar, - hi_GroupPos, - hi_Selected, - hi_Hot, - hi_Odd, - hi_Indent, - hi_Index, - hi_Name, - hi_Group, - hi_True, - hi_False, - hi_ONLINE, - hi_AWAY, - hi_DND, - hi_NA, - hi_OCCUPIED, - hi_FREECHAT, - hi_INVISIBLE, - hi_OUTTOLUNCH, - hi_ONTHEPHONE, - hi_IDLE, - hi_OFFLINE, - hi_Row, - hi_CL, - hi_SubContact, - hi_MetaContact, - hi_Contact, - hi_Divider, - hi_Info, - hi_First_Single, - hi_First, - hi_Middle, - hi_Mid, - hi_Single, - hi_Last, - hi_Rate, - hi_None, - hi_Low, - hi_Medium, - hi_High, - hi_State, - hi_stActive, - hi_stInactive, - //ADD new item above here - hi_LastItem - } enumHASHINDEX; - static const char * HASHTEXT[hi_LastItem]; - static DWORD HASH[hi_LastItem]; - - void _FillQuickHash(); - void _SetHotTrackColour(HDC hdc, ClcData *dat); - int _GetStatusOnlineness(int status); - int _GetGeneralisedStatus(); - int _GetRealStatus(ClcContact *pContact, int nStatus); - RECT _GetRectangle(ClcData *dat, RECT *row_rc, RECT *free_row_rc, int *left_pos, int *right_pos, BOOL left, int real_width, int width, int height, int horizontal_space); - void _DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, TCHAR *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley); - void _AddParameter(MODERNMASK *mpModernMask, MASKPARAM * lpParam); - void _AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWORD dwValueIndex); - void _FillParam(MASKPARAM * lpParam, DWORD dwParamHash, const char* szValue, DWORD dwValueHash); - MODERNMASK* _GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat); - void _RTLRect(RECT *rect, int width); - void _PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int selected, int hottrack); - void _DrawStatusIcon(ClcContact *Drawing, ClcData *dat, int iImage, HDC hdcMem, int x, int y, int cx, int cy, DWORD colorbg, DWORD colorfg, int mode); - BOOL _DrawNonEnginedBackground(HDC hdcMem, RECT *rcPaint, RECT clRect, ClcData *dat); - void _PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint); - void _StoreItemPos(ClcContact *contact, int ItemType, RECT *rc); - void _CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *in_row_rc, RECT *in_free_row_rc, int left_pos, int right_pos, int selected); - BOOL __IsVisible(RECT *firtRect, RECT *secondRect); - void _GetBlendMode(IN ClcData *dat, IN ClcContact *Drawing, IN BOOL selected, IN BOOL hottrack, IN BOOL bFlag, OUT COLORREF * OutColourFg, OUT int * OutMode); - void _DrawContactItems(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *row_rc, RECT *free_row_rc, int selected, int hottrack, RECT *rcPaint); - void _PaintRowItems(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint); - - void _DrawContactAvatar(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *row_rc, int& selected, int& hottrack, RECT *prcItem); - void _DrawContactIcon(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT *prcItem); - void _DrawContactText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT *prcItem, UINT uTextFormat); - void _DrawContactSubText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT *prcItem, UINT uTextFormat, BYTE itemType); - void _DrawContactTime(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *prcItem); - void _DrawContactExtraIcon(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT *rc, int iImage); - void _DrawContactSelection(HDC hdcMem, ClcData *dat, int& selected, int& hottrack, RECT *rcPaint, RECT *prcItem); - void _DrawContactLine(HDC hdcMem, ClcContact *Drawing, RECT *free_row_rc, RECT *rcPaint, RECT& text_rc); - - int _rcWidth(RECT *rc) { return rc->right - rc->left; } - int _rcHeight(RECT *rc) { return rc->bottom - rc->top; } - -private: - enum enDrawMode - { - DM_LAYERED = 1, // Draw normal skin on 32 bit with alpha layer - DM_NON_LAYERED = 2, // Draw skinnable, but does not take care about alpha - DM_CLASSIC = 4, // Old style draw for classic - DM_CONTROL = 8, // Draw as control according to windows color scheme - DM_FLOAT = 16, // Float mode - DM_GRAY = 32, // Grayed mode - DM_GREYALTERNATE = 64, // Gray odd lines - DM_DRAW_OFFSCREEN = DM_FLOAT | DM_CONTROL | DM_NON_LAYERED | DM_CLASSIC, - }; - - inline int _DetermineDrawMode(HWND hWnd, ClcData *dat); - - struct _PaintContext - { - enum - { - release_none = 0, - release_hdcmem2 = 1, - release_hdcmem = 2 - }; - HDC hdcMem; - HDC hdcMem2; - - HBITMAP hBmpOsb2; - HBITMAP oldbmp2; - - HBITMAP hBmpOsb; - HBITMAP oldbmp; - - HBRUSH hBrushAlternateGrey; - COLORREF tmpbkcolour; - COLORREF tmpforecolour; - - DWORD fRelease; - _PaintContext(HDC _hdcMem = NULL) : - hdcMem(_hdcMem), hdcMem2(NULL), - hBmpOsb2(NULL), oldbmp2(NULL), - hBmpOsb(NULL), oldbmp(NULL), - hBrushAlternateGrey(NULL), - tmpbkcolour(0), tmpforecolour(0), - fRelease(release_none) {}; - }; - - inline void _PreparePaintContext(ClcData *dat, HDC hdc, int paintMode, RECT& clRect, _PaintContext& pc); - inline void _DrawBackground(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint, RECT& clRect, _PaintContext& pc); - inline void _DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint, RECT& clRect, _PaintContext& pc); - inline void _DrawInsertionMark(ClcData *dat, RECT& clRect, _PaintContext& pc); - inline void _CopyPaintToDest(HDC hdc, int paintMode, RECT* rcPaint, _PaintContext& pc); - inline void _FreePaintContext(_PaintContext& pc); -}; - - -#endif // modern_clcpaint_h__ diff --git a/plugins/Clist_modern/src/hdr/modern_clist.h b/plugins/Clist_modern/src/hdr/modern_clist.h deleted file mode 100644 index 13bf41d6ad..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_clist.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#pragma once - -#ifndef _CLIST_H_ -#define _CLIST_H_ - -void LoadContactTree(void); -HTREEITEM GetTreeItemByHContact(MCONTACT hContact); -void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add); -int GetContactInfosForSort(MCONTACT hContact, char **Proto, TCHAR **Name, int *Status); - -/////////////////////////////////////////////////////////////////////////////// - -class CSmileyString -{ -public: - SortedList* plText; - int iMaxSmileyHeight; - - CSmileyString() : plText(NULL), iMaxSmileyHeight(0) {}; - CSmileyString(const CSmileyString& ssIn) - { - _CopySmileyList(ssIn.plText); - iMaxSmileyHeight = ssIn.iMaxSmileyHeight; - } - - CSmileyString& operator= (const CSmileyString& ssIn) - { - DestroySmileyList(); - _CopySmileyList(ssIn.plText); - iMaxSmileyHeight = ssIn.iMaxSmileyHeight; - return *this; - } - - ~CSmileyString() - { - DestroySmileyList(); - } - - void ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, TCHAR *szText, BOOL replace_smileys); - - /** Destroy smiley list */ - void DestroySmileyList(); - /** Copy Smiley List */ - void _CopySmileyList(SortedList *plInput); - void AddListeningToIcon(SHORTDATA *dat, TCHAR *szText); - -}; - -/////////////////////////////////////////////////////////////////////////////// - -struct ClcCacheEntry : public ClcCacheEntryBase -{ - int m_cache_nNoHiddenOffline; - - int m_cache_nStatus; - char* m_cache_cszProto; - bool m_bProtoNotExists, m_bIsSub; - bool isUnknown; - - int ApparentMode; - int NotOnList; - int IdleTS; - void* ClcContact; - int IsExpanded; - - TCHAR* szSecondLineText; - CSmileyString ssSecondLine; - - TCHAR* szThirdLineText; - CSmileyString ssThirdLine; - - HANDLE hTimeZone; - DWORD dwLastMsgTime; - - void getName(void); - void freeName(void); -}; - -/////////////////////////////////////////////////////////////////////////////// - -#define CLVM_FILTER_PROTOS 1 -#define CLVM_FILTER_GROUPS 2 -#define CLVM_FILTER_STATUS 4 -#define CLVM_FILTER_VARIABLES 8 -#define CLVM_STICKY_CONTACTS 16 -#define CLVM_FILTER_STICKYSTATUS 32 -#define CLVM_FILTER_LASTMSG 64 -#define CLVM_FILTER_LASTMSG_OLDERTHAN 128 -#define CLVM_FILTER_LASTMSG_NEWERTHAN 256 - -#define CLVM_PROTOGROUP_OP 1 -#define CLVM_GROUPSTATUS_OP 2 -#define CLVM_AUTOCLEAR 4 -#define CLVM_INCLUDED_UNGROUPED 8 -#define CLVM_USELASTMSG 16 - -#define CLVM_USEGROUPS 32 -#define CLVM_DONOTUSEGROUPS 64 - -//changes the 'use groups' flag and call CLUI v0.8.0.16+ -//wParam=newValue -//lParam=0 -//returns 0 on success, nonzero on failure -//newValue is 0 to not use gruops, 1 to use groups -//or -1 to toggle the value -#define MS_CLIST_SETUSEGROUPS "CList/SetUseGroups" - - -#if defined(_UNICODE) -#define CLVM_MODULE "CLVM_W" -#else -#define CLVM_MODULE "CLVM" -#endif - -#define GROUPF_SHOWOFFLINE 0x40 - -#endif diff --git a/plugins/Clist_modern/src/hdr/modern_clui.h b/plugins/Clist_modern/src/hdr/modern_clui.h deleted file mode 100644 index b9301670c2..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_clui.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef modern_clui_h__ -#define modern_clui_h__ - -#include "windowsX.h" -#define HANDLE_MESSAGE( _message, _fn) \ - case (_message): return This->_fn((_message), (wParam), (lParam)) - -class CLUI -{ -public: - static HWND m_hWnd; - static CLUI * m_pCLUI; - static BOOL m_fMainMenuInited; - -private: - CLUI(); // is protected use InitClui to initialize instead - -public: - ~CLUI(); - - static HRESULT InitClui() { m_pCLUI = new CLUI(); return S_OK; }; - static CLUI * GetClui() { return m_pCLUI; } - static BOOL IsMainMenuInited() { return CLUI::m_fMainMenuInited; } - - CLINTERFACE void cliOnCreateClc(); - - EVENTHOOK(OnEvent_ModulesLoaded); - EVENTHOOK(OnEvent_ContactMenuPreBuild); - EVENTHOOK(OnEvent_FontReload); - - SERVICE(Service_ShowMainMenu); - SERVICE(Service_ShowStatusMenu); - SERVICE(Service_Menu_ShowContactAvatar); - SERVICE(Service_Menu_HideContactAvatar); - - static LRESULT CALLBACK cli_ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - CLUI * This = m_pCLUI; - if (!m_hWnd) m_hWnd = hwnd; - - BOOL bHandled = FALSE; - LRESULT lRes = This->PreProcessWndProc(msg, wParam, lParam, bHandled); - if (bHandled) return lRes; - - switch (msg) - { - HANDLE_MESSAGE(WM_NCCREATE, OnNcCreate); - HANDLE_MESSAGE(WM_CREATE, OnCreate); - HANDLE_MESSAGE(UM_CREATECLC, OnCreateClc); - HANDLE_MESSAGE(UM_SETALLEXTRAICONS, OnSetAllExtraIcons); - HANDLE_MESSAGE(WM_INITMENU, OnInitMenu); - HANDLE_MESSAGE(WM_SIZE, OnSizingMoving); - HANDLE_MESSAGE(WM_SIZING, OnSizingMoving); - HANDLE_MESSAGE(WM_MOVE, OnSizingMoving); - HANDLE_MESSAGE(WM_EXITSIZEMOVE, OnSizingMoving); - HANDLE_MESSAGE(WM_WINDOWPOSCHANGING, OnSizingMoving); - HANDLE_MESSAGE(WM_DISPLAYCHANGE, OnSizingMoving); - HANDLE_MESSAGE(WM_THEMECHANGED, OnThemeChanged); - HANDLE_MESSAGE(WM_DWMCOMPOSITIONCHANGED, OnDwmCompositionChanged); - HANDLE_MESSAGE(UM_UPDATE, OnUpdate); - HANDLE_MESSAGE(WM_NCACTIVATE, OnNcPaint); - HANDLE_MESSAGE(WM_PRINT, OnNcPaint); - HANDLE_MESSAGE(WM_NCPAINT, OnNcPaint); - HANDLE_MESSAGE(WM_ERASEBKGND, OnEraseBkgnd); - HANDLE_MESSAGE(WM_PAINT, OnPaint); - HANDLE_MESSAGE(WM_LBUTTONDOWN, OnLButtonDown); - HANDLE_MESSAGE(WM_PARENTNOTIFY, OnParentNotify); - HANDLE_MESSAGE(WM_SETFOCUS, OnSetFocus); - HANDLE_MESSAGE(WM_TIMER, OnTimer); - HANDLE_MESSAGE(WM_ACTIVATE, OnActivate); - HANDLE_MESSAGE(WM_SETCURSOR, OnSetCursor); - HANDLE_MESSAGE(WM_MOUSEACTIVATE, OnMouseActivate); - HANDLE_MESSAGE(WM_NCLBUTTONDOWN, OnNcLButtonDown); - HANDLE_MESSAGE(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClk); - HANDLE_MESSAGE(WM_NCHITTEST, OnNcHitTest); - HANDLE_MESSAGE(WM_SHOWWINDOW, OnShowWindow); - HANDLE_MESSAGE(WM_SYSCOMMAND, OnSysCommand); - HANDLE_MESSAGE(WM_KEYDOWN, OnKeyDown); - HANDLE_MESSAGE(WM_GETMINMAXINFO, OnGetMinMaxInfo); - HANDLE_MESSAGE(WM_MOVING, OnMoving); - HANDLE_MESSAGE(WM_NOTIFY, OnNotify); - HANDLE_MESSAGE(WM_CONTEXTMENU, OnContextMenu); - HANDLE_MESSAGE(WM_MEASUREITEM, OnMeasureItem); - HANDLE_MESSAGE(WM_DRAWITEM, OnDrawItem); - HANDLE_MESSAGE(WM_DESTROY, OnDestroy); - default: - return This->DefCluiWndProc(msg, wParam, lParam); - } - } - - - ////////////////////////////////////////////////////////////////////////// - // METHODS - // -private: - HRESULT CreateCLC(); - HRESULT FillAlphaChannel(HDC hDC, RECT* prcParent); - HRESULT SnappingToEdge(WINDOWPOS * lpWindowPos); - HRESULT LoadDllsRuntime(); - HRESULT RegisterAvatarMenu(); // TODO move to CLC class - HRESULT CreateCluiFrames(); - HRESULT CreateCLCWindow(const HWND parent); - HRESULT CreateUIFrames(); - - LRESULT DefCluiWndProc(UINT msg, WPARAM wParam, LPARAM lParam) - { - return corecli.pfnContactListWndProc(m_hWnd, msg, wParam, lParam); - } - - // MessageMap - LRESULT PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnThemeChanged(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnDwmCompositionChanged(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnUpdate(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnInitMenu(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnNcPaint(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnEraseBkgnd(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnNcCreate(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnPaint(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnCreate(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnSetAllExtraIcons(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnCreateClc(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnLButtonDown(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnParentNotify(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnSetFocus(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnTimer(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnStatusBarUpdateTimer(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnAutoAlphaTimer(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnSmoothAlphaTransitionTimer(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnDelayedSizingTimer(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnBringOutTimer(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnBringInTimer(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnUpdateBringTimer(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnActivate(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnSetCursor(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnMouseActivate(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnNcLButtonDown(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnNcLButtonDblClk(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnNcHitTest(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnShowWindow(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnSysCommand(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnKeyDown(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnGetMinMaxInfo(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnMoving(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnNotify(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnListSizeChangeNotify(NMCLISTCONTROL *pnmc); - LRESULT OnClickNotify(NMCLISTCONTROL *pnmc); - LRESULT OnContextMenu(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnMeasureItem(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnDrawItem(UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT OnDestroy(UINT msg, WPARAM wParam, LPARAM lParam); - -protected: - HMODULE m_hDwmapiDll; - - enum { SNAPTOEDGESENSIVITY = 30 }; -}; - -#endif // modern_clui_h__ \ No newline at end of file diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h deleted file mode 100644 index 9192a73d2d..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ /dev/null @@ -1,355 +0,0 @@ -#ifndef commonheaders_h__ -#define commonheaders_h__ - -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#pragma once - -#ifndef DB_USEHELPERFUNCTIONS // to supress static inline db helpers -#define DB_NOHELPERFUNCTIONS -#endif - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS // to suppress secure warnings in VC2005 -#endif - -#ifndef _CRT_SECURE_NO_DEPRECATE // to suppress secure deprecate warnings in VC2005 -#define _CRT_SECURE_NO_DEPRECATE -#endif - -#if defined (_DEBUG) -#define TRACE(str) { log0(str); } -#else -#define TRACE(str) -#endif - -#if defined (_DEBUG) -#define TRACEVAR(str,n) { log1(str,n); } -#else -#define TRACEVAR(str,n) -#endif - -#if defined (_DEBUG) -#define TRACET(str) OutputDebugString(str) -#else -#define TRACET(str) -#endif - -#define SERVICE(serviceproc) static INT_PTR serviceproc(WPARAM wParam, LPARAM lParam) -#define EVENTHOOK(eventhookproc) static int eventhookproc(WPARAM wParam, LPARAM lParam) -#define CLINTERFACE static - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "modern_global_structure.h" -#include "modern_clc.h" -#include "modern_clist.h" -#include "CLUIFrames/cluiframes.h" -#include "modern_rowheight_funcs.h" -#include "modern_cache_funcs.h" -#include "modern_log.h" -#include "../resource.h" - -#define DEFAULT_SKIN_FOLDER "Skins\\Modern contact list" -extern TCHAR SkinsFolder[MAX_PATH]; - -//macros to free data and set it pointer to NULL -#define mir_free_and_nil(x) {mir_free((void*)x); x=NULL;} -// shared vars - -#define CLUI_FRAME_AUTOHIDENOTIFY 512 -#define CLUI_FRAME_SHOWALWAYS 1024 - -#ifndef CS_DROPSHADOW -#define CS_DROPSHADOW 0x00020000 -#endif - -#define MENU_MIRANDAMENU 0xFFFF1234 -#define MENU_STATUSMENU 0xFFFF1235 -#define MENU_MINIMIZE 0xFFFF1236 - -#define UM_CREATECLC (WM_USER+1) -#define UM_SETALLEXTRAICONS (WM_USER+2) -#define UM_UPDATE (WM_USER+50) - -// Define constants for CLUI_SizingOnBorder SC_SIZE - -#define SCF_NONE 0 -#define SCF_LEFT 1 -#define SCF_RIGHT 2 -#define SCF_TOP 3 -#define SCF_BOTTOM 6 - -char* __cdecl strstri(char *a, const char *b); - -// Register of plugin's user -// -// wParam = (WPARAM)szSetting - string that describes a user -// format: Category/ModuleName, -// eg: "Contact list background/CLUI", -// "Status bar background/StatusBar" -// lParam = (LPARAM)dwFlags -// -#define MS_BACKGROUNDCONFIG_REGISTER "ModernBkgrCfg/Register" - -// -// Notification about changed background -// wParam = ModuleName -// lParam = 0 -#define ME_BACKGROUNDCONFIG_CHANGED "ModernBkgrCfg/Changed" - -HBITMAP ske_CreateDIB32(int cx, int cy); - -void InitDisplayNameCache(void); -void FreeDisplayNameCache(); -int CLUI_ShowWindowMod(HWND hwnd, int cmd); - -void MakeButtonSkinned(HWND hWnd); - -#ifndef LWA_COLORKEY -#define LWA_COLORKEY 0x00000001 -#endif - -#ifndef AC_SRC_ALPHA -#define AC_SRC_ALPHA 0x01 -#endif - -#define strsetA(a,b) {if (a) mir_free_and_nill(a); a=mir_strdup(b);} -#define strsetT(a,b) {if (a) mir_free_and_nill(a); a=mir_tstrdup(b);} - -extern void TRACE_ERROR(); -extern BOOL DebugDeleteObject(HGDIOBJ a); -extern void IvalidateDisplayNameCache(DWORD mode); - -extern LIST clistCache; - -HICON LoadSmallIcon(HINSTANCE hInstance, int idx); -BOOL DestroyIcon_protect(HICON icon); - -#ifndef ETDT_ENABLETAB -#define ETDT_DISABLE 0x00000001 -#define ETDT_ENABLE 0x00000002 -#define ETDT_USETABTEXTURE 0x00000004 -#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE) -#endif - -enum -{ - STATE_DLL_LOADING = 0, - STATE_CLUI_LOADING, - STATE_NORMAL, - STATE_PREPARETOEXIT, - STATE_EXITING -}; - -#define MirandaLoading() ((g_CluiData.bSTATESTATE_NORMAL)) - -char * strdupn(const char * src, int len); - -#define SORTBY_NAME 0 -#define SORTBY_STATUS 1 -#define SORTBY_LASTMSG 2 -#define SORTBY_PROTO 3 -#define SORTBY_RATE 4 -#define SORTBY_NAME_LOCALE 5 -#define SORTBY_NOTHING 10 - -#define DT_FORCENATIVERENDER 0x10000000 - -#define _BOOL(a) (a != 0) - -/* modern_animated_avatars.c */ -int AniAva_InitModule(); // HAVE TO BE AFTER GDI+ INITIALIZED -int AniAva_UnloadModule(); -int AniAva_UpdateOptions(); //reload options, //hot enable/disable engine - -int AniAva_AddAvatar(MCONTACT hContact, TCHAR * szFilename, int width, int heigth); // adds avatars to be displayed -int AniAva_SetAvatarPos(MCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha); // update avatars pos -int AniAva_InvalidateAvatarPositions(MCONTACT hContact); // reset positions of avatars to be drawn (still be painted at same place) -int AniAva_RemoveInvalidatedAvatars(); // all avatars without validated position will be stop painted and probably removed -int AniAva_RemoveAvatar(MCONTACT hContact); // remove avatar -int AniAva_RedrawAllAvatars(BOOL updateZOrder); // request to repaint all -void AniAva_UpdateParent(); -int AniAva_RenderAvatar(MCONTACT hContact, HDC hdcMem, RECT *rc); - -#define CCI_NAME 1 -#define CCI_GROUP (1<<1) -#define CCI_PROTO (1<<2) -#define CCI_STATUS (1<<3) -#define CCI_LINES (1<<4) -#define CCI_HIDDEN (1<<4) -#define CCI_NOHIDEOFFLINE (1<<5) -#define CCI_NOPROTO (1<<6) -#define CCI_HIDESUBCONTACT (1<<7) -#define CCI_I (1<<8) -#define CCI_APPARENT (1<<9) -#define CCI_NOTONLIST (1<<10) -#define CCI_IDLETS (1<<11) -#define CCI_CCONTACT (1<<12) -#define CCI_EXPAND (1<<13) -#define CCI_UNKNOWN (1<<14) -#define CCI_TIME (1<<15) -#define CCI_OTHER ~( CCI_NAME|CCI_GROUP|CCI_PROTO|CCI_STATUS|CCI_LINES|CCI_TIME ) -#define CCI_ALL (0xFFFFFFFF) - -void CListSettings_FreeCacheItemData(ClcCacheEntry *pDst); -int CLUI_SyncGetPDNCE(WPARAM wParam, LPARAM lParam); -WORD pdnce___GetStatus(ClcCacheEntry *pdnce); - -/* move to list module */ -typedef void(*ItemDestuctor)(void*); - -#ifdef __cplusplus -const ROWCELL * rowAddCell(ROWCELL* &, int); -void rowDeleteTree(ROWCELL *cell); -BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &sequence, ROWCELL** RowTabAccess); -void rowSizeWithReposition(ROWCELL* &root, int width); -#endif - -#define UNPACK_POINT(X) { (short)LOWORD(X), (short)HIWORD(X) } - -////////////////////////////////////////////////////////////////////////// -// Specific class for quick implementation of map list -// with some more fast searching it is -// hash_map alternative - for faked hash search; -// the items are stored no by char* key but both int(hash),char*. -// have items sorted in map firstly via hash, secondly via string -// the method is case insensitive -// To use this simple define like -// typedef std::map map_Type; -// map_Type myMap; -// and access it as usual via simpe char* indexing: -// myList[ "first" ]=_Type_value; -// myList[ "second" ]=_Type_value; -// _Type a = myList[ "second"]; - -class HashStringKeyNoCase -{ -public: - - HashStringKeyNoCase(const char* szKey) - { - _strKey = _strdup(szKey); - _CreateHashKey(); - } - - HashStringKeyNoCase(const HashStringKeyNoCase& hsKey) - { - _strKey = _strdup(hsKey._strKey); - _dwKey = hsKey._dwKey; - } - - HashStringKeyNoCase& operator= (const HashStringKeyNoCase& hsKey) - { - _strKey = _strdup(hsKey._strKey); - _dwKey = hsKey._dwKey; - } - -#ifdef _UNICODE - HashStringKeyNoCase(const wchar_t* szKey) - { - int codepage = 0; - int cbLen = WideCharToMultiByte(codepage, 0, szKey, -1, NULL, 0, NULL, NULL); - char* result = (char*)malloc(cbLen + 1); - WideCharToMultiByte(codepage, 0, szKey, -1, result, cbLen, NULL, NULL); - result[cbLen] = 0; - - _strKey = result; - _CreateHashKey(); - } -#endif - - ~HashStringKeyNoCase() - { - free(_strKey); - _strKey = NULL; - _dwKey = 0; - } - -private: - char* _strKey; - DWORD _dwKey; - - void _CreateHashKey() - { - _strKey = _strupr(_strKey); - _dwKey = mod_CalcHash(_strKey); - } - -public: - bool operator< (const HashStringKeyNoCase& second) const - { - if (this->_dwKey != second._dwKey) - return (this->_dwKey < second._dwKey); - else - return (mir_strcmp(this->_strKey, second._strKey) < 0); // already maked upper so in any case - will be case insensitive - } - - struct HashKeyLess - { - bool operator() (const HashStringKeyNoCase& first, const HashStringKeyNoCase& second) const - { - return (first < second); - } - }; -}; - -#endif // commonheaders_h__ diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h deleted file mode 100644 index 7ea8b2d8dc..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ /dev/null @@ -1,323 +0,0 @@ -#pragma once - -#ifndef _COMMONPROTOTYPES -#define _COMMONPROTOTYPES - -#ifndef commonheaders_h__ -#error "hdr/modern_commonheaders.h have to be including first" -#endif - -#include "modern_commonheaders.h" //TO DO: Move contents of this file to commonheaders.h -#include "modern_clist.h" -#include "CLUIFrames/cluiframes.h" -#include "modern_row.h" -#include "modern_skinengine.h" -#include "modern_skinselector.h" -#include "modern_statusbar.h" - -#define SKIN "ModernSkin" - -extern PLUGININFOEX pluginInfo; -extern CLIST_INTERFACE * pcli; -extern CLIST_INTERFACE corecli; - -//Global variables -extern int ON_SETALLEXTRAICON_CYCLE; -extern FRAMEWND *g_pfwFrames; -extern int g_nFramesCount; -extern RECT g_rcEdgeSizingRect; -extern FRAMEWND *wndFrameEventArea; -extern ROWCELL * gl_RowTabAccess[]; -extern ROWCELL * gl_RowRoot; -extern HIMAGELIST hAvatarOverlays; -extern int g_nTitleBarHeight; -extern BOOL g_bTransparentFlag; -extern HIMAGELIST g_himlCListClc; -extern BOOL g_mutex_bSizing; -extern BOOL LOCK_RECALC_SCROLLBAR; -extern HIMAGELIST g_himlCListClc; -extern BYTE nameOrder[]; -extern SortedList lContactsCache; -extern BOOL g_flag_bOnModulesLoadedCalled; -extern SKINOBJECTSLIST g_SkinObjectList; -extern CURRWNDIMAGEDATA * g_pCachedWindow; -extern BOOL g_mutex_bLockUpdating; -extern STATUSBARDATA g_StatusBarData; -extern SKINOBJECTSLIST g_SkinObjectList; -extern CURRWNDIMAGEDATA * g_pCachedWindow; -extern char * g_szConnectingProto; -extern BOOL g_mutex_bLockUpdating; -extern int g_mutex_nCalcRowHeightLock; -extern int g_mutex_bOnTrayRightClick; -extern BOOL g_flag_bPostWasCanceled; -extern BOOL g_flag_bFullRepaint; -extern BOOL g_bMultiConnectionMode; -extern BYTE g_bCalledFromShowHide; -extern HICON g_hListeningToIcon; -extern HWND g_hCLUIOptionsWnd; -extern BOOL g_bTransparentFlag; -extern HINSTANCE g_hInst, g_hMirApp; -extern BOOL g_mutex_bChangingMode; -extern UINT g_dwMainThreadID; -extern HANDLE g_hAwayMsgThread, g_hGetTextAsyncThread, g_hSmoothAnimationThread; -extern HWND g_hwndViewModeFrame; -extern BYTE gl_TrimText; - -/************************************************************************/ -/* TYPE DEFS */ -/************************************************************************/ - -typedef INT_PTR(*PSYNCCALLBACKPROC)(WPARAM, LPARAM); - -/************************************************************************/ -/* PROTOTYPES */ -/************************************************************************/ - - -/* CLCItems */ -BOOL CLCItems_IsShowOfflineGroup(ClcGroup* group); - -/* CListMod */ -int CListMod_HideWindow(); - -/* CLUI */ -HANDLE RegisterIcolibIconHandle(char * szIcoID, char *szSectionName, char * szDescription, TCHAR * tszDefaultFile, int iDefaultIndex, HINSTANCE hDefaultModule, int iDefaultResource); -void CLUI_UpdateAeroGlass(); -void CLUI_ChangeWindowMode(); -BOOL CLUI_CheckOwnedByClui(HWND hwnd); -INT_PTR CLUI_GetConnectingIconService(WPARAM wParam, LPARAM lParam); -int CLUI_HideBehindEdge(); -int CLUI_IconsChanged(WPARAM, LPARAM); -int CLUI_IsInMainWindow(HWND hwnd); -int CLUI_OnSkinLoad(WPARAM wParam, LPARAM lParam); -int CLUI_ReloadCLUIOptions(); -int CLUI_ShowFromBehindEdge(); -int CLUI_SizingGetWindowRect(HWND hwnd, RECT *rc); -int CLUI_SizingOnBorder(POINT, int); -int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam); -int CLUI_TestCursorOnBorders(); -int CLUI_UpdateTimer(); -void CLUI_UpdateLayeredMode(); -UINT_PTR CLUI_SafeSetTimer(HWND hwnd, int ID, int Timeout, TIMERPROC proc); - -/* CLUIServices */ -int CLUIUnreadEmailCountChanged(WPARAM wParam, LPARAM lParam); - -/* GDIPlus */ -BOOL GDIPlus_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, BLENDFUNCTION * blendFunction); -HBITMAP GDIPlus_LoadGlyphImage(const TCHAR *szFileName); - -/* EventArea */ -void EventArea_ConfigureEventArea(); - -/* ModernSkinButton */ -int ModernSkinButton_AddButton(HWND parent, char * ID, char * CommandService, char * StateDefService, char * HandeService, int Left, int Top, int Right, int Bottom, DWORD AlignedTo, TCHAR * Hint, char * DBkey, char * TypeDef, int MinWidth, int MinHeight); -int ModernSkinButtonLoadModule(); -int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *r); -int ModernSkinButtonUnloadModule(WPARAM, LPARAM); - -/* RowHeight */ -int RowHeight_CalcRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, int item); - -/* SkinEngine */ -BOOL ske_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, BLENDFUNCTION blendFunction); -void ske_ApplyTranslucency(void); -int ske_BltBackImage(HWND destHWND, HDC destDC, RECT *BltClientRect); -HBITMAP ske_CreateDIB32(int cx, int cy); -HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits); -HRGN ske_CreateOpaqueRgn(BYTE Level, bool Opaque); -HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha); -int ske_DrawImageAt(HDC hdc, RECT *rc); -BOOL ske_DrawIconEx(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); -int ske_DrawNonFramedObjects(BOOL Erase, RECT *r); -BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format); -LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char * szName, BYTE objType, SKINOBJECTSLIST* Skin); -HBITMAP ske_GetCurrentWindowImage(); -int ske_GetFullFilename(TCHAR *buf, const TCHAR *file, TCHAR *skinfolder, BOOL madeAbsolute); -int ske_GetSkinFolder(TCHAR *szFileName, char * t2); -BOOL ske_ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle); -HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i); -int ske_JustUpdateWindowImageRect(RECT *rty); -HBITMAP ske_LoadGlyphImage(const TCHAR *szFileName); -HRESULT SkinEngineLoadModule(); -void ske_LoadSkinFromDB(void); -int ske_LoadSkinFromIniFile(TCHAR*, BOOL); -TCHAR* ske_ParseText(TCHAR *stzText); -int ske_PrepareImageButDontUpdateIt(RECT *r); -int ske_ReCreateBackImage(BOOL Erase, RECT *w); -int ske_RedrawCompleteWindow(); -bool ske_ResetTextEffect(HDC); -bool ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor); -INT_PTR ske_Service_DrawGlyph(WPARAM wParam, LPARAM lParam); -BOOL ske_SetRectOpaque(HDC memdc, RECT *fr, BOOL force = FALSE); -BOOL ske_SetRgnOpaque(HDC memdc, HRGN hrgn, BOOL force = FALSE); -BOOL ske_TextOut(HDC hdc, int x, int y, LPCTSTR lpString, int nCount); -int ske_UnloadGlyphImage(HBITMAP hbmp); -int SkinEngineUnloadModule(); -int ske_UpdateWindowImage(); -int ske_UpdateWindowImageRect(RECT *lpRect); -int ske_ValidateFrameImageProc(RECT *r); - -/* CLUIFrames.c PROXIED */ - -int CLUIFrames_ActivateSubContainers(BOOL wParam); -int CLUIFrames_OnClistResize_mod(WPARAM wParam, LPARAM lParam); -int CLUIFrames_OnMoving(HWND, RECT *); -int CLUIFrames_OnShowHide(int mode); -int CLUIFrames_SetLayeredMode(BOOL fLayeredMode, HWND hwnd); -int CLUIFrames_SetParentForContainers(HWND parent); -int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam); - -FRAMEWND * FindFrameByItsHWND(HWND FrameHwnd); //cluiframes.c - -//int callProxied_DrawTitleBar(HDC hdcMem2,RECT *rect,int Frameid); -int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid); - -int FindFrameID(HWND FrameHwnd); -int SetAlpha(BYTE Alpha); - - -/* others TODO: move above */ -int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam); -void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColour, DWORD backgroundBmpUse); -HRESULT BackgroundsLoadModule(); -int BackgroundsUnloadModule(); -INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //RowTemplate.c -BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c -BOOL MatchMask(char *name, char *mask); //mod_skin_selector.c -char* GetContactCachedProtocol(MCONTACT hContact); //clistsettings.c -char* GetParamN(char *string, char *buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces); //mod_skin_selector.c -WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim, BOOL SkipSpaces); -DWORD CompareContacts2_getLMTime(MCONTACT u); //contact.c -DWORD mod_CalcHash(const char * a); //mod_skin_selector.c -HICON cliGetIconFromStatusMode(MCONTACT hContact, const char *szProto, int status); //clistmod.c -HICON GetMainStatusOverlay(int STATUS); //clc.c -int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szStatus, ClcData *dat); //clcitems.c -int BgStatusBarChange(WPARAM wParam, LPARAM lParam); //clcopts.c -int ClcDoProtoAck(MCONTACT wParam, ACKDATA *ack); //clc.c -int ModernSkinButtonDeleteAll(); //modernbutton.c -int GetContactCachedStatus(MCONTACT hContact); //clistsettings.c -int GetContactIconC(ClcCacheEntry *cacheEntry); //clistmod.c -int GetContactIndex(ClcGroup *group, ClcContact *contact); //clcidents.c -int GetStatusForContact(MCONTACT hContact, char *szProto); //clistsettings.c -int InitCustomMenus(void); //clistmenus.c -int LoadMoveToGroup(); //movetogroup.c -int LoadStatusBarData(); //modern_statusbar.c -int MenuModulesLoaded(WPARAM wParam, LPARAM lParam); //clistmenu.c -int MenuModulesShutdown(WPARAM wParam, LPARAM lParam); //clistmenu.c -int MenuProcessCommand(WPARAM wParam, LPARAM lParam); //clistmenu.c -int OnFrameTitleBarBackgroundChange(WPARAM wParam, LPARAM lParam); //cluiframes.c -int QueueAllFramesUpdating(bool); //cluiframes.c -int RecursiveDeleteMenu(HMENU hMenu); //clistmenus.c -int ModernSkinButtonRedrawAll(); //modern_button.c -int RegisterButtonByParce(char * ObjectName, char * Params); //mod_skin_selector.c -int RestoreAllContactData(ClcData *dat); //cache_funcs.c - -int SkinSelector_DeleteMask(MODERNMASK *mm); //mod_skin_selector.c -int StoreAllContactData(ClcData *dat); //cache_func.c -INT_PTR ToggleHideOffline(WPARAM wParam, LPARAM lParam); //contact.c -INT_PTR ToggleGroups(WPARAM wParam, LPARAM lParam); //contact.c -INT_PTR SetUseGroups(WPARAM wParam, LPARAM lParam); //contact.c -INT_PTR ToggleSounds(WPARAM wParam, LPARAM lParam); //contact.c -void ClcOptionsChanged(); //clc.c -void Docking_GetMonitorRectFromWindow(HWND hWnd, RECT *rc); //Docking.c -void DrawAvatarImageWithGDIp(HDC hDestDC, int x, int y, DWORD width, DWORD height, HBITMAP hbmp, int x1, int y1, DWORD width1, DWORD height1, DWORD flag, BYTE alpha); //gdiplus.cpp -void FreeRowCell(); //RowHeight -void InitGdiPlus(); //gdiplus.cpp -void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int SettingType); //clistsettings.c -void ShutdownGdiPlus(); //gdiplus.cpp -void UninitCustomMenus(); //clistmenus.c -void UnloadAvatarOverlayIcon(); //clc.c -void UnLoadContactListModule(); //clistmod.c -void UpdateAllAvatars(ClcData *dat); //cache_func.c - -void ApplyViewMode(const char *Name, bool onlySelector = false); -void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options, unsigned int stickies, unsigned int operators, unsigned int lmdat); - -//cluiframes.c -void gtaRenewText(MCONTACT hContact); -int ExtraImage_ExtraIDToColumnNum(int extra); - -int LoadSkinButtonModule(); -void UninitSkinHotKeys(); -void GetDefaultFontSetting(int i, LOGFONTA *lf, COLORREF *colour); -int CLUI_OnSkinLoad(WPARAM wParam, LPARAM lParam); -HRESULT CluiLoadModule(); -HRESULT PreLoadContactListModule(); -HRESULT ClcLoadModule(); -HRESULT ToolbarLoadModule(); -HRESULT ToolbarButtonLoadModule(); -void ToolbarButtonUnloadModule(); - -// INTERFACES - -void cliCheckCacheItem(ClcCacheEntry *pdnce); -void cliFreeCacheItem(ClcCacheEntry *p); -void cliRebuildEntireList(HWND hwnd, ClcData *dat); -void cliRecalcScrollBar(HWND hwnd, ClcData *dat); -void CLUI_cliOnCreateClc(void); -int cli_AddItemToGroup(ClcGroup *group, int iAboveItem); -int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); -int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly); -int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk); -int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex); -int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact); -int cli_GetContactIcon(MCONTACT hContact); -int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent); -void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline); -void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem); -void cli_FreeContact(ClcContact*); -void cli_FreeGroup(ClcGroup*); -TCHAR* cli_GetGroupCountsText(ClcData *dat, ClcContact *contact); -void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add); -void cli_SetContactCheckboxes(ClcContact*, int); -LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); -struct CListEvent* cliCreateEvent(void); -struct CListEvent* cli_AddEvent(CLISTEVENT *cle); -LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -int cliShowHide(WPARAM wParam, LPARAM lParam); -BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase); -int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2); -int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); -int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam); -void cliCluiProtocolStatusChanged(int status, const char * proto); -HMENU cliBuildGroupPopupMenu(ClcGroup *group); -void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact); -void cliCheckCacheItem(ClcCacheEntry *pdnce); -void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat); -void CLUI_cli_LoadCluiGlobalOpts(void); -INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam); -BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase); -int cliTrayIconInit(HWND hwnd); -int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount); - -ClcContact* cliCreateClcContact(void); -ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact); -ClcCacheEntry* cliGetCacheEntry(MCONTACT hContact); - -#define WM_DWMCOMPOSITIONCHANGED 0x031E - -#define DWM_BB_ENABLE 0x00000001 -#define DWM_BB_BLURREGION 0x00000002 -#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004 -struct DWM_BLURBEHIND -{ - DWORD dwFlags; - BOOL fEnable; - HRGN hRgnBlur; - BOOL fTransitionOnMaximized; -}; -extern HRESULT(WINAPI *g_proc_DWMEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); - -extern tPaintCallbackProc CLCPaint_PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData); - -/* SkinEngine.c */ - - -BYTE SkinDBGetContactSettingByte(MCONTACT hContact, const char* szSection, const char*szKey, BYTE bDefault); - -extern OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1]; -extern OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1]; - - -#endif diff --git a/plugins/Clist_modern/src/hdr/modern_defsettings.h b/plugins/Clist_modern/src/hdr/modern_defsettings.h deleted file mode 100644 index 92c9bd2784..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_defsettings.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -Copyright 2007 Artem Shpynov - -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -///////////////////////////////////////////////////////////////////////// -/// This file contains default settings value predefinitions -////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define SETTING_TOOLWINDOW_DEFAULT 1 //"CList","ToolWindow" -#define SETTING_ONTOP_DEFAULT 0 //"CList","OnTop" -#define SETTING_MIN2TRAY_DEFAULT 1 //"CList","Min2Tray" -#define SETTING_HIDEOFFLINE_DEFAULT 0 //"CList", "HideOffline" -#define SETTING_HIDEEMPTYGROUPS_DEFAULT 0 //"CList","HideEmptyGroups" -#define SETTING_USEGROUPS_DEFAULT 1 //"CList","UseGroups" -#define SETTING_PLACEOFFLINETOROOT_DEFAULT 0 //"CList","PlaceOfflineToRoot" -#define SETTING_DISABLETRAYFLASH_DEFAULT 0 //! "CList","DisableTrayFlash" -#define SETTING_ICONFLASHTIME_DEFAULT 550 //! "CList","IconFlashTime" -#define SETTING_THINBORDER_DEFAULT 0 //! "CList","ThinBorder" -#define SETTING_NOBORDER_DEFAULT 0 //! "CList","NoBorder" -#define SETTING_WINDOWSHADOW_DEFAULT 0 //! "CList","WindowShadow" -#define SETTING_ONDESKTOP_DEFAULT 0 //! "CList","OnDesktop" -#define SETTING_DISABLEWORKINGSET_DEFAULT 1 //! "CList","DisableWorkingSet" -#define SETTING_NOICONBLINF_DEFAULT 0 //! "CList","NoIconBlink" -#define SETTING_ALWAYSVISICON_DEFAULT 0 //! "CList","AlwaysShowAlwaysVisIcon" - -#define SETTING_SHOWMAINMENU_DEFAULT 1 //"CLUI","ShowMainMenu" -#define SETTING_SHOWCAPTION_DEFAULT 1 //"CLUI","ShowCaption" -#define SETTING_CLIENTDRAG_DEFAULT 1 //"CLUI","ClientAreaDrag" -#define SETTING_SHOWSBAR_DEFAULT 1 //! "CLUI","ShowSBar" -#define SETTING_SBARPERPROTO_DEFAULT 0 //! "CLUI","SBarPerProto" -#define SETTING_USECONNECTINGICON_DEFAULT 1 //! "CLUI","UseConnectingIcon" -#define SETTING_SHOWXSTATUS_DEFAULT 6 //! "CLUI","ShowXStatus" -#define SETTING_SHOWUNREADEMAILS_DEFAULT 0 //! "CLUI","ShowUnreadEmails" -#define SETTING_SBARSHOW_DEFAULT 3 //! "CLUI","SBarShow" -#define SETTING_SBARACCOUNTISCUSTOM_DEFAULT 0 //! "CLUI","AccountIsCustom" -#define SETTING_SBARHIDEACCOUNT_DEFAULT 0 //! "CLUI","HideAccount" -#define SETTING_SBARRIGHTCLK_DEFAULT 0 //! "CLUI","SBarRightClk" -#define SETTING_EQUALSECTIONS_DEFAULT 0 //! "CLUI","EqualSections" -#define SETTING_LEFTOFFSET_DEFAULT 0 //! "CLUI","LeftOffset" -#define SETTING_RIGHTOFFSET_DEFAULT 0 //! "CLUI","RightOffset -#define SETTING_TOPOFFSET_DEFAULT 0 //! "CLUI","TopOffset" -#define SETTING_BOTTOMOFFSET_DEFAULT 0 //! "CLUI","BottomOffset -#define SETTING_SPACEBETWEEN_DEFAULT 0 //! "CLUI","SpaceBetween" -#define SETTING_ALIGN_DEFAULT 0 //! "CLUI","Align" -#define SETTING_VALIGN_DEFAULT 1 //! "CLUI","VAlign" -#define SETTING_PADDINGLEFT_DEFAULT 0 //! "CLUI","PaddingLeft_*" -#define SETTING_PADDINGRIGHT_DEFAULT 0 //! "CLUI","PaddingRight_*" -#define SETTING_DRAGTOSCROLL_DEFAULT 0 //! "CLUI","DragToScroll" -#define SETTING_AUTOSIZE_DEFAULT 0 //! "CLUI","AutoSize" -#define SETTING_LOCKSIZE_DEFAULT 0 //! "CLUI","LockSize" -#define SETTING_MINHEIGTH_DEFAULT 0 //! "CLUI","MinHeight" -#define SETTING_MINWIDTH_DEFAULT 18 //! "CLUI","MinWidth" -#define SETTING_MAXSIZEHEIGHT_DEFAULT 75 //! "CLUI","MaxSizeHeight" -#define SETTING_MINSIZEHEIGHT_DEFAULT 10 //! "CLUI","MinSizeHeight" -#define SETTING_AUTOSIZEUPWARD_DEFAULT 0 //! "CLUI","AutoSizeUpward" -#define SETTING_SNAPTOEDGES_DEFAULT 1 //! "CLUI","SnapToEdges" -#define SETTING_DOCKTOSIDES_DEFAULT 1 //! "CLUI","DockToSides", - -#define SETTING_PROTOSPERLINE_DEFAULT 0 //! "CLUI","StatusBarProtosPerLine" -#define SETTING_TEXTEFFECTID_DEFAULT 0xFF //! "StatusBar","TextEffectID" -#define SETTING_TEXTEFFECTCOLOR1_DEFAULT 0 //! "StatusBar","TextEffectColor1" -#define SETTING_TEXTEFFECTCOLOR2_DEFAULT 0 //! "StatusBar","TextEffectColor2" -#define SETTING_SBHILIGHTMODE_DEFAULT 0 //! "StatusBar","HiLightMode" -#define SETTING_HIDETOOLTIPTIME_DEFAULT 5000 //! "CLUIFrames","HideToolTipTime" - -#define SETTING_EXTRA_ICON_EMAIL_DEFAULT 0 //! -#define SETTING_EXTRA_ICON_PROTO_DEFAULT 0 //! -#define SETTING_EXTRA_ICON_SMS_DEFAULT 0 //! -#define SETTING_EXTRA_ICON_ADV1_DEFAULT 1 //! -#define SETTING_EXTRA_ICON_ADV2_DEFAULT 1 //! -#define SETTING_EXTRA_ICON_WEB_DEFAULT 0 //! -#define SETTING_EXTRA_ICON_CLIENT_DEFAULT 1 //! -#define SETTING_EXTRA_ICON_VISMODE_DEFAULT 1 //! -#define SETTING_EXTRA_ICON_ADV3_DEFAULT 1 //! -#define SETTING_EXTRA_ICON_ADV4_DEFAULT 1 //! - -#define SETTING_EXTRACOLUMNSPACE_DEFAULT 18 //! "CLUI","ExtraColumnSpace" - -#define SETTING_HIDEBEHIND_DEFAULT 0 //! "ModernData","HideBehind" //(0-none, 1-leftedge, 2-rightedge) -#define SETTING_BEHINDEDGE_DEFAULT 0 //! "ModernData", "BehindEdge" -#define SETTING_SHOWDELAY_DEFAULT 3 //! "ModernData","ShowDelay" -#define SETTING_HIDEDELAY_DEFAULT 3 //! "ModernData","HideDelay" -#define SETTING_HIDEBEHINDBORDERSIZE_DEFAULT 0 //! "ModernData","HideBehindBorderSize" -#define SETTING_AEROGLASS_DEFAULT 1 //! "ModernData","AeroGlass" - -#define SETTING_ROUNDCORNERS_DEFAULT 0 //! "CLC","RoundCorners" -#define SETTING_GAPFRAMES_DEFAULT 1 //! "CLUIFrames","GapBetweenFrames" -#define SETTING_GAPTITLEBAR_DEFAULT 1 //! "CLUIFrames","GapBetweenTitleBar" -#define SETTING_LEFTCLIENTMARIGN_DEFAULT 0 //! "CLUI","LeftClientMargin" -#define SETTING_RIGHTCLIENTMARIGN_DEFAULT 0 //! "CLUI","RightClientMargin" -#define SETTING_TOPCLIENTMARIGN_DEFAULT 0 //! "CLUI","TopClientMargin" -#define SETTING_BOTTOMCLIENTMARIGN_DEFAULT 0 //! "CLUI","BottomClientMargin" -#define SETTING_KEYCOLOR_DEFAULT RGB(255,0,255) //! "ModernSettings","KeyColor" -#define SETTING_LINEUNDERMENU_DEFAULT 0 //! "CLUI","LineUnderMenu" -#define SETTING_SHOWONSTART_DEFAULT 0 //! "CList","ShowOnStart" - -#define SETTING_INTERNALAWAYMSGREQUEST_DEFAULT 1 //"ModernData","InternalAwayMsgDiscovery" -#define SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT 1 //"ModernData","RemoveAwayMessageForOffline" -#define SETTING_FILTERSEARCH_DEFAULT 0 //"ModernData","FilterSearch" -#define SETTING_METAAVOIDDBLCLICK_DEFAULT 1 //"CLC","MetaDoubleClick" -#define SETTING_METAIGNOREEMPTYEXTRA_DEFAULT 1 //"CLC","MetaIgnoreEmptyExtra" -#define SETTING_METAHIDEEXTRA_DEFAULT 0 //"CLC","MetaHideExtra" -#define SETTING_METAEXPANDING_DEFAULT 1 //"CLC","MetaExpanding" -#define SETTING_USEMETAICON_DEFAULT 1 //"CLC","Meta" -#define SETTING_DRAWOVERLAYEDSTATUS_DEFAULT 3 //todo replace by contstants - - -#define SETTING_SORTBY1_DEFAULT SORTBY_RATE //"CList","SortBy1" -#define SETTING_SORTBY2_DEFAULT SORTBY_NAME //"CList","SortBy2" -#define SETTING_SORTBY3_DEFAULT SORTBY_STATUS //"CList","SortBy3" - -#define SETTING_PLACEOOFLINETOROOT_DEFAULT 0 //"CList","PlaceOfflineToRoot" -#define SETTING_NOOFFLINEBOTTOM_DEFAULT 0 //"CList","NoOfflineBottom" -#define SETTING_HIDEOFFLINEATROOT_DEFAULT 0 //"CLC","HideOfflineRoot" -#define SETTING_HILIGHTMODE_DEFAULT 0 //todo replace by constant //"CLC","HiLightMode" - -#define SETTING_DISABLESKIN_DEFAULT 0 //"ModernData","DisableEngine" -#define SETTING_ENABLELAYERING_DEFAULT 1 //! "ModernData","EnableLayering" -#define SETTING_COMPACTMODE_DEFAULT 0 //"CLC","CompactMode" - -#define SETTING_EVENTAREAMODE_DEFAULT 1 //autohide todo replace by const //"CLUI","EventArea" -#define SETTING_SHOWEVENTAREAFRAME_DEFAULT 1 //"CLUI","ShowEventArea" - -#define SETTING_TRAYOPTION_DEFAULT 15 //show combined icon -#define SETTING_FADEIN_DEFAULT 0 //"CLUI","FadeInOut" - -////////////////////////////////////////////////////////////////////////// -// ROW SETTINGS -#define SETTING_ROWBORDER_DEFAULT 1 //"CList","RowBorder" -#define SETTING_ROW_ADVANCEDLAYOUT_DEFAULT 0 //"ModernData","UseAdvancedRowLayout" -#define SETTING_ROW_ROWBORDER_DEFAULT 1 //"CList","RowBorder" -#define SETTING_VARIABLEROWHEIGHT_DEFAULT 1 //"CList","VariableRowHeight" -#define SETTING_ALIGNLEFTTOLEFT_DEFAULT 0 //"CList","AlignLeftItemsToLeft" -#define SETTING_ALIGNRIGHTORIGHT_DEFAULT 1 //"CList","AlignRightItemsToRight" -#define SETTING_HIDEGROUPSICON_DEFAULT 0 //"CList","HideGroupsIcon" -#define SETTING_ALIGNGROPCAPTION_DEFAULT 0 //left todo replace by const //"CList","AlignGroupCaptions" -#define SETTINS_ROWITEMORDER_DEFAULT {ITEM_AVATAR, ITEM_ICON, ITEM_TEXT, ITEM_EXTRA_ICONS, ITEM_CONTACT_TIME} - -#define SETTINGS_SHOWAVATARS_DEFAULT 1 //"CList","AvatarsShow" -#define SETTINGS_AVATARDRAWBORDER_DEFAULT 0 //"CList","AvatarsDrawBorders" -#define SETTINGS_AVATARBORDERCOLOR_DEFAULT RGB(0,0,0) //"CList","AvatarsBorderColor" -#define SETTINGS_AVATARROUNDCORNERS_DEFAULT 0 //"CList","AvatarsRoundCorners" -#define SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT 0 //"CList","AvatarsUseCustomCornerSize" -#define SETTINGS_AVATARCORNERSIZE_DEFAULT 4 //"CList","AvatarsCustomCornerSize" -#define SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT 0 //"CList","AvatarsIgnoreSizeForRow" -#define SETTINGS_AVATARDRAWOVERLAY_DEFAULT 0 //"CList","AvatarsDrawOverlay" -#define SETTINGS_AVATAROVERLAYTYPE_DEFAULT SETTING_AVATAR_OVERLAY_TYPE_NORMAL -#define SETTING_AVATARHEIGHT_DEFAULT 24 //"CList","AvatarsSize" -#define SETTING_AVATARWIDTH_DEFAULT 24 //"CList","AvatarsWidth" -#define SETTINGS_AVATARINSEPARATE_DEFAULT 0 //"CList","AvatarsInSeparateWnd", - -#define SETTING_HIDEICONONAVATAR_DEFAULT 0 //"CList","IconHideOnAvatar" -#define SETTING_ICONONAVATARPLACE_DEFAULT 0 //"CList","IconDrawOnAvatarSpace" -#define SETTING_ICONIGNORESIZE_DEFAULT 0 //"CList","IconIgnoreSizeForRownHeight" -#define SETTING_SHOWTIME_DEFAULT 0 //"CList","ContactTimeShow" -#define SETTING_SHOWTIMEIFDIFF_DEFAULT 1 //"CList","ContactTimeShowOnlyIfDifferent" - -#define SETTING_TEXT_RTL_DEFAULT 0 //"CList","TextRTL" -#define SETTING_TEXT_RIGHTALIGN_DEFAULT 0 //"CList","TextAlignToRight" -#define SETTING_TEXT_SMILEY_DEFAULT 1 //"CList","TextReplaceSmileys" -#define SETTING_TEXT_RESIZESMILEY_DEFAULT 1 //"CList","TextResizeSmileys" -#define SETTING_TEXT_PROTOSMILEY_DEFAULT 1 //"CList","TextUseProtocolSmileys" -#define SETTING_TEXT_IGNORESIZE_DEFAULT 0 //"CList","TextIgnoreSizeForRownHeight" - -#define SETTING_FIRSTLINE_SMILEYS_DEFAULT 1 //"CList","FirstLineDrawSmileys" -#define SETTING_FIRSTLINE_APPENDNICK_DEFAULT 0 //"CList","FirstLineAppendNick" -#define SETTING_FIRSTLINE_TRIMTEXT_DEFAULT 1 //"CList","TrimText" - -#define SETTING_SECONDLINE_SHOW_DEFAULT 1 //"CList","SecondLineShow" -#define SETTING_SECONDLINE_TOPSPACE_DEFAULT 2 //"CList","SecondLineTopSpace" -#define SETTING_SECONDLINE_SMILEYS_DEFAULT 1 //"CList","SecondLineDrawSmileys" -#define SETTING_SECONDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE //"CList","SecondLineType" -#define SETTING_SECONDLINE_XSTATUS_DEFAULT 1 //"CList","SecondLineXStatusHasPriority" -#define SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT 0 //"CList","SecondLineUseNameAndMessageForXStatus" -#define SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT 1 //"CList","SecondLineShowStatusIfNoAway" -#define SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT 1 //"CList","SecondLineShowListeningIfNoAway" - -#define SETTING_THIRDLINE_SHOW_DEFAULT 0 //"CList","ThirdLineShow" -#define SETTING_THIRDLINE_TOPSPACE_DEFAULT 2 //"CList","ThirdLineTopSpace" -#define SETTING_THIRDLINE_SMILEYS_DEFAULT 0 //"CList","ThirdLineDrawSmileys" -#define SETTING_THIRDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE //"CList","ThirdLineType" -#define SETTING_THIRDLINE_XSTATUS_DEFAULT 1 //"ThirdLineXStatusHasPriority" -#define SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT 0 //"ThirdLineUseNameAndMessageForXStatus" -#define SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT 0 //"CList","ThirdLineShowStatusIfNoAway" -#define SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT 0 //"ThirdLineShowListeningIfNoAway" - -#define SETTING_TRANSPARENT_DEFAULT 0 //"CList","Transparent" -#define SETTING_AUTOALPHA_DEFAULT 150 //"CList","AutoAlpha" -#define SETTING_CONFIRMDELETE_DEFAULT 1 //"CList","ConfirmDelete" -#define SETTING_AUTOHIDE_DEFAULT 0 //"CList","AutoHide" -#define SETTING_HIDETIME_DEFAULT 30 //"CList","HideTime" -#define SETTING_CYCLETIME_DEFAULT 4 //"CList","CycleTime" -#define SETTING_TRAYICON_DEFAULT SETTING_TRAYICON_SINGLE //"CList","TrayIcon" -#define SETTING_ALWAYSSTATUS_DEFAULT 0 //"CList","AlwaysStatus" - -#define SETTING_BLENDINACTIVESTATE_DEFAULT 0 //"CLC","BlendInActiveState" - -#define CLCDEFAULT_MODERN_SELTEXTCOLOUR (g_CluiData.fDisableSkinEngine?GetSysColor(COLOR_HIGHLIGHTTEXT):RGB(0,0,128)) -#define CLCDEFAULT_MODERN_HOTTEXTCOLOUR (g_CluiData.fDisableSkinEngine ? CLCDEFAULT_MODERN_SELTEXTCOLOUR : RGB(0,0,255)) -#define CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR RGB(255,255,0) -#define CLCDEFAULT_NOVSCROLL 0 //"CLC","NoVScrollBar" -#define CLCDEFAULT_INFOTIPTIME 750 //"! "CLC","InfoTipHoverTime" -#define CLCDEFAULT_COLLICONTOLEFT 0 //"! "FrameTitleBar","AlignCOLLIconToLeft" - -#define SKIN_OFFSET_TOP_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Top" -#define SKIN_OFFSET_BOTTOM_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Bottom" -#define SKIN_OFFSET_LEFT_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Left" -#define SKIN_OFFSET_RIGHT_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Right" -#define SKIN_SPACEBEFOREGROUP_DEFAULT 0 //! "ModernSkin","SpaceBeforeGroup" - -#define SETTINGS_BARBTNWIDTH_DEFAULT 22 //"ModernToolBar", "option_Bar0_BtnWidth" -#define SETTINGS_BARBTNHEIGHT_DEFAULT 22 //"ModernToolBar", "option_Bar0_BtnHeight" -#define SETTINGS_BARBTNSPACE_DEFAULT 0 //"ModernToolBar", "option_Bar0_BtnSpace" -#define SETTINGS_BARAUTOSIZE_DEFAULT 1 //"ModernToolBar", "option_Bar0_Autosize" -#define SETTINGS_BARMULTILINE_DEFAULT 1 //"ModernToolBar", "option_Bar0_Multiline" - -#define SETTING_ENABLESOUNDS_DEFAULT 1 // !"Skin", "UseSound", diff --git a/plugins/Clist_modern/src/hdr/modern_effectenum.h b/plugins/Clist_modern/src/hdr/modern_effectenum.h deleted file mode 100644 index b15c4a1f11..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_effectenum.h +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once - -typedef signed char sbyte; -typedef struct _MODERNEFFECTMATRIX -{ - sbyte matrix[25]; - BYTE topEffect; - BYTE leftEffect; - BYTE rightEffect; - BYTE bottomEffect; - BYTE cycleCount; //low 7 bits -}MODERNEFFECTMATRIX; - -typedef struct _MODERNEFFECT -{ - BYTE EffectID; - MODERNEFFECTMATRIX EffectMatrix; - DWORD EffectColor1; - DWORD EffectColor2; -}MODERNEFFECT; - -#ifdef _EFFECTENUM_FULL_H -TCHAR * ModernEffectNames[] = -#else -TCHAR * _ModernEffectNames[] = -#endif -{ - _T("Shadow at left"), - _T("Shadow at right"), - _T("Outline"), - _T("Outline smooth"), - _T("Smooth bump"), - _T("Contour thin"), - _T("Contour heavy"), -}; - -#ifdef _EFFECTENUM_FULL_H -MODERNEFFECTMATRIX ModernEffectsEnum[] = { - { //Shadow at Left - { 0, 0, 0, 0, 0, - 0, 4, 16, 4, 4, - 0, 16, 64, 32, 16, - 0, 4, 32, 32, 16, - 0, 4, 16, 16, 16 }, 2, 2, 2, 2, 1 }, - { //Shadow at Right - { 0, 0, 0, 0, 0, - 4, 4, 16, 4, 0, - 16, 32, 64, 16, 0, - 16, 32, 32, 4, 0, - 16, 16, 16, 4, 0 }, 2, 2, 2, 2, 1 }, - { //Outline - { 0, 0, 0, 0, 0, - 0, 16, 16, 16, 0, - 0, 16, 32, 16, 0, - 0, 16, 16, 16, 0, - 0, 0, 0, 0, 0 }, 1, 1, 1, 1, 1 }, - - { //Outline smooth - { 4, 4, 4, 4, 4, - 4, 8, 8, 8, 4, - 4, 8, 32, 8, 4, - 4, 8, 8, 8, 4, - 4, 4, 4, 4, 4 }, 2, 2, 2, 2, 1 }, - - { //Smooth bump - { -2, 2, 2, 2, 2, - -2, -16, 16, 16, 2, - -2, -16, 48, 16, 2, - -2, -16, -16, 16, 2, - -2, -2, -2, -2, -2 }, 2, 2, 2, 2, 1 + 0x80 }, - { //Contour thin - { 0, 0, 0, 0, 0, - 0, 48, 64, 48, 0, - 0, 64, 64, 64, 0, - 0, 48, 64, 48, 0, - 0, 0, 0, 0, 0 }, 1, 1, 1, 1, 1 }, - { //Contour heavy - { 8, 16, 16, 16, 8, - 16, 64, 64, 64, 16, - 16, 64, 64, 64, 16, - 16, 64, 64, 64, 16, - 8, 16, 16, 16, 8 }, 2, 2, 2, 2, 1 }, - -}; -#endif -#ifdef _EFFECTENUM_FULL_H -#define MAXPREDEFINEDEFFECTS sizeof(ModernEffectNames)/sizeof(ModernEffectNames[0]) -#else -#define MAXPREDEFINEDEFFECTS sizeof(_ModernEffectNames)/sizeof(_ModernEffectNames[0]) -extern TCHAR * ModernEffectNames[]; -#endif -extern BOOL SkinEngine_ResetTextEffect(HDC); -extern BOOL SkinEngine_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor); \ No newline at end of file diff --git a/plugins/Clist_modern/src/hdr/modern_gettextasync.h b/plugins/Clist_modern/src/hdr/modern_gettextasync.h deleted file mode 100644 index c53039da71..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_gettextasync.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -void InitCacheAsync(); - -void gtaRenewText(MCONTACT hContact); -int gtaAddRequest(ClcData *dat, MCONTACT hContact); -void gtaShutdown(void); diff --git a/plugins/Clist_modern/src/hdr/modern_global_structure.h b/plugins/Clist_modern/src/hdr/modern_global_structure.h deleted file mode 100644 index a7da9383ac..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_global_structure.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#ifndef modern_global_structure_h__ -#define modern_global_structure_h__ - -typedef struct tagCLUIDATA -{ - /************************************ - ** Global variables ** - ************************************/ - - // NotifyArea menu - HMENU hMenuNotify; - WORD wNextMenuID; - int iIconNotify; - BOOL bEventAreaEnabled; - BOOL bNotifyActive; - DWORD dwFlags; - int hIconNotify; - MCONTACT hUpdateContact; - - // Contact List View Mode - TCHAR groupFilter[2048]; - char protoFilter[2048]; - char varFilter[2048]; - DWORD lastMsgFilter; - char current_viewmode[256], old_viewmode[256]; - BYTE boldHideOffline; - BYTE bOldUseGroups; - DWORD statusMaskFilter; - DWORD stickyMaskFilter; - DWORD filterFlags; - DWORD bFilterEffective; - DWORD t_now; - - // Modern Global Variables - BOOL fDisableSkinEngine; - BOOL fOnDesktop; - BOOL fSmoothAnimation; - BOOL fLayered; - BOOL fDocked; - BOOL fSortNoOfflineBottom; - BOOL fAutoSize; - BOOL fAeroGlass; - HRGN hAeroGlassRgn; - - BOOL mutexPreventDockMoving; - BOOL mutexOnEdgeSizing; - BOOL mutexPaintLock; - - BYTE bCurrentAlpha; - BYTE bSTATE; - BYTE bBehindEdgeSettings; - BYTE bSortByOrder[3]; - - signed char nBehindEdgeState; - - DWORD dwKeyColor; - - HWND hwndEventFrame; - - int LeftClientMargin; - int RightClientMargin; - int TopClientMargin; - int BottomClientMargin; - - BOOL bInternalAwayMsgDiscovery; - BOOL bRemoveAwayMessageForOffline; - - //hEventHandles - - HANDLE hEventBkgrChanged; - HANDLE hEventPreBuildTrayMenu; - HANDLE hEventPreBuildGroupMenu; - HANDLE hEventPreBuildSubGroupMenu; - HANDLE hEventStatusBarShowToolTip; - HANDLE hEventStatusBarHideToolTip; - HANDLE hEventSkinServicesCreated; - - int nGapBetweenTitlebar; -} CLUIDATA; - -EXTERN_C CLUIDATA g_CluiData; - -#endif // modern_global_structure_h__ diff --git a/plugins/Clist_modern/src/hdr/modern_image_array.h b/plugins/Clist_modern/src/hdr/modern_image_array.h deleted file mode 100644 index 00056edae0..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_image_array.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Created by Pescuma -*/ - -#pragma once - -#ifndef __IMAGE_ARRAY_H__ -# define __IMAGE_ARRAY_H__ - -#include - - -struct IMAGE_ARRAY_DATA_NODE -{ - int width; - int height; -}; - -struct IMAGE_ARRAY_DATA -{ - // Configuration - BOOL width_based; - int grow_step; - HDC hdc; - - // Img data - HBITMAP img; - int width; - int height; - void *lpBits; - - // Array - IMAGE_ARRAY_DATA_NODE *nodes; - int nodes_size; - int nodes_allocated_size; -}; - - -// Initialize data -void ImageArray_Initialize(IMAGE_ARRAY_DATA *iad, BOOL width_based, int grow_step); - -// Free data but keep config -void ImageArray_Clear(IMAGE_ARRAY_DATA *iad); - -// Free data -// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return NULL -HBITMAP ImageArray_Free(IMAGE_ARRAY_DATA *iad, BOOL keep_bitmap); - -// Add image to the list (return the index of the image or -1 on error) -// If pos == -1, add to the end of the list -int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos); - -// Change an image in the list (return TRUE on success) -BOOL ImageArray_ChangeImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos); - -// Remove an image -BOOL ImageArray_RemoveImage(IMAGE_ARRAY_DATA *iad, int pos); - -// Draw an image -BOOL ImageArray_DrawImage(IMAGE_ARRAY_DATA *iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha); - -#endif // __IMAGE_ARRAY_H__ diff --git a/plugins/Clist_modern/src/hdr/modern_log.h b/plugins/Clist_modern/src/hdr/modern_log.h deleted file mode 100644 index b96eaafd65..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_log.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#ifndef __LOG_H__ -# define __LOG_H__ - -#ifdef _DEBUG - -void Log(const char *file, int line, const char *fmt, ...); -#define log0(s) Log(__FILE__,__LINE__,s) -#define log1(s,a) Log(__FILE__,__LINE__,s,a) - -#else - -#define log0(s) -#define log1(s,a) - -#endif - -#endif // __LOG_H__ \ No newline at end of file diff --git a/plugins/Clist_modern/src/hdr/modern_row.h b/plugins/Clist_modern/src/hdr/modern_row.h deleted file mode 100644 index ad84c94071..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_row.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef modern_row_h__ -#define modern_row_h__ - -#pragma once - - -// Types of cells -#define TC_TEXT1 1 -#define TC_TEXT2 2 -#define TC_TEXT3 3 -#define TC_STATUS 4 -#define TC_AVATAR 5 -#define TC_EXTRA 6 -#define TC_EXTRA1 7 -#define TC_EXTRA2 8 -#define TC_EXTRA3 9 -#define TC_EXTRA4 10 -#define TC_EXTRA5 11 -#define TC_EXTRA6 12 -#define TC_EXTRA7 13 -#define TC_EXTRA8 14 -#define TC_EXTRA9 15 -#define TC_TIME 16 -#define TC_SPACE 17 -#define TC_FIXED 18 - - -#define TC_ELEMENTSCOUNT 18 - -// Containers -#define TC_ROOT 50 -#define TC_ROW 51 -#define TC_COL 52 -#define TC_FLOAT 53 - -// Alignes -#define TC_LEFT 0 -#define TC_HCENTER 100 -#define TC_RIGHT 101 - -#define TC_TOP 0 -#define TC_VCENTER 102 -#define TC_BOTTOM 103 - -// Sizes -#define TC_WIDTH 104 -#define TC_HEIGHT 105 - - - -// Ñòðóêòóðà, îïèñûâàþùàÿ êîíòåéíåð ýëåìåíòà êîíòàêòà -// -typedef struct tagRowCell -{ - int cont; // Òèï êîíòåéíåðà - êîíòàêò, ñòîðîêà, ñòîëáåö - int type; // Òèï ýëåìåíòà, ñîäåðæàùåãîñÿ â êîíòåéíåðå, åñëè 0 - ïóñòîé êîíòåéíåð - int halign; // Ãîðèçîíòàëüíîå âûðàâíèâàíèå âíóòðè êîíòåéíåðà - int valign; // Âåðòèêàëüíîå âûðàâíèâàíèå âíóòðè êîíòåéíåðà - - int w; // Øèðèíà ýëåìåíòà êîíòàêòà, äëÿ òåêñòîâûõ ïîëåé èãíîðèðóåòñÿ - int h; // Âûñîòà ýëåìåíòà êîòíàêòà - - BOOL sizing; // Ïàðàìåòð, ïîêàçûâàþùèé íàëè÷èå òåêñòîâûõ ïîëåé â äî÷åðíèõ êîíòåéíåðàõ - BOOL layer; // Ïàðàìåòð, ïîêàçûâàþùèé, ÷òî êîíòåéíåð îáðàçóåò íîâûé ñëîé - - BOOL hasfixed; // Ïàðàìåòð ïîêàçûâàþùèé ÷òî åñòü âëîæåííûå ôèêñèðîâàííûå ýëåìåíòû - BOOL fitwidth; // Ïàðàìåòð óêàçûâàþùèé ÷òî ïîñëåäíèé ýëåìåíò çàïîëíÿåò âñå îñòàâøååñÿ - // Ïðîñòðàíñòâî (ðàññòÿãèâàåò ðîäèòåëÿ.îâåðëåé) - - int fixed_width; - int full_width; - - RECT r; // Ïðÿìîóãîëüíèê äëÿ ðèñîâàíèÿ ýëåìåíòà - struct tagRowCell * next; // Ïîëå ñâÿçè - struct tagRowCell * child; // Ïîëå ñâÿçè ñì. ôàéë îïèñàíèÿ -} -ROWCELL, *pROWCELL; - -// Ñòðóêòóðà äëÿ äîñòóïà ê êîíòåéíåðàì ýëåìåíòà êîíòàêòà âíóòðè äåðåâà îïèâàíèÿ -#ifndef _CPPCODE -int cppCalculateRowHeight(ROWCELL *RowRoot); -void cppCalculateRowItemsPos(ROWCELL *RowRoot, int width); -ROWCELL *cppInitModernRow(ROWCELL ** tabAccess); -void cppDeleteTree(ROWCELL * RowRoot); -#endif - -#endif // modern_row_h__ \ No newline at end of file diff --git a/plugins/Clist_modern/src/hdr/modern_rowheight_funcs.h b/plugins/Clist_modern/src/hdr/modern_rowheight_funcs.h deleted file mode 100644 index 439355e405..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_rowheight_funcs.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Created by Pescuma -*/ - -#pragma once - -#ifndef __ROWHEIGHT_FUNCS_H__ -# define __ROWHEIGHT_FUNCS_H__ - -#include "modern_clc.h" - -#define ROW_SPACE_BEETWEEN_LINES 2 -#define ICON_HEIGHT 16 -#define ICON_WIDTH 16 - - - -BOOL RowHeights_Initialize(ClcData *dat); -void RowHeights_Free(ClcData *dat); -void RowHeights_Clear(ClcData *dat); - -BOOL RowHeights_Alloc(ClcData *dat, int size); - -// Calc and store max row height -int RowHeights_GetMaxRowHeight(ClcData *dat, HWND hwnd); - -// Calc and store row height -int RowHeights_GetRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, int item); - -// Calc and store row height for all itens in the list -void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd); - -// Calc item top Y (using stored data) -int cliGetRowTopY(ClcData *dat, int item); - -// Calc item bottom Y (using stored data) -int cliGetRowBottomY(ClcData *dat, int item); - -// Calc total height of rows (using stored data) -int cliGetRowTotalHeight(ClcData *dat); - -// Return the line that pos_y is at or -1 (using stored data). Y start at 0 -int cliRowHitTest(ClcData *dat, int pos_y); - -// Returns the height of the chosen row -int cliGetRowHeight(ClcData *dat, int item); - -#endif // __ROWHEIGHT_FUNCS_H__ diff --git a/plugins/Clist_modern/src/hdr/modern_skinengine.h b/plugins/Clist_modern/src/hdr/modern_skinengine.h deleted file mode 100644 index 70b7a9b838..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_skinengine.h +++ /dev/null @@ -1,124 +0,0 @@ -#pragma once - -#ifndef ske_H_INC -#define ske_H_INC - -#include "modern_skinselector.h" -#include "modern_commonprototypes.h" - -/* Definitions */ -#define GetAValue(argb)((BYTE)((argb)>>24)) - -#define DEFAULTSKINSECTION "ModernSkin" - - - -#define MAX_BUFF_SIZE 255*400 -#define MAXSN_BUFF_SIZE 255*1000 - -/* External variables */ - -/* Structs */ - -struct SKINOBJECTSLIST -{ - DWORD dwObjLPReserved; - DWORD dwObjLPAlocated; - TCHAR *szSkinPlace; - LISTMODERNMASK *pMaskList; - SKINOBJECTDESCRIPTOR *pObjects; - SortedList *pTextList; -}; - -struct GLYPHIMAGE -{ - TCHAR *szFileName; - DWORD dwLoadedTimes; - HBITMAP hGlyph; - BYTE isSemiTransp; -}; - -typedef GLYPHIMAGE *LPGLYPHIMAGE; - -struct CURRWNDIMAGEDATA -{ - HDC hImageDC; - HDC hBackDC; - HDC hScreenDC; - HBITMAP hImageDIB, hImageOld; - HBITMAP hBackDIB, hBackOld; - BYTE * hImageDIBByte; - BYTE * hBackDIBByte; - int Width, Height; -}; - -struct EFFECTSSTACKITEM -{ - HDC hdc; - BYTE EffectID; - DWORD FirstColor; - DWORD SecondColor; -}; - -class IniParser -{ -public: - enum { - FLAG_WITH_SETTINGS = 0, - FLAG_ONLY_OBJECTS = 1, - }; - - enum { IT_UNKNOWN, IT_FILE, IT_RESOURCE }; - - typedef HRESULT(*ParserCallback_t)(const char * szSection, const char * szKey, const char * szValue, IniParser * This); - - IniParser(TCHAR * szFileName, BYTE flags = FLAG_WITH_SETTINGS); - IniParser(HINSTANCE hInst, const char *resourceName, const char *resourceType, BYTE flags = FLAG_ONLY_OBJECTS); - ~IniParser(); - - bool CheckOK() { return _isValid; } - HRESULT Parse(ParserCallback_t pLineCallBackProc, LPARAM lParam); - - static HRESULT WriteStrToDb(const char * szSection, const char * szKey, const char * szValue, IniParser * This); - static int GetSkinFolder(IN const TCHAR * szFileName, OUT TCHAR * pszFolderName); - -private: - // common - enum { MAX_LINE_LEN = 512 }; - int _eType; - bool _isValid; - char * _szSection; - ParserCallback_t _pLineCallBackProc; - BOOL _SecCheck; - int _nLine; - - void _DoInit(); - BOOL _DoParseLine(char * szLine); - - // Processing File - HRESULT _DoParseFile(); - FILE * _hFile; - - // Processing resource - void _LoadResourceIni(HINSTANCE hInst, const char * resourceName, const char * resourceType); - HRESULT _DoParseResource(); - const char * _RemoveTailings(const char * szLine, size_t& len); - - HGLOBAL _hGlobalRes; - DWORD _dwSizeOfRes; - char * _pPosition; - - BYTE _Flags; - - -}; - - -int ske_UnloadSkin(SKINOBJECTSLIST * Skin); -int ske_AddDescriptorToSkinObjectList(SKINOBJECTDESCRIPTOR *lpDescr, SKINOBJECTSLIST* Skin); -INT_PTR ske_Service_DrawGlyph(WPARAM wParam, LPARAM lParam); - - - -#endif - diff --git a/plugins/Clist_modern/src/hdr/modern_skinselector.h b/plugins/Clist_modern/src/hdr/modern_skinselector.h deleted file mode 100644 index 16e6a574d0..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_skinselector.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#pragma once - -#ifndef M_MOD_SKIN_SELECTOR_H_INC -#define M_MOD_SKIN_SELECTOR_H_INC - -#include "newpluginapi.h" -#include "modern_commonheaders.h" - -#define MAXVALUE 20 - -#define MPF_EQUAL 1 -#define MPF_DIFF 2 -#define MPF_NOT_EQUAL ( MPF_DIFF|MPF_EQUAL ) -#define MPF_HASHED 4 - -struct MASKPARAM -{ - DWORD dwId; - BYTE bMaskParamFlag; - char* szName; - DWORD dwValueHash; - char* szValue; -}; - -struct MODERNMASK -{ - MASKPARAM* pl_Params; - DWORD dwParamCnt; - union - { - void* pObject; - char* szObjectName; - }; - DWORD dwMaskId; - BOOL bObjectFound; -}; - -struct LISTMODERNMASK -{ - MODERNMASK* pl_Masks; - DWORD dwMaskCnt; -}; - -/// PROTOTYPES -int AddModernMaskToList(MODERNMASK *mm, LISTMODERNMASK *mmTemplateList); -int AddStrModernMaskToList(DWORD maskID, char *szStr, char *objectName, LISTMODERNMASK *mmTemplateList); -int SortMaskList(LISTMODERNMASK *mmList); - -int DeleteMaskByItID(DWORD mID, LISTMODERNMASK *mmTemplateList); -int ClearMaskList(LISTMODERNMASK *mmTemplateList); -int ExchangeMasksByID(DWORD mID1, DWORD mID2, LISTMODERNMASK *mmTemplateList); - -int ParseToModernMask(MODERNMASK *mm, char *szText); -BOOL CompareModernMask(MODERNMASK *mmValue, MODERNMASK *mmTemplate); -BOOL CompareStrWithModernMask(char * szValue, MODERNMASK *mmTemplate); -MODERNMASK * FindMaskByStr(char * szValue, LISTMODERNMASK * mmTemplateList); -DWORD mod_CalcHash(const char * a); -char * ModernMaskToString(MODERNMASK *mm, char *buf, UINT bufsize); -int RegisterObjectByParce(char * ObjectName, char *Params); -SKINOBJECTDESCRIPTOR* skin_FindObjectByRequest(char *szValue, LISTMODERNMASK *mmTemplateList); -SKINOBJECTDESCRIPTOR* skin_FindObjectByMask(MODERNMASK *mm, LISTMODERNMASK *mmTemplateList); -TCHAR * GetParamNT(char * string, TCHAR * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces); -int SkinDrawGlyphMask(HDC hdc, RECT *rcSize, RECT *rcClip, MODERNMASK *ModernMask); -#endif diff --git a/plugins/Clist_modern/src/hdr/modern_static_clui.h b/plugins/Clist_modern/src/hdr/modern_static_clui.h deleted file mode 100644 index 8aea29123b..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_static_clui.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -/************************************************************************/ -/** FILE CONTAINS HEADER PART FOR .../modernb/clui.c file **/ -/** **/ -/** !!! DO NOT INCLUDE IN TO OTHER FILES !!! **/ -/************************************************************************/ - -/* Definitions */ -#pragma once - -#define TM_AUTOALPHA 1 -#define TM_DELAYEDSIZING 2 -#define TM_BRINGOUTTIMEOUT 3 -#define TM_BRINGINTIMEOUT 4 -#define TM_UPDATEBRINGTIMER 5 -#define TM_SMOTHALPHATRANSITION 20 -#define TM_WINDOWUPDATE 100 -#define TM_STATUSBARUPDATE 200 - -#define MS_CLUI_SHOWMAINMENU "CList/ShowMainMenu" -#define MS_CLUI_SHOWSTATUSMENU "CList/ShowStatusMenu" - -#define AC_SRC_NO_PREMULT_ALPHA 0x01 -#define AC_SRC_NO_ALPHA 0x02 -#define AC_DST_NO_PREMULT_ALPHA 0x10 -#define AC_DST_NO_ALPHA 0x20 - -#define ANIMATION_STEP 40 - -#define AEROGLASS_MINALPHA 24 - -/* Declaration of prototypes in other modules */ - -int ClcUnloadModule(); -int ClcGetShortData(ClcData* pData, SHORTDATA *pShortData); -int ClcEnterDragToScroll(HWND hwnd, int Y); - -int CListMod_ContactListShutdownProc(WPARAM wParam, LPARAM lParam); -int CListMod_HideWindow(HWND hwndContactList, int mode); - -int CListSettings_GetCopyFromCache(ClcCacheEntry *pDest, DWORD flag); -int CListSettings_SetToCache(ClcCacheEntry *pSrc, DWORD flag); - -int CLUIServices_LoadModule(void); -INT_PTR CLUIServices_SortList(WPARAM wParam, LPARAM lParam); - -void Docking_GetMonitorRectFromWindow(HWND hWnd, RECT *rc); - -int EventArea_Create(HWND hCluiWnd); - -int ExtraImage_ExtraIDToColumnNum(int extra); - -void GroupMenus_Init(); - -int ModernSkinButtonLoadModule(); -int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *r); - -void ske_ApplyTranslucency(); -HBITMAP ske_CreateDIB32(int cx, int cy); -HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits); -int ske_JustUpdateWindowImage(); -void ske_LoadSkinFromDB(void); -int ske_RedrawCompleteWindow(); -int ske_UpdateWindowImage(); -int ske_ValidateFrameImageProc(RECT *r); - -HWND StatusBar_Create(HWND parent); - -void RowHeight_InitModernRow(); - -int UnhookAll(); - -/* Module function prototypes */ - -int CLUI_IsInMainWindow(HWND hwnd); -int CLUI_SizingOnBorder(POINT pt, int size); -int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam); -int CLUI_TestCursorOnBorders(); - -static int CLUI_SmoothAlphaThreadTransition(); - -/* structs */ - -struct CHECKFILLING -{ - HDC hDC; - RECT rcRect; -}; - -int CheckFramesPos(RECT *wr); //cluiframes.c -int CLUIFrames_ApplyNewSizes(int mode); //cluiframes.c -int CLUIFrames_GetTotalHeight(); //cluiframes.c -int CLUIFrames_RepaintSubContainers(); //cluiframes.c -int CLUIFramesGetMinHeight(); //cluiframes.c - -int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode); //cluiframes.c - -int InitSkinHotKeys(); -BOOL amWakeThread(); -BOOL gtaWakeThread(); -void CreateViewModeFrame(); diff --git a/plugins/Clist_modern/src/hdr/modern_static_cluiframes_service.h b/plugins/Clist_modern/src/hdr/modern_static_cluiframes_service.h deleted file mode 100644 index 7a4ce4007a..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_static_cluiframes_service.h +++ /dev/null @@ -1,235 +0,0 @@ -////////////////////////////////////////////////////////////////////////// -// WARNING -////////////////////////////////////////////////////////////////////////// -// TO BE INCLUDED ONLY TO modern_cluiframes.cpp -////////////////////////////////////////////////////////////////////////// - -static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam); -static int _us_DoAddFrame(WPARAM wParam, LPARAM lParam); -static int _us_DoRemoveFrame(WPARAM wParam, LPARAM lParam); -static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam); -static INT_PTR _us_DoGetFrameOptions(WPARAM wParam, LPARAM lParam); -static int _us_DoUpdateFrame(WPARAM wParam, LPARAM lParam); -static int _us_DoShowHideFrameTitle(WPARAM wParam, LPARAM lParam); -static int _us_DoShowTitles(WPARAM wParam, LPARAM lParam); -static int _us_DoHideTitles(WPARAM wParam, LPARAM lParam); -static int _us_DoShowHideFrame(WPARAM wParam, LPARAM lParam); -static int _us_DoShowAllFrames(WPARAM wParam, LPARAM lParam); -static int _us_DoLockFrame(WPARAM wParam, LPARAM lParam); -static int _us_DoCollapseFrame(WPARAM wParam, LPARAM lParam); -static int _us_DoSetFrameBorder(WPARAM wParam, LPARAM lParam); -static int _us_DoSetFrameAlign(WPARAM wParam, LPARAM lParam); -static int _us_DoMoveFrame(WPARAM wParam, LPARAM lParam); -static int _us_DoMoveFrameUp(WPARAM wParam, LPARAM lParam); -static int _us_DoMoveFrameDown(WPARAM wParam, LPARAM lParam); -static int _us_DoAlignFrameTop(WPARAM wParam, LPARAM lParam); -static int _us_DoAlignFrameClient(WPARAM wParam, LPARAM lParam); -static int _us_DoAlignFrameBottom(WPARAM wParam, LPARAM lParam); -static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam); - -enum { - CFM_FIRST_MGS = WM_USER + 0x2FF, - - CFM_SETFRAMEPAINTPROC, - CFM_ADDFRAME, - CFM_REMOVEFRAME, - CFM_SETFRAMEOPTIONS, - CFM_GETFRAMEOPTIONS, - CFM_UPDATEFRAME, - CFM_SHOWHIDEFRAMETITLE, - CFM_SHOWTITLES, - CFM_HIDETITLES, - CFM_SHOWHIDEFRAME, - CFM_SHOWALL, - CFM_LOCKFRAME, - CFM_COLLAPSEFRAME, - CFM_SETFRAMEBORDER, - CFM_SETFRAMEALIGN, - CFM_MOVEFRAME, - CFM_MOVEFRAMEUP, - CFM_MOVEFRAMEDOWN, - CFM_ALIGNFRAMETOP, - CFM_ALIGNFRAMEBOTTOM, - CFM_ALIGNFRAMECLIENT, - CFM_SETFRAMEFLOAT, - - CFM_LAST_MSG -}; - -#define CLM_PROCESS( msg, proc ) case msg: result = proc( wParam, lParam); break; - -BOOL CALLBACK ProcessCLUIFrameInternalMsg(HWND, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& result) -{ - if (msg <= CFM_FIRST_MGS || msg >= CFM_LAST_MSG) - return FALSE; - - switch (msg) { - CLM_PROCESS(CFM_SETFRAMEPAINTPROC, _us_DoSetFramePaintProc); - CLM_PROCESS(CFM_ADDFRAME, _us_DoAddFrame); - CLM_PROCESS(CFM_REMOVEFRAME, _us_DoRemoveFrame); - CLM_PROCESS(CFM_SETFRAMEOPTIONS, _us_DoSetFrameOptions); - CLM_PROCESS(CFM_GETFRAMEOPTIONS, _us_DoGetFrameOptions); - CLM_PROCESS(CFM_UPDATEFRAME, _us_DoUpdateFrame); - CLM_PROCESS(CFM_SHOWHIDEFRAMETITLE, _us_DoShowHideFrameTitle); - CLM_PROCESS(CFM_SHOWTITLES, _us_DoShowTitles); - CLM_PROCESS(CFM_HIDETITLES, _us_DoHideTitles); - CLM_PROCESS(CFM_SHOWHIDEFRAME, _us_DoShowHideFrame); - CLM_PROCESS(CFM_SHOWALL, _us_DoShowAllFrames); - CLM_PROCESS(CFM_LOCKFRAME, _us_DoLockFrame); - CLM_PROCESS(CFM_COLLAPSEFRAME, _us_DoCollapseFrame); - CLM_PROCESS(CFM_SETFRAMEBORDER, _us_DoSetFrameBorder); - CLM_PROCESS(CFM_SETFRAMEALIGN, _us_DoSetFrameAlign); - CLM_PROCESS(CFM_MOVEFRAME, _us_DoMoveFrame); - CLM_PROCESS(CFM_MOVEFRAMEUP, _us_DoMoveFrameUp); - CLM_PROCESS(CFM_MOVEFRAMEDOWN, _us_DoMoveFrameDown); - CLM_PROCESS(CFM_ALIGNFRAMETOP, _us_DoAlignFrameTop); - CLM_PROCESS(CFM_ALIGNFRAMEBOTTOM, _us_DoAlignFrameClient); - CLM_PROCESS(CFM_ALIGNFRAMECLIENT, _us_DoAlignFrameBottom); - CLM_PROCESS(CFM_SETFRAMEFLOAT, _us_DoSetFrameFloat); - default: - return FALSE; // Not Handled - } - return TRUE; -} - -static INT_PTR CLUIFrames_SetFramePaintProc(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEPAINTPROC, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_AddFrame(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_ADDFRAME, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_RemoveFrame(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_REMOVEFRAME, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_SetFrameOptions(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEOPTIONS, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_GetFrameOptions(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_GETFRAMEOPTIONS, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_UpdateFrame(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_UPDATEFRAME, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_ShowHideFrameTitle(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SHOWHIDEFRAMETITLE, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_ShowTitles(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SHOWTITLES, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_HideTitles(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_HIDETITLES, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_ShowHideFrame(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SHOWHIDEFRAME, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_ShowAllFrames(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SHOWALL, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_LockFrame(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_LOCKFRAME, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_CollapseFrame(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_COLLAPSEFRAME, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_SetFrameBorder(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEBORDER, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_SetFrameAlign(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEALIGN, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_MoveFrame(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_MOVEFRAME, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_MoveFrameUp(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_MOVEFRAMEUP, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_MoveFrameDown(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_MOVEFRAMEDOWN, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_AlignFrameTop(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_ALIGNFRAMETOP, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_AlignFrameClient(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_ALIGNFRAMEBOTTOM, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_AlignFrameBottom(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_ALIGNFRAMECLIENT, wParam, lParam) : 0; -} - -static INT_PTR CLUIFrames_SetFrameFloat(WPARAM wParam, LPARAM lParam) -{ - return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEFLOAT, wParam, lParam) : 0; -} - -static void CreateCluiFramesServices() -{ - CreateServiceFunction(MS_SKINENG_REGISTERPAINTSUB, CLUIFrames_SetFramePaintProc); - CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME, CLUIFrames_AddFrame); - CreateServiceFunction(MS_CLIST_FRAMES_REMOVEFRAME, CLUIFrames_RemoveFrame); - - CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS, CLUIFrames_SetFrameOptions); - CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS, CLUIFrames_GetFrameOptions); - CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME, CLUIFrames_UpdateFrame); - - CreateServiceFunction(MS_CLIST_FRAMES_SHFRAMETITLEBAR, CLUIFrames_ShowHideFrameTitle); - CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMESTB, CLUIFrames_ShowTitles); - CreateServiceFunction(MS_CLIST_FRAMES_HIDEALLFRAMESTB, CLUIFrames_HideTitles); - CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME, CLUIFrames_ShowHideFrame); - CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES, CLUIFrames_ShowAllFrames); - - CreateServiceFunction(MS_CLIST_FRAMES_ULFRAME, CLUIFrames_LockFrame); - CreateServiceFunction(MS_CLIST_FRAMES_UCOLLFRAME, CLUIFrames_CollapseFrame); - CreateServiceFunction(MS_CLIST_FRAMES_SETUNBORDER, CLUIFrames_SetFrameBorder); - - CreateServiceFunction(CLUIFRAMESSETALIGN, CLUIFrames_SetFrameAlign); - CreateServiceFunction(CLUIFRAMESMOVEUPDOWN, CLUIFrames_MoveFrame); - CreateServiceFunction(CLUIFRAMESMOVEUP, CLUIFrames_MoveFrameUp); - CreateServiceFunction(CLUIFRAMESMOVEDOWN, CLUIFrames_MoveFrameDown); - - CreateServiceFunction(CLUIFRAMESSETALIGNALTOP, CLUIFrames_AlignFrameTop); - CreateServiceFunction(CLUIFRAMESSETALIGNALCLIENT, CLUIFrames_AlignFrameClient); - CreateServiceFunction(CLUIFRAMESSETALIGNALBOTTOM, CLUIFrames_AlignFrameBottom); - - CreateServiceFunction(CLUIFRAMESSETFLOATING, CLUIFrames_SetFrameFloat); -} diff --git a/plugins/Clist_modern/src/hdr/modern_statusbar.h b/plugins/Clist_modern/src/hdr/modern_statusbar.h deleted file mode 100644 index 2ac385b6d4..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_statusbar.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#ifndef modern_statusbar_h__ -#define modern_statusbar_h__ - -#include "modern_commonprototypes.h" -#include "m_xpTheme.h" - -int ModernDrawStatusBar(HWND hwnd, HDC hDC); -int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC); - -typedef struct tagSTATUSBARDATA -{ - BOOL sameWidth; - RECT rectBorders; - BYTE extraspace; - BYTE Align; - BYTE VAlign; - bool bShowProtoIcon; - bool bShowProtoName; - bool bShowStatusName; - bool bConnectingIcon; - HFONT BarFont; - DWORD fontColor; - BYTE TextEffectID; - DWORD TextEffectColor1; - DWORD TextEffectColor2; - BYTE xStatusMode; // 0-only main, 1-xStatus, 2-main as overlay - BYTE nProtosPerLine; - bool bShowProtoEmails; - - HBITMAP hBmpBackground; - COLORREF bkColour; - DWORD backgroundBmpUse; - BOOL bkUseWinColors; - - XPTHANDLE hTheme; - - BOOL perProtoConfig; - BYTE SBarRightClk; - -} STATUSBARDATA; - -#endif // modern_statusbar_h__ diff --git a/plugins/Clist_modern/src/hdr/modern_sync.h b/plugins/Clist_modern/src/hdr/modern_sync.h deleted file mode 100644 index 0b5a827f11..0000000000 --- a/plugins/Clist_modern/src/hdr/modern_sync.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef modern_sync_h__ -#define modern_sync_h__ - -typedef INT_PTR(*PSYNCCALLBACKPROC)(WPARAM, LPARAM); - -int SyncCall(void * vproc, int count, ...); - -// Experimental sync caller - -int DoCall(PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam); - -// Have to be here due to MS Visual C++ does not support 'export' keyword - -// 3 params - -template class PARAMS3 -{ - typedef RET(*proc_t)(A, B, C); - proc_t _proc; A _a; B _b; C _c; RET _ret; - -public: - PARAMS3(proc_t __proc, A __a, B __b, C __c) : _proc(__proc), _a(__a), _b(__b), _c(__c){}; - static int DoSyncCall(WPARAM, LPARAM lParam) - { - PARAMS3 * params = (PARAMS3 *)lParam; - params->_ret = params->_proc(params->_a, params->_b, params->_c); - return 0; - }; - RET GetResult() { return _ret; } -}; - -template< class RET, class Ap, class Bp, class Cp, class A, class B, class C> RET Sync(RET(*proc)(Ap, Bp, Cp), A a, B b, C c) -{ - PARAMS3 params(proc, a, b, c); - DoCall((PSYNCCALLBACKPROC)PARAMS3::DoSyncCall, 0, (LPARAM)¶ms); - return params.GetResult(); -}; - - -// 2 params - -template class PARAMS2 -{ - typedef RET(*proc_t)(A, B); - proc_t _proc; A _a; B _b; RET _ret; - -public: - PARAMS2(proc_t __proc, A __a, B __b) : _proc(__proc), _a(__a), _b(__b){}; - static int DoSyncCall(WPARAM, LPARAM lParam) - { - PARAMS2 * params = (PARAMS2 *)lParam; - params->_ret = params->_proc(params->_a, params->_b); - return 0; - }; - RET GetResult() { return _ret; } -}; - -template< class RET, class Ap, class Bp, class A, class B> RET Sync(RET(*proc)(Ap, Bp), A a, B b) -{ - PARAMS2 params(proc, a, b); - DoCall((PSYNCCALLBACKPROC)PARAMS2::DoSyncCall, 0, (LPARAM)¶ms); - return params.GetResult(); -}; - - -// 1 param -template class PARAMS1 -{ - typedef RET(*proc_t)(A); - proc_t _proc; A _a; RET _ret; - -public: - PARAMS1(proc_t __proc, A __a) : _proc(__proc), _a(__a){}; - static int DoSyncCall(WPARAM, LPARAM lParam) - { - PARAMS1 * params = (PARAMS1 *)lParam; - params->_ret = params->_proc(params->_a); - return 0; - }; - RET GetResult() { return _ret; } -}; - -template< class RET, class Ap, class A> RET Sync(RET(*proc)(Ap), A a) -{ - PARAMS1 params(proc, a); - DoCall((PSYNCCALLBACKPROC)PARAMS1::DoSyncCall, 0, (LPARAM)¶ms); - return params.GetResult(); -}; - -#endif // modern_sync_h__ \ No newline at end of file diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 1be5809ace..c4ee6f98a0 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -23,12 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //include -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_commonprototypes.h" +#include "stdafx.h" +#include "modern_commonprototypes.h" #include "version.h" -#include "hdr/modern_clui.h" -#include "hdr/modern_clcpaint.h" +#include "modern_clui.h" +#include "modern_clcpaint.h" //definitions @@ -166,7 +166,6 @@ static HRESULT SubclassClistInterface() pcli->pfnShowHide = cliShowHide; pcli->pfnHitTest = cliHitTest; pcli->pfnCompareContacts = cliCompareContacts; - pcli->pfnBuildGroupPopupMenu = cliBuildGroupPopupMenu; pcli->pfnGetIconFromStatusMode = cliGetIconFromStatusMode; pcli->pfnFindItem = cliFindItem; pcli->pfnGetRowByIndex = cliGetRowByIndex; @@ -205,8 +204,6 @@ static HRESULT CreateHookableEvents() { g_CluiData.hEventBkgrChanged = CreateHookableEvent(ME_BACKGROUNDCONFIG_CHANGED); g_CluiData.hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU); - g_CluiData.hEventPreBuildGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU); - g_CluiData.hEventPreBuildSubGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU); g_CluiData.hEventStatusBarShowToolTip = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP); g_CluiData.hEventStatusBarHideToolTip = CreateHookableEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP); g_CluiData.hEventSkinServicesCreated = CreateHookableEvent(ME_SKIN_SERVICESCREATED); diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 5fbbfea721..f6e36bd95a 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // File contains implementation of animated avatars in contact list -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #define IMMEDIATE_DRAW (!s_bSeparateWindow) diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index 251217e4a0..f9a4510d83 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -30,9 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ////////////////////////////////////////////////////////////////////////// // Module to Request Away Messages -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_awaymsg.h" -#include "hdr/modern_sync.h" +#include "stdafx.h" +#include "modern_awaymsg.h" +#include "modern_sync.h" #define AMASKPERIOD 3000 diff --git a/plugins/Clist_modern/src/modern_awaymsg.h b/plugins/Clist_modern/src/modern_awaymsg.h new file mode 100644 index 0000000000..d99be87d2e --- /dev/null +++ b/plugins/Clist_modern/src/modern_awaymsg.h @@ -0,0 +1,37 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +/* +* Author Artem Shpynov aka FYR +* Copyright 2000-2008 Artem Shpynov +*/ + +#pragma once +////////////////////////////////////////////////////////////////////////// +// Module to Request Away Messages + +void InitAwayMsgModule(); +void UninitAwayMsgModule(); +void amRequestAwayMsg(MCONTACT hContact); diff --git a/plugins/Clist_modern/src/modern_cache_funcs.h b/plugins/Clist_modern/src/modern_cache_funcs.h new file mode 100644 index 0000000000..f1b228f215 --- /dev/null +++ b/plugins/Clist_modern/src/modern_cache_funcs.h @@ -0,0 +1,47 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Created by Pescuma + +*/ +#pragma once + +#ifndef __CACHE_FUNCS_H__ +# define __CACHE_FUNCS_H__ + +#include "modern_clc.h" +#include "modern_commonprototypes.h" + +void Cache_GetText(ClcData *dat, ClcContact *contact, BOOL forceRenew); +void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact); +void Cache_GetSecondLineText(SHORTDATA *dat, ClcCacheEntry *pdnce); +void Cache_GetThirdLineText(SHORTDATA *dat, ClcCacheEntry *pdnce); +void Cache_GetAvatar(ClcData *dat, ClcContact *contact); +void Cache_GetTimezone(ClcData *dat, MCONTACT hContact); +int Cache_GetLineText(ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size, TCHAR *variable_text, BOOL xstatus_has_priority, + BOOL show_status_if_no_away, BOOL show_listening_if_no_away, BOOL use_name_and_message_for_xstatus, + BOOL pdnce_time_show_only_if_different); + +void amRequestAwayMsg(MCONTACT hContact); + +#endif // __CACHE_FUNCS_H__ diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 40dab74c2f..280a33acbd 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -28,11 +28,11 @@ Modified by FYR ///////////////////////////////////////////////////////////////////////////////////////// // Module for working with lines text and avatars -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_cache_funcs.h" +#include "stdafx.h" +#include "modern_cache_funcs.h" #include "newpluginapi.h" -#include "./hdr/modern_gettextasync.h" -#include "hdr/modern_sync.h" +#include "./modern_gettextasync.h" +#include "modern_sync.h" typedef BOOL(*ExecuteOnAllContactsFuncPtr) (ClcContact *contact, BOOL subcontact, void *param); diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 5ee7d52875..754055f7dd 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -26,13 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Module responsible for working with contact list control */ /************************************************************************/ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include "m_skin.h" -#include "hdr/modern_commonprototypes.h" +#include "modern_commonprototypes.h" -#include "hdr/modern_clc.h" -#include "hdr/modern_clist.h" -#include "hdr/modern_clcpaint.h" +#include "modern_clc.h" +#include "modern_clist.h" +#include "modern_clcpaint.h" #include "m_modernopt.h" diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h new file mode 100644 index 0000000000..7f6c2cb894 --- /dev/null +++ b/plugins/Clist_modern/src/modern_clc.h @@ -0,0 +1,451 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#pragma once + +#ifndef _CLC_H_ +#define _CLC_H_ +#include "modern_image_array.h" +#include "m_xpTheme.h" + +#include "modern_defsettings.h" +#include "modern_clist.h" + +// Íîâûé ôîðìàò íàñòðîåê. +#define TRAY_ICON_MODE_GLOBAL 1 +#define TRAY_ICON_MODE_ACC 2 +#define TRAY_ICON_MODE_CYCLE 4 +#define TRAY_ICON_MODE_ALL 8 + +#define NIIF_INTERN_UNICODE 0x00000100 + +#define SETTING_STATE_HIDDEN 0 +#define SETTING_STATE_MINIMIZED 1 +#define SETTING_STATE_NORMAL 2 + +#define SETTING_BRINGTOFRONT_DEFAULT 0 + +#define SETTING_AVATAR_OVERLAY_TYPE_NORMAL 0 +#define SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL 1 +#define SETTING_AVATAR_OVERLAY_TYPE_CONTACT 2 + +#define HCONTACT_ISGROUP 0x80000000 +#define HCONTACT_ISINFO 0xFFFF0000 + +#define MAXSTATUSMSGLEN 256 + +#define INTM_NAMECHANGED (WM_USER+10) +#define INTM_ICONCHANGED (WM_USER+11) +#define INTM_GROUPCHANGED (WM_USER+12) +#define INTM_GROUPSCHANGED (WM_USER+13) +#define INTM_CONTACTADDED (WM_USER+14) +#define INTM_CONTACTDELETED (WM_USER+15) +#define INTM_HIDDENCHANGED (WM_USER+16) +#define INTM_INVALIDATE (WM_USER+17) +#define INTM_APPARENTMODECHANGED (WM_USER+18) +#define INTM_SETINFOTIPHOVERTIME (WM_USER+19) +#define INTM_NOTONLISTCHANGED (WM_USER+20) +#define INTM_RELOADOPTIONS (WM_USER+21) +#define INTM_NAMEORDERCHANGED (WM_USER+22) +#define INTM_IDLECHANGED (WM_USER+23) +#define INTM_SCROLLBARCHANGED (WM_USER+24) +#define INTM_PROTOCHANGED (WM_USER+25) +#define INTM_STATUSMSGCHANGED (WM_USER+26) +#define INTM_STATUSCHANGED (WM_USER+27) +#define INTM_AVATARCHANGED (WM_USER+28) +#define INTM_TIMEZONECHANGED (WM_USER+29) + +#define CLBF_TILEVTOROWHEIGHT 0x0100 + +#define TIMERID_RENAME 10 +#define TIMERID_DRAGAUTOSCROLL 11 +#define TIMERID_INFOTIP 13 +#define TIMERID_REBUILDAFTER 14 +#define TIMERID_DELAYEDRESORTCLC 15 +#define TIMERID_SUBEXPAND 21 +#define TIMERID_INVALIDATE 22 +#define TIMERID_INVALIDATE_FULL 25 +#define TIMERID_RECALCSCROLLBAR 26 + +#define TIMERID_FIRST TIMERID_RENAME +#define TIMERID_LAST TIMERID_RECALCSCROLLBAR + +void clcSetDelayTimer(UINT_PTR uIDEvent, HWND hwnd, int nDelay = -1); + +#define FONTID_CONTACTS 0 +#define FONTID_INVIS 1 +#define FONTID_OFFLINE 2 +#define FONTID_NOTONLIST 3 +#define FONTID_OPENGROUPS 4 +#define FONTID_OPENGROUPCOUNTS 5 +#define FONTID_DIVIDERS 6 +#define FONTID_OFFINVIS 7 +#define FONTID_SECONDLINE 8 +#define FONTID_THIRDLINE 9 +#define FONTID_AWAY 10 +#define FONTID_DND 11 +#define FONTID_NA 12 +#define FONTID_OCCUPIED 13 +#define FONTID_CHAT 14 +#define FONTID_INVISIBLE 15 +#define FONTID_PHONE 16 +#define FONTID_LUNCH 17 +#define FONTID_CONTACT_TIME 18 +#define FONTID_CLOSEDGROUPS 19 +#define FONTID_CLOSEDGROUPCOUNTS 20 +#define FONTID_STATUSBAR_PROTONAME 21 +#define FONTID_EVENTAREA 22 +#define FONTID_VIEMODES 23 +#define FONTID_MODERN_MAX 23 + +#define DROPTARGET_OUTSIDE 0 +#define DROPTARGET_ONSELF 1 +#define DROPTARGET_ONNOTHING 2 +#define DROPTARGET_ONGROUP 3 +#define DROPTARGET_ONCONTACT 4 +#define DROPTARGET_INSERTION 5 +#define DROPTARGET_ONMETACONTACT 6 +#define DROPTARGET_ONSUBCONTACT 7 + +ClcGroup; + +#define CONTACTF_ONLINE 1 +#define CONTACTF_INVISTO 2 +#define CONTACTF_VISTO 4 +#define CONTACTF_NOTONLIST 8 +#define CONTACTF_CHECKED 16 +#define CONTACTF_IDLE 32 +//#define CONTACTF_STATUSMSG 64 + +#define AVATAR_POS_DONT_HAVE -1 +#define AVATAR_POS_ANIMATED -2 + +#define TEXT_PIECE_TYPE_TEXT 0 +#define TEXT_PIECE_TYPE_SMILEY 1 + +#define DRAGSTAGE_NOTMOVED 0 +#define DRAGSTAGE_ACTIVE 1 +#define DRAGSTAGEM_STAGE 0x00FF +#define DRAGSTAGEF_MAYBERENAME 0x8000 +#define DRAGSTAGEF_OUTSIDE 0x4000 +#define DRAGSTAGEF_SKIPRENAME 0x2000 + +#define ITEM_AVATAR 0 +#define ITEM_ICON 1 +#define ITEM_TEXT 2 +#define ITEM_EXTRA_ICONS 3 +#define ITEM_CONTACT_TIME 4 +#define NUM_ITEM_TYPE 5 + +#define TEXT_EMPTY -1 +#define TEXT_STATUS 0 +#define TEXT_NICKNAME 1 +#define TEXT_STATUS_MESSAGE 2 +#define TEXT_TEXT 3 +#define TEXT_CONTACT_TIME 4 +#define TEXT_LISTENING_TO 5 + +#define TEXT_TEXT_MAX_LENGTH 1024 + +typedef struct tagClcContactTextPiece +{ + int type; + int len; + union + { + struct + { + int start_pos; + }; + struct + { + HICON smiley; + int smiley_width; + int smiley_height; + }; + }; +} ClcContactTextPiece; + +enum { + CIT_PAINT_END = 0, //next items are invalids + CIT_AVATAR, // 1 + CIT_ICON, // 2 + CIT_TEXT, // 3 //the contact name or group name + CIT_SUBTEXT1, // 4 //the second line for contact or group counter for groups + CIT_SUBTEXT2, // 5 + CIT_TIME, // 6 + CIT_CHECKBOX, // 7 + CIT_SELECTION, // 8 + CIT_EXTRA = 64 //use bit compare for extra icon, the mask &0x3F will return number of extra icon +}; + +struct tContactItems +{ + BYTE itemType; //one of above CIT_ definitions + RECT itemRect; +}; + +struct ClcContact : public ClcContactBase +{ + ClcContact *subcontacts; + BYTE SubAllocated; + BYTE SubExpanded; + BYTE isSubcontact; + // int status; + BOOL image_is_special; + int avatar_pos; + avatarCacheEntry *avatar_data; + SIZE avatar_size; + CSmileyString ssText; + + // For hittest + int pos_indent; + RECT pos_check; + RECT pos_avatar; + RECT pos_icon; + RECT pos_label; + RECT pos_rename_rect; + RECT pos_contact_time; + RECT pos_extra[EXTRA_ICON_COUNT]; + DWORD lastPaintCounter; + BYTE bContactRate; + + // For extended layout + BYTE ext_nItemsNum; + BOOL ext_fItemsValid; + tContactItems ext_mpItemsDesc[EXTRA_ICON_COUNT + 10]; //up to 10 items + + __forceinline bool isChat() const + { + return (type == CLCIT_CONTACT) && (db_get_b(hContact, proto, "ChatRoom", 0) != 0); + } +}; + +struct ClcModernFontInfo { + HFONT hFont; + int fontHeight, changed; + COLORREF colour; + BYTE effect; + COLORREF effectColour1; + COLORREF effectColour2; +}; + +struct ClcData : public ClcDataBase +{ + BYTE HiLightMode; + BYTE doubleClickExpand; + int MetaIgnoreEmptyExtra; + BYTE expandMeta; + BYTE IsMetaContactsEnabled; + time_t last_tick_time; + BOOL force_in_dialog; + int subIndent; + int rightMargin; + HBITMAP hMenuBackground; + DWORD MenuBkColor, MenuBkHiColor, MenuTextColor, MenuTextHiColor; + int MenuBmpUse; + + // Row height + int *row_heights; + int row_heights_size; + int row_heights_allocated; + + // Avatar cache + IMAGE_ARRAY_DATA avatar_cache; + + // Row + int row_min_heigh; + int row_border; + int row_before_group_space; + + BOOL row_variable_height; + BOOL row_align_left_items_to_left; + BOOL row_align_right_items_to_right; + int row_items[NUM_ITEM_TYPE]; + BOOL row_hide_group_icon; + BYTE row_align_group_mode; + + // Avatar + BOOL avatars_show; + BOOL avatars_draw_border; + COLORREF avatars_border_color; + BOOL avatars_round_corners; + BOOL avatars_use_custom_corner_size; + int avatars_custom_corner_size; + BOOL avatars_ignore_size_for_row_height; + BOOL avatars_draw_overlay; + int avatars_overlay_type; + + int avatars_maxheight_size; + int avatars_maxwidth_size; + + // Icon + BOOL icon_hide_on_avatar; + BOOL icon_draw_on_avatar_space; + BOOL icon_ignore_size_for_row_height; + + // Contact time + BOOL contact_time_show; + BOOL contact_time_show_only_if_different; + + // Text + BOOL text_rtl; + BOOL text_align_right; + BOOL text_replace_smileys; + BOOL text_resize_smileys; + int text_smiley_height; + BOOL text_use_protocol_smileys; + BOOL text_ignore_size_for_row_height; + + // First line + BOOL first_line_draw_smileys; + BOOL first_line_append_nick; + + // Second line + BOOL second_line_show; + int second_line_top_space; + BOOL second_line_draw_smileys; + int second_line_type; + TCHAR second_line_text[TEXT_TEXT_MAX_LENGTH]; + BOOL second_line_xstatus_has_priority; + BOOL second_line_show_status_if_no_away; + BOOL second_line_show_listening_if_no_away; + BOOL second_line_use_name_and_message_for_xstatus; + + // Third line + BOOL third_line_show; + int third_line_top_space; + BOOL third_line_draw_smileys; + int third_line_type; + TCHAR third_line_text[TEXT_TEXT_MAX_LENGTH]; + BOOL third_line_xstatus_has_priority; + BOOL third_line_show_status_if_no_away; + BOOL third_line_show_listening_if_no_away; + BOOL third_line_use_name_and_message_for_xstatus; + struct ClcModernFontInfo fontModernInfo[FONTID_MODERN_MAX + 1]; + HWND hWnd; + BYTE menuOwnerType; + int menuOwnerID; + DWORD m_paintCouter; //range is enoght to 49 days if painting will occure each one millisecond + BYTE useMetaIcon; + BYTE drawOverlayedStatus; + int nInsertionLevel; + + BYTE dbbMetaHideExtra; + BYTE dbbBlendInActiveState; + BYTE dbbBlend25; + + XPTHANDLE hCheckBoxTheme; + BYTE bCompactMode; +}; + +struct SHORTDATA +{ + HWND hWnd; + BOOL contact_time_show_only_if_different; + int text_smiley_height; + BOOL text_replace_smileys; + BOOL text_use_protocol_smileys; + + // Second line + BOOL second_line_show; + BOOL second_line_draw_smileys; + int second_line_type; + TCHAR second_line_text[TEXT_TEXT_MAX_LENGTH]; + BOOL second_line_xstatus_has_priority; + BOOL second_line_show_status_if_no_away; + BOOL second_line_show_listening_if_no_away; + BOOL second_line_use_name_and_message_for_xstatus; + + // Third line + BOOL third_line_show; + BOOL third_line_draw_smileys; + int third_line_type; + TCHAR third_line_text[TEXT_TEXT_MAX_LENGTH]; + BOOL third_line_xstatus_has_priority; + BOOL third_line_show_status_if_no_away; + BOOL third_line_show_listening_if_no_away; + BOOL third_line_use_name_and_message_for_xstatus; +}; + +typedef struct tagOVERLAYICONINFO +{ + char *name; + char *description; + int id; + int listID; +} OVERLAYICONINFO; + +//clc.c +void ClcOptionsChanged(void); + +//clcidents.c +int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex); +int FindItem(HWND hwnd, ClcData *dat, DWORD hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible, BOOL isIgnoreSubcontacts); +int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup); +HANDLE ContactToHItem(ClcContact *contact); +HANDLE ContactToItemHandle(ClcContact *contact, DWORD *nmFlags); +void ClearRowByIndexCache(); + +//clcitems.c +ClcGroup *cli_AddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); +void cli_FreeGroup(ClcGroup *group); +int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); +void cliRebuildEntireList(HWND hwnd, ClcData *dat); +void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem); +void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline); +void cli_SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort); +int GetNewSelection(ClcGroup *group, int selection, int direction); + +//clcmsgs.c +LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); + +//clcutils.c +void cliRecalcScrollBar(HWND hwnd, ClcData *dat); +void cliBeginRenameSelection(HWND hwnd, ClcData *dat); +int cliHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags); +void cliScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth); +int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt); +void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst); + + +//clcpaint.c +void CLCPaint_cliPaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint); + +//clcopts.c +int ClcOptInit(WPARAM wParam, LPARAM lParam); +DWORD GetDefaultExStyle(void); +void GetFontSetting(int i, LOGFONT *lf, COLORREF *colour, BYTE *effect, COLORREF *eColour1, COLORREF *eColour2); + +//clistsettings.c +TCHAR * GetContactDisplayNameW(MCONTACT hContact, int mode); + +//groups.c +TCHAR* GetGroupNameTS(int idx, DWORD* pdwFlags); +int RenameGroupT(WPARAM groupID, LPARAM newName); + +int GetContactCachedStatus(MCONTACT hContact); +char *GetContactCachedProtocol(MCONTACT hContact); + +#endif /* _CLC_H_ */ diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 8e04c56eea..3a933a1df7 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -22,9 +22,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clc.h" -#include "hdr/modern_commonprototypes.h" +#include "stdafx.h" +#include "modern_clc.h" +#include "modern_commonprototypes.h" #define CacheArrSize 255 ClcGroup *CacheIndex[CacheArrSize] = { NULL }; diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 4ebc0806bd..c7753ca7a1 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -22,11 +22,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clc.h" -#include "hdr/modern_clist.h" +#include "stdafx.h" +#include "modern_clc.h" +#include "modern_clist.h" #include "m_metacontacts.h" -#include "hdr/modern_commonprototypes.h" +#include "modern_commonprototypes.h" void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) { @@ -285,7 +285,7 @@ void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem) ClearRowByIndexCache(); } -__inline BOOL CLCItems_IsShowOfflineGroup(ClcGroup* group) +BOOL CLCItems_IsShowOfflineGroup(ClcGroup* group) { DWORD groupFlags = 0; if (!group) return FALSE; diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 849270026b..e8cf1a0e75 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -22,9 +22,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clc.h" -#include "hdr/modern_commonprototypes.h" +#include "stdafx.h" +#include "modern_clc.h" +#include "modern_commonprototypes.h" //processing of all the CLM_ messages incoming diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 6c2a3b15f6..6c63d290a0 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -22,15 +22,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clc.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_defsettings.h" -#include "hdr/modern_effectenum.h" -#include "hdr/modern_sync.h" +#include "stdafx.h" +#include "modern_clc.h" +#include "modern_commonprototypes.h" +#include "modern_defsettings.h" +#include "modern_effectenum.h" +#include "modern_sync.h" #include #include "m_fontservice.h" +#pragma comment(lib, "shlwapi.lib") + INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); #define FONTF_NORMAL 0 diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index f8c845ac65..bf337c1282 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -22,13 +22,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" -#include "hdr/modern_clc.h" -#include "hdr/modern_skinengine.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_row.h" -#include "hdr/modern_clcpaint.h" +#include "modern_clc.h" +#include "modern_skinengine.h" +#include "modern_commonprototypes.h" +#include "modern_row.h" +#include "modern_clcpaint.h" CLCPaint g_clcPainter; diff --git a/plugins/Clist_modern/src/modern_clcpaint.h b/plugins/Clist_modern/src/modern_clcpaint.h new file mode 100644 index 0000000000..879452125f --- /dev/null +++ b/plugins/Clist_modern/src/modern_clcpaint.h @@ -0,0 +1,188 @@ +#ifndef modern_clcpaint_h__ +#define modern_clcpaint_h__ + +extern class CLCPaint g_clcPainter; +class CLCPaint +{ + +public: + CLCPaint(); + ~CLCPaint() {}; + + CLINTERFACE void cliPaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint); + CLINTERFACE tPaintCallbackProc PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData); + + BOOL IsForegroundWindow(HWND hWnd); + HFONT ChangeToFont(HDC hdc, ClcData *dat, int id, int *fontHeight); + int GetBasicFontID(ClcContact *contact); + void GetTextSize(SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHAR *szText, SortedList *plText, UINT uTextFormat, int smiley_height); + void AddParam(MODERNMASK *mpModernMask, DWORD dwParamHash, const char* szValue, DWORD dwValueHash); + BOOL CheckMiniMode(ClcData *dat, BOOL selected); + +private: + static const int HORIZONTAL_SPACE; + static const int EXTRA_CHECKBOX_SPACE; + static const int EXTRA_SPACE; + static const int SELECTION_BORDER; + static const int MIN_TEXT_WIDTH; + static const int BUF2SIZE; + + static const BYTE GIM_SELECTED_AFFECT; + static const BYTE GIM_HOT_AFFECT; + static const BYTE GIM_TEMP_AFFECT; + static const BYTE GIM_IDLE_AFFECT; + static const BYTE GIM_EXTRAICON_AFFECT; + static const BYTE GIM_STATUSICON_AFFECT; + static const BYTE GIM_AVATAR_AFFECT; + + enum tagenumHASHINDEX + { + hi_Module = 0, + hi_ID, + hi_Type, + hi_Open, + hi_IsEmpty, + hi_SubPos, + hi_Protocol, + hi_RootGroup, + hi_Status, + hi_HasAvatar, + hi_GroupPos, + hi_Selected, + hi_Hot, + hi_Odd, + hi_Indent, + hi_Index, + hi_Name, + hi_Group, + hi_True, + hi_False, + hi_ONLINE, + hi_AWAY, + hi_DND, + hi_NA, + hi_OCCUPIED, + hi_FREECHAT, + hi_INVISIBLE, + hi_OUTTOLUNCH, + hi_ONTHEPHONE, + hi_IDLE, + hi_OFFLINE, + hi_Row, + hi_CL, + hi_SubContact, + hi_MetaContact, + hi_Contact, + hi_Divider, + hi_Info, + hi_First_Single, + hi_First, + hi_Middle, + hi_Mid, + hi_Single, + hi_Last, + hi_Rate, + hi_None, + hi_Low, + hi_Medium, + hi_High, + hi_State, + hi_stActive, + hi_stInactive, + //ADD new item above here + hi_LastItem + } enumHASHINDEX; + static const char * HASHTEXT[hi_LastItem]; + static DWORD HASH[hi_LastItem]; + + void _FillQuickHash(); + void _SetHotTrackColour(HDC hdc, ClcData *dat); + int _GetStatusOnlineness(int status); + int _GetGeneralisedStatus(); + int _GetRealStatus(ClcContact *pContact, int nStatus); + RECT _GetRectangle(ClcData *dat, RECT *row_rc, RECT *free_row_rc, int *left_pos, int *right_pos, BOOL left, int real_width, int width, int height, int horizontal_space); + void _DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, TCHAR *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley); + void _AddParameter(MODERNMASK *mpModernMask, MASKPARAM * lpParam); + void _AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWORD dwValueIndex); + void _FillParam(MASKPARAM * lpParam, DWORD dwParamHash, const char* szValue, DWORD dwValueHash); + MODERNMASK* _GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat); + void _RTLRect(RECT *rect, int width); + void _PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int selected, int hottrack); + void _DrawStatusIcon(ClcContact *Drawing, ClcData *dat, int iImage, HDC hdcMem, int x, int y, int cx, int cy, DWORD colorbg, DWORD colorfg, int mode); + BOOL _DrawNonEnginedBackground(HDC hdcMem, RECT *rcPaint, RECT clRect, ClcData *dat); + void _PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint); + void _StoreItemPos(ClcContact *contact, int ItemType, RECT *rc); + void _CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *in_row_rc, RECT *in_free_row_rc, int left_pos, int right_pos, int selected); + BOOL __IsVisible(RECT *firtRect, RECT *secondRect); + void _GetBlendMode(IN ClcData *dat, IN ClcContact *Drawing, IN BOOL selected, IN BOOL hottrack, IN BOOL bFlag, OUT COLORREF * OutColourFg, OUT int * OutMode); + void _DrawContactItems(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *row_rc, RECT *free_row_rc, int selected, int hottrack, RECT *rcPaint); + void _PaintRowItems(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint); + + void _DrawContactAvatar(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *row_rc, int& selected, int& hottrack, RECT *prcItem); + void _DrawContactIcon(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT *prcItem); + void _DrawContactText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT *prcItem, UINT uTextFormat); + void _DrawContactSubText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT *prcItem, UINT uTextFormat, BYTE itemType); + void _DrawContactTime(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT *prcItem); + void _DrawContactExtraIcon(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT *rc, int iImage); + void _DrawContactSelection(HDC hdcMem, ClcData *dat, int& selected, int& hottrack, RECT *rcPaint, RECT *prcItem); + void _DrawContactLine(HDC hdcMem, ClcContact *Drawing, RECT *free_row_rc, RECT *rcPaint, RECT& text_rc); + + int _rcWidth(RECT *rc) { return rc->right - rc->left; } + int _rcHeight(RECT *rc) { return rc->bottom - rc->top; } + +private: + enum enDrawMode + { + DM_LAYERED = 1, // Draw normal skin on 32 bit with alpha layer + DM_NON_LAYERED = 2, // Draw skinnable, but does not take care about alpha + DM_CLASSIC = 4, // Old style draw for classic + DM_CONTROL = 8, // Draw as control according to windows color scheme + DM_FLOAT = 16, // Float mode + DM_GRAY = 32, // Grayed mode + DM_GREYALTERNATE = 64, // Gray odd lines + DM_DRAW_OFFSCREEN = DM_FLOAT | DM_CONTROL | DM_NON_LAYERED | DM_CLASSIC, + }; + + inline int _DetermineDrawMode(HWND hWnd, ClcData *dat); + + struct _PaintContext + { + enum + { + release_none = 0, + release_hdcmem2 = 1, + release_hdcmem = 2 + }; + HDC hdcMem; + HDC hdcMem2; + + HBITMAP hBmpOsb2; + HBITMAP oldbmp2; + + HBITMAP hBmpOsb; + HBITMAP oldbmp; + + HBRUSH hBrushAlternateGrey; + COLORREF tmpbkcolour; + COLORREF tmpforecolour; + + DWORD fRelease; + _PaintContext(HDC _hdcMem = NULL) : + hdcMem(_hdcMem), hdcMem2(NULL), + hBmpOsb2(NULL), oldbmp2(NULL), + hBmpOsb(NULL), oldbmp(NULL), + hBrushAlternateGrey(NULL), + tmpbkcolour(0), tmpforecolour(0), + fRelease(release_none) {}; + }; + + inline void _PreparePaintContext(ClcData *dat, HDC hdc, int paintMode, RECT& clRect, _PaintContext& pc); + inline void _DrawBackground(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint, RECT& clRect, _PaintContext& pc); + inline void _DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint, RECT& clRect, _PaintContext& pc); + inline void _DrawInsertionMark(ClcData *dat, RECT& clRect, _PaintContext& pc); + inline void _CopyPaintToDest(HDC hdc, int paintMode, RECT* rcPaint, _PaintContext& pc); + inline void _FreePaintContext(_PaintContext& pc); +}; + + +#endif // modern_clcpaint_h__ diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 9d16e85de7..8949cc7457 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -22,10 +22,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clc.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_defsettings.h" +#include "stdafx.h" +#include "modern_clc.h" +#include "modern_commonprototypes.h" +#include "modern_defsettings.h" //loads of stuff that didn't really fit anywhere else diff --git a/plugins/Clist_modern/src/modern_clist.h b/plugins/Clist_modern/src/modern_clist.h new file mode 100644 index 0000000000..13bf41d6ad --- /dev/null +++ b/plugins/Clist_modern/src/modern_clist.h @@ -0,0 +1,141 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#pragma once + +#ifndef _CLIST_H_ +#define _CLIST_H_ + +void LoadContactTree(void); +HTREEITEM GetTreeItemByHContact(MCONTACT hContact); +void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add); +int GetContactInfosForSort(MCONTACT hContact, char **Proto, TCHAR **Name, int *Status); + +/////////////////////////////////////////////////////////////////////////////// + +class CSmileyString +{ +public: + SortedList* plText; + int iMaxSmileyHeight; + + CSmileyString() : plText(NULL), iMaxSmileyHeight(0) {}; + CSmileyString(const CSmileyString& ssIn) + { + _CopySmileyList(ssIn.plText); + iMaxSmileyHeight = ssIn.iMaxSmileyHeight; + } + + CSmileyString& operator= (const CSmileyString& ssIn) + { + DestroySmileyList(); + _CopySmileyList(ssIn.plText); + iMaxSmileyHeight = ssIn.iMaxSmileyHeight; + return *this; + } + + ~CSmileyString() + { + DestroySmileyList(); + } + + void ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, TCHAR *szText, BOOL replace_smileys); + + /** Destroy smiley list */ + void DestroySmileyList(); + /** Copy Smiley List */ + void _CopySmileyList(SortedList *plInput); + void AddListeningToIcon(SHORTDATA *dat, TCHAR *szText); + +}; + +/////////////////////////////////////////////////////////////////////////////// + +struct ClcCacheEntry : public ClcCacheEntryBase +{ + int m_cache_nNoHiddenOffline; + + int m_cache_nStatus; + char* m_cache_cszProto; + bool m_bProtoNotExists, m_bIsSub; + bool isUnknown; + + int ApparentMode; + int NotOnList; + int IdleTS; + void* ClcContact; + int IsExpanded; + + TCHAR* szSecondLineText; + CSmileyString ssSecondLine; + + TCHAR* szThirdLineText; + CSmileyString ssThirdLine; + + HANDLE hTimeZone; + DWORD dwLastMsgTime; + + void getName(void); + void freeName(void); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#define CLVM_FILTER_PROTOS 1 +#define CLVM_FILTER_GROUPS 2 +#define CLVM_FILTER_STATUS 4 +#define CLVM_FILTER_VARIABLES 8 +#define CLVM_STICKY_CONTACTS 16 +#define CLVM_FILTER_STICKYSTATUS 32 +#define CLVM_FILTER_LASTMSG 64 +#define CLVM_FILTER_LASTMSG_OLDERTHAN 128 +#define CLVM_FILTER_LASTMSG_NEWERTHAN 256 + +#define CLVM_PROTOGROUP_OP 1 +#define CLVM_GROUPSTATUS_OP 2 +#define CLVM_AUTOCLEAR 4 +#define CLVM_INCLUDED_UNGROUPED 8 +#define CLVM_USELASTMSG 16 + +#define CLVM_USEGROUPS 32 +#define CLVM_DONOTUSEGROUPS 64 + +//changes the 'use groups' flag and call CLUI v0.8.0.16+ +//wParam=newValue +//lParam=0 +//returns 0 on success, nonzero on failure +//newValue is 0 to not use gruops, 1 to use groups +//or -1 to toggle the value +#define MS_CLIST_SETUSEGROUPS "CList/SetUseGroups" + + +#if defined(_UNICODE) +#define CLVM_MODULE "CLVM_W" +#else +#define CLVM_MODULE "CLVM" +#endif + +#define GROUPF_SHOWOFFLINE 0x40 + +#endif diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index db9139c4b6..3793e806ca 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -22,11 +22,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include "m_clui.h" -#include "hdr/modern_clist.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_clcpaint.h" +#include "modern_clist.h" +#include "modern_commonprototypes.h" +#include "modern_clcpaint.h" /**************************************************/ /* Notify Event Area Frame implementation */ @@ -106,7 +106,7 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) if (p->cle.hContact != 0 && p->cle.hDbEvent != 1 && !(p->cle.flags & CLEF_ONLYAFEW)) { MENUITEMINFO mii = { 0 }; - mii.cbSize = sizeof(mii); + mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA | MIIM_BITMAP | MIIM_ID; if (p->cle.pszService && (!strncmp("SRMsg/ReadMessage", p->cle.pszService, _countof("SRMsg/ReadMessage")) || diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index 068a34b237..6d362e128c 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -22,11 +22,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clist.h" +#include "stdafx.h" +#include "modern_clist.h" #include "m_genmenu.h" #include "m_clui.h" -#include "hdr/modern_commonprototypes.h" +#include "modern_commonprototypes.h" int LoadFavoriteContactMenu(); int UnloadFavoriteContactMenu(); diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index f4489c499d..e0b3a257be 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -22,19 +22,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clist.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_gettextasync.h" -#include "hdr/modern_sync.h" -#include "hdr/modern_clui.h" +#include "stdafx.h" +#include "modern_clist.h" +#include "modern_commonprototypes.h" +#include "modern_gettextasync.h" +#include "modern_sync.h" +#include "modern_clui.h" #include int OnLoadLangpack(WPARAM, LPARAM); int CListMod_HideWindow(); -void GroupMenus_Init(void); int AddMainMenuItem(WPARAM wParam, LPARAM lParam); int AddContactMenuItem(WPARAM wParam, LPARAM lParam); void UninitCListEvents(void); diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index 4173bb0751..f936d8f743 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -22,10 +22,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include "m_clui.h" -#include "hdr/modern_clist.h" -#include "hdr/modern_commonprototypes.h" +#include "modern_clist.h" +#include "modern_commonprototypes.h" static INT_PTR CALLBACK DlgProcItemRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 466948d15f..28c36ab379 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -22,11 +22,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clist.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_awaymsg.h" -#include "hdr/modern_gettextasync.h" +#include "stdafx.h" +#include "modern_clist.h" +#include "modern_commonprototypes.h" +#include "modern_awaymsg.h" +#include "modern_gettextasync.h" void InsertContactIntoTree(MCONTACT hContact, int status); void CListSettings_FreeCacheItemDataOption(ClcCacheEntry *pDst, DWORD flag); diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 583dec0ed8..234ec01839 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -22,11 +22,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include -#include "hdr/modern_clist.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_statusbar.h" +#include "modern_clist.h" +#include "modern_commonprototypes.h" +#include "modern_statusbar.h" #include int g_mutex_bOnTrayRightClick = 0; diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index d3711780ac..9a73b66c63 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -22,16 +22,16 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include "m_skinbutton.h" -#include "hdr/modern_skinengine.h" -#include "hdr/modern_statusbar.h" +#include "modern_skinengine.h" +#include "modern_statusbar.h" -#include "hdr/modern_static_clui.h" +#include "modern_static_clui.h" #include -#include "hdr/modern_clcpaint.h" -#include "hdr/modern_sync.h" +#include "modern_clcpaint.h" +#include "modern_sync.h" struct PROTOTICKS { @@ -147,7 +147,7 @@ OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + }; //////////////// CLUI CLASS IMPLEMENTATION // /////////////////////////////// -#include "hdr/modern_clui.h" +#include "modern_clui.h" CLUI* CLUI::m_pCLUI = NULL; BOOL CLUI::m_fMainMenuInited = FALSE; @@ -2430,7 +2430,7 @@ LRESULT CLUI::OnContextMenu(UINT, WPARAM, LPARAM lParam) } } if (PtInRect(&rc, pt)) { - HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDGROUP, 0, 0); + HMENU hMenu = Menu_BuildGroupMenu(); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, m_hWnd, NULL); DestroyTrayMenu(hMenu); } diff --git a/plugins/Clist_modern/src/modern_clui.h b/plugins/Clist_modern/src/modern_clui.h new file mode 100644 index 0000000000..b9301670c2 --- /dev/null +++ b/plugins/Clist_modern/src/modern_clui.h @@ -0,0 +1,184 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef modern_clui_h__ +#define modern_clui_h__ + +#include "windowsX.h" +#define HANDLE_MESSAGE( _message, _fn) \ + case (_message): return This->_fn((_message), (wParam), (lParam)) + +class CLUI +{ +public: + static HWND m_hWnd; + static CLUI * m_pCLUI; + static BOOL m_fMainMenuInited; + +private: + CLUI(); // is protected use InitClui to initialize instead + +public: + ~CLUI(); + + static HRESULT InitClui() { m_pCLUI = new CLUI(); return S_OK; }; + static CLUI * GetClui() { return m_pCLUI; } + static BOOL IsMainMenuInited() { return CLUI::m_fMainMenuInited; } + + CLINTERFACE void cliOnCreateClc(); + + EVENTHOOK(OnEvent_ModulesLoaded); + EVENTHOOK(OnEvent_ContactMenuPreBuild); + EVENTHOOK(OnEvent_FontReload); + + SERVICE(Service_ShowMainMenu); + SERVICE(Service_ShowStatusMenu); + SERVICE(Service_Menu_ShowContactAvatar); + SERVICE(Service_Menu_HideContactAvatar); + + static LRESULT CALLBACK cli_ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + CLUI * This = m_pCLUI; + if (!m_hWnd) m_hWnd = hwnd; + + BOOL bHandled = FALSE; + LRESULT lRes = This->PreProcessWndProc(msg, wParam, lParam, bHandled); + if (bHandled) return lRes; + + switch (msg) + { + HANDLE_MESSAGE(WM_NCCREATE, OnNcCreate); + HANDLE_MESSAGE(WM_CREATE, OnCreate); + HANDLE_MESSAGE(UM_CREATECLC, OnCreateClc); + HANDLE_MESSAGE(UM_SETALLEXTRAICONS, OnSetAllExtraIcons); + HANDLE_MESSAGE(WM_INITMENU, OnInitMenu); + HANDLE_MESSAGE(WM_SIZE, OnSizingMoving); + HANDLE_MESSAGE(WM_SIZING, OnSizingMoving); + HANDLE_MESSAGE(WM_MOVE, OnSizingMoving); + HANDLE_MESSAGE(WM_EXITSIZEMOVE, OnSizingMoving); + HANDLE_MESSAGE(WM_WINDOWPOSCHANGING, OnSizingMoving); + HANDLE_MESSAGE(WM_DISPLAYCHANGE, OnSizingMoving); + HANDLE_MESSAGE(WM_THEMECHANGED, OnThemeChanged); + HANDLE_MESSAGE(WM_DWMCOMPOSITIONCHANGED, OnDwmCompositionChanged); + HANDLE_MESSAGE(UM_UPDATE, OnUpdate); + HANDLE_MESSAGE(WM_NCACTIVATE, OnNcPaint); + HANDLE_MESSAGE(WM_PRINT, OnNcPaint); + HANDLE_MESSAGE(WM_NCPAINT, OnNcPaint); + HANDLE_MESSAGE(WM_ERASEBKGND, OnEraseBkgnd); + HANDLE_MESSAGE(WM_PAINT, OnPaint); + HANDLE_MESSAGE(WM_LBUTTONDOWN, OnLButtonDown); + HANDLE_MESSAGE(WM_PARENTNOTIFY, OnParentNotify); + HANDLE_MESSAGE(WM_SETFOCUS, OnSetFocus); + HANDLE_MESSAGE(WM_TIMER, OnTimer); + HANDLE_MESSAGE(WM_ACTIVATE, OnActivate); + HANDLE_MESSAGE(WM_SETCURSOR, OnSetCursor); + HANDLE_MESSAGE(WM_MOUSEACTIVATE, OnMouseActivate); + HANDLE_MESSAGE(WM_NCLBUTTONDOWN, OnNcLButtonDown); + HANDLE_MESSAGE(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClk); + HANDLE_MESSAGE(WM_NCHITTEST, OnNcHitTest); + HANDLE_MESSAGE(WM_SHOWWINDOW, OnShowWindow); + HANDLE_MESSAGE(WM_SYSCOMMAND, OnSysCommand); + HANDLE_MESSAGE(WM_KEYDOWN, OnKeyDown); + HANDLE_MESSAGE(WM_GETMINMAXINFO, OnGetMinMaxInfo); + HANDLE_MESSAGE(WM_MOVING, OnMoving); + HANDLE_MESSAGE(WM_NOTIFY, OnNotify); + HANDLE_MESSAGE(WM_CONTEXTMENU, OnContextMenu); + HANDLE_MESSAGE(WM_MEASUREITEM, OnMeasureItem); + HANDLE_MESSAGE(WM_DRAWITEM, OnDrawItem); + HANDLE_MESSAGE(WM_DESTROY, OnDestroy); + default: + return This->DefCluiWndProc(msg, wParam, lParam); + } + } + + + ////////////////////////////////////////////////////////////////////////// + // METHODS + // +private: + HRESULT CreateCLC(); + HRESULT FillAlphaChannel(HDC hDC, RECT* prcParent); + HRESULT SnappingToEdge(WINDOWPOS * lpWindowPos); + HRESULT LoadDllsRuntime(); + HRESULT RegisterAvatarMenu(); // TODO move to CLC class + HRESULT CreateCluiFrames(); + HRESULT CreateCLCWindow(const HWND parent); + HRESULT CreateUIFrames(); + + LRESULT DefCluiWndProc(UINT msg, WPARAM wParam, LPARAM lParam) + { + return corecli.pfnContactListWndProc(m_hWnd, msg, wParam, lParam); + } + + // MessageMap + LRESULT PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnThemeChanged(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnDwmCompositionChanged(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnUpdate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnInitMenu(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcPaint(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnEraseBkgnd(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcCreate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnPaint(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnCreate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSetAllExtraIcons(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnCreateClc(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnLButtonDown(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnParentNotify(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSetFocus(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnStatusBarUpdateTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnAutoAlphaTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSmoothAlphaTransitionTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnDelayedSizingTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnBringOutTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnBringInTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnUpdateBringTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnActivate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSetCursor(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnMouseActivate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcLButtonDown(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcLButtonDblClk(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcHitTest(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnShowWindow(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSysCommand(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnKeyDown(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnGetMinMaxInfo(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnMoving(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNotify(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnListSizeChangeNotify(NMCLISTCONTROL *pnmc); + LRESULT OnClickNotify(NMCLISTCONTROL *pnmc); + LRESULT OnContextMenu(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnMeasureItem(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnDrawItem(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnDestroy(UINT msg, WPARAM wParam, LPARAM lParam); + +protected: + HMODULE m_hDwmapiDll; + + enum { SNAPTOEDGESENSIVITY = 30 }; +}; + +#endif // modern_clui_h__ \ No newline at end of file diff --git a/plugins/Clist_modern/src/modern_cluiservices.cpp b/plugins/Clist_modern/src/modern_cluiservices.cpp index 7a18e7d9e9..037b32f52f 100644 --- a/plugins/Clist_modern/src/modern_cluiservices.cpp +++ b/plugins/Clist_modern/src/modern_cluiservices.cpp @@ -22,8 +22,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_commonprototypes.h" +#include "stdafx.h" +#include "modern_commonprototypes.h" INT_PTR CListTray_GetGlobalStatus(WPARAM wparam, LPARAM lparam); diff --git a/plugins/Clist_modern/src/modern_commonheaders.cpp b/plugins/Clist_modern/src/modern_commonheaders.cpp deleted file mode 100644 index d2c889fa24..0000000000 --- a/plugins/Clist_modern/src/modern_commonheaders.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#define DB_USEHELPERFUNCTIONS -#include "hdr/modern_commonheaders.h" diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h new file mode 100644 index 0000000000..26e2e56bff --- /dev/null +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -0,0 +1,322 @@ +#pragma once + +#ifndef _COMMONPROTOTYPES +#define _COMMONPROTOTYPES + +#ifndef commonheaders_h__ +#error "stdafx.h have to be including first" +#endif + +#include "stdafx.h" //TO DO: Move contents of this file to commonheaders.h +#include "modern_clist.h" +#include "cluiframes.h" +#include "modern_row.h" +#include "modern_skinengine.h" +#include "modern_skinselector.h" +#include "modern_statusbar.h" + +#define SKIN "ModernSkin" + +extern PLUGININFOEX pluginInfo; +extern CLIST_INTERFACE * pcli; +extern CLIST_INTERFACE corecli; + +//Global variables +extern int ON_SETALLEXTRAICON_CYCLE; +extern FRAMEWND *g_pfwFrames; +extern int g_nFramesCount; +extern RECT g_rcEdgeSizingRect; +extern FRAMEWND *wndFrameEventArea; +extern ROWCELL * gl_RowTabAccess[]; +extern ROWCELL * gl_RowRoot; +extern HIMAGELIST hAvatarOverlays; +extern int g_nTitleBarHeight; +extern BOOL g_bTransparentFlag; +extern HIMAGELIST g_himlCListClc; +extern BOOL g_mutex_bSizing; +extern BOOL LOCK_RECALC_SCROLLBAR; +extern HIMAGELIST g_himlCListClc; +extern BYTE nameOrder[]; +extern SortedList lContactsCache; +extern BOOL g_flag_bOnModulesLoadedCalled; +extern SKINOBJECTSLIST g_SkinObjectList; +extern CURRWNDIMAGEDATA * g_pCachedWindow; +extern BOOL g_mutex_bLockUpdating; +extern STATUSBARDATA g_StatusBarData; +extern SKINOBJECTSLIST g_SkinObjectList; +extern CURRWNDIMAGEDATA * g_pCachedWindow; +extern char * g_szConnectingProto; +extern BOOL g_mutex_bLockUpdating; +extern int g_mutex_nCalcRowHeightLock; +extern int g_mutex_bOnTrayRightClick; +extern BOOL g_flag_bPostWasCanceled; +extern BOOL g_flag_bFullRepaint; +extern BOOL g_bMultiConnectionMode; +extern BYTE g_bCalledFromShowHide; +extern HICON g_hListeningToIcon; +extern HWND g_hCLUIOptionsWnd; +extern BOOL g_bTransparentFlag; +extern HINSTANCE g_hInst, g_hMirApp; +extern BOOL g_mutex_bChangingMode; +extern UINT g_dwMainThreadID; +extern HANDLE g_hAwayMsgThread, g_hGetTextAsyncThread, g_hSmoothAnimationThread; +extern HWND g_hwndViewModeFrame; +extern BYTE gl_TrimText; + +/************************************************************************/ +/* TYPE DEFS */ +/************************************************************************/ + +typedef INT_PTR(*PSYNCCALLBACKPROC)(WPARAM, LPARAM); + +/************************************************************************/ +/* PROTOTYPES */ +/************************************************************************/ + + +/* CLCItems */ +BOOL CLCItems_IsShowOfflineGroup(ClcGroup* group); + +/* CListMod */ +int CListMod_HideWindow(); + +/* CLUI */ +HANDLE RegisterIcolibIconHandle(char * szIcoID, char *szSectionName, char * szDescription, TCHAR * tszDefaultFile, int iDefaultIndex, HINSTANCE hDefaultModule, int iDefaultResource); +void CLUI_UpdateAeroGlass(); +void CLUI_ChangeWindowMode(); +BOOL CLUI_CheckOwnedByClui(HWND hwnd); +INT_PTR CLUI_GetConnectingIconService(WPARAM wParam, LPARAM lParam); +int CLUI_HideBehindEdge(); +int CLUI_IconsChanged(WPARAM, LPARAM); +int CLUI_IsInMainWindow(HWND hwnd); +int CLUI_OnSkinLoad(WPARAM wParam, LPARAM lParam); +int CLUI_ReloadCLUIOptions(); +int CLUI_ShowFromBehindEdge(); +int CLUI_SizingGetWindowRect(HWND hwnd, RECT *rc); +int CLUI_SizingOnBorder(POINT, int); +int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam); +int CLUI_TestCursorOnBorders(); +int CLUI_UpdateTimer(); +void CLUI_UpdateLayeredMode(); +UINT_PTR CLUI_SafeSetTimer(HWND hwnd, int ID, int Timeout, TIMERPROC proc); + +/* CLUIServices */ +int CLUIUnreadEmailCountChanged(WPARAM wParam, LPARAM lParam); + +/* GDIPlus */ +BOOL GDIPlus_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, BLENDFUNCTION * blendFunction); +HBITMAP GDIPlus_LoadGlyphImage(const TCHAR *szFileName); + +/* EventArea */ +void EventArea_ConfigureEventArea(); + +/* ModernSkinButton */ +int ModernSkinButton_AddButton(HWND parent, char * ID, char * CommandService, char * StateDefService, char * HandeService, int Left, int Top, int Right, int Bottom, DWORD AlignedTo, TCHAR * Hint, char * DBkey, char * TypeDef, int MinWidth, int MinHeight); +int ModernSkinButtonLoadModule(); +int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *r); +int ModernSkinButtonUnloadModule(WPARAM, LPARAM); + +/* RowHeight */ +int RowHeight_CalcRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, int item); + +/* SkinEngine */ +BOOL ske_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, BLENDFUNCTION blendFunction); +void ske_ApplyTranslucency(void); +int ske_BltBackImage(HWND destHWND, HDC destDC, RECT *BltClientRect); +HBITMAP ske_CreateDIB32(int cx, int cy); +HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits); +HRGN ske_CreateOpaqueRgn(BYTE Level, bool Opaque); +HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha); +int ske_DrawImageAt(HDC hdc, RECT *rc); +BOOL ske_DrawIconEx(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); +int ske_DrawNonFramedObjects(BOOL Erase, RECT *r); +BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format); +LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char * szName, BYTE objType, SKINOBJECTSLIST* Skin); +HBITMAP ske_GetCurrentWindowImage(); +int ske_GetFullFilename(TCHAR *buf, const TCHAR *file, TCHAR *skinfolder, BOOL madeAbsolute); +int ske_GetSkinFolder(TCHAR *szFileName, char * t2); +BOOL ske_ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle); +HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i); +int ske_JustUpdateWindowImageRect(RECT *rty); +HBITMAP ske_LoadGlyphImage(const TCHAR *szFileName); +HRESULT SkinEngineLoadModule(); +void ske_LoadSkinFromDB(void); +int ske_LoadSkinFromIniFile(TCHAR*, BOOL); +TCHAR* ske_ParseText(TCHAR *stzText); +int ske_PrepareImageButDontUpdateIt(RECT *r); +int ske_ReCreateBackImage(BOOL Erase, RECT *w); +int ske_RedrawCompleteWindow(); +bool ske_ResetTextEffect(HDC); +bool ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor); +INT_PTR ske_Service_DrawGlyph(WPARAM wParam, LPARAM lParam); +BOOL ske_SetRectOpaque(HDC memdc, RECT *fr, BOOL force = FALSE); +BOOL ske_SetRgnOpaque(HDC memdc, HRGN hrgn, BOOL force = FALSE); +BOOL ske_TextOut(HDC hdc, int x, int y, LPCTSTR lpString, int nCount); +int ske_UnloadGlyphImage(HBITMAP hbmp); +int SkinEngineUnloadModule(); +int ske_UpdateWindowImage(); +int ske_UpdateWindowImageRect(RECT *lpRect); +int ske_ValidateFrameImageProc(RECT *r); + +/* CLUIFrames.c PROXIED */ + +int CLUIFrames_ActivateSubContainers(BOOL wParam); +int CLUIFrames_OnClistResize_mod(WPARAM wParam, LPARAM lParam); +int CLUIFrames_OnMoving(HWND, RECT *); +int CLUIFrames_OnShowHide(int mode); +int CLUIFrames_SetLayeredMode(BOOL fLayeredMode, HWND hwnd); +int CLUIFrames_SetParentForContainers(HWND parent); +int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam); + +FRAMEWND * FindFrameByItsHWND(HWND FrameHwnd); //cluiframes.c + +//int callProxied_DrawTitleBar(HDC hdcMem2,RECT *rect,int Frameid); +int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid); + +int FindFrameID(HWND FrameHwnd); +int SetAlpha(BYTE Alpha); + + +/* others TODO: move above */ +int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam); +void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColour, DWORD backgroundBmpUse); +HRESULT BackgroundsLoadModule(); +int BackgroundsUnloadModule(); +INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //RowTemplate.c +BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c +BOOL MatchMask(char *name, char *mask); //mod_skin_selector.c +char* GetContactCachedProtocol(MCONTACT hContact); //clistsettings.c +char* GetParamN(char *string, char *buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces); //mod_skin_selector.c +WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim, BOOL SkipSpaces); +DWORD CompareContacts2_getLMTime(MCONTACT u); //contact.c +DWORD mod_CalcHash(const char * a); //mod_skin_selector.c +HICON cliGetIconFromStatusMode(MCONTACT hContact, const char *szProto, int status); //clistmod.c +HICON GetMainStatusOverlay(int STATUS); //clc.c +int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szStatus, ClcData *dat); //clcitems.c +int BgStatusBarChange(WPARAM wParam, LPARAM lParam); //clcopts.c +int ClcDoProtoAck(MCONTACT wParam, ACKDATA *ack); //clc.c +int ModernSkinButtonDeleteAll(); //modernbutton.c +int GetContactCachedStatus(MCONTACT hContact); //clistsettings.c +int GetContactIconC(ClcCacheEntry *cacheEntry); //clistmod.c +int GetContactIndex(ClcGroup *group, ClcContact *contact); //clcidents.c +int GetStatusForContact(MCONTACT hContact, char *szProto); //clistsettings.c +int InitCustomMenus(void); //clistmenus.c +int LoadMoveToGroup(); //movetogroup.c +int LoadStatusBarData(); //modern_statusbar.c +int MenuModulesLoaded(WPARAM wParam, LPARAM lParam); //clistmenu.c +int MenuModulesShutdown(WPARAM wParam, LPARAM lParam); //clistmenu.c +int MenuProcessCommand(WPARAM wParam, LPARAM lParam); //clistmenu.c +int OnFrameTitleBarBackgroundChange(WPARAM wParam, LPARAM lParam); //cluiframes.c +int QueueAllFramesUpdating(bool); //cluiframes.c +int RecursiveDeleteMenu(HMENU hMenu); //clistmenus.c +int ModernSkinButtonRedrawAll(); //modern_button.c +int RegisterButtonByParce(char * ObjectName, char * Params); //mod_skin_selector.c +int RestoreAllContactData(ClcData *dat); //cache_funcs.c + +int SkinSelector_DeleteMask(MODERNMASK *mm); //mod_skin_selector.c +int StoreAllContactData(ClcData *dat); //cache_func.c +INT_PTR ToggleHideOffline(WPARAM wParam, LPARAM lParam); //contact.c +INT_PTR ToggleGroups(WPARAM wParam, LPARAM lParam); //contact.c +INT_PTR SetUseGroups(WPARAM wParam, LPARAM lParam); //contact.c +INT_PTR ToggleSounds(WPARAM wParam, LPARAM lParam); //contact.c +void ClcOptionsChanged(); //clc.c +void Docking_GetMonitorRectFromWindow(HWND hWnd, RECT *rc); //Docking.c +void DrawAvatarImageWithGDIp(HDC hDestDC, int x, int y, DWORD width, DWORD height, HBITMAP hbmp, int x1, int y1, DWORD width1, DWORD height1, DWORD flag, BYTE alpha); //gdiplus.cpp +void FreeRowCell(); //RowHeight +void InitGdiPlus(); //gdiplus.cpp +void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int SettingType); //clistsettings.c +void ShutdownGdiPlus(); //gdiplus.cpp +void UninitCustomMenus(); //clistmenus.c +void UnloadAvatarOverlayIcon(); //clc.c +void UnLoadContactListModule(); //clistmod.c +void UpdateAllAvatars(ClcData *dat); //cache_func.c + +void ApplyViewMode(const char *Name, bool onlySelector = false); +void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options, unsigned int stickies, unsigned int operators, unsigned int lmdat); + +//cluiframes.c +void gtaRenewText(MCONTACT hContact); +int ExtraImage_ExtraIDToColumnNum(int extra); + +int LoadSkinButtonModule(); +void UninitSkinHotKeys(); +void GetDefaultFontSetting(int i, LOGFONTA *lf, COLORREF *colour); +int CLUI_OnSkinLoad(WPARAM wParam, LPARAM lParam); +HRESULT CluiLoadModule(); +HRESULT PreLoadContactListModule(); +HRESULT ClcLoadModule(); +HRESULT ToolbarLoadModule(); +HRESULT ToolbarButtonLoadModule(); +void ToolbarButtonUnloadModule(); + +// INTERFACES + +void cliCheckCacheItem(ClcCacheEntry *pdnce); +void cliFreeCacheItem(ClcCacheEntry *p); +void cliRebuildEntireList(HWND hwnd, ClcData *dat); +void cliRecalcScrollBar(HWND hwnd, ClcData *dat); +void CLUI_cliOnCreateClc(void); +int cli_AddItemToGroup(ClcGroup *group, int iAboveItem); +int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); +int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly); +int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk); +int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex); +int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact); +int cli_GetContactIcon(MCONTACT hContact); +int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent); +void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline); +void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem); +void cli_FreeContact(ClcContact*); +void cli_FreeGroup(ClcGroup*); +TCHAR* cli_GetGroupCountsText(ClcData *dat, ClcContact *contact); +void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add); +void cli_SetContactCheckboxes(ClcContact*, int); +LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); +struct CListEvent* cliCreateEvent(void); +struct CListEvent* cli_AddEvent(CLISTEVENT *cle); +LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +int cliShowHide(WPARAM wParam, LPARAM lParam); +BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase); +int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2); +int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); +int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam); +void cliCluiProtocolStatusChanged(int status, const char * proto); +void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact); +void cliCheckCacheItem(ClcCacheEntry *pdnce); +void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat); +void CLUI_cli_LoadCluiGlobalOpts(void); +INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam); +BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase); +int cliTrayIconInit(HWND hwnd); +int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount); + +ClcContact* cliCreateClcContact(void); +ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact); +ClcCacheEntry* cliGetCacheEntry(MCONTACT hContact); + +#define WM_DWMCOMPOSITIONCHANGED 0x031E + +#define DWM_BB_ENABLE 0x00000001 +#define DWM_BB_BLURREGION 0x00000002 +#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004 +struct DWM_BLURBEHIND +{ + DWORD dwFlags; + BOOL fEnable; + HRGN hRgnBlur; + BOOL fTransitionOnMaximized; +}; +extern HRESULT(WINAPI *g_proc_DWMEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); + +extern tPaintCallbackProc CLCPaint_PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData); + +/* SkinEngine.c */ + + +BYTE SkinDBGetContactSettingByte(MCONTACT hContact, const char* szSection, const char*szKey, BYTE bDefault); + +extern OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1]; +extern OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1]; + + +#endif diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index bfc6aab7fd..f6c0f299a5 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -22,10 +22,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include "m_clui.h" -#include "hdr/modern_clist.h" -#include "hdr/modern_commonprototypes.h" +#include "modern_clist.h" +#include "modern_commonprototypes.h" struct { diff --git a/plugins/Clist_modern/src/modern_defsettings.h b/plugins/Clist_modern/src/modern_defsettings.h new file mode 100644 index 0000000000..92c9bd2784 --- /dev/null +++ b/plugins/Clist_modern/src/modern_defsettings.h @@ -0,0 +1,241 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +Copyright 2007 Artem Shpynov + +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +///////////////////////////////////////////////////////////////////////// +/// This file contains default settings value predefinitions +////////////////////////////////////////////////////////////////////////// + +#pragma once + +#define SETTING_TOOLWINDOW_DEFAULT 1 //"CList","ToolWindow" +#define SETTING_ONTOP_DEFAULT 0 //"CList","OnTop" +#define SETTING_MIN2TRAY_DEFAULT 1 //"CList","Min2Tray" +#define SETTING_HIDEOFFLINE_DEFAULT 0 //"CList", "HideOffline" +#define SETTING_HIDEEMPTYGROUPS_DEFAULT 0 //"CList","HideEmptyGroups" +#define SETTING_USEGROUPS_DEFAULT 1 //"CList","UseGroups" +#define SETTING_PLACEOFFLINETOROOT_DEFAULT 0 //"CList","PlaceOfflineToRoot" +#define SETTING_DISABLETRAYFLASH_DEFAULT 0 //! "CList","DisableTrayFlash" +#define SETTING_ICONFLASHTIME_DEFAULT 550 //! "CList","IconFlashTime" +#define SETTING_THINBORDER_DEFAULT 0 //! "CList","ThinBorder" +#define SETTING_NOBORDER_DEFAULT 0 //! "CList","NoBorder" +#define SETTING_WINDOWSHADOW_DEFAULT 0 //! "CList","WindowShadow" +#define SETTING_ONDESKTOP_DEFAULT 0 //! "CList","OnDesktop" +#define SETTING_DISABLEWORKINGSET_DEFAULT 1 //! "CList","DisableWorkingSet" +#define SETTING_NOICONBLINF_DEFAULT 0 //! "CList","NoIconBlink" +#define SETTING_ALWAYSVISICON_DEFAULT 0 //! "CList","AlwaysShowAlwaysVisIcon" + +#define SETTING_SHOWMAINMENU_DEFAULT 1 //"CLUI","ShowMainMenu" +#define SETTING_SHOWCAPTION_DEFAULT 1 //"CLUI","ShowCaption" +#define SETTING_CLIENTDRAG_DEFAULT 1 //"CLUI","ClientAreaDrag" +#define SETTING_SHOWSBAR_DEFAULT 1 //! "CLUI","ShowSBar" +#define SETTING_SBARPERPROTO_DEFAULT 0 //! "CLUI","SBarPerProto" +#define SETTING_USECONNECTINGICON_DEFAULT 1 //! "CLUI","UseConnectingIcon" +#define SETTING_SHOWXSTATUS_DEFAULT 6 //! "CLUI","ShowXStatus" +#define SETTING_SHOWUNREADEMAILS_DEFAULT 0 //! "CLUI","ShowUnreadEmails" +#define SETTING_SBARSHOW_DEFAULT 3 //! "CLUI","SBarShow" +#define SETTING_SBARACCOUNTISCUSTOM_DEFAULT 0 //! "CLUI","AccountIsCustom" +#define SETTING_SBARHIDEACCOUNT_DEFAULT 0 //! "CLUI","HideAccount" +#define SETTING_SBARRIGHTCLK_DEFAULT 0 //! "CLUI","SBarRightClk" +#define SETTING_EQUALSECTIONS_DEFAULT 0 //! "CLUI","EqualSections" +#define SETTING_LEFTOFFSET_DEFAULT 0 //! "CLUI","LeftOffset" +#define SETTING_RIGHTOFFSET_DEFAULT 0 //! "CLUI","RightOffset +#define SETTING_TOPOFFSET_DEFAULT 0 //! "CLUI","TopOffset" +#define SETTING_BOTTOMOFFSET_DEFAULT 0 //! "CLUI","BottomOffset +#define SETTING_SPACEBETWEEN_DEFAULT 0 //! "CLUI","SpaceBetween" +#define SETTING_ALIGN_DEFAULT 0 //! "CLUI","Align" +#define SETTING_VALIGN_DEFAULT 1 //! "CLUI","VAlign" +#define SETTING_PADDINGLEFT_DEFAULT 0 //! "CLUI","PaddingLeft_*" +#define SETTING_PADDINGRIGHT_DEFAULT 0 //! "CLUI","PaddingRight_*" +#define SETTING_DRAGTOSCROLL_DEFAULT 0 //! "CLUI","DragToScroll" +#define SETTING_AUTOSIZE_DEFAULT 0 //! "CLUI","AutoSize" +#define SETTING_LOCKSIZE_DEFAULT 0 //! "CLUI","LockSize" +#define SETTING_MINHEIGTH_DEFAULT 0 //! "CLUI","MinHeight" +#define SETTING_MINWIDTH_DEFAULT 18 //! "CLUI","MinWidth" +#define SETTING_MAXSIZEHEIGHT_DEFAULT 75 //! "CLUI","MaxSizeHeight" +#define SETTING_MINSIZEHEIGHT_DEFAULT 10 //! "CLUI","MinSizeHeight" +#define SETTING_AUTOSIZEUPWARD_DEFAULT 0 //! "CLUI","AutoSizeUpward" +#define SETTING_SNAPTOEDGES_DEFAULT 1 //! "CLUI","SnapToEdges" +#define SETTING_DOCKTOSIDES_DEFAULT 1 //! "CLUI","DockToSides", + +#define SETTING_PROTOSPERLINE_DEFAULT 0 //! "CLUI","StatusBarProtosPerLine" +#define SETTING_TEXTEFFECTID_DEFAULT 0xFF //! "StatusBar","TextEffectID" +#define SETTING_TEXTEFFECTCOLOR1_DEFAULT 0 //! "StatusBar","TextEffectColor1" +#define SETTING_TEXTEFFECTCOLOR2_DEFAULT 0 //! "StatusBar","TextEffectColor2" +#define SETTING_SBHILIGHTMODE_DEFAULT 0 //! "StatusBar","HiLightMode" +#define SETTING_HIDETOOLTIPTIME_DEFAULT 5000 //! "CLUIFrames","HideToolTipTime" + +#define SETTING_EXTRA_ICON_EMAIL_DEFAULT 0 //! +#define SETTING_EXTRA_ICON_PROTO_DEFAULT 0 //! +#define SETTING_EXTRA_ICON_SMS_DEFAULT 0 //! +#define SETTING_EXTRA_ICON_ADV1_DEFAULT 1 //! +#define SETTING_EXTRA_ICON_ADV2_DEFAULT 1 //! +#define SETTING_EXTRA_ICON_WEB_DEFAULT 0 //! +#define SETTING_EXTRA_ICON_CLIENT_DEFAULT 1 //! +#define SETTING_EXTRA_ICON_VISMODE_DEFAULT 1 //! +#define SETTING_EXTRA_ICON_ADV3_DEFAULT 1 //! +#define SETTING_EXTRA_ICON_ADV4_DEFAULT 1 //! + +#define SETTING_EXTRACOLUMNSPACE_DEFAULT 18 //! "CLUI","ExtraColumnSpace" + +#define SETTING_HIDEBEHIND_DEFAULT 0 //! "ModernData","HideBehind" //(0-none, 1-leftedge, 2-rightedge) +#define SETTING_BEHINDEDGE_DEFAULT 0 //! "ModernData", "BehindEdge" +#define SETTING_SHOWDELAY_DEFAULT 3 //! "ModernData","ShowDelay" +#define SETTING_HIDEDELAY_DEFAULT 3 //! "ModernData","HideDelay" +#define SETTING_HIDEBEHINDBORDERSIZE_DEFAULT 0 //! "ModernData","HideBehindBorderSize" +#define SETTING_AEROGLASS_DEFAULT 1 //! "ModernData","AeroGlass" + +#define SETTING_ROUNDCORNERS_DEFAULT 0 //! "CLC","RoundCorners" +#define SETTING_GAPFRAMES_DEFAULT 1 //! "CLUIFrames","GapBetweenFrames" +#define SETTING_GAPTITLEBAR_DEFAULT 1 //! "CLUIFrames","GapBetweenTitleBar" +#define SETTING_LEFTCLIENTMARIGN_DEFAULT 0 //! "CLUI","LeftClientMargin" +#define SETTING_RIGHTCLIENTMARIGN_DEFAULT 0 //! "CLUI","RightClientMargin" +#define SETTING_TOPCLIENTMARIGN_DEFAULT 0 //! "CLUI","TopClientMargin" +#define SETTING_BOTTOMCLIENTMARIGN_DEFAULT 0 //! "CLUI","BottomClientMargin" +#define SETTING_KEYCOLOR_DEFAULT RGB(255,0,255) //! "ModernSettings","KeyColor" +#define SETTING_LINEUNDERMENU_DEFAULT 0 //! "CLUI","LineUnderMenu" +#define SETTING_SHOWONSTART_DEFAULT 0 //! "CList","ShowOnStart" + +#define SETTING_INTERNALAWAYMSGREQUEST_DEFAULT 1 //"ModernData","InternalAwayMsgDiscovery" +#define SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT 1 //"ModernData","RemoveAwayMessageForOffline" +#define SETTING_FILTERSEARCH_DEFAULT 0 //"ModernData","FilterSearch" +#define SETTING_METAAVOIDDBLCLICK_DEFAULT 1 //"CLC","MetaDoubleClick" +#define SETTING_METAIGNOREEMPTYEXTRA_DEFAULT 1 //"CLC","MetaIgnoreEmptyExtra" +#define SETTING_METAHIDEEXTRA_DEFAULT 0 //"CLC","MetaHideExtra" +#define SETTING_METAEXPANDING_DEFAULT 1 //"CLC","MetaExpanding" +#define SETTING_USEMETAICON_DEFAULT 1 //"CLC","Meta" +#define SETTING_DRAWOVERLAYEDSTATUS_DEFAULT 3 //todo replace by contstants + + +#define SETTING_SORTBY1_DEFAULT SORTBY_RATE //"CList","SortBy1" +#define SETTING_SORTBY2_DEFAULT SORTBY_NAME //"CList","SortBy2" +#define SETTING_SORTBY3_DEFAULT SORTBY_STATUS //"CList","SortBy3" + +#define SETTING_PLACEOOFLINETOROOT_DEFAULT 0 //"CList","PlaceOfflineToRoot" +#define SETTING_NOOFFLINEBOTTOM_DEFAULT 0 //"CList","NoOfflineBottom" +#define SETTING_HIDEOFFLINEATROOT_DEFAULT 0 //"CLC","HideOfflineRoot" +#define SETTING_HILIGHTMODE_DEFAULT 0 //todo replace by constant //"CLC","HiLightMode" + +#define SETTING_DISABLESKIN_DEFAULT 0 //"ModernData","DisableEngine" +#define SETTING_ENABLELAYERING_DEFAULT 1 //! "ModernData","EnableLayering" +#define SETTING_COMPACTMODE_DEFAULT 0 //"CLC","CompactMode" + +#define SETTING_EVENTAREAMODE_DEFAULT 1 //autohide todo replace by const //"CLUI","EventArea" +#define SETTING_SHOWEVENTAREAFRAME_DEFAULT 1 //"CLUI","ShowEventArea" + +#define SETTING_TRAYOPTION_DEFAULT 15 //show combined icon +#define SETTING_FADEIN_DEFAULT 0 //"CLUI","FadeInOut" + +////////////////////////////////////////////////////////////////////////// +// ROW SETTINGS +#define SETTING_ROWBORDER_DEFAULT 1 //"CList","RowBorder" +#define SETTING_ROW_ADVANCEDLAYOUT_DEFAULT 0 //"ModernData","UseAdvancedRowLayout" +#define SETTING_ROW_ROWBORDER_DEFAULT 1 //"CList","RowBorder" +#define SETTING_VARIABLEROWHEIGHT_DEFAULT 1 //"CList","VariableRowHeight" +#define SETTING_ALIGNLEFTTOLEFT_DEFAULT 0 //"CList","AlignLeftItemsToLeft" +#define SETTING_ALIGNRIGHTORIGHT_DEFAULT 1 //"CList","AlignRightItemsToRight" +#define SETTING_HIDEGROUPSICON_DEFAULT 0 //"CList","HideGroupsIcon" +#define SETTING_ALIGNGROPCAPTION_DEFAULT 0 //left todo replace by const //"CList","AlignGroupCaptions" +#define SETTINS_ROWITEMORDER_DEFAULT {ITEM_AVATAR, ITEM_ICON, ITEM_TEXT, ITEM_EXTRA_ICONS, ITEM_CONTACT_TIME} + +#define SETTINGS_SHOWAVATARS_DEFAULT 1 //"CList","AvatarsShow" +#define SETTINGS_AVATARDRAWBORDER_DEFAULT 0 //"CList","AvatarsDrawBorders" +#define SETTINGS_AVATARBORDERCOLOR_DEFAULT RGB(0,0,0) //"CList","AvatarsBorderColor" +#define SETTINGS_AVATARROUNDCORNERS_DEFAULT 0 //"CList","AvatarsRoundCorners" +#define SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT 0 //"CList","AvatarsUseCustomCornerSize" +#define SETTINGS_AVATARCORNERSIZE_DEFAULT 4 //"CList","AvatarsCustomCornerSize" +#define SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT 0 //"CList","AvatarsIgnoreSizeForRow" +#define SETTINGS_AVATARDRAWOVERLAY_DEFAULT 0 //"CList","AvatarsDrawOverlay" +#define SETTINGS_AVATAROVERLAYTYPE_DEFAULT SETTING_AVATAR_OVERLAY_TYPE_NORMAL +#define SETTING_AVATARHEIGHT_DEFAULT 24 //"CList","AvatarsSize" +#define SETTING_AVATARWIDTH_DEFAULT 24 //"CList","AvatarsWidth" +#define SETTINGS_AVATARINSEPARATE_DEFAULT 0 //"CList","AvatarsInSeparateWnd", + +#define SETTING_HIDEICONONAVATAR_DEFAULT 0 //"CList","IconHideOnAvatar" +#define SETTING_ICONONAVATARPLACE_DEFAULT 0 //"CList","IconDrawOnAvatarSpace" +#define SETTING_ICONIGNORESIZE_DEFAULT 0 //"CList","IconIgnoreSizeForRownHeight" +#define SETTING_SHOWTIME_DEFAULT 0 //"CList","ContactTimeShow" +#define SETTING_SHOWTIMEIFDIFF_DEFAULT 1 //"CList","ContactTimeShowOnlyIfDifferent" + +#define SETTING_TEXT_RTL_DEFAULT 0 //"CList","TextRTL" +#define SETTING_TEXT_RIGHTALIGN_DEFAULT 0 //"CList","TextAlignToRight" +#define SETTING_TEXT_SMILEY_DEFAULT 1 //"CList","TextReplaceSmileys" +#define SETTING_TEXT_RESIZESMILEY_DEFAULT 1 //"CList","TextResizeSmileys" +#define SETTING_TEXT_PROTOSMILEY_DEFAULT 1 //"CList","TextUseProtocolSmileys" +#define SETTING_TEXT_IGNORESIZE_DEFAULT 0 //"CList","TextIgnoreSizeForRownHeight" + +#define SETTING_FIRSTLINE_SMILEYS_DEFAULT 1 //"CList","FirstLineDrawSmileys" +#define SETTING_FIRSTLINE_APPENDNICK_DEFAULT 0 //"CList","FirstLineAppendNick" +#define SETTING_FIRSTLINE_TRIMTEXT_DEFAULT 1 //"CList","TrimText" + +#define SETTING_SECONDLINE_SHOW_DEFAULT 1 //"CList","SecondLineShow" +#define SETTING_SECONDLINE_TOPSPACE_DEFAULT 2 //"CList","SecondLineTopSpace" +#define SETTING_SECONDLINE_SMILEYS_DEFAULT 1 //"CList","SecondLineDrawSmileys" +#define SETTING_SECONDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE //"CList","SecondLineType" +#define SETTING_SECONDLINE_XSTATUS_DEFAULT 1 //"CList","SecondLineXStatusHasPriority" +#define SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT 0 //"CList","SecondLineUseNameAndMessageForXStatus" +#define SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT 1 //"CList","SecondLineShowStatusIfNoAway" +#define SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT 1 //"CList","SecondLineShowListeningIfNoAway" + +#define SETTING_THIRDLINE_SHOW_DEFAULT 0 //"CList","ThirdLineShow" +#define SETTING_THIRDLINE_TOPSPACE_DEFAULT 2 //"CList","ThirdLineTopSpace" +#define SETTING_THIRDLINE_SMILEYS_DEFAULT 0 //"CList","ThirdLineDrawSmileys" +#define SETTING_THIRDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE //"CList","ThirdLineType" +#define SETTING_THIRDLINE_XSTATUS_DEFAULT 1 //"ThirdLineXStatusHasPriority" +#define SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT 0 //"ThirdLineUseNameAndMessageForXStatus" +#define SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT 0 //"CList","ThirdLineShowStatusIfNoAway" +#define SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT 0 //"ThirdLineShowListeningIfNoAway" + +#define SETTING_TRANSPARENT_DEFAULT 0 //"CList","Transparent" +#define SETTING_AUTOALPHA_DEFAULT 150 //"CList","AutoAlpha" +#define SETTING_CONFIRMDELETE_DEFAULT 1 //"CList","ConfirmDelete" +#define SETTING_AUTOHIDE_DEFAULT 0 //"CList","AutoHide" +#define SETTING_HIDETIME_DEFAULT 30 //"CList","HideTime" +#define SETTING_CYCLETIME_DEFAULT 4 //"CList","CycleTime" +#define SETTING_TRAYICON_DEFAULT SETTING_TRAYICON_SINGLE //"CList","TrayIcon" +#define SETTING_ALWAYSSTATUS_DEFAULT 0 //"CList","AlwaysStatus" + +#define SETTING_BLENDINACTIVESTATE_DEFAULT 0 //"CLC","BlendInActiveState" + +#define CLCDEFAULT_MODERN_SELTEXTCOLOUR (g_CluiData.fDisableSkinEngine?GetSysColor(COLOR_HIGHLIGHTTEXT):RGB(0,0,128)) +#define CLCDEFAULT_MODERN_HOTTEXTCOLOUR (g_CluiData.fDisableSkinEngine ? CLCDEFAULT_MODERN_SELTEXTCOLOUR : RGB(0,0,255)) +#define CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR RGB(255,255,0) +#define CLCDEFAULT_NOVSCROLL 0 //"CLC","NoVScrollBar" +#define CLCDEFAULT_INFOTIPTIME 750 //"! "CLC","InfoTipHoverTime" +#define CLCDEFAULT_COLLICONTOLEFT 0 //"! "FrameTitleBar","AlignCOLLIconToLeft" + +#define SKIN_OFFSET_TOP_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Top" +#define SKIN_OFFSET_BOTTOM_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Bottom" +#define SKIN_OFFSET_LEFT_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Left" +#define SKIN_OFFSET_RIGHT_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Right" +#define SKIN_SPACEBEFOREGROUP_DEFAULT 0 //! "ModernSkin","SpaceBeforeGroup" + +#define SETTINGS_BARBTNWIDTH_DEFAULT 22 //"ModernToolBar", "option_Bar0_BtnWidth" +#define SETTINGS_BARBTNHEIGHT_DEFAULT 22 //"ModernToolBar", "option_Bar0_BtnHeight" +#define SETTINGS_BARBTNSPACE_DEFAULT 0 //"ModernToolBar", "option_Bar0_BtnSpace" +#define SETTINGS_BARAUTOSIZE_DEFAULT 1 //"ModernToolBar", "option_Bar0_Autosize" +#define SETTINGS_BARMULTILINE_DEFAULT 1 //"ModernToolBar", "option_Bar0_Multiline" + +#define SETTING_ENABLESOUNDS_DEFAULT 1 // !"Skin", "UseSound", diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp index 837bcfc797..9f7d491565 100644 --- a/plugins/Clist_modern/src/modern_docking.cpp +++ b/plugins/Clist_modern/src/modern_docking.cpp @@ -22,12 +22,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clist.h" +#include "stdafx.h" +#include "modern_clist.h" #include "m_skin_eng.h" #include "m_skinbutton.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_sync.h" +#include "modern_commonprototypes.h" +#include "modern_sync.h" #define WM_DOCKCALLBACK (WM_USER+121) #define WM_CREATEDOCKED (WM_USER+122) diff --git a/plugins/Clist_modern/src/modern_effectenum.h b/plugins/Clist_modern/src/modern_effectenum.h new file mode 100644 index 0000000000..b15c4a1f11 --- /dev/null +++ b/plugins/Clist_modern/src/modern_effectenum.h @@ -0,0 +1,93 @@ +#pragma once + +typedef signed char sbyte; +typedef struct _MODERNEFFECTMATRIX +{ + sbyte matrix[25]; + BYTE topEffect; + BYTE leftEffect; + BYTE rightEffect; + BYTE bottomEffect; + BYTE cycleCount; //low 7 bits +}MODERNEFFECTMATRIX; + +typedef struct _MODERNEFFECT +{ + BYTE EffectID; + MODERNEFFECTMATRIX EffectMatrix; + DWORD EffectColor1; + DWORD EffectColor2; +}MODERNEFFECT; + +#ifdef _EFFECTENUM_FULL_H +TCHAR * ModernEffectNames[] = +#else +TCHAR * _ModernEffectNames[] = +#endif +{ + _T("Shadow at left"), + _T("Shadow at right"), + _T("Outline"), + _T("Outline smooth"), + _T("Smooth bump"), + _T("Contour thin"), + _T("Contour heavy"), +}; + +#ifdef _EFFECTENUM_FULL_H +MODERNEFFECTMATRIX ModernEffectsEnum[] = { + { //Shadow at Left + { 0, 0, 0, 0, 0, + 0, 4, 16, 4, 4, + 0, 16, 64, 32, 16, + 0, 4, 32, 32, 16, + 0, 4, 16, 16, 16 }, 2, 2, 2, 2, 1 }, + { //Shadow at Right + { 0, 0, 0, 0, 0, + 4, 4, 16, 4, 0, + 16, 32, 64, 16, 0, + 16, 32, 32, 4, 0, + 16, 16, 16, 4, 0 }, 2, 2, 2, 2, 1 }, + { //Outline + { 0, 0, 0, 0, 0, + 0, 16, 16, 16, 0, + 0, 16, 32, 16, 0, + 0, 16, 16, 16, 0, + 0, 0, 0, 0, 0 }, 1, 1, 1, 1, 1 }, + + { //Outline smooth + { 4, 4, 4, 4, 4, + 4, 8, 8, 8, 4, + 4, 8, 32, 8, 4, + 4, 8, 8, 8, 4, + 4, 4, 4, 4, 4 }, 2, 2, 2, 2, 1 }, + + { //Smooth bump + { -2, 2, 2, 2, 2, + -2, -16, 16, 16, 2, + -2, -16, 48, 16, 2, + -2, -16, -16, 16, 2, + -2, -2, -2, -2, -2 }, 2, 2, 2, 2, 1 + 0x80 }, + { //Contour thin + { 0, 0, 0, 0, 0, + 0, 48, 64, 48, 0, + 0, 64, 64, 64, 0, + 0, 48, 64, 48, 0, + 0, 0, 0, 0, 0 }, 1, 1, 1, 1, 1 }, + { //Contour heavy + { 8, 16, 16, 16, 8, + 16, 64, 64, 64, 16, + 16, 64, 64, 64, 16, + 16, 64, 64, 64, 16, + 8, 16, 16, 16, 8 }, 2, 2, 2, 2, 1 }, + +}; +#endif +#ifdef _EFFECTENUM_FULL_H +#define MAXPREDEFINEDEFFECTS sizeof(ModernEffectNames)/sizeof(ModernEffectNames[0]) +#else +#define MAXPREDEFINEDEFFECTS sizeof(_ModernEffectNames)/sizeof(_ModernEffectNames[0]) +extern TCHAR * ModernEffectNames[]; +#endif +extern BOOL SkinEngine_ResetTextEffect(HDC); +extern BOOL SkinEngine_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor); \ No newline at end of file diff --git a/plugins/Clist_modern/src/modern_gdiplus.cpp b/plugins/Clist_modern/src/modern_gdiplus.cpp index 1ae96da1ab..e514870b7d 100644 --- a/plugins/Clist_modern/src/modern_gdiplus.cpp +++ b/plugins/Clist_modern/src/modern_gdiplus.cpp @@ -2,13 +2,14 @@ * test for gdi+ */ - -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #undef Translate //otherwise will conflict with gdi plus Translate #include -#include "hdr/modern_global_structure.h" +#include "modern_global_structure.h" + +#pragma comment(lib, "gdiplus.lib") using namespace Gdiplus; diff --git a/plugins/Clist_modern/src/modern_gettextasync.cpp b/plugins/Clist_modern/src/modern_gettextasync.cpp index b9bb6cdb72..43738f5246 100644 --- a/plugins/Clist_modern/src/modern_gettextasync.cpp +++ b/plugins/Clist_modern/src/modern_gettextasync.cpp @@ -30,10 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ////////////////////////////////////////////////////////////////////////// // Module to async parsing of texts -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_gettextasync.h" +#include "stdafx.h" +#include "modern_gettextasync.h" #include "newpluginapi.h" -#include "hdr/modern_sync.h" +#include "modern_sync.h" int CLUI_SyncSetPDNCE(WPARAM wParam, LPARAM lParam); int CLUI_SyncGetShortData(WPARAM wParam, LPARAM lParam); diff --git a/plugins/Clist_modern/src/modern_gettextasync.h b/plugins/Clist_modern/src/modern_gettextasync.h new file mode 100644 index 0000000000..c53039da71 --- /dev/null +++ b/plugins/Clist_modern/src/modern_gettextasync.h @@ -0,0 +1,6 @@ +#pragma once +void InitCacheAsync(); + +void gtaRenewText(MCONTACT hContact); +int gtaAddRequest(ClcData *dat, MCONTACT hContact); +void gtaShutdown(void); diff --git a/plugins/Clist_modern/src/modern_global.cpp b/plugins/Clist_modern/src/modern_global.cpp index af92dae599..46244c0866 100644 --- a/plugins/Clist_modern/src/modern_global.cpp +++ b/plugins/Clist_modern/src/modern_global.cpp @@ -22,7 +22,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" ////////////////////////////////////////////////////////////////////////// // Global variables diff --git a/plugins/Clist_modern/src/modern_global_structure.h b/plugins/Clist_modern/src/modern_global_structure.h new file mode 100644 index 0000000000..f6e94f3cb2 --- /dev/null +++ b/plugins/Clist_modern/src/modern_global_structure.h @@ -0,0 +1,83 @@ +#pragma once + +#ifndef modern_global_structure_h__ +#define modern_global_structure_h__ + +typedef struct tagCLUIDATA +{ + /************************************ + ** Global variables ** + ************************************/ + + // NotifyArea menu + HMENU hMenuNotify; + WORD wNextMenuID; + int iIconNotify; + BOOL bEventAreaEnabled; + BOOL bNotifyActive; + DWORD dwFlags; + int hIconNotify; + MCONTACT hUpdateContact; + + // Contact List View Mode + TCHAR groupFilter[2048]; + char protoFilter[2048]; + char varFilter[2048]; + DWORD lastMsgFilter; + char current_viewmode[256], old_viewmode[256]; + BYTE boldHideOffline; + BYTE bOldUseGroups; + DWORD statusMaskFilter; + DWORD stickyMaskFilter; + DWORD filterFlags; + DWORD bFilterEffective; + DWORD t_now; + + // Modern Global Variables + BOOL fDisableSkinEngine; + BOOL fOnDesktop; + BOOL fSmoothAnimation; + BOOL fLayered; + BOOL fDocked; + BOOL fSortNoOfflineBottom; + BOOL fAutoSize; + BOOL fAeroGlass; + HRGN hAeroGlassRgn; + + BOOL mutexPreventDockMoving; + BOOL mutexOnEdgeSizing; + BOOL mutexPaintLock; + + BYTE bCurrentAlpha; + BYTE bSTATE; + BYTE bBehindEdgeSettings; + BYTE bSortByOrder[3]; + + signed char nBehindEdgeState; + + DWORD dwKeyColor; + + HWND hwndEventFrame; + + int LeftClientMargin; + int RightClientMargin; + int TopClientMargin; + int BottomClientMargin; + + BOOL bInternalAwayMsgDiscovery; + BOOL bRemoveAwayMessageForOffline; + + //hEventHandles + + HANDLE hEventBkgrChanged; + HANDLE hEventPreBuildTrayMenu; + HANDLE hEventStatusBarShowToolTip; + HANDLE hEventStatusBarHideToolTip; + HANDLE hEventSkinServicesCreated; + + int nGapBetweenTitlebar; +} CLUIDATA; + +EXTERN_C CLUIDATA g_CluiData; + +#endif // modern_global_structure_h__ diff --git a/plugins/Clist_modern/src/modern_image_array.cpp b/plugins/Clist_modern/src/modern_image_array.cpp index 9219e60712..f9ceede3a6 100644 --- a/plugins/Clist_modern/src/modern_image_array.cpp +++ b/plugins/Clist_modern/src/modern_image_array.cpp @@ -24,9 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Created by Pescuma */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_image_array.h" -#include "hdr/modern_commonprototypes.h" +#include "stdafx.h" +#include "modern_image_array.h" +#include "modern_commonprototypes.h" + +#pragma comment(lib, "msimg32.lib") static mir_cs cs; diff --git a/plugins/Clist_modern/src/modern_image_array.h b/plugins/Clist_modern/src/modern_image_array.h new file mode 100644 index 0000000000..00056edae0 --- /dev/null +++ b/plugins/Clist_modern/src/modern_image_array.h @@ -0,0 +1,84 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Created by Pescuma +*/ + +#pragma once + +#ifndef __IMAGE_ARRAY_H__ +# define __IMAGE_ARRAY_H__ + +#include + + +struct IMAGE_ARRAY_DATA_NODE +{ + int width; + int height; +}; + +struct IMAGE_ARRAY_DATA +{ + // Configuration + BOOL width_based; + int grow_step; + HDC hdc; + + // Img data + HBITMAP img; + int width; + int height; + void *lpBits; + + // Array + IMAGE_ARRAY_DATA_NODE *nodes; + int nodes_size; + int nodes_allocated_size; +}; + + +// Initialize data +void ImageArray_Initialize(IMAGE_ARRAY_DATA *iad, BOOL width_based, int grow_step); + +// Free data but keep config +void ImageArray_Clear(IMAGE_ARRAY_DATA *iad); + +// Free data +// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return NULL +HBITMAP ImageArray_Free(IMAGE_ARRAY_DATA *iad, BOOL keep_bitmap); + +// Add image to the list (return the index of the image or -1 on error) +// If pos == -1, add to the end of the list +int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos); + +// Change an image in the list (return TRUE on success) +BOOL ImageArray_ChangeImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos); + +// Remove an image +BOOL ImageArray_RemoveImage(IMAGE_ARRAY_DATA *iad, int pos); + +// Draw an image +BOOL ImageArray_DrawImage(IMAGE_ARRAY_DATA *iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha); + +#endif // __IMAGE_ARRAY_H__ diff --git a/plugins/Clist_modern/src/modern_keyboard.cpp b/plugins/Clist_modern/src/modern_keyboard.cpp index 55026ad3ac..1a5af4ee06 100644 --- a/plugins/Clist_modern/src/modern_keyboard.cpp +++ b/plugins/Clist_modern/src/modern_keyboard.cpp @@ -22,7 +22,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include int InitSkinHotKeys(void); diff --git a/plugins/Clist_modern/src/modern_log.cpp b/plugins/Clist_modern/src/modern_log.cpp index 780177c2a1..d051bb359d 100644 --- a/plugins/Clist_modern/src/modern_log.cpp +++ b/plugins/Clist_modern/src/modern_log.cpp @@ -1,4 +1,4 @@ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include #include diff --git a/plugins/Clist_modern/src/modern_log.h b/plugins/Clist_modern/src/modern_log.h new file mode 100644 index 0000000000..b96eaafd65 --- /dev/null +++ b/plugins/Clist_modern/src/modern_log.h @@ -0,0 +1,19 @@ +#pragma once + +#ifndef __LOG_H__ +# define __LOG_H__ + +#ifdef _DEBUG + +void Log(const char *file, int line, const char *fmt, ...); +#define log0(s) Log(__FILE__,__LINE__,s) +#define log1(s,a) Log(__FILE__,__LINE__,s,a) + +#else + +#define log0(s) +#define log1(s,a) + +#endif + +#endif // __LOG_H__ \ No newline at end of file diff --git a/plugins/Clist_modern/src/modern_newrowopts.cpp b/plugins/Clist_modern/src/modern_newrowopts.cpp index d435f7e0e2..7b090b6847 100644 --- a/plugins/Clist_modern/src/modern_newrowopts.cpp +++ b/plugins/Clist_modern/src/modern_newrowopts.cpp @@ -31,8 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /************************************************************************/ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clist.h" +#include "stdafx.h" +#include "modern_clist.h" #define EMPTY_PLACE 255 #define COLUMNS_PLACE 254 diff --git a/plugins/Clist_modern/src/modern_row.cpp b/plugins/Clist_modern/src/modern_row.cpp index 52a530e276..1d1128e8ee 100644 --- a/plugins/Clist_modern/src/modern_row.cpp +++ b/plugins/Clist_modern/src/modern_row.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Created by Anton Senko aka ZORG , tweaked by Artem Shpynov aka FYR */ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" /* #include @@ -37,9 +37,9 @@ Created by Anton Senko aka ZORG , tweaked by Artem Shpynov aka FYR #include #include #include "resource.h" -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" */ -#include "hdr/modern_row.h" +#include "modern_row.h" //Futher declaration void rowCalculateMinSize(ROWCELL* cell); diff --git a/plugins/Clist_modern/src/modern_row.h b/plugins/Clist_modern/src/modern_row.h new file mode 100644 index 0000000000..ad84c94071 --- /dev/null +++ b/plugins/Clist_modern/src/modern_row.h @@ -0,0 +1,87 @@ +#ifndef modern_row_h__ +#define modern_row_h__ + +#pragma once + + +// Types of cells +#define TC_TEXT1 1 +#define TC_TEXT2 2 +#define TC_TEXT3 3 +#define TC_STATUS 4 +#define TC_AVATAR 5 +#define TC_EXTRA 6 +#define TC_EXTRA1 7 +#define TC_EXTRA2 8 +#define TC_EXTRA3 9 +#define TC_EXTRA4 10 +#define TC_EXTRA5 11 +#define TC_EXTRA6 12 +#define TC_EXTRA7 13 +#define TC_EXTRA8 14 +#define TC_EXTRA9 15 +#define TC_TIME 16 +#define TC_SPACE 17 +#define TC_FIXED 18 + + +#define TC_ELEMENTSCOUNT 18 + +// Containers +#define TC_ROOT 50 +#define TC_ROW 51 +#define TC_COL 52 +#define TC_FLOAT 53 + +// Alignes +#define TC_LEFT 0 +#define TC_HCENTER 100 +#define TC_RIGHT 101 + +#define TC_TOP 0 +#define TC_VCENTER 102 +#define TC_BOTTOM 103 + +// Sizes +#define TC_WIDTH 104 +#define TC_HEIGHT 105 + + + +// Ñòðóêòóðà, îïèñûâàþùàÿ êîíòåéíåð ýëåìåíòà êîíòàêòà +// +typedef struct tagRowCell +{ + int cont; // Òèï êîíòåéíåðà - êîíòàêò, ñòîðîêà, ñòîëáåö + int type; // Òèï ýëåìåíòà, ñîäåðæàùåãîñÿ â êîíòåéíåðå, åñëè 0 - ïóñòîé êîíòåéíåð + int halign; // Ãîðèçîíòàëüíîå âûðàâíèâàíèå âíóòðè êîíòåéíåðà + int valign; // Âåðòèêàëüíîå âûðàâíèâàíèå âíóòðè êîíòåéíåðà + + int w; // Øèðèíà ýëåìåíòà êîíòàêòà, äëÿ òåêñòîâûõ ïîëåé èãíîðèðóåòñÿ + int h; // Âûñîòà ýëåìåíòà êîòíàêòà + + BOOL sizing; // Ïàðàìåòð, ïîêàçûâàþùèé íàëè÷èå òåêñòîâûõ ïîëåé â äî÷åðíèõ êîíòåéíåðàõ + BOOL layer; // Ïàðàìåòð, ïîêàçûâàþùèé, ÷òî êîíòåéíåð îáðàçóåò íîâûé ñëîé + + BOOL hasfixed; // Ïàðàìåòð ïîêàçûâàþùèé ÷òî åñòü âëîæåííûå ôèêñèðîâàííûå ýëåìåíòû + BOOL fitwidth; // Ïàðàìåòð óêàçûâàþùèé ÷òî ïîñëåäíèé ýëåìåíò çàïîëíÿåò âñå îñòàâøååñÿ + // Ïðîñòðàíñòâî (ðàññòÿãèâàåò ðîäèòåëÿ.îâåðëåé) + + int fixed_width; + int full_width; + + RECT r; // Ïðÿìîóãîëüíèê äëÿ ðèñîâàíèÿ ýëåìåíòà + struct tagRowCell * next; // Ïîëå ñâÿçè + struct tagRowCell * child; // Ïîëå ñâÿçè ñì. ôàéë îïèñàíèÿ +} +ROWCELL, *pROWCELL; + +// Ñòðóêòóðà äëÿ äîñòóïà ê êîíòåéíåðàì ýëåìåíòà êîíòàêòà âíóòðè äåðåâà îïèâàíèÿ +#ifndef _CPPCODE +int cppCalculateRowHeight(ROWCELL *RowRoot); +void cppCalculateRowItemsPos(ROWCELL *RowRoot, int width); +ROWCELL *cppInitModernRow(ROWCELL ** tabAccess); +void cppDeleteTree(ROWCELL * RowRoot); +#endif + +#endif // modern_row_h__ \ No newline at end of file diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index aa07ffd865..25d1fa1b56 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -24,11 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Created by Pescuma, modified by Artem Shpynov */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_rowheight_funcs.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_row.h" -#include "hdr/modern_clcpaint.h" +#include "stdafx.h" +#include "modern_rowheight_funcs.h" +#include "modern_commonprototypes.h" +#include "modern_row.h" +#include "modern_clcpaint.h" int g_mutex_nCalcRowHeightLock = 0; int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int item); diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.h b/plugins/Clist_modern/src/modern_rowheight_funcs.h new file mode 100644 index 0000000000..439355e405 --- /dev/null +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.h @@ -0,0 +1,70 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Created by Pescuma +*/ + +#pragma once + +#ifndef __ROWHEIGHT_FUNCS_H__ +# define __ROWHEIGHT_FUNCS_H__ + +#include "modern_clc.h" + +#define ROW_SPACE_BEETWEEN_LINES 2 +#define ICON_HEIGHT 16 +#define ICON_WIDTH 16 + + + +BOOL RowHeights_Initialize(ClcData *dat); +void RowHeights_Free(ClcData *dat); +void RowHeights_Clear(ClcData *dat); + +BOOL RowHeights_Alloc(ClcData *dat, int size); + +// Calc and store max row height +int RowHeights_GetMaxRowHeight(ClcData *dat, HWND hwnd); + +// Calc and store row height +int RowHeights_GetRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, int item); + +// Calc and store row height for all itens in the list +void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd); + +// Calc item top Y (using stored data) +int cliGetRowTopY(ClcData *dat, int item); + +// Calc item bottom Y (using stored data) +int cliGetRowBottomY(ClcData *dat, int item); + +// Calc total height of rows (using stored data) +int cliGetRowTotalHeight(ClcData *dat); + +// Return the line that pos_y is at or -1 (using stored data). Y start at 0 +int cliRowHitTest(ClcData *dat, int pos_y); + +// Returns the height of the chosen row +int cliGetRowHeight(ClcData *dat, int item); + +#endif // __ROWHEIGHT_FUNCS_H__ diff --git a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp index fa5ec60d54..23bce5e5a7 100644 --- a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp +++ b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp @@ -22,10 +22,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clist.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_row.h" +#include "stdafx.h" +#include "modern_clist.h" +#include "modern_commonprototypes.h" +#include "modern_row.h" void RefreshTree(HWND hwndDlg, HTREEITEM hti); static char* rowOptTmplStr; diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index 4e78f1c789..6666b7e55f 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -26,9 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. This file contains code related to new modern free positioned skinned buttons */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_skinengine.h" -#include "hdr/modern_clcpaint.h" +#include "stdafx.h" +#include "modern_skinengine.h" +#include "modern_clcpaint.h" #include "m_skinbutton.h" #define MODERNSKINBUTTONCLASS "MirandaModernSkinButtonClass" diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 14c8216866..22b8d32f59 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -23,18 +23,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //Include -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" #include "m_skin_eng.h" -#include "hdr/modern_skinselector.h" -#include "CLUIFrames/cluiframes.h" +#include "modern_skinselector.h" +#include "cluiframes.h" #define _EFFECTENUM_FULL_H -#include "hdr/modern_effectenum.h" +#include "modern_effectenum.h" #undef _EFFECTENUM_FULL_H -#include "hdr/modern_skinengine.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_sync.h" +#include "modern_skinengine.h" +#include "modern_commonprototypes.h" +#include "modern_sync.h" //Implementation diff --git a/plugins/Clist_modern/src/modern_skinengine.h b/plugins/Clist_modern/src/modern_skinengine.h new file mode 100644 index 0000000000..70b7a9b838 --- /dev/null +++ b/plugins/Clist_modern/src/modern_skinengine.h @@ -0,0 +1,124 @@ +#pragma once + +#ifndef ske_H_INC +#define ske_H_INC + +#include "modern_skinselector.h" +#include "modern_commonprototypes.h" + +/* Definitions */ +#define GetAValue(argb)((BYTE)((argb)>>24)) + +#define DEFAULTSKINSECTION "ModernSkin" + + + +#define MAX_BUFF_SIZE 255*400 +#define MAXSN_BUFF_SIZE 255*1000 + +/* External variables */ + +/* Structs */ + +struct SKINOBJECTSLIST +{ + DWORD dwObjLPReserved; + DWORD dwObjLPAlocated; + TCHAR *szSkinPlace; + LISTMODERNMASK *pMaskList; + SKINOBJECTDESCRIPTOR *pObjects; + SortedList *pTextList; +}; + +struct GLYPHIMAGE +{ + TCHAR *szFileName; + DWORD dwLoadedTimes; + HBITMAP hGlyph; + BYTE isSemiTransp; +}; + +typedef GLYPHIMAGE *LPGLYPHIMAGE; + +struct CURRWNDIMAGEDATA +{ + HDC hImageDC; + HDC hBackDC; + HDC hScreenDC; + HBITMAP hImageDIB, hImageOld; + HBITMAP hBackDIB, hBackOld; + BYTE * hImageDIBByte; + BYTE * hBackDIBByte; + int Width, Height; +}; + +struct EFFECTSSTACKITEM +{ + HDC hdc; + BYTE EffectID; + DWORD FirstColor; + DWORD SecondColor; +}; + +class IniParser +{ +public: + enum { + FLAG_WITH_SETTINGS = 0, + FLAG_ONLY_OBJECTS = 1, + }; + + enum { IT_UNKNOWN, IT_FILE, IT_RESOURCE }; + + typedef HRESULT(*ParserCallback_t)(const char * szSection, const char * szKey, const char * szValue, IniParser * This); + + IniParser(TCHAR * szFileName, BYTE flags = FLAG_WITH_SETTINGS); + IniParser(HINSTANCE hInst, const char *resourceName, const char *resourceType, BYTE flags = FLAG_ONLY_OBJECTS); + ~IniParser(); + + bool CheckOK() { return _isValid; } + HRESULT Parse(ParserCallback_t pLineCallBackProc, LPARAM lParam); + + static HRESULT WriteStrToDb(const char * szSection, const char * szKey, const char * szValue, IniParser * This); + static int GetSkinFolder(IN const TCHAR * szFileName, OUT TCHAR * pszFolderName); + +private: + // common + enum { MAX_LINE_LEN = 512 }; + int _eType; + bool _isValid; + char * _szSection; + ParserCallback_t _pLineCallBackProc; + BOOL _SecCheck; + int _nLine; + + void _DoInit(); + BOOL _DoParseLine(char * szLine); + + // Processing File + HRESULT _DoParseFile(); + FILE * _hFile; + + // Processing resource + void _LoadResourceIni(HINSTANCE hInst, const char * resourceName, const char * resourceType); + HRESULT _DoParseResource(); + const char * _RemoveTailings(const char * szLine, size_t& len); + + HGLOBAL _hGlobalRes; + DWORD _dwSizeOfRes; + char * _pPosition; + + BYTE _Flags; + + +}; + + +int ske_UnloadSkin(SKINOBJECTSLIST * Skin); +int ske_AddDescriptorToSkinObjectList(SKINOBJECTDESCRIPTOR *lpDescr, SKINOBJECTSLIST* Skin); +INT_PTR ske_Service_DrawGlyph(WPARAM wParam, LPARAM lParam); + + + +#endif + diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index d55aed2cd7..34ca2187cb 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -22,10 +22,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clist.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_sync.h" +#include "stdafx.h" +#include "modern_clist.h" +#include "modern_commonprototypes.h" +#include "modern_sync.h" /*******************************/ // Main skin selection routine // diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 64c9aad075..a7921a1c4d 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -25,12 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///// structures and services to manage modern skin objects (mask mechanism) //#include "windows.h" -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_skinselector.h" -#include "hdr/modern_skinengine.h" +#include "stdafx.h" +#include "modern_skinselector.h" +#include "modern_skinengine.h" #include "m_skin_eng.h" #include "m_skinbutton.h" -#include "hdr/modern_commonprototypes.h" +#include "modern_commonprototypes.h" /// IMPLEMENTATIONS char* ModernMaskToString(MODERNMASK *mm, char * buf, UINT bufsize) diff --git a/plugins/Clist_modern/src/modern_skinselector.h b/plugins/Clist_modern/src/modern_skinselector.h new file mode 100644 index 0000000000..51805a6ecf --- /dev/null +++ b/plugins/Clist_modern/src/modern_skinselector.h @@ -0,0 +1,87 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#pragma once + +#ifndef M_MOD_SKIN_SELECTOR_H_INC +#define M_MOD_SKIN_SELECTOR_H_INC + +#include "newpluginapi.h" +#include "stdafx.h" + +#define MAXVALUE 20 + +#define MPF_EQUAL 1 +#define MPF_DIFF 2 +#define MPF_NOT_EQUAL ( MPF_DIFF|MPF_EQUAL ) +#define MPF_HASHED 4 + +struct MASKPARAM +{ + DWORD dwId; + BYTE bMaskParamFlag; + char* szName; + DWORD dwValueHash; + char* szValue; +}; + +struct MODERNMASK +{ + MASKPARAM* pl_Params; + DWORD dwParamCnt; + union + { + void* pObject; + char* szObjectName; + }; + DWORD dwMaskId; + BOOL bObjectFound; +}; + +struct LISTMODERNMASK +{ + MODERNMASK* pl_Masks; + DWORD dwMaskCnt; +}; + +/// PROTOTYPES +int AddModernMaskToList(MODERNMASK *mm, LISTMODERNMASK *mmTemplateList); +int AddStrModernMaskToList(DWORD maskID, char *szStr, char *objectName, LISTMODERNMASK *mmTemplateList); +int SortMaskList(LISTMODERNMASK *mmList); + +int DeleteMaskByItID(DWORD mID, LISTMODERNMASK *mmTemplateList); +int ClearMaskList(LISTMODERNMASK *mmTemplateList); +int ExchangeMasksByID(DWORD mID1, DWORD mID2, LISTMODERNMASK *mmTemplateList); + +int ParseToModernMask(MODERNMASK *mm, char *szText); +BOOL CompareModernMask(MODERNMASK *mmValue, MODERNMASK *mmTemplate); +BOOL CompareStrWithModernMask(char * szValue, MODERNMASK *mmTemplate); +MODERNMASK * FindMaskByStr(char * szValue, LISTMODERNMASK * mmTemplateList); +DWORD mod_CalcHash(const char * a); +char * ModernMaskToString(MODERNMASK *mm, char *buf, UINT bufsize); +int RegisterObjectByParce(char * ObjectName, char *Params); +SKINOBJECTDESCRIPTOR* skin_FindObjectByRequest(char *szValue, LISTMODERNMASK *mmTemplateList); +SKINOBJECTDESCRIPTOR* skin_FindObjectByMask(MODERNMASK *mm, LISTMODERNMASK *mmTemplateList); +TCHAR * GetParamNT(char * string, TCHAR * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces); +int SkinDrawGlyphMask(HDC hdc, RECT *rcSize, RECT *rcClip, MODERNMASK *ModernMask); +#endif diff --git a/plugins/Clist_modern/src/modern_static_clui.h b/plugins/Clist_modern/src/modern_static_clui.h new file mode 100644 index 0000000000..8aea29123b --- /dev/null +++ b/plugins/Clist_modern/src/modern_static_clui.h @@ -0,0 +1,124 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/************************************************************************/ +/** FILE CONTAINS HEADER PART FOR .../modernb/clui.c file **/ +/** **/ +/** !!! DO NOT INCLUDE IN TO OTHER FILES !!! **/ +/************************************************************************/ + +/* Definitions */ +#pragma once + +#define TM_AUTOALPHA 1 +#define TM_DELAYEDSIZING 2 +#define TM_BRINGOUTTIMEOUT 3 +#define TM_BRINGINTIMEOUT 4 +#define TM_UPDATEBRINGTIMER 5 +#define TM_SMOTHALPHATRANSITION 20 +#define TM_WINDOWUPDATE 100 +#define TM_STATUSBARUPDATE 200 + +#define MS_CLUI_SHOWMAINMENU "CList/ShowMainMenu" +#define MS_CLUI_SHOWSTATUSMENU "CList/ShowStatusMenu" + +#define AC_SRC_NO_PREMULT_ALPHA 0x01 +#define AC_SRC_NO_ALPHA 0x02 +#define AC_DST_NO_PREMULT_ALPHA 0x10 +#define AC_DST_NO_ALPHA 0x20 + +#define ANIMATION_STEP 40 + +#define AEROGLASS_MINALPHA 24 + +/* Declaration of prototypes in other modules */ + +int ClcUnloadModule(); +int ClcGetShortData(ClcData* pData, SHORTDATA *pShortData); +int ClcEnterDragToScroll(HWND hwnd, int Y); + +int CListMod_ContactListShutdownProc(WPARAM wParam, LPARAM lParam); +int CListMod_HideWindow(HWND hwndContactList, int mode); + +int CListSettings_GetCopyFromCache(ClcCacheEntry *pDest, DWORD flag); +int CListSettings_SetToCache(ClcCacheEntry *pSrc, DWORD flag); + +int CLUIServices_LoadModule(void); +INT_PTR CLUIServices_SortList(WPARAM wParam, LPARAM lParam); + +void Docking_GetMonitorRectFromWindow(HWND hWnd, RECT *rc); + +int EventArea_Create(HWND hCluiWnd); + +int ExtraImage_ExtraIDToColumnNum(int extra); + +void GroupMenus_Init(); + +int ModernSkinButtonLoadModule(); +int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *r); + +void ske_ApplyTranslucency(); +HBITMAP ske_CreateDIB32(int cx, int cy); +HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits); +int ske_JustUpdateWindowImage(); +void ske_LoadSkinFromDB(void); +int ske_RedrawCompleteWindow(); +int ske_UpdateWindowImage(); +int ske_ValidateFrameImageProc(RECT *r); + +HWND StatusBar_Create(HWND parent); + +void RowHeight_InitModernRow(); + +int UnhookAll(); + +/* Module function prototypes */ + +int CLUI_IsInMainWindow(HWND hwnd); +int CLUI_SizingOnBorder(POINT pt, int size); +int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam); +int CLUI_TestCursorOnBorders(); + +static int CLUI_SmoothAlphaThreadTransition(); + +/* structs */ + +struct CHECKFILLING +{ + HDC hDC; + RECT rcRect; +}; + +int CheckFramesPos(RECT *wr); //cluiframes.c +int CLUIFrames_ApplyNewSizes(int mode); //cluiframes.c +int CLUIFrames_GetTotalHeight(); //cluiframes.c +int CLUIFrames_RepaintSubContainers(); //cluiframes.c +int CLUIFramesGetMinHeight(); //cluiframes.c + +int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode); //cluiframes.c + +int InitSkinHotKeys(); +BOOL amWakeThread(); +BOOL gtaWakeThread(); +void CreateViewModeFrame(); diff --git a/plugins/Clist_modern/src/modern_static_cluiframes_service.h b/plugins/Clist_modern/src/modern_static_cluiframes_service.h new file mode 100644 index 0000000000..7a4ce4007a --- /dev/null +++ b/plugins/Clist_modern/src/modern_static_cluiframes_service.h @@ -0,0 +1,235 @@ +////////////////////////////////////////////////////////////////////////// +// WARNING +////////////////////////////////////////////////////////////////////////// +// TO BE INCLUDED ONLY TO modern_cluiframes.cpp +////////////////////////////////////////////////////////////////////////// + +static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam); +static int _us_DoAddFrame(WPARAM wParam, LPARAM lParam); +static int _us_DoRemoveFrame(WPARAM wParam, LPARAM lParam); +static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam); +static INT_PTR _us_DoGetFrameOptions(WPARAM wParam, LPARAM lParam); +static int _us_DoUpdateFrame(WPARAM wParam, LPARAM lParam); +static int _us_DoShowHideFrameTitle(WPARAM wParam, LPARAM lParam); +static int _us_DoShowTitles(WPARAM wParam, LPARAM lParam); +static int _us_DoHideTitles(WPARAM wParam, LPARAM lParam); +static int _us_DoShowHideFrame(WPARAM wParam, LPARAM lParam); +static int _us_DoShowAllFrames(WPARAM wParam, LPARAM lParam); +static int _us_DoLockFrame(WPARAM wParam, LPARAM lParam); +static int _us_DoCollapseFrame(WPARAM wParam, LPARAM lParam); +static int _us_DoSetFrameBorder(WPARAM wParam, LPARAM lParam); +static int _us_DoSetFrameAlign(WPARAM wParam, LPARAM lParam); +static int _us_DoMoveFrame(WPARAM wParam, LPARAM lParam); +static int _us_DoMoveFrameUp(WPARAM wParam, LPARAM lParam); +static int _us_DoMoveFrameDown(WPARAM wParam, LPARAM lParam); +static int _us_DoAlignFrameTop(WPARAM wParam, LPARAM lParam); +static int _us_DoAlignFrameClient(WPARAM wParam, LPARAM lParam); +static int _us_DoAlignFrameBottom(WPARAM wParam, LPARAM lParam); +static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam); + +enum { + CFM_FIRST_MGS = WM_USER + 0x2FF, + + CFM_SETFRAMEPAINTPROC, + CFM_ADDFRAME, + CFM_REMOVEFRAME, + CFM_SETFRAMEOPTIONS, + CFM_GETFRAMEOPTIONS, + CFM_UPDATEFRAME, + CFM_SHOWHIDEFRAMETITLE, + CFM_SHOWTITLES, + CFM_HIDETITLES, + CFM_SHOWHIDEFRAME, + CFM_SHOWALL, + CFM_LOCKFRAME, + CFM_COLLAPSEFRAME, + CFM_SETFRAMEBORDER, + CFM_SETFRAMEALIGN, + CFM_MOVEFRAME, + CFM_MOVEFRAMEUP, + CFM_MOVEFRAMEDOWN, + CFM_ALIGNFRAMETOP, + CFM_ALIGNFRAMEBOTTOM, + CFM_ALIGNFRAMECLIENT, + CFM_SETFRAMEFLOAT, + + CFM_LAST_MSG +}; + +#define CLM_PROCESS( msg, proc ) case msg: result = proc( wParam, lParam); break; + +BOOL CALLBACK ProcessCLUIFrameInternalMsg(HWND, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& result) +{ + if (msg <= CFM_FIRST_MGS || msg >= CFM_LAST_MSG) + return FALSE; + + switch (msg) { + CLM_PROCESS(CFM_SETFRAMEPAINTPROC, _us_DoSetFramePaintProc); + CLM_PROCESS(CFM_ADDFRAME, _us_DoAddFrame); + CLM_PROCESS(CFM_REMOVEFRAME, _us_DoRemoveFrame); + CLM_PROCESS(CFM_SETFRAMEOPTIONS, _us_DoSetFrameOptions); + CLM_PROCESS(CFM_GETFRAMEOPTIONS, _us_DoGetFrameOptions); + CLM_PROCESS(CFM_UPDATEFRAME, _us_DoUpdateFrame); + CLM_PROCESS(CFM_SHOWHIDEFRAMETITLE, _us_DoShowHideFrameTitle); + CLM_PROCESS(CFM_SHOWTITLES, _us_DoShowTitles); + CLM_PROCESS(CFM_HIDETITLES, _us_DoHideTitles); + CLM_PROCESS(CFM_SHOWHIDEFRAME, _us_DoShowHideFrame); + CLM_PROCESS(CFM_SHOWALL, _us_DoShowAllFrames); + CLM_PROCESS(CFM_LOCKFRAME, _us_DoLockFrame); + CLM_PROCESS(CFM_COLLAPSEFRAME, _us_DoCollapseFrame); + CLM_PROCESS(CFM_SETFRAMEBORDER, _us_DoSetFrameBorder); + CLM_PROCESS(CFM_SETFRAMEALIGN, _us_DoSetFrameAlign); + CLM_PROCESS(CFM_MOVEFRAME, _us_DoMoveFrame); + CLM_PROCESS(CFM_MOVEFRAMEUP, _us_DoMoveFrameUp); + CLM_PROCESS(CFM_MOVEFRAMEDOWN, _us_DoMoveFrameDown); + CLM_PROCESS(CFM_ALIGNFRAMETOP, _us_DoAlignFrameTop); + CLM_PROCESS(CFM_ALIGNFRAMEBOTTOM, _us_DoAlignFrameClient); + CLM_PROCESS(CFM_ALIGNFRAMECLIENT, _us_DoAlignFrameBottom); + CLM_PROCESS(CFM_SETFRAMEFLOAT, _us_DoSetFrameFloat); + default: + return FALSE; // Not Handled + } + return TRUE; +} + +static INT_PTR CLUIFrames_SetFramePaintProc(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEPAINTPROC, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_AddFrame(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_ADDFRAME, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_RemoveFrame(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_REMOVEFRAME, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_SetFrameOptions(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEOPTIONS, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_GetFrameOptions(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_GETFRAMEOPTIONS, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_UpdateFrame(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_UPDATEFRAME, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_ShowHideFrameTitle(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SHOWHIDEFRAMETITLE, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_ShowTitles(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SHOWTITLES, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_HideTitles(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_HIDETITLES, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_ShowHideFrame(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SHOWHIDEFRAME, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_ShowAllFrames(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SHOWALL, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_LockFrame(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_LOCKFRAME, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_CollapseFrame(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_COLLAPSEFRAME, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_SetFrameBorder(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEBORDER, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_SetFrameAlign(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEALIGN, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_MoveFrame(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_MOVEFRAME, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_MoveFrameUp(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_MOVEFRAMEUP, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_MoveFrameDown(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_MOVEFRAMEDOWN, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_AlignFrameTop(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_ALIGNFRAMETOP, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_AlignFrameClient(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_ALIGNFRAMEBOTTOM, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_AlignFrameBottom(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_ALIGNFRAMECLIENT, wParam, lParam) : 0; +} + +static INT_PTR CLUIFrames_SetFrameFloat(WPARAM wParam, LPARAM lParam) +{ + return (pcli->hwndContactList) ? SendMessage(pcli->hwndContactList, CFM_SETFRAMEFLOAT, wParam, lParam) : 0; +} + +static void CreateCluiFramesServices() +{ + CreateServiceFunction(MS_SKINENG_REGISTERPAINTSUB, CLUIFrames_SetFramePaintProc); + CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME, CLUIFrames_AddFrame); + CreateServiceFunction(MS_CLIST_FRAMES_REMOVEFRAME, CLUIFrames_RemoveFrame); + + CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS, CLUIFrames_SetFrameOptions); + CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS, CLUIFrames_GetFrameOptions); + CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME, CLUIFrames_UpdateFrame); + + CreateServiceFunction(MS_CLIST_FRAMES_SHFRAMETITLEBAR, CLUIFrames_ShowHideFrameTitle); + CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMESTB, CLUIFrames_ShowTitles); + CreateServiceFunction(MS_CLIST_FRAMES_HIDEALLFRAMESTB, CLUIFrames_HideTitles); + CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME, CLUIFrames_ShowHideFrame); + CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES, CLUIFrames_ShowAllFrames); + + CreateServiceFunction(MS_CLIST_FRAMES_ULFRAME, CLUIFrames_LockFrame); + CreateServiceFunction(MS_CLIST_FRAMES_UCOLLFRAME, CLUIFrames_CollapseFrame); + CreateServiceFunction(MS_CLIST_FRAMES_SETUNBORDER, CLUIFrames_SetFrameBorder); + + CreateServiceFunction(CLUIFRAMESSETALIGN, CLUIFrames_SetFrameAlign); + CreateServiceFunction(CLUIFRAMESMOVEUPDOWN, CLUIFrames_MoveFrame); + CreateServiceFunction(CLUIFRAMESMOVEUP, CLUIFrames_MoveFrameUp); + CreateServiceFunction(CLUIFRAMESMOVEDOWN, CLUIFrames_MoveFrameDown); + + CreateServiceFunction(CLUIFRAMESSETALIGNALTOP, CLUIFrames_AlignFrameTop); + CreateServiceFunction(CLUIFRAMESSETALIGNALCLIENT, CLUIFrames_AlignFrameClient); + CreateServiceFunction(CLUIFRAMESSETALIGNALBOTTOM, CLUIFrames_AlignFrameBottom); + + CreateServiceFunction(CLUIFRAMESSETFLOATING, CLUIFrames_SetFrameFloat); +} diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index e2b429d3a5..793fffc989 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -1,9 +1,9 @@ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_statusbar.h" +#include "stdafx.h" +#include "modern_statusbar.h" #include "m_skin_eng.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_clcpaint.h" -#include "hdr/modern_sync.h" +#include "modern_commonprototypes.h" +#include "modern_clcpaint.h" +#include "modern_sync.h" BOOL tooltipshoing; POINT lastpnt; diff --git a/plugins/Clist_modern/src/modern_statusbar.h b/plugins/Clist_modern/src/modern_statusbar.h new file mode 100644 index 0000000000..2ac385b6d4 --- /dev/null +++ b/plugins/Clist_modern/src/modern_statusbar.h @@ -0,0 +1,44 @@ +#pragma once + +#ifndef modern_statusbar_h__ +#define modern_statusbar_h__ + +#include "modern_commonprototypes.h" +#include "m_xpTheme.h" + +int ModernDrawStatusBar(HWND hwnd, HDC hDC); +int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC); + +typedef struct tagSTATUSBARDATA +{ + BOOL sameWidth; + RECT rectBorders; + BYTE extraspace; + BYTE Align; + BYTE VAlign; + bool bShowProtoIcon; + bool bShowProtoName; + bool bShowStatusName; + bool bConnectingIcon; + HFONT BarFont; + DWORD fontColor; + BYTE TextEffectID; + DWORD TextEffectColor1; + DWORD TextEffectColor2; + BYTE xStatusMode; // 0-only main, 1-xStatus, 2-main as overlay + BYTE nProtosPerLine; + bool bShowProtoEmails; + + HBITMAP hBmpBackground; + COLORREF bkColour; + DWORD backgroundBmpUse; + BOOL bkUseWinColors; + + XPTHANDLE hTheme; + + BOOL perProtoConfig; + BYTE SBarRightClk; + +} STATUSBARDATA; + +#endif // modern_statusbar_h__ diff --git a/plugins/Clist_modern/src/modern_statusbar_options.cpp b/plugins/Clist_modern/src/modern_statusbar_options.cpp index 601dad4d04..63ccf96317 100644 --- a/plugins/Clist_modern/src/modern_statusbar_options.cpp +++ b/plugins/Clist_modern/src/modern_statusbar_options.cpp @@ -22,10 +22,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_clc.h" -#include "hdr/modern_commonprototypes.h" -#include "hdr/modern_defsettings.h" +#include "stdafx.h" +#include "modern_clc.h" +#include "modern_commonprototypes.h" +#include "modern_defsettings.h" typedef struct _StatusBarProtocolOptions { diff --git a/plugins/Clist_modern/src/modern_sync.cpp b/plugins/Clist_modern/src/modern_sync.cpp index 8266c95660..7285758066 100644 --- a/plugins/Clist_modern/src/modern_sync.cpp +++ b/plugins/Clist_modern/src/modern_sync.cpp @@ -1,5 +1,5 @@ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_sync.h" +#include "stdafx.h" +#include "modern_sync.h" static INT_PTR SyncCaller(WPARAM proc, LPARAM lParam) { diff --git a/plugins/Clist_modern/src/modern_sync.h b/plugins/Clist_modern/src/modern_sync.h new file mode 100644 index 0000000000..0b5a827f11 --- /dev/null +++ b/plugins/Clist_modern/src/modern_sync.h @@ -0,0 +1,90 @@ +#ifndef modern_sync_h__ +#define modern_sync_h__ + +typedef INT_PTR(*PSYNCCALLBACKPROC)(WPARAM, LPARAM); + +int SyncCall(void * vproc, int count, ...); + +// Experimental sync caller + +int DoCall(PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam); + +// Have to be here due to MS Visual C++ does not support 'export' keyword + +// 3 params + +template class PARAMS3 +{ + typedef RET(*proc_t)(A, B, C); + proc_t _proc; A _a; B _b; C _c; RET _ret; + +public: + PARAMS3(proc_t __proc, A __a, B __b, C __c) : _proc(__proc), _a(__a), _b(__b), _c(__c){}; + static int DoSyncCall(WPARAM, LPARAM lParam) + { + PARAMS3 * params = (PARAMS3 *)lParam; + params->_ret = params->_proc(params->_a, params->_b, params->_c); + return 0; + }; + RET GetResult() { return _ret; } +}; + +template< class RET, class Ap, class Bp, class Cp, class A, class B, class C> RET Sync(RET(*proc)(Ap, Bp, Cp), A a, B b, C c) +{ + PARAMS3 params(proc, a, b, c); + DoCall((PSYNCCALLBACKPROC)PARAMS3::DoSyncCall, 0, (LPARAM)¶ms); + return params.GetResult(); +}; + + +// 2 params + +template class PARAMS2 +{ + typedef RET(*proc_t)(A, B); + proc_t _proc; A _a; B _b; RET _ret; + +public: + PARAMS2(proc_t __proc, A __a, B __b) : _proc(__proc), _a(__a), _b(__b){}; + static int DoSyncCall(WPARAM, LPARAM lParam) + { + PARAMS2 * params = (PARAMS2 *)lParam; + params->_ret = params->_proc(params->_a, params->_b); + return 0; + }; + RET GetResult() { return _ret; } +}; + +template< class RET, class Ap, class Bp, class A, class B> RET Sync(RET(*proc)(Ap, Bp), A a, B b) +{ + PARAMS2 params(proc, a, b); + DoCall((PSYNCCALLBACKPROC)PARAMS2::DoSyncCall, 0, (LPARAM)¶ms); + return params.GetResult(); +}; + + +// 1 param +template class PARAMS1 +{ + typedef RET(*proc_t)(A); + proc_t _proc; A _a; RET _ret; + +public: + PARAMS1(proc_t __proc, A __a) : _proc(__proc), _a(__a){}; + static int DoSyncCall(WPARAM, LPARAM lParam) + { + PARAMS1 * params = (PARAMS1 *)lParam; + params->_ret = params->_proc(params->_a); + return 0; + }; + RET GetResult() { return _ret; } +}; + +template< class RET, class Ap, class A> RET Sync(RET(*proc)(Ap), A a) +{ + PARAMS1 params(proc, a); + DoCall((PSYNCCALLBACKPROC)PARAMS1::DoSyncCall, 0, (LPARAM)¶ms); + return params.GetResult(); +}; + +#endif // modern_sync_h__ \ No newline at end of file diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp index dbf6a79907..6644f0a846 100644 --- a/plugins/Clist_modern/src/modern_tbbutton.cpp +++ b/plugins/Clist_modern/src/modern_tbbutton.cpp @@ -1,7 +1,7 @@ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_commonprototypes.h" +#include "stdafx.h" +#include "modern_commonprototypes.h" #include "m_skinbutton.h" -#include "hdr/modern_clcpaint.h" +#include "modern_clcpaint.h" #include #include diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index a3cba86884..068462bc3e 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -24,11 +24,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_commonprototypes.h" +#include "stdafx.h" +#include "modern_commonprototypes.h" #include "m_skinbutton.h" #include -#include "hdr/modern_sync.h" +#include "modern_sync.h" struct { diff --git a/plugins/Clist_modern/src/modern_utils.cpp b/plugins/Clist_modern/src/modern_utils.cpp index b68088679c..196398b68f 100644 --- a/plugins/Clist_modern/src/modern_utils.cpp +++ b/plugins/Clist_modern/src/modern_utils.cpp @@ -1,4 +1,4 @@ -#include "hdr/modern_commonheaders.h" +#include "stdafx.h" BYTE gl_TrimText = 1; diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index faea096349..bec68bae1d 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -27,8 +27,8 @@ $Id: viewmodes.c 2998 2006-06-01 07:11:52Z nightwish2004 $ */ -#include "hdr/modern_commonheaders.h" -#include "CLUIFrames/cluiframes.h" +#include "stdafx.h" +#include "cluiframes.h" #include "m_skinbutton.h" #define TIMERID_VIEWMODEEXPIRE 100 diff --git a/plugins/Clist_modern/src/modern_xptheme.cpp b/plugins/Clist_modern/src/modern_xptheme.cpp index 1d8fd910f5..a135642061 100644 --- a/plugins/Clist_modern/src/modern_xptheme.cpp +++ b/plugins/Clist_modern/src/modern_xptheme.cpp @@ -1,5 +1,5 @@ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_commonprototypes.h" +#include "stdafx.h" +#include "modern_commonprototypes.h" #include "m_xpTheme.h" diff --git a/plugins/Clist_modern/src/stdafx.cxx b/plugins/Clist_modern/src/stdafx.cxx new file mode 100644 index 0000000000..f60995429a --- /dev/null +++ b/plugins/Clist_modern/src/stdafx.cxx @@ -0,0 +1,3 @@ +#define DB_USEHELPERFUNCTIONS + +#include "stdafx.h" diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h new file mode 100644 index 0000000000..d7ec890625 --- /dev/null +++ b/plugins/Clist_modern/src/stdafx.h @@ -0,0 +1,355 @@ +#ifndef commonheaders_h__ +#define commonheaders_h__ + +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-08 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#pragma once + +#ifndef DB_USEHELPERFUNCTIONS // to supress static inline db helpers +#define DB_NOHELPERFUNCTIONS +#endif + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS // to suppress secure warnings in VC2005 +#endif + +#ifndef _CRT_SECURE_NO_DEPRECATE // to suppress secure deprecate warnings in VC2005 +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#if defined (_DEBUG) +#define TRACE(str) { log0(str); } +#else +#define TRACE(str) +#endif + +#if defined (_DEBUG) +#define TRACEVAR(str,n) { log1(str,n); } +#else +#define TRACEVAR(str,n) +#endif + +#if defined (_DEBUG) +#define TRACET(str) OutputDebugString(str) +#else +#define TRACET(str) +#endif + +#define SERVICE(serviceproc) static INT_PTR serviceproc(WPARAM wParam, LPARAM lParam) +#define EVENTHOOK(eventhookproc) static int eventhookproc(WPARAM wParam, LPARAM lParam) +#define CLINTERFACE static + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "modern_global_structure.h" +#include "modern_clc.h" +#include "modern_clist.h" +#include "cluiframes.h" +#include "modern_rowheight_funcs.h" +#include "modern_cache_funcs.h" +#include "modern_log.h" +#include "resource.h" + +#define DEFAULT_SKIN_FOLDER "Skins\\Modern contact list" +extern TCHAR SkinsFolder[MAX_PATH]; + +//macros to free data and set it pointer to NULL +#define mir_free_and_nil(x) {mir_free((void*)x); x=NULL;} +// shared vars + +#define CLUI_FRAME_AUTOHIDENOTIFY 512 +#define CLUI_FRAME_SHOWALWAYS 1024 + +#ifndef CS_DROPSHADOW +#define CS_DROPSHADOW 0x00020000 +#endif + +#define MENU_MIRANDAMENU 0xFFFF1234 +#define MENU_STATUSMENU 0xFFFF1235 +#define MENU_MINIMIZE 0xFFFF1236 + +#define UM_CREATECLC (WM_USER+1) +#define UM_SETALLEXTRAICONS (WM_USER+2) +#define UM_UPDATE (WM_USER+50) + +// Define constants for CLUI_SizingOnBorder SC_SIZE + +#define SCF_NONE 0 +#define SCF_LEFT 1 +#define SCF_RIGHT 2 +#define SCF_TOP 3 +#define SCF_BOTTOM 6 + +char* __cdecl strstri(char *a, const char *b); + +// Register of plugin's user +// +// wParam = (WPARAM)szSetting - string that describes a user +// format: Category/ModuleName, +// eg: "Contact list background/CLUI", +// "Status bar background/StatusBar" +// lParam = (LPARAM)dwFlags +// +#define MS_BACKGROUNDCONFIG_REGISTER "ModernBkgrCfg/Register" + +// +// Notification about changed background +// wParam = ModuleName +// lParam = 0 +#define ME_BACKGROUNDCONFIG_CHANGED "ModernBkgrCfg/Changed" + +HBITMAP ske_CreateDIB32(int cx, int cy); + +void InitDisplayNameCache(void); +void FreeDisplayNameCache(); +int CLUI_ShowWindowMod(HWND hwnd, int cmd); + +void MakeButtonSkinned(HWND hWnd); + +#ifndef LWA_COLORKEY +#define LWA_COLORKEY 0x00000001 +#endif + +#ifndef AC_SRC_ALPHA +#define AC_SRC_ALPHA 0x01 +#endif + +#define strsetA(a,b) {if (a) mir_free_and_nill(a); a=mir_strdup(b);} +#define strsetT(a,b) {if (a) mir_free_and_nill(a); a=mir_tstrdup(b);} + +extern void TRACE_ERROR(); +extern BOOL DebugDeleteObject(HGDIOBJ a); +extern void IvalidateDisplayNameCache(DWORD mode); + +extern LIST clistCache; + +HICON LoadSmallIcon(HINSTANCE hInstance, int idx); +BOOL DestroyIcon_protect(HICON icon); + +#ifndef ETDT_ENABLETAB +#define ETDT_DISABLE 0x00000001 +#define ETDT_ENABLE 0x00000002 +#define ETDT_USETABTEXTURE 0x00000004 +#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE) +#endif + +enum +{ + STATE_DLL_LOADING = 0, + STATE_CLUI_LOADING, + STATE_NORMAL, + STATE_PREPARETOEXIT, + STATE_EXITING +}; + +#define MirandaLoading() ((g_CluiData.bSTATESTATE_NORMAL)) + +char * strdupn(const char * src, int len); + +#define SORTBY_NAME 0 +#define SORTBY_STATUS 1 +#define SORTBY_LASTMSG 2 +#define SORTBY_PROTO 3 +#define SORTBY_RATE 4 +#define SORTBY_NAME_LOCALE 5 +#define SORTBY_NOTHING 10 + +#define DT_FORCENATIVERENDER 0x10000000 + +#define _BOOL(a) (a != 0) + +/* modern_animated_avatars.c */ +int AniAva_InitModule(); // HAVE TO BE AFTER GDI+ INITIALIZED +int AniAva_UnloadModule(); +int AniAva_UpdateOptions(); //reload options, //hot enable/disable engine + +int AniAva_AddAvatar(MCONTACT hContact, TCHAR * szFilename, int width, int heigth); // adds avatars to be displayed +int AniAva_SetAvatarPos(MCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha); // update avatars pos +int AniAva_InvalidateAvatarPositions(MCONTACT hContact); // reset positions of avatars to be drawn (still be painted at same place) +int AniAva_RemoveInvalidatedAvatars(); // all avatars without validated position will be stop painted and probably removed +int AniAva_RemoveAvatar(MCONTACT hContact); // remove avatar +int AniAva_RedrawAllAvatars(BOOL updateZOrder); // request to repaint all +void AniAva_UpdateParent(); +int AniAva_RenderAvatar(MCONTACT hContact, HDC hdcMem, RECT *rc); + +#define CCI_NAME 1 +#define CCI_GROUP (1<<1) +#define CCI_PROTO (1<<2) +#define CCI_STATUS (1<<3) +#define CCI_LINES (1<<4) +#define CCI_HIDDEN (1<<4) +#define CCI_NOHIDEOFFLINE (1<<5) +#define CCI_NOPROTO (1<<6) +#define CCI_HIDESUBCONTACT (1<<7) +#define CCI_I (1<<8) +#define CCI_APPARENT (1<<9) +#define CCI_NOTONLIST (1<<10) +#define CCI_IDLETS (1<<11) +#define CCI_CCONTACT (1<<12) +#define CCI_EXPAND (1<<13) +#define CCI_UNKNOWN (1<<14) +#define CCI_TIME (1<<15) +#define CCI_OTHER ~( CCI_NAME|CCI_GROUP|CCI_PROTO|CCI_STATUS|CCI_LINES|CCI_TIME ) +#define CCI_ALL (0xFFFFFFFF) + +void CListSettings_FreeCacheItemData(ClcCacheEntry *pDst); +int CLUI_SyncGetPDNCE(WPARAM wParam, LPARAM lParam); +WORD pdnce___GetStatus(ClcCacheEntry *pdnce); + +/* move to list module */ +typedef void(*ItemDestuctor)(void*); + +#ifdef __cplusplus +const ROWCELL * rowAddCell(ROWCELL* &, int); +void rowDeleteTree(ROWCELL *cell); +BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &sequence, ROWCELL** RowTabAccess); +void rowSizeWithReposition(ROWCELL* &root, int width); +#endif + +#define UNPACK_POINT(X) { (short)LOWORD(X), (short)HIWORD(X) } + +////////////////////////////////////////////////////////////////////////// +// Specific class for quick implementation of map list +// with some more fast searching it is +// hash_map alternative - for faked hash search; +// the items are stored no by char* key but both int(hash),char*. +// have items sorted in map firstly via hash, secondly via string +// the method is case insensitive +// To use this simple define like +// typedef std::map map_Type; +// map_Type myMap; +// and access it as usual via simpe char* indexing: +// myList[ "first" ]=_Type_value; +// myList[ "second" ]=_Type_value; +// _Type a = myList[ "second"]; + +class HashStringKeyNoCase +{ +public: + + HashStringKeyNoCase(const char* szKey) + { + _strKey = _strdup(szKey); + _CreateHashKey(); + } + + HashStringKeyNoCase(const HashStringKeyNoCase& hsKey) + { + _strKey = _strdup(hsKey._strKey); + _dwKey = hsKey._dwKey; + } + + HashStringKeyNoCase& operator= (const HashStringKeyNoCase& hsKey) + { + _strKey = _strdup(hsKey._strKey); + _dwKey = hsKey._dwKey; + } + +#ifdef _UNICODE + HashStringKeyNoCase(const wchar_t* szKey) + { + int codepage = 0; + int cbLen = WideCharToMultiByte(codepage, 0, szKey, -1, NULL, 0, NULL, NULL); + char* result = (char*)malloc(cbLen + 1); + WideCharToMultiByte(codepage, 0, szKey, -1, result, cbLen, NULL, NULL); + result[cbLen] = 0; + + _strKey = result; + _CreateHashKey(); + } +#endif + + ~HashStringKeyNoCase() + { + free(_strKey); + _strKey = NULL; + _dwKey = 0; + } + +private: + char* _strKey; + DWORD _dwKey; + + void _CreateHashKey() + { + _strKey = _strupr(_strKey); + _dwKey = mod_CalcHash(_strKey); + } + +public: + bool operator< (const HashStringKeyNoCase& second) const + { + if (this->_dwKey != second._dwKey) + return (this->_dwKey < second._dwKey); + else + return (mir_strcmp(this->_strKey, second._strKey) < 0); // already maked upper so in any case - will be case insensitive + } + + struct HashKeyLess + { + bool operator() (const HashStringKeyNoCase& first, const HashStringKeyNoCase& second) const + { + return (first < second); + } + }; +}; + +#endif // commonheaders_h__ -- cgit v1.2.3